Open Bug 1340694 Opened 9 years ago Updated 3 months ago

don't set fetch/xhr referrer based on exact nsIPrincipal URI value

Categories

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

defect

Tracking

()

People

(Reporter: bkelly, Unassigned)

References

Details

(Whiteboard: [necko-triaged])

In nsContentUtils::SetFetchReferrerURIWithPolicy() we set the referrer based on the URI in the nsIPrincipal: https://dxr.mozilla.org/mozilla-central/source/dom/base/nsContentUtils.cpp#8530 This is called when fetch/xhr are used from worker threads. This is very fragile since its not obvious that the nsIPrincipal URI is significant here. It would be much better to make these paths get the referrer from WorkerPrivate::GetResolvedScriptURI() or WorkerPrivate::ScriptURL(). https://dxr.mozilla.org/mozilla-central/source/dom/workers/WorkerPrivate.h#506
Note, because of this issue we likely send the wrong referer header for blob: URL workers at the moment. See: https://github.com/w3c/webappsec-referrer-policy/issues/95
To clarify comment 1, a blob: URL worker currently ends up with a principal where the URL is the triggering document URL, not the blob URL.
Priority: -- → P3
Component: DOM → DOM: Core & HTML
Severity: normal → S3
Component: DOM: Core & HTML → DOM: Networking

We need to confirm if this is still the case. 5 points for the investigation efforts, ranked low since this likely is fixed(?).

Whiteboard: [necko-triaged]
You need to log in before you can comment on or make changes to this bug.