Closed Bug 1966620 Opened 8 months ago Closed 5 months ago

Don't allow JSON MIME type for JS non-JSON module loads

Categories

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

defect

Tracking

()

RESOLVED FIXED
143 Branch
Tracking Status
firefox-esr128 --- unaffected
firefox-esr140 --- wontfix
firefox138 --- wontfix
firefox139 --- wontfix
firefox140 --- wontfix
firefox141 --- wontfix
firefox142 --- wontfix
firefox143 --- fixed

People

(Reporter: tschuster, Assigned: jon4t4n)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

Since bug 1858078 JSON modules (i.e. with {type: "json"}) load have their own nsContentPolicyType(s). This means the exception added for allowing loads of JS modules with a JSON MIME type in bug 1916351 is now incorrect. We should disallow normal JS modules with a JSON MIME type again and we should make sure JSON modules loads have a JSON MIME type.

Set release status flags based on info from the regressing bug 1858078

:jon4t4n, since you are the author of the regressor, bug 1858078, could you take a look?

For more information, please visit BugBot documentation.

Flags: needinfo?(jonatan.r.klemets)
Depends on: 1916351

This code broke when TYPE_JSON was added in bug 1858078 because it
lacked test coverage. This patch fixes the code and adds tests to make
sure we don't break it again.

Assignee: nobody → jonatan.r.klemets
Status: NEW → ASSIGNED
Flags: needinfo?(jonatan.r.klemets)
Pushed by jonatan.r.klemets@gmail.com: https://github.com/mozilla-firefox/firefox/commit/f54e29178c57 https://hg.mozilla.org/integration/autoland/rev/5748d8f98d18 Update EnsureMIMEOfScript and WarnWrongMIMEOfScript to handle TYPE_JSON r=necko-reviewers,devtools-reviewers,tschuster,nchevobbe,kershaw
Pushed by smolnar@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/206140a3348c https://hg.mozilla.org/integration/autoland/rev/3febe603af79 Revert "Bug 1966620 - Update EnsureMIMEOfScript and WarnWrongMIMEOfScript to handle TYPE_JSON r=necko-reviewers,devtools-reviewers,tschuster,nchevobbe,kershaw" for causing wpt perm failures @ /html/semantics/scripting-1/the-script-element/json-module/charset-bom.any.sharedworker.html
Flags: needinfo?(jonatan.r.klemets)
Depends on: 1977784
Flags: needinfo?(jonatan.r.klemets)
Severity: -- → S3
Priority: -- → P3
Pushed by jonatan.r.klemets@gmail.com: https://github.com/mozilla-firefox/firefox/commit/f9986599ac33 https://hg.mozilla.org/integration/autoland/rev/9da423677f3f Update EnsureMIMEOfScript and WarnWrongMIMEOfScript to handle TYPE_JSON r=necko-reviewers,devtools-reviewers,tschuster,nchevobbe,kershaw https://github.com/mozilla-firefox/firefox/commit/695b5f9484ae https://hg.mozilla.org/integration/autoland/rev/ede12d3619af 1977784: apply code formatting via Lando
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 143 Branch

The patch landed in nightly and beta is affected.
:jon4t4n, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(jonatan.r.klemets)
Flags: needinfo?(jonatan.r.klemets) → in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: