Closed Bug 1013559 Opened 11 years ago Closed 11 years ago

Support both CSP parsers coexisting

Categories

(Core :: DOM: Security, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: grobinson, Assigned: ckerschb)

References

Details

Attachments

(1 file, 1 obsolete file)

Part of our landing plan for CSP is the we should be able to parse 1.x headers with the new parser while still supporting parsing X-CSP with the old parser. The current code prevents this behavior because it aborts on receiving X-CSP if the newBackend pref is flipped (currently on nsDocument.cpp:2808, may rot). We should change this so we use the old backend for X-CSP and the new backend for CSP (if the newBackend pref is true).
Assignee: nobody → mozilla
Attached patch bug_1013559.patch (obsolete) — Splinter Review
Uses the new (C++) backend (if available) for CSP 1.* policies while falling back to the old (JS) implementation for XCSP headers.
Attachment #8425820 - Flags: review?(sstamm)
Attachment #8425820 - Flags: review?(grobinson)
Comment on attachment 8425820 [details] [diff] [review] bug_1013559.patch Review of attachment 8425820 [details] [diff] [review]: ----------------------------------------------------------------- lgtm! Consider removing the unnecessary PR logging, but r=me either way. ::: content/base/src/nsDocument.cpp @@ +2816,5 @@ > #ifdef PR_LOGGING > PR_LOG(gCspPRLog, PR_LOG_DEBUG, ("%s %s %s", > + "This document uses the deprecated x-content-security-policy header", > + "which will not be supported in the future." > + "Please update the document to use CSP 1.* compliant headers.")); I don't think we need to PRLOG about deprecated headers. The audience for PRLOG is Firefox developers, while the people who are typically concerned with setting headers are web developers. We already log to the Web Console for their benefit if they use deprecated CSP headers, on nsDocument.cpp:2730.
Attachment #8425820 - Flags: review?(grobinson) → review+
(In reply to Garrett Robinson [:grobinson] from comment #2) > Comment on attachment 8425820 [details] [diff] [review] > bug_1013559.patch > > Review of attachment 8425820 [details] [diff] [review]: > ----------------------------------------------------------------- > > lgtm! Consider removing the unnecessary PR logging, but r=me either way. > > ::: content/base/src/nsDocument.cpp > @@ +2816,5 @@ > > #ifdef PR_LOGGING > > PR_LOG(gCspPRLog, PR_LOG_DEBUG, ("%s %s %s", > > + "This document uses the deprecated x-content-security-policy header", > > + "which will not be supported in the future." > > + "Please update the document to use CSP 1.* compliant headers.")); > > I don't think we need to PRLOG about deprecated headers. The audience for > PRLOG is Firefox developers, while the people who are typically concerned > with setting headers are web developers. We already log to the Web Console > for their benefit if they use deprecated CSP headers, on nsDocument.cpp:2730. Haha, I really thought is console logging. Will remove that right away. Thanks!
Comment on attachment 8425820 [details] [diff] [review] bug_1013559.patch Review of attachment 8425820 [details] [diff] [review]: ----------------------------------------------------------------- I strongly encourage running this through try.
Attachment #8425820 - Flags: review?(sstamm) → review+
Carrying over the r+ from grobinson and sstamm. Even though this is a one line change, we are going to run this everywhere on try to make sure it's working as expected: https://tbpl.mozilla.org/?tree=Try&rev=e16633a51898
Attachment #8425862 - Flags: review+
Comment on attachment 8425820 [details] [diff] [review] bug_1013559.patch Marking the first patch as obsolete.
Attachment #8425820 - Attachment is obsolete: true
Try looks good to me, this is ready to land!
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: