Closed Bug 1819592 Opened 2 years ago Closed 2 years ago

Don't set Sec-Fetch-* headers if a channel is used for a download

Categories

(Core :: Networking: HTTP, defect, P2)

defect

Tracking

()

RESOLVED FIXED
117 Branch
Tracking Status
thunderbird_esr115 --- fixed
firefox-esr115 --- fixed
firefox117 --- fixed

People

(Reporter: KaiE, Assigned: mkmelin)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file, 2 obsolete files)

Bug 1803739 needs an additional load flag, to selectively prevent that Sec-Fetch-* headers are sent.

Unfortunately there is no more room more additional flags in the existing nsIRequest.loadFlags attribute:

0:00.96 xpidl.xpidl.IDLError: error: xpidl constants must fit within uint32_t, /home/user/moz/commcent/mozilla/netwerk/base/nsIChannel.idl line 292:4
 0:00.96     const unsigned long LOAD_NO_SEC_FETCH_HEADERS = 1 << 32;

This patch suggests to introduce an additional loadFlags2 attribute for storing additional flags.

Assignee: nobody → kaie
Status: NEW → ASSIGNED
Attachment #9320483 - Attachment is obsolete: true

Valentin explained we don't need a new load flag, but can instead use nsIHttpChannelInternal.

And in the meantime, in bug 1803739, Freddy suggested we should use a more general flag like "this is a download".

Combining these, I see that nsIHttpChannelInternal already has an attribute channelIsForDownload.

Based on Freddy's suggestion, we could omit the sec-fetch-* headers if channelIsForDownload is set to true.

Summary: New loadFlag LOAD2_NO_SEC_FETCH_HEADERS and make room for more load flags → Don't set Sec-Fetch-* headers if a channel is used for a download
See Also: → 1508292
Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged]
Attachment #9320532 - Attachment description: Bug 1819592 - Don't set Sec-Fetch-* headers if a channel is used for a download. r=valentin → Bug 1819592 - Add flag noSecurityContext to nsIHttpChannelInternal, don't send Sec-Fetch-* headers if set. r=valentin

Would someone from the Necko team be able to point us to an existing test, which would be suited as an example for adding a test?

IIUC, we need a test that creates an XMLHttpRequest, see the new flag, then receive the headers that are generated by the request, and check that these headers aren't present?

Probably the test will need to be even more advanced, because it needs to operate in a context that would normally produce the Sec-Fetch-* flags? Do we need to have a related parent request?

Any pointers/suggestions would be very much appreciated.

I found toolkit/components/extensions/test/xpcshell/test_ext_secfetch.js
Would that be a good starting point?
It uses "fetch" (not XMLHttpRequest). Is there a way to set an attribute of nsIHttpChannelInternal when using fetch?

dom/xhr/tests/test_XHR_anon.html is a test where XMLHttpRequest() is making use of advanced preferences.
dom/xhr/tests/test_XHR_parameters.html is testing the privilege questions.

Sorry I cannot make the remaining work a priority right now.

Assignee: kaie → nobody
Status: ASSIGNED → NEW
Assignee: nobody → mkmelin+mozilla
Attachment #9339039 - Attachment description: WIP: Bug 1819592 - Don't set Sec- headers for mozSystem requests. → Bug 1819592 - Don't set Sec- headers for mozSystem requests. r=valentin,freddyb
Status: NEW → ASSIGNED
Attachment #9339039 - Attachment description: Bug 1819592 - Don't set Sec- headers for mozSystem requests. r=valentin,freddyb → Bug 1819592 - Don't set Sec- headers for system requests. r=valentin,freddyb,ckerschb
Attachment #9339039 - Attachment description: Bug 1819592 - Don't set Sec- headers for system requests. r=valentin,freddyb,ckerschb → Bug 1819592 - Don't set Sec- headers for system requests. r=freddyb,ckerschb
Pushed by mkmelin@iki.fi: https://hg.mozilla.org/integration/autoland/rev/d8a8eaf13f78 Don't set Sec- headers for system requests. r=freddyb,ckerschb
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch
Attachment #9320532 - Attachment is obsolete: true
Attachment #9320532 - Attachment is obsolete: false

Comment on attachment 9339039 [details]
Bug 1819592 - Don't set Sec- headers for system requests. r=freddyb,ckerschb

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: Makes reading of rss feeds from some major sites like Feedburner work in Thunderbird.
  • User impact if declined: Feed reading won't work.
  • Fix Landed on Version: 117
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): It only affects requests/fetches from privileged code, in combination with the server reacting differently to Sec- headers.
    Probably such cases do not exist for Firefox.
Attachment #9339039 - Flags: approval-mozilla-esr115?
Attachment #9320532 - Flags: approval-mozilla-esr115?
Attachment #9320532 - Attachment is obsolete: true
Attachment #9320532 - Flags: approval-mozilla-esr115?

Comment on attachment 9339039 [details]
Bug 1819592 - Don't set Sec- headers for system requests. r=freddyb,ckerschb

Approved for 115.2esr.

Attachment #9339039 - Flags: approval-mozilla-esr115? → approval-mozilla-esr115+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: