Closed Bug 1290560 Opened 8 years ago Closed 8 years ago

Update CSPParser to handle 'sandbox', 'require-sri' and 'report-uri' with no valid srcs correctly

Categories

(Core :: DOM: Security, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: ckerschb, Assigned: ckerschb)

References

(Blocks 1 open bug)

Details

(Whiteboard: [domsecurity-active])

Attachments

(2 files)

We should update TestCSPParser to include a testcase for adding a CSP Policy of: * 'sandbox' * 'report-uri' * 'require-sri' without any srcs. All three of the above mentioned directives need special handling within the CSPParser. In fact we shouldn't handle the srcs of those directives within directiveValue() but rather in directive() itself.
Blocks: csp-w3c-3
Priority: -- → P3
Whiteboard: [domsecurity-backlog1]
Assignee: nobody → ckerschb
Status: NEW → ASSIGNED
Whiteboard: [domsecurity-backlog1] → [domsecurity-active]
Dan, I slightly refactored those bits in the parser so that directives which do not contain 'regular' srcs follow the same schemata. Those are: * UPGRADE_IF_INSECURE_DIRECTIVE * REQUIRE_SRI_FOR * REPORT_URI_DIRECTIVE * SANDBOX_DIRECTIVE Further, I fixed the memory leak within requireSRIForDirectiveValue. While updating the parser I also made sure we have enough test coverage for the parser for all of the directives mentioned above. I figured that we don't convert to lower case for sandbox and also referrer, but we do for all other directives, hence I also updated that within that patch so that all of the four special directives behalf the same way.
Attachment #8781654 - Flags: review?(dveditz)
Attachment #8781655 - Flags: review?(dveditz)
Comment on attachment 8781655 [details] [diff] [review] bug_1290560_update_csp_parser_tests.patch Review of attachment 8781655 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/security/test/TestCSPParser.cpp @@ +531,5 @@ > { "script-src https://foo.com/%$", > "script-src 'none'" }, > { "require-SRI-for script elephants", > "require-sri-for script"}, > + { "sandbox foo", // allow-popups I don't know how '// allow-popups' ended up there but I'll remove it for the final patch. @@ -527,5 @@ > { "script-src https://foo.com/%$", > "script-src 'none'" }, > { "require-SRI-for script elephants", > "require-sri-for script"}, > - { "require-sri-for paul", That test actually moved into TestBadPolicies and I replaced 'paul' with foo.
Comment on attachment 8781654 [details] [diff] [review] bug_1290560_update_csp_parser.patch Review of attachment 8781654 [details] [diff] [review]: ----------------------------------------------------------------- r=dveditz
Attachment #8781654 - Flags: review?(dveditz) → review+
Attachment #8781655 - Flags: review?(dveditz) → review+
Pushed by mozilla@christophkerschbaumer.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/a62fbb0065fc Update CSPParser to handle 'sandbox', 'require-sri' and 'report-uri' with no valid srcs correctly. r=dveditz https://hg.mozilla.org/integration/mozilla-inbound/rev/82bbabfdb3c2 Update TestCSPParser to include 'sandbox', 'require-sri' and 'report-uri' with no valid srcs. r=dveditz
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: