Closed Bug 2082095 Opened 1 month ago Closed 23 days ago

Speculation-rules prefetch follows redirects to non-trustworthy or cross-site URLs

Categories

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

defect

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: smayya, Assigned: smayya)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 external file)

PrefetchRecordParent::Init checks that the prefetch URL is potentially trustworthy and same-site, but PrefetchRecordParent::AsyncOnChannelRedirect doesn't repeat either check. A prefetch of an https URL that redirects to an http URL, or to another site, is followed and can later be used for the navigation.

Per "create navigation params by fetching" (https://wicg.github.io/nav-speculation/prefetch.html#create-navigation-params-by-fetching), the step "If request's current URL is not potentially trustworthy, then set response to a network error" runs inside the redirect loop, so it applies to every hop, not only the first.

Cross-site prefetches aren't supported yet: the isolated, uncredentialed partition that a cross-site hop needs isn't implemented. So while dom.speculation_rules.same_site_only is set, a redirect off the document's site has to be rejected as well, the same way the initial URL is.

Proposed fix: in PrefetchRecordParent::AsyncOnChannelRedirect, abort the redirect when the new URL isn't potentially trustworthy, or when it is cross-site and dom.speculation_rules.same_site_only is set.

Assignee: nobody → smayya
Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged]

The spec rejects a prefetch whose current URL is not potentially trustworthy
on every redirect hop, not only the first one. Cross-site prefetches are also
not supported yet (the isolated, uncredentialed partition isn't implemented),
so while dom.speculation_rules.same_site_only is set, don't follow a redirect
off the document's site either.

Attachment #9661601 - Attachment description: WIP: Bug 2082095 - Reject non-trustworthy and cross-site redirects of speculation-rules prefetches. r=#necko → Bug 2082095 - Reject non-trustworthy and cross-site redirects of speculation-rules prefetches. r=#necko
Pushed by smayya@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/225bd93a5d0b https://hg.mozilla.org/integration/autoland/rev/44c8d8318eeb Reject non-trustworthy and cross-site redirects of speculation-rules prefetches. r=necko-reviewers,valentin
Pushed by smayya@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/e49c072fcf6e https://hg.mozilla.org/integration/autoland/rev/d581e941e11b Reject non-trustworthy and cross-site redirects of speculation-rules prefetches. r=necko-reviewers,valentin
Status: NEW → RESOLVED
Closed: 23 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
QA Whiteboard: [qa-triage-done-c163/b162]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: