-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Correctly detect insecure CSP when default-src is missing. #4594
Conversation
bab37e0
to
214a7b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r+wc
@@ -1922,12 +1919,13 @@ describe('ManifestJSONParser', () => { | |||
|
|||
const keys = Object.keys(contentSecurityPolicy); | |||
for (let i = 0; i < keys.length; i++) { | |||
expect(warningsV3[i].code).toEqual(messages.MANIFEST_CSP_UNSAFE_EVAL); | |||
expect(warningsV3[i].message).toContain( | |||
expect(warningsV3[i * 2].code).toEqual(messages.MANIFEST_CSP_UNSAFE_EVAL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe mention that we expect two codes for each key, and so first warning is MANIFEST_CSP_UNSAFE_EVAL
and second warning is MANIFEST_CSP
.
@@ -1888,6 +1883,8 @@ describe('ManifestJSONParser', () => { | |||
expect(warnings[0].message).toEqual( | |||
messages.manifestCspUnsafeEval('content_security_policy').message | |||
); | |||
expect(warnings[1].code).toEqual(messages.MANIFEST_CSP); | |||
expect(warnings.length).toBe(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect(warnings.length).toBe(2); | |
expect(warnings.length).toEqual(2); |
} | ||
expect(warningsV3.length).toBe(3); | ||
expect(warningsV3.length).toBe(6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect(warningsV3.length).toBe(6); | |
expect(warningsV3.length).toEqual(6); |
Codecov ReportBase: 98.74% // Head: 98.74% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## master #4594 +/- ##
=======================================
Coverage 98.74% 98.74%
=======================================
Files 54 54
Lines 2859 2859
Branches 859 859
=======================================
Hits 2823 2823
Misses 36 36
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Fixes #4578.