Closed Bug 1733274 Opened 3 years ago Closed 3 years ago

Modal error when right-click save button on StorySaver.net

Categories

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

Desktop
All
defect

Tracking

()

VERIFIED FIXED
95 Branch
Tracking Status
firefox-esr78 --- wontfix
firefox-esr91 --- verified
firefox93 --- wontfix
firefox94 --- wontfix
firefox95 --- verified

People

(Reporter: bj, Assigned: valentin)

References

(Regression, )

Details

(Keywords: nightly-community, parity-chrome, regression, Whiteboard: [necko-triaged])

Attachments

(2 files, 1 obsolete file)

Steps to reproduce:

  1. Visit https://www.storysaver.net/ .
  2. Enter "arminvanbuuren" as the account name and click Download! (or any other account with a story).
  3. Complete the Captcha.
  4. Right-click on Save as Video for a story and select Save Link As...

Expected:
4) Standard Save pop-up appears.

Actual:
4) Modal popup with the text:

The download cannot be saved because an unknown error occurred.
Please try again.
[OK]

Side note: No, it isn't "OK". It's an annoying situation. Why does Firefox keep insisting users say that everything is OK? Does Firefox have some issue where it constantly wants affirmation?

Right-click Save works with Google Chrome.

Issue observed with Firefox 92 and Nightly 94.

Has STR: --- → yes
Component: Untriaged → Downloads API
OS: Linux → All
Product: Firefox → Toolkit

The site is timing out very often for me, so it was not trivial to reproduce, but I could reproduce it after a few tries.
The error comes from here:
https://searchfox.org/mozilla-central/rev/eecd2dd4ba630bea4ce103623a4bfb398065b64b/browser/base/content/nsContextMenu.js#1593,1604,1611
so it's an onStartRequest call for a failed request.

The request status is NS_ERROR_DOM_CORP_FAILED for me
Used to indicate that a resource with the Cross-Origin-Resource-Policy response header set failed the origin check.

I'm not sure why it'd work in Chrome though, I'll neeinfo kershaw from Netwerk to evaluate, or eventually forward, the question.

Flags: needinfo?(kershaw)

Eden, could you take a look? you probably know more CORP code than me.
I can only tell the error is coming from this line, which shows the origin of the channel https://scontent.cdninstagram.com is different than load info's https://www.storysaver.net/.

Flags: needinfo?(kershaw) → needinfo?(echuang)

It seems that it triggers cross-origin resource fetching. However, the resource's CORP is "same-site" which means is not allowed for cross-origin fetching. Then we meet the network error. I will double-check if there is a bug in our CORP implementation.

(In reply to Eden Chuang[:edenchuang] from comment #3)

It seems that it triggers cross-origin resource fetching. However, the resource's CORP is "same-site" which means is not allowed for cross-origin fetching. Then we meet the network error. I will double-check if there is a bug in our CORP implementation.

The response header is:

[Parent 74062: Socket Thread]: I/nsHttp http response [
[Parent 74062: Socket Thread]: E/nsHttp   HTTP/2 302 Found
[Parent 74062: Socket Thread]: E/nsHttp   location: https://scontent.cdninstagram.com/v/t50.2886-16/88639615_2347906042012816_4944134342582634168_n.mp4?efg=eyJ2ZW5jb2RlX3RhZyI6InZ0c192b2RfdXJsZ2VuLjcyMC5zdG9yeS5kZWZhdWx0IiwicWVfZ3JvdXBzIjoiW1wiaWdfd2ViX2RlbGl2ZXJ5X3Z0c19vdGZcIl0ifQ&_nc_ht=scontent-otp1-1.cdninstagram.com&_nc_cat=104&_nc_ohc=lN29BrmIVfIAX-0E1f7&edm=ANmP7GQBAAAA&vs=17876945792542179_3548604875&_nc_vs=HBksFQAYJEdIX0lTQVdRcEpsNWFGY0lBTGlHY2t2OUY1MUVidXFIQUFBQRUAAsgBABUAGCRHTXdna1E0M1NCTUNnRmdCQUMzT2dXZ3JTVTljYnBrd0FBQUYVAgLIAQAoABgAGwGIB3VzZV9vaWwBMRUAACbyqcTBjv%2FkPxUCKAJDMywXQC4AAAAAAAAYEmRhc2hfYmFzZWxpbmVfMV92MREAdegHAA%3D%3D&_nc_rid=370a9b483a&ccb=7-4&oe=615EB49B&oh=0d7fb8f08be773236b3daab7f19acd02&_nc_sid=276363&_nc_vts_prog=1&vts=1
[Parent 74062: Socket Thread]: E/nsHttp   content-type: text/plain
[Parent 74062: Socket Thread]: E/nsHttp   content-length: 0
[Parent 74062: Socket Thread]: E/nsHttp   server: proxygen-bolt
[Parent 74062: Socket Thread]: E/nsHttp   x-fb-trip-id: 1425083115
[Parent 74062: Socket Thread]: E/nsHttp   date: Tue, 05 Oct 2021 08:51:27 GMT
[Parent 74062: Socket Thread]: E/nsHttp   cross-origin-resource-policy: same-origin
[Parent 74062: Socket Thread]: E/nsHttp   x-frame-options: DENY
[Parent 74062: Socket Thread]: E/nsHttp   alt-svc: h3=":443"; ma=3600,h3-29=":443"; ma=3600,h3-27=":443"; ma=3600
[Parent 74062: Socket Thread]: E/nsHttp   X-Firefox-Spdy: h2
[Parent 74062: Socket Thread]: E/nsHttp     OriginalHeaders
[Parent 74062: Socket Thread]: E/nsHttp   location: https://scontent.cdninstagram.com/v/t50.2886-16/88639615_2347906042012816_4944134342582634168_n.mp4?efg=eyJ2ZW5jb2RlX3RhZyI6InZ0c192b2RfdXJsZ2VuLjcyMC5zdG9yeS5kZWZhdWx0IiwicWVfZ3JvdXBzIjoiW1wiaWdfd2ViX2RlbGl2ZXJ5X3Z0c19vdGZcIl0ifQ&_nc_ht=scontent-otp1-1.cdninstagram.com&_nc_cat=104&_nc_ohc=lN29BrmIVfIAX-0E1f7&edm=ANmP7GQBAAAA&vs=17876945792542179_3548604875&_nc_vs=HBksFQAYJEdIX0lTQVdRcEpsNWFGY0lBTGlHY2t2OUY1MUVidXFIQUFBQRUAAsgBABUAGCRHTXdna1E0M1NCTUNnRmdCQUMzT2dXZ3JTVTljYnBrd0FBQUYVAgLIAQAoABgAGwGIB3VzZV9vaWwBMRUAACbyqcTBjv%2FkPxUCKAJDMywXQC4AAAAAAAAYEmRhc2hfYmFzZWxpbmVfMV92MREAdegHAA%3D%3D&_nc_rid=370a9b483a&ccb=7-4&oe=615EB49B&oh=0d7fb8f08be773236b3daab7f19acd02&_nc_sid=276363&_nc_vts_prog=1&vts=1
[Parent 74062: Socket Thread]: E/nsHttp   content-type: text/plain
[Parent 74062: Socket Thread]: E/nsHttp   content-length: 0
[Parent 74062: Socket Thread]: E/nsHttp   server: proxygen-bolt
[Parent 74062: Socket Thread]: E/nsHttp   x-fb-trip-id: 1425083115
[Parent 74062: Socket Thread]: E/nsHttp   date: Tue, 05 Oct 2021 08:51:27 GMT
[Parent 74062: Socket Thread]: E/nsHttp   cross-origin-resource-policy: same-origin
[Parent 74062: Socket Thread]: E/nsHttp   x-frame-options: DENY
[Parent 74062: Socket Thread]: E/nsHttp   alt-svc: h3=":443"; ma=3600,h3-29=":443"; ma=3600,h3-27=":443"; ma=3600
[Parent 74062: Socket Thread]: E/nsHttp   X-Firefox-Spdy: h2
[Parent 74062: Socket Thread]: I/nsHttp ]

The corp header is same-origin.
It looks like the problem is that the document (https://www.storysaver.net/) wants to load a resource at https://scontent-otp1-1.cdninstagram.com/, and the server returns a 302 with cross-origin-resource-policy: same-origin. Since the origin is not the same, the channel returned the error NS_ERROR_DOM_CORP_FAILED.

Eden: is it actually correct to apply CORP to "save link as" requests? I kind of doubt that - it's basically the same as saying "copy this link and pass to curl", or "open in new tab and save the document", both of which work.

Valentin, if true this doesn't match the specification for Cross-Origin-Resource-Policy. It only applies to "no-cors" requests (i.e., when fetching subresources). A download is a "navigate" request. Could you take a look at this since you implemented this header?

(FWIW, we shipped this header two years ago in bug 1602363.)

Flags: needinfo?(echuang) → needinfo?(valentin.gosu)

Indeed, we also need to allow ExtContentPolicy::TYPE_SAVEAS_DOWNLOAD

Assignee: nobody → valentin.gosu
Severity: -- → S3
Component: Downloads API → DOM: Networking
Flags: needinfo?(valentin.gosu)
Priority: -- → P2
Product: Toolkit → Core
Regressed by: 1602363
Whiteboard: [necko-triaged]
Has Regression Range: --- → yes
Pushed by valentin.gosu@gmail.com: https://hg.mozilla.org/integration/autoland/rev/90b3f27d6c66 Skip CORP check for TYPE_SAVEAS_DOWNLOAD r=Gijs

When looking at that code I initially thought it would also end up applying to CORS requests, but there are tests for that and we pass them. It's weird that CORS_MODE_NO_CORS encompasses navigation requests, they really ought to have their own mode as they do in Fetch.

Tests are in https://github.com/web-platform-tests/wpt/tree/master/fetch/cross-origin-resource-policy. It seems that navigations are tested, but navigations that are downloads are not. Those might be trickier to test as well given that there's no test API to deal with downloads.

(In reply to Anne (:annevk) from comment #10)

When looking at that code I initially thought it would also end up applying to CORS requests, but there are tests for that and we pass them. It's weird that CORS_MODE_NO_CORS encompasses navigation requests, they really ought to have their own mode as they do in Fetch.

CORS, mixed content and downloads / "save page as" are fun, fwiw - x-ref bug 1668530.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch
Attachment #9247685 - Attachment description: WIP: Bug 1733274 - Exclude SaveAsDownload requests from CORP checking. → WIP: Bug 1733274 - Exclude SaveAsDownload requests from CORP checking. r=kershaw
Attachment #9247685 - Attachment description: WIP: Bug 1733274 - Exclude SaveAsDownload requests from CORP checking. r=kershaw → Bug 1733274 - Exclude SaveAsDownload requests from CORP checking. r=kershaw
Attachment #9247685 - Attachment is obsolete: true

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

Is this something we should consider backporting to ESR91?

Flags: needinfo?(valentin.gosu)
Flags: needinfo?(valentin.gosu)

I think the patch is simple enough that backporting it should be OK.

Comment on attachment 9247539 [details]
Bug 1733274 - Skip CORP check for TYPE_SAVEAS_DOWNLOAD r=Gijs

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration:
  • User impact if declined: Users could be prevented from downloading files because of CORP errors.
  • Fix Landed on Version: 95
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky):
Attachment #9247539 - Flags: approval-mozilla-esr91?

Comment on attachment 9247539 [details]
Bug 1733274 - Skip CORP check for TYPE_SAVEAS_DOWNLOAD r=Gijs

Approved for 91.5esr.

Attachment #9247539 - Flags: approval-mozilla-esr91? → approval-mozilla-esr91+
QA Whiteboard: [qa-triaged]
Flags: qe-verify+

I wasn't able to reproduce the error message on Firefox 92.0.1 nor 94.0a1 (2021-09-29) under macOS 12.0.1, Ubuntu 20 or Windows 10 by following the exact steps from Comment 0.

Verified though that the videos downloads as expected after the fix on Firefox 95.0.2 and ESR 91.5.0 under the same systems.

Just to be extra sure, B.J. can you verify too the fixes on Firefox 95.0.2 and ESR 91.5.0? Thank you!

Status: RESOLVED → VERIFIED
Flags: qe-verify+ → needinfo?(bj)

I don't have the ESR, but I used Firefox 95.0.2 and the problem is fixed.

Flags: needinfo?(bj)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: