Support X-Content-Type-Options: nosniff when navigating
Categories
(Core :: DOM: Security, task, P3)
Tracking
()
People
(Reporter: x, Assigned: sstreich)
References
(Regressed 1 open bug)
Details
(Keywords: sec-other, Whiteboard: [domsecurity-backlog1] [post-critsmash-triage][adv-main70-])
Attachments
(3 files, 2 obsolete files)
Comment 1•8 years ago
|
||
Updated•8 years ago
|
Comment 2•8 years ago
|
||
Comment 4•8 years ago
|
||
Comment 7•8 years ago
|
||
Updated•8 years ago
|
Comment 8•8 years ago
|
||
Comment 10•8 years ago
|
||
Comment 11•8 years ago
|
||
Comment 12•8 years ago
|
||
| Reporter | ||
Comment 13•8 years ago
|
||
Comment 14•7 years ago
|
||
Comment 15•7 years ago
|
||
Updated•7 years ago
|
Comment 17•7 years ago
|
||
Comment 18•7 years ago
•
|
||
Updated•6 years ago
|
Comment 19•6 years ago
|
||
Dragana, as discussed on Slack I am trying to tackle that bug. Here is my approach:
- In case XCTO nosniff is present within ProcessXCTO() then I set a newly added flag on the loadinfo - I call it skipContentSniffing.
- Later in the NsNetutil where we actually do the sniffing, we just bail out early in case the flag is true within the loadinfo.
I am not sure if that is the best approach, you mentioned that we might be able to use the channel flag LOAD_CALL_CONTENT_SNIFFERS - do you think it might be possible to just remove the flag in ProcessXCTO if necessary?
Finally, how do we create an automated test for that?
Comment 20•6 years ago
|
||
Regarding automated tests:
- load
file-bogus-content-type-nosniff.htmlin an iframe - content of the file should be along the lines of
<script>ok(false, 'This shouldnt parse as HTML or execute JS')</script> - supply headers as in comment 0, via a
^headersfile.
If I'm not mistaken we also seem to have tests for the download prompt in /uriloader/exthandler/tests/mochitest/download.sjs#6
Comment 21•6 years ago
|
||
An example of a sniffer test is:
https://searchfox.org/mozilla-central/source/netwerk/test/unit/test_plaintext_sniff.js
you can do something like that.
Comment 22•6 years ago
|
||
Comment 23•6 years ago
|
||
(In reply to Dragana Damjanovic [:dragana] from comment #22)
Comment on attachment 9048429 [details] [diff] [review]
xcto_nosniff.patch
Thanks Dragana for the detailed notes - I'll look into that and also write some automated tests!
Comment 24•6 years ago
|
||
Basti will take over this bug - assigning to him.
Comment 25•6 years ago
|
||
Basti, here is a half baked patch (including test), both the patch as well as the test need to be modified and updated. I started working on this but then had too many other things on my plate.
In short: We have to identify all the cases where we do sniffing for navigations and bail out of that sniffing. I guess the easiest way is to set a flag as in the patch on the loadinfo and then just check the flag in those cases - we can talk more whenever you start working on it.
Comment 26•6 years ago
|
||
Please also compare with Chrome Canary and Safari Technology Preview to ensure we're reasonably compatible. (It's not going to be great as the fallbacks are different, from what I remember, but we should know what we're in for.)
| Assignee | ||
Comment 27•6 years ago
|
||
Updated•6 years ago
|
| Assignee | ||
Comment 28•6 years ago
|
||
| Assignee | ||
Comment 29•6 years ago
|
||
Hey, i already applied the feedback of Henri (hsivonen) on the Patch but as he's currently away (until august) and it would be great to land the patch this cycle.
Is there anyone else from the html/parser team that could possibly review the Patch again?
Thanks So much,
Basti :)
Updated•6 years ago
|
| Assignee | ||
Updated•6 years ago
|
Comment 30•6 years ago
|
||
Comment 31•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Comment 33•6 years ago
|
||
Sorry, I commented on bug 1602213 before realizing that this one was still hidden. (It was easier to notice that bugs were restricted when the whole background color was different instead of just a banner at the top. Please hide bug 1602213 if considered necessary.)
Chromium still runs its encoding detector, so for non-Latin pages, we can end up in a situation where a page is completely unreadable in Firefox but readable in Chromium. See http://dolnocerovene.tk/site/novini.php . This is a Web compat problem.
Do we have a really strong security reason to turn off the encoding detector when Chromium doesn't? I.e. do we have a strong reason not to take the patch I attached to bug 1602213?
Comment 34•6 years ago
|
||
...and that bug got another duplicate. I think it's not practical to let nosniff affect the character encoding.
Comment 35•6 years ago
|
||
Explaining on this hidden side why I posted a patch that undoes a part of this for review:
I think it's not workable for Firefox to let headers that people add to legacy content "for security" break the content in ways that the content doesn't break in in Chrome. The breakage from security headers should be limited to what is easily discovered by testing in Chrome. Otherwise, we create a Web compat problem.
Furthermore, for avoidance of encoding sniffing to be an effective security measure, we'd need a story for why it would be OK to go to the previous state where lack of sniffing could still result in different interpretations on .com based on the UI localization.
Updated•6 years ago
|
Updated•5 years ago
|
Description
•