Check non-JavaScript script loading from file:// later
Categories
(Core :: DOM: Security, task)
Tracking
()
People
(Reporter: tschuster, Assigned: tschuster)
References
Details
Attachments
(2 external files)
Currently we check the MIME-type of scripts loaded from file:// too early. That means we actually preempt the checks that disallow loading file: from normal webpages loaded via https: etc. This is probably skewing our telemetry.
While investigating this I also realized another issue or at least unexpected behavior. I thought GetTypeFromURI would also check the OS for the file-extension, but that doesn't seem to work, presumably because of the content-process sandbox for file URIs?
| Assignee | ||
Comment 1•4 years ago
|
||
Updated•4 years ago
|
| Assignee | ||
Comment 2•4 years ago
|
||
Depends on D148898
| Assignee | ||
Updated•4 years ago
|
Comment 3•4 years ago
|
||
(In reply to Tom Schuster (MoCo) from comment #0)
Currently we check the MIME-type of scripts loaded from file:// too early. That means we actually preempt the checks that disallow loading file: from normal webpages loaded via https: etc. This is probably skewing our telemetry.
While investigating this I also realized another issue or at least unexpected behavior. I thought
GetTypeFromURIwould also check the OS for the file-extension, but that doesn't seem to work, presumably because of the content-process sandbox for file URIs?
I think it's meant to be forwarded via IPC. Does that not happen?
| Assignee | ||
Comment 4•4 years ago
|
||
I think it's meant to be forwarded via IPC. Does that not happen?
Seems like that specific case is broken:
nsExternalHelperAppService::GetMIMETypeFromOSForExtensioncallsGetMIMEInfoFromOSwith an empty-string MIME type.nsOSHelperAppServiceChild::GetMIMEInfoFromOScreates ansChildProcessMIMEInfowith the passed in empty MIME type.- It then calls
ContentHandlerService::GetMIMEInfoFromOS, which modifies some of the passed innsIHandlerInfodata.typehowever is readonly.
Frankly the whole design here seems problematic.
Comment 5•4 years ago
|
||
(In reply to Tom Schuster (MoCo) from comment #4)
I think it's meant to be forwarded via IPC. Does that not happen?
Seems like that specific case is broken:
nsExternalHelperAppService::GetMIMETypeFromOSForExtensioncallsGetMIMEInfoFromOSwith an empty-string MIME type.nsOSHelperAppServiceChild::GetMIMEInfoFromOScreates ansChildProcessMIMEInfowith the passed in empty MIME type.- It then calls
ContentHandlerService::GetMIMEInfoFromOS, which modifies some of the passed innsIHandlerInfodata.typehowever is readonly.Frankly the whole design here seems problematic.
I don't know much about the IPC implementation apart from (a) it exists and (b) I would like it not to (exist). So I don't have any trouble believing it's problematic and would be happy to see it removed or, failing that, improved.
For scripts I would expect us to short-circuit anyway because we have a hardcoded list... if that would be sufficient to fix the issue here, perhaps that could be a short-term fix to improve the telemetry?
| Assignee | ||
Comment 6•4 years ago
|
||
For scripts I would expect us to short-circuit anyway because we have a hardcoded list... if that would be sufficient to fix the issue here, perhaps that could be a short-term fix to improve the telemetry?
Thanks to the hardcoded list nsExternalHelperAppService we already support all the normal extensions like .js, .mjs etc. I don't think we need to fix anything right now.
| Assignee | ||
Updated•4 years ago
|
| Assignee | ||
Comment 8•4 years ago
|
||
Comment on attachment 9280647 [details]
Bug 1773667 - Perform file URI script check after other checks. r?freddyb
Beta/Release Uplift Approval Request
- User impact if declined: We want to monitor potential problems with a new security enforcement mechanism that is shipping in 102. Without this patch the telemetry we collect is misleading.
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Existing code is only changed in a very small way to mirrors other existing code.
- String changes made/needed:
- Is Android affected?: Yes
Comment 9•4 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/0e68d8f8c151
https://hg.mozilla.org/mozilla-central/rev/168fed291e9c
Updated•4 years ago
|
Comment 10•4 years ago
|
||
Fred, the uplift request was done for only one of the patches that landed on mozilla-central, is that wanted?
Comment 12•4 years ago
|
||
I believe the console logging change isn't that necessary for the telemetry, which is the main interesting thing we wanted uplifted here.
Comment 13•4 years ago
|
||
Comment on attachment 9280647 [details]
Bug 1773667 - Perform file URI script check after other checks. r?freddyb
Approved for 102 beta 9, thanks.
Comment 14•4 years ago
|
||
| bugherder uplift | ||
| Assignee | ||
Comment 15•4 years ago
|
||
Correct. The second patch is nice too have, but contains string changes so I didn't really bother with it.
Description
•