Open StephenHeaps opened 4 days ago
Fwiw, I expect window.origin is not the only place this is happening (JS inserted code is using page editable versions of WebAPIs) and so it might be good to expand the scope of this issue.
I’m 99% sure I’ve used JS (not TS) static analysis tools too that can check for instances too. Happy to root around for them if it’d be helpful
Fwiw, I expect window.origin is not the only place this is happening (JS inserted code is using page editable versions of WebAPIs) and so it might be good to expand the scope of this issue.
I’m 99% sure I’ve used JS (not TS) static analysis tools too that can check for instances too. Happy to root around for them if it’d be helpful
@pes10k I think it'd be good if you have any tools to run static analysis for this if we want to include more than just window.origin
.
Fwiw, I expect window.origin is not the only place this is happening (JS inserted code is using page editable versions of WebAPIs) and so it might be good to expand the scope of this issue. I’m 99% sure I’ve used JS (not TS) static analysis tools too that can check for instances too. Happy to root around for them if it’d be helpful
yeah, @Brandon-T fixed a lot of similar issues on iOS already, we now save original copies of such objects and access the frozen copies. Also we only care if by modifying a JS object the web page can somehow affect privacy/security of the browser/user. Most of the times though these edits only allow the page to attack itself, but there is not much we can do about.
@pes10k I think it'd be good if you have any tools to run static analysis for this if we want to include more than just window.origin.
@thypon, i think you had a tool you were using to detect when scripts were using posionable-prototypes?
Description
window.origin
is marked readonly, but is replaceable. We should store a secured copy of thewindow.origin
so a site can't change thewindow.origin
to circumvent out scripts.Follow up to https://github.com/brave/brave-core/pull/26622#discussion_r1857499931.
Steps to Reproduce
stephenheaps.github.io/$first-party
to the custom filtershttps://stephenheaps.github.io/local-frames/ad.txt
were blocked. At this pointhttps://stephenheaps.github.io/local-frames/ad.txt
is cached, so we need to use a different URLlocal-iframe
in the bottom right cornerfetch
wasn't blocked: