-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#4609 stop using initialLegacySubmit
- Loading branch information
Showing
9 changed files
with
112 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import { AcctStore } from './platform/store/acct-store.js'; | |
import { KeyAlgo } from './core/crypto/key.js'; | ||
|
||
type ClientConfiguration$flag = 'NO_PRV_CREATE' | 'NO_PRV_BACKUP' | 'PRV_AUTOIMPORT_OR_AUTOGEN' | 'PASS_PHRASE_QUIET_AUTOGEN' | | ||
'ENFORCE_ATTESTER_SUBMIT' | 'NO_ATTESTER_SUBMIT' | 'USE_LEGACY_ATTESTER_SUBMIT' | | ||
'ENFORCE_ATTESTER_SUBMIT' | 'NO_ATTESTER_SUBMIT' | 'SETUP_ENSURE_IMPORTED_PRV_MATCH_LDAP_PUB' | | ||
'DEFAULT_REMEMBER_PASS_PHRASE' | 'HIDE_ARMOR_META' | 'FORBID_STORING_PASS_PHRASE'; | ||
|
||
export type ClientConfigurationJson = { | ||
|
@@ -192,12 +192,10 @@ export class ClientConfiguration { | |
}; | ||
|
||
/** | ||
* Some orgs use flows that are only implemented in POST /initial/legacy_submit and not in POST /pub/[email protected]: | ||
* -> enforcing that submitted keys match customer key server | ||
* Until the newer endpoint is ready, this flag will point users in those orgs to the original endpoint | ||
* Some orgs will require user's imported private key to match their LDAP pub key result | ||
*/ | ||
public useLegacyAttesterSubmit = (): boolean => { | ||
return (this.clientConfigurationJson.flags || []).includes('USE_LEGACY_ATTESTER_SUBMIT'); | ||
public setupEnsureImportedPrvMatchLdapPub = (): boolean => { | ||
return (this.clientConfigurationJson.flags || []).includes('SETUP_ENSURE_IMPORTED_PRV_MATCH_LDAP_PUB'); | ||
}; | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,6 +122,12 @@ export const mockAttesterEndpoints: HandlersDefinition = { | |
if (emailOrLongid === '[email protected]') { | ||
return protonMailCompatKey; | ||
} | ||
if (emailOrLongid === '[email protected]') { | ||
return hasPubKey; | ||
} | ||
if (emailOrLongid === '[email protected]') { | ||
return protonMailCompatKey; | ||
} | ||
if (emailOrLongid === '[email protected]' && server === 'keyserver.pgp.com') { | ||
return [protonMailCompatKey, testMatchPubKey].join('\n'); | ||
} | ||
|
@@ -136,19 +142,6 @@ export const mockAttesterEndpoints: HandlersDefinition = { | |
throw new HttpClientErr(`Not implemented: ${req.method}`); | ||
} | ||
}, | ||
'/attester/initial/legacy_submit': async ({ body }, req) => { | ||
if (!isPost(req)) { | ||
throw new HttpClientErr(`Wrong method: ${req.method}`); | ||
} | ||
const { email, pubkey } = body as Dict<string>; | ||
expect(email).to.contain('@'); | ||
expect(pubkey).to.contain('-----BEGIN PGP PUBLIC KEY BLOCK-----'); | ||
if (email === '[email protected]') { | ||
throw new HttpClientErr(`Could not find LDAP pubkey on a LDAP-only domain for email ${email} on server keys.flowcrypt.test`); | ||
} | ||
MOCK_ATTESTER_LAST_INSERTED_PUB[email] = pubkey; | ||
return { saved: true }; | ||
}, | ||
'/attester/test/welcome': async ({ body }, req) => { | ||
if (!isPost(req)) { | ||
throw new HttpClientErr(`Wrong method: ${req.method}`); | ||
|
@@ -387,3 +380,55 @@ qHJuDNEmMUvx3cMUd5HtsOFO9JapCp1iCVo2p49CIXA4NUrLETNM2ZddknhbFm8bsK48tTJEH6l4 | |
Wq3aCVXYGg== | ||
=Ldag | ||
-----END PGP PUBLIC KEY BLOCK-----`; | ||
|
||
const hasPubKey = `-----BEGIN PGP PUBLIC KEY BLOCK----- | ||
mQINBF3H8N8BEADHCZdJnXkMn+asjH6eodMCqIcd4LJdLtOZljWEBsErV2vf+zZl | ||
sle3lzo/LK5uGThwg0kY7QRFhLS2QII8atYw0E/+WWuWNhm+9UpmuZXpLcfkxKEr | ||
P+xXJaX8ktSt0KXj0RUdFrkgh5EeqG2sdrflFjp90z9XQzt3BEpfr+9IhIQZDe23 | ||
9Xu0Zde4VzrxuA2WFHnsZiqTF41CGQmFapcroAZ5JmP+zXLrig62LFxkACJq4Fxb | ||
WX6k1JrFjD+QXs78hB4sVdULDnxI4J8rXvryzW2PMXGr9GFAEmIx7ksOHp51Hyyq | ||
Br8Zcj/YCmwDvm+9GaNKY1oVBeviphBHNXOBYLYO9py/1OSS9lCW7Ja0YsrPp+wh | ||
VC+pDk0NmY0HSZPOXwkJBL8VkcYI4ZMFSLqqMpQFN86y61uezUD2gdX+zbEoS+Pn | ||
dIV5lZUuLEO0trRjg1b1/PJSyi8bBgcoduhEUtGD+n5J3NGyOP9w1jHWaDhjMJ6n | ||
p/Su8RUC7p4/uXzBxn77jwkYnO4kULuK9K6it5gB8kXgaaQ6tc21p2VyID8fb1nP | ||
Hi3Jg524NkkqsmRA7Ulmo087B+k3yK/rbI7rVAs5sFQI45hqKyVvTITm9MSMBDFk | ||
+T7VA2NLuM7QhS7hHxhokTzo80H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+cVzYP98NU/fOcDSCG6u6X6UyZ | ||
AbivCgdNtKkCJS6c0bDmLxnwxqfrXtJBHb//RcKOIt29ULwDDpg7pbyLHPVeHoww | ||
wAsfVpC/5GYoG5beanFou5ssHr6yUwEo/sSjj8FiLISPb2MewWl6SREpqQf3zuaa | ||
bHoV/t27o3082KxgFH7zyJ6nOCrP4AT8nmPSu4uypYIanmn97+RdjIeJjN/VDt3p | ||
NaqFqwp9jMCYEnjfM2VSYFTKFrQYm9zYUTIKnQxNtWC8Z85UKz2eMk/INukzWe7g | ||
cvQabqad/ZghLSTzo/Kf | ||
=sshZ | ||
-----END PGP PUBLIC KEY BLOCK-----`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -499,6 +499,17 @@ AN8G3r5Htj8olot+jm9mIa5XLXWzMNUZgg== | |
expect(ki[0].public).to.not.include('Comment'); | ||
})); | ||
|
||
ava.default('[email protected] - no backup, no keygen', testWithBrowser(undefined, async (t, browser) => { | ||
const settingsPage = await BrowserRecipe.openSettingsLoginApprove(t, browser, '[email protected]'); | ||
await SetupPageRecipe.manualEnter(settingsPage, 'has.pub.client.configuration.test', { noPrvCreateClientConfiguration: true, enforceAttesterSubmitClientConfiguration: true, fillOnly: true }, | ||
{ isSavePassphraseChecked: false, isSavePassphraseHidden: false }); | ||
await settingsPage.waitAndClick('@input-step2bmanualenter-save'); | ||
await settingsPage.waitAll(['@container-overlay-prompt-text', '@action-overlay-retry']); | ||
const renderedErr = await settingsPage.read('@container-overlay-prompt-text'); | ||
expect(renderedErr).to.contain('Failed to submit to Attester'); | ||
expect(renderedErr).to.contain('Imported private key with ids 576C48E8E9E33B772FF07B11BC614F7068DB6E23 does not match public keys on company LDAP server with ids AB8CF86E37157C3F290D72007ED43D79E9617655. Please ask your help desk.'); | ||
})); | ||
|
||
ava.default('no.pub@client-configurations-test - no backup, no keygen, enforce attester submit with submit err', testWithBrowser(undefined, async (t, browser) => { | ||
const settingsPage = await BrowserRecipe.openSettingsLoginApprove(t, browser, '[email protected]'); | ||
await SetupPageRecipe.manualEnter(settingsPage, 'no.pub.client.configuration', { noPrvCreateClientConfiguration: true, enforceAttesterSubmitClientConfiguration: true, fillOnly: true }, | ||
|
@@ -507,7 +518,7 @@ AN8G3r5Htj8olot+jm9mIa5XLXWzMNUZgg== | |
await settingsPage.waitAll(['@container-overlay-prompt-text', '@action-overlay-retry']); | ||
const renderedErr = await settingsPage.read('@container-overlay-prompt-text'); | ||
expect(renderedErr).to.contain(`Failed to submit to Attester`); | ||
expect(renderedErr).to.contain(`Could not find LDAP pubkey on a LDAP-only domain for email [email protected] on server keys.flowcrypt.test`); | ||
expect(renderedErr).to.contain(`Your organization requires public keys to be present on company LDAP server, but no public key was found. Please ask your internal help desk.`); | ||
})); | ||
|
||
ava.default('[email protected] - do not submit to attester', testWithBrowser(undefined, async (t, browser) => { | ||
|