Closed Bug 1661423 Opened 5 years ago Closed 5 years ago

Content-Security-Policy upgrade-insecure-requests is applied to <form>s on 127.0.0.0/8

Categories

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

defect

Tracking

()

RESOLVED FIXED
82 Branch
Webcompat Priority ?
Tracking Status
firefox82 --- fixed

People

(Reporter: denschub, Assigned: freddy)

References

Details

(Whiteboard: [domsecurity-active])

Attachments

(1 file)

For a simple form like

<form>
  <input type="submit">
</form>

served with a Content-Security-Policy: upgrade-insecure-requests header, the form submission is upgraded to HTTPS even on localhost/127.0.0.0/8.

Given the existence of bug 1447784, the test in dom/security/test/csp/test_upgrade_insecure_loopback.html (which only is testing XHR, not form submissions), and the fact that Chrome seems not to upgrade, I assume this is a bug. :)

Yeah, that is a bug, in fact we are missing the check nsMixedContentBlocker::IsPotentiallyTrustworthyLoopbackURL(aURI) in HTMLFormElement.

Probably worth auditing all the other places where we do document->GetUpgradeInsecureRequests or loadinfo->GetUpgradeInsecureRequests.

Maybe we can also extend the loopback test.

Freddy, maybe something for Jens?

Flags: needinfo?(fbraun)
Assignee: nobody → fbraun
Status: NEW → ASSIGNED

I have a patch, but the test looks a bit ugly now.
For some reason, the existing request from XHR didn't show up in the observer and I can't easily look at the result of the <form>, so now I have two methods to check for the tests to complete. Testcase 1 still uses the XHR response and I introduced an specialpowers-http-notify-request observer for testcase 2.

Flags: needinfo?(fbraun)
Severity: -- → S4
Priority: -- → P2
Whiteboard: [domsecurity-active]
Pushed by fbraun@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/299dd2d878ac dont apply upgrade-insecure-requests to localhost form submissions r=ckerschb
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: