Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
Tor Browser
Commits
b388b64c
Commit
b388b64c
authored
7 months ago
by
henry
Committed by
Beatriz Rizental
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
BB 29745: Limit remote access to content accessible resources
parent
e684af42
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1507
Rebase Tor Browser onto 136.0a1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
caps/nsScriptSecurityManager.cpp
+42
-0
42 additions, 0 deletions
caps/nsScriptSecurityManager.cpp
with
42 additions
and
0 deletions
caps/nsScriptSecurityManager.cpp
+
42
−
0
View file @
b388b64c
...
...
@@ -1044,6 +1044,48 @@ nsresult nsScriptSecurityManager::CheckLoadURIFlags(
}
}
// Only allow some "about:" pages to have access to contentaccessible
// "chrome://branding/" assets. Otherwise web pages could easily and
// consistently detect the differences between channels when their
// branding differs. See tor-browser#43308 and tor-browser#42319.
// NOTE: The same assets under the alternative URI
// "resource:///chrome/browser/content/branding/" should already be
// inaccessible to web content, so we only add a condition for the chrome
// path.
if
(
targetScheme
.
EqualsLiteral
(
"chrome"
))
{
nsAutoCString
targetHost
;
rv
=
aTargetBaseURI
->
GetHost
(
targetHost
);
NS_ENSURE_SUCCESS
(
rv
,
rv
);
if
(
targetHost
.
EqualsLiteral
(
"branding"
))
{
// Disallow any Principal whose scheme is not "about", or is a
// contentaccessible "about" URI ("about:blank" or "about:srcdoc").
// NOTE: "about:blank" and "about:srcdoc" would be unexpected here
// since such a document spawned by a web document should inherit the
// same Principal URI. I.e. they would be "http:" or "https:" schemes.
// But we add this condition for extra assurances.
// NOTE: Documents with null Principals, like "about:blank" typed by
// the user, would also be excluded since the Principal URI would be
// "moz-nullprincipal:".
if
(
!
aSourceBaseURI
->
SchemeIs
(
"about"
)
||
NS_IsContentAccessibleAboutURI
(
aSourceBaseURI
))
{
return
NS_ERROR_DOM_BAD_URI
;
}
// Also exclude "about:reader" from accessing branding assets. I.e. if
// a web page includes `<img src="chrome://branding/..." />` we do not
// want it to render within "about:reader" either.
// Though it is unknown whether the information within "about:reader"
// would be exploitable by a web page, we also want to exclude
// "about:reader" for consistency: if it does not display in the
// original web page, it should not display in "about:reader" either.
nsAutoCString
sourcePath
;
rv
=
aSourceBaseURI
->
GetFilePath
(
sourcePath
);
NS_ENSURE_SUCCESS
(
rv
,
rv
);
if
(
sourcePath
.
EqualsLiteral
(
"reader"
))
{
return
NS_ERROR_DOM_BAD_URI
;
}
}
}
if
(
targetScheme
.
EqualsLiteral
(
"resource"
))
{
if
(
StaticPrefs
::
security_all_resource_uri_content_accessible
())
{
return
NS_OK
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment