Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extension/chrome/elements/pgp_pubkey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ View.run(

private showKeyNotUsableError = async () => {
$('.error_container').removeClass('hidden');
$('.error_introduce_label').html(`This OpenPGP key is not usable.<br/><small>(${await this.getErrorText()})</small>`); // xss-escaped
$('.error_introduce_label').html(`This OpenPGP key is not usable.<br/><small>(${Xss.escape(await this.getErrorText())})</small>`); // xss-escaped
$('.hide_if_error').hide();
$('.fingerprints, .add_contact, #manual_import_warning').remove();
const email = this.firstParsedPublicKey ? KeyUtil.getPrimaryEmail(this.firstParsedPublicKey) : undefined;
Expand Down
7 changes: 5 additions & 2 deletions extension/chrome/settings/modules/contacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,16 @@ View.run(
}
const key = await KeyUtil.parse(armoredPubkey);
$('.hide_when_rendering_subpage').css('display', 'none');
Xss.sanitizeRender('h1', `${this.backBtn}${this.space}${email}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`);
Xss.sanitizeRender('h1', `${this.backBtn}${this.space}${Xss.escape(email)}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`); // xss-escaped
$('#view_contact .key_dump').text(armoredPubkey);
$('#view_contact #container-pubkey-details').text(
[
`Type: ${key.family}`,
`Fingerprint: ${Str.spaced(key.id || 'none')}`,
`Users: ${key.users?.map(u => u.email).filter(Boolean).join(', ')}`,
`Users: ${key.users
?.map(u => u.email)
.filter(Boolean)
.join(', ')}`,
`Created on: ${key.created ? new Date(key.created) : ''}`,
`Expiration: ${key.expiration ? new Date(key.expiration) : 'Does not expire'}`,
`Last signature: ${key.lastModified ? new Date(key.lastModified) : ''}`,
Expand Down
4 changes: 2 additions & 2 deletions extension/js/common/ui/passphrase-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export const isCreatePrivateFormInputCorrect = async (section: string, clientCon
Please write down your passphrase and store it in safe place or even two.
It is needed in order to access your FlowCrypt account.
</div>
<div class="passphrase-sticky-note">${notePp}</div>
`;
<div class="passphrase-sticky-note">${Xss.escape(notePp)}</div>
`; // xss-escaped
return await Ui.modal.confirmWithCheckbox('Yes, I wrote it down', paperPassPhraseStickyNote);
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@
],
"minimum_chrome_version": "96",
"content_security_policy": {
"extension_pages": "script-src 'self'; frame-ancestors 'self' https://mail.google.com; img-src 'self' data: blob: https:; frame-src 'self' blob:; worker-src 'self'; form-action 'none'; media-src 'none'; font-src 'none'; manifest-src 'none'; object-src 'none'; base-uri 'self';"
"extension_pages": "script-src 'self'; default-src 'self'; frame-ancestors 'self' https://mail.google.com; img-src 'self' https://* data: blob:; frame-src 'self' blob:; worker-src 'self'; form-action 'none'; media-src 'none'; font-src 'none'; manifest-src 'none'; object-src 'none'; base-uri 'self'; connect-src 'self' https://flowcrypt.com https://*.flowcrypt.com https://flowcrypt.s3.amazonaws.com https://www.google.com https://gmail.googleapis.com;"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are a lot of connection errors in console logs because of added strict connect-src rules:

Image

also refresh token requests fail:

Image

contacts search doesn't work too. WKD search won't work, as it requires connection to recipient's domain, which will fail with current connect-src.

we'll probably won't be able to list all used domains in connect-src config, so it'll be better to remove it.

}
}
20 changes: 17 additions & 3 deletions tooling/build-types-and-manifests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,23 @@ const makeMockBuild = (sourceBuildType: string) => {
edit(`${buildDir(mockBuildType)}/js/common/core/const.js`, editor);
edit(`${buildDir(mockBuildType)}/js/common/platform/catch.js`, editor);
edit(`${buildDir(mockBuildType)}/js/content_scripts/webmail_bundle.js`, editor);
edit(`${buildDir(mockBuildType)}/manifest.json`, code =>
code.replace(/https:\/\/mail\.google\.com/g, mockGmailPage).replace(/https:\/\/\*\.google.com\/\*/, 'https://google.localhost/*')
);
edit(`${buildDir(mockBuildType)}/manifest.json`, code => {
let updatedCode = code.replace(/https:\/\/mail\.google\.com/g, mockGmailPage).replace(/https:\/\/\*\.google.com\/\*/, 'https://google.localhost/*');
const manifest = JSON.parse(updatedCode) as chrome.runtime.ManifestV3;
if (manifest.content_security_policy?.extension_pages) {
const csp = manifest.content_security_policy.extension_pages;
if (csp) {
let updatedCsp = csp.replace(
/connect-src[^;]*/,
"connect-src 'self' https://localhost:* https://flowcrypt.com https://fes.flowcrypt.test https://fes.standardsubdomainfes.localhost:* https://fes.key-manager-server-offline.flowcrypt.test https://google.com https://www.google.com https://*.flowcrypt.com https://flowcrypt.s3.amazonaws.com https://*.localhost:* https://google.localhost:* https://gmail.localhost:*;"
);
updatedCsp += "; style-src 'self' 'unsafe-inline'";
manifest.content_security_policy.extension_pages = updatedCsp;
}
updatedCode = JSON.stringify(manifest, undefined, 2);
}
return updatedCode;
});
};

const makeLocalFesBuild = (sourceBuildType: string) => {
Expand Down
Loading