Closed Bug 1857894 Opened 2 years ago Closed 2 years ago

Embedded videos can not be played at video.sina.com.cn with ETP set to STANDARD

Categories

(Core :: Privacy: Anti-Tracking, defect, P3)

Firefox 120
Desktop
Windows 10
defect

Tracking

()

VERIFIED FIXED
123 Branch
Tracking Status
firefox120 --- wontfix
firefox122 --- wontfix
firefox123 --- verified
firefox124 --- verified

People

(Reporter: rbucata, Assigned: maltejur)

References

(Blocks 1 open bug, )

Details

Attachments

(4 files)

Attached image Untitled.png

Environment:
Operating System: Windows 10 PRO x64
Firefox version: Firefox Nightly 120.0a1 (2023-10-08)

Preconditions:
ETP set to STANDARD
Clean profile

Steps to reproduce:

  1. Navigate to : https://video.sina.com.cn/p/news/2023-10-09/detail-imzqnhxr8243879.d.html
  2. Observe the result inside the embedded video placeholder.

Expected Behavior:
The video plays

Actual Behavior:
An error is shown

Notes:

  • Not reproducible with ETP turned OFF(Both Normal and Private Browsing)
  • Works as expected using Chrome
  • Screenshot attached

Seems to be related with video.sina.cn

Severity: -- → S3
Priority: -- → P3

This appears to be because of the Referer header on the video resource, not because of partitioning.

Specifically the video resource is http://... but the request is being sent as https://. However the Referer header is not being sent for the video resource when ETP is enabled.

I think with ETP disabled we aren't enforcing RefererPolicy (which is no-referer-when-downgrade).

Christoph: Should Mixed Content auto-upgrades change the content's security level when considering the RefererPolicy?

Flags: needinfo?(ckerschb)

The resource itself is available over https?

It's very likely that mixed-content-auto-upgrading needs to touch the referrer-policy bits.

Malte, can you take a look at this one?

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

The issue here seems to be that the site has CSP upgrade-insecure-requests enabled, and the referrer gets calculated before the upgrade is happening. When ETP is disabled this isn't a problem in this case, as the site sets its referrer policy to always/unsafe-url. But once ETP gets enabled Firefox will use strict-origin-when-cross-origin, as it won't consider less secure policies than the default (disallowCrossSiteRelaxing). In that case the referrer of course won't be sent, as when it is calculated the target URL is still http and https->http isn't allowed under strict-origin-when-cross-origin.

This issue seems to be a bit more general though. The referrer for everything that's being upgraded because of NS_ShouldSecureUpgrade seems to be calculated before the actual upgrade is happening. I could reproduce the same behavior on a small test site with HSTS, Mixed content upgrading, CSP upgrade-insecure-requests and HTTPS-Only.

Upon closer inspection of our code and the fetch spec, this seems to only be an issue with Mixed Content upgrading and CSP Upgrade-Insecure-Requests, and not HSTS. Per spec, we should follow this order:

  1. Potentially upgrade a request by means of upgrade-insecure-requests (Main fetch 5.)
  2. Potentially upgrade a mixed content request (Main fetch 6.)
  3. Determine the referrer of the request (Main fetch 9.)
  4. Potentially set the scheme to https if the relevant HSTS conditions apply (Main fetch 10.)

I am not sure where HTTPS-First and HTTPS-Only would fit in there. In the ongoing HTTPS upgrades proposal, which is roughly trying to achieve what HTTPS-First does, the upgrade step is placed before mixed content upgrading. So judging from that, I would also recalculate the referrer for HTTPS-First and HTTPS-Only.

Attachment #9363237 - Attachment description: WIP: Bug 1857894 - Use more strict referrer policy on redirect instead of consecutively applying both policies → WIP: Bug 1857894 - Recalculate referrer based on original referrer after non-HSTS HTTPS upgrade
Attachment #9363237 - Attachment description: WIP: Bug 1857894 - Recalculate referrer based on original referrer after non-HSTS HTTPS upgrade → Bug 1857894 - Recalculate referrer based on original referrer after non-HSTS HTTPS upgrade r?#necko-reviewers,freddyb!

This way we have a domain available that is on the HSTS preload list.

cert9.db, key4.db and mochitest.client have been generated by ./mach python build/pgo/genpgocert.py,
as per https://firefox-source-docs.mozilla.org/build/buildsystem/test_certificates.html.

Attachment #9368467 - Attachment description: Bug 1857894 - Make hstspreload.org available to mochitest r?freddyb → Bug 1857894 - Make includesubdomains.preloaded.test available to mochitest r?freddyb

There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:mjurgens, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(mjurgens)
Flags: needinfo?(fbraun)
Flags: needinfo?(mjurgens)
Flags: needinfo?(fbraun)
Pushed by mjurgens@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d291d8ac8124 Make includesubdomains.preloaded.test available to mochitest r=freddyb https://hg.mozilla.org/integration/autoland/rev/504ffc20d2eb Recalculate referrer based on original referrer after non-HSTS HTTPS upgrade r=necko-reviewers,freddyb,kershaw
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch
Regressions: 1875271

I can reproduce this issue in Release v122.0.1 and I can confirm the fix in Beta v122.0b8 and v122.0b9 and Nightly v124.0a1.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: