-
Notifications
You must be signed in to change notification settings - Fork 904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't reveal chrome-untrusted:// and other parents in ancestorOrigins. #20792
Conversation
4c97c40
to
2f16868
Compare
2f16868
to
224ecbb
Compare
224ecbb
to
7493df7
Compare
7493df7
to
ab6f3fd
Compare
auto* raw_origins = ancestorOrigins_ChromiumImpl(); | ||
for (uint32_t i = 0; i < raw_origins->length(); ++i) { | ||
const String raw_origin = raw_origins->item(i); | ||
const scoped_refptr<SecurityOrigin> origin = | ||
SecurityOrigin::CreateFromString(raw_origin); | ||
if (is_chrome_untrusted(origin.get())) { | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for missing that during the review, but shouldn't we use continue
here instead?
I think we want to remove chrome-untrusted
from the list, but if there are multiple nesting levels, then we should probably leave the other ones there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for missing that during the review, but shouldn't we use
continue
here instead? I think we want to removechrome-untrusted
from the list, but if there are multiple nesting levels, then we should probably leave the other ones there.
we explicitly don't want the player iframe to know its nested level (how many iframes deep it's running).
I don't think we want to reveal this info to any iframe inside chrome-untrusted://
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be clear, I was not suggesting adding "null"
entries in this case, just omitting the chrome-untrusted
entries instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be clear, I was not suggesting adding
"null"
entries in this case, just omitting thechrome-untrusted
entries instead.
yep, but this way the ancestorOrigins
will still contain the top frame, which is chrome://player
. We also don't want this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it would be fine to remove chrome://
URLs in a similar way IMO.
So basically I think we should do one of two things:
- Remove
chrome-untrusted
andchrome
untrusted entries fromancestorOrigins
in all cases, but leave the other entries alone. This would apply all of the time. - Clear
ancestorOrigins
entirely, but only forchrome://player
.
With #1, it would mean that if we have nested iframes like:
chrome://player => chrome-untrusted://whatever => https://example.com => https://targetsite.com
then targetsite.com
would see the same ancestorOrigins
as in the normal web case:
https://example.com => https://targetsite.com
#2 on the other hand would solve the immediate problem without affecting anything else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With #1, it would mean that if we have nested iframes like:
chrome://player => chrome-untrusted://whatever => https://example.com => https://targetsite.com
then targetsite.com would see the same ancestorOrigins as in the normal web case:
https://example.com => https://targetsite.com
This example should already work like you described. The chain will be left intact until chrome-untrusted://
is encountered, so https://example.com => https://targetsite.com
chain will stay. The order in the chain list is reversed: first we get https://targetsite.com
, then https://example.com
, then chrome-untrusted://
. We stop at chrome-untrusted://
item, this means the "good" https://
chain is there.
Resolves brave/brave-browser#34033
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run lint
,npm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: