Skip to content

Commit 4cb08c1

Browse files
authored
Merge pull request #259 from ezzak/coverage_fix
Fix missing WA check in recent worker CSP improvements
2 parents 063646e + 065f745 commit 4cb08c1

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

config/v2/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "Code Verify",
4-
"version": "3.2.0",
4+
"version": "3.2.1",
55
"default_locale": "en",
66
"description": "An extension to verify the code running in your browser matches what was published.",
77
"page_action": {

config/v3/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "Code Verify",
4-
"version": "3.2.0",
4+
"version": "3.2.1",
55
"default_locale": "en",
66
"description": "An extension to verify the code running in your browser matches what was published.",
77
"action": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "meta-code-verify",
3-
"version": "3.2.0",
3+
"version": "3.2.1",
44
"description": "Browser extensions to verify code running in the browser against a published manifest",
55
"main": "none",
66
"repository": "git@github.com:facebookincubator/meta-code-verify.git",

src/js/contentUtils.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -528,21 +528,23 @@ chrome.runtime.onMessage.addListener(request => {
528528
) {
529529
return;
530530
}
531-
const hostname = window.location.hostname;
532-
const resourceURL = new URL(request.response.url);
533-
if (resourceURL.hostname === hostname) {
534-
// This can potentially be a worker, check if CSPs allow it as a worker
535-
if (
536-
allowedWorkerCSPs.every(csp =>
537-
doesWorkerUrlConformToCSP(csp, resourceURL.toString()),
538-
)
539-
) {
540-
// This might be a worker, ensure it's CSP headers are valid
541-
checkWorkerEndpointCSP(
542-
request.response,
543-
allowedWorkerCSPs,
544-
currentOrigin.val,
545-
);
531+
if (isFbMsgrOrIgOrigin(currentOrigin.val)) {
532+
const hostname = window.location.hostname;
533+
const resourceURL = new URL(request.response.url);
534+
if (resourceURL.hostname === hostname) {
535+
// This can potentially be a worker, check if CSPs allow it as a worker
536+
if (
537+
allowedWorkerCSPs.every(csp =>
538+
doesWorkerUrlConformToCSP(csp, resourceURL.toString()),
539+
)
540+
) {
541+
// This might be a worker, ensure it's CSP headers are valid
542+
checkWorkerEndpointCSP(
543+
request.response,
544+
allowedWorkerCSPs,
545+
currentOrigin.val,
546+
);
547+
}
546548
}
547549
}
548550
sendMessageToBackground({

0 commit comments

Comments
 (0)