-
Notifications
You must be signed in to change notification settings - Fork 879
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
PDF checks for blocking should use proper tab origin #958
Conversation
|
||
GURL GetURLOrPDFURL(const GURL& url) { | ||
if (url.SchemeIs("chrome-extension") && | ||
url.host() == pdfjs_extension_id) { |
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.
[minor] it would be helpful to set chrome-extension://<pdfjs_extension_id>/
as a constant pdfjs_extension_prefix
in extension_constants since it is repeated a lot in this PR and will also be needed in the PR to hide the pdfjs prefix.
then this check can be replaced with if (url.GetOrigin() == pdfjs_extension_prefix)
@@ -23,7 +24,7 @@ void BraveRequestInfo::FillCTXFromRequest(const net::URLRequest* request, | |||
std::shared_ptr<brave::BraveRequestInfo> ctx) { | |||
ctx->request_identifier = request->identifier(); | |||
ctx->request_url = request->url(); | |||
ctx->tab_origin = request->site_for_cookies().GetOrigin(); | |||
ctx->tab_origin = brave::GetURLOrPDFURL(request->site_for_cookies()).GetOrigin(); |
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.
is ctx->tab_origin
used for anything security-related? if so it probably shouldn't be set to the pdfjs pseudo-origin.
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.
no only our internal filtering, but I'll update this to scope it to only adblock+TP or just exclude TP.
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.
LGTM
I'm going to change to different approach. |
Fix brave/brave-browser#1033
Submitter Checklist:
npm test brave_unit_tests && npm test brave_browser_tests
) ongit rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
Reviewer Checklist: