-
Notifications
You must be signed in to change notification settings - Fork 942
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
Allow certain client hints in request headers. #14155
Conversation
@@ -15,7 +15,15 @@ namespace blink { | |||
|
|||
void EnabledClientHints::SetIsEnabled(const WebClientHintsType type, | |||
const bool should_send) { | |||
enabled_types_[static_cast<int>(type)] = false; | |||
switch (type) { | |||
case WebClientHintsType::kUA: |
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.
What value do we send for this one? The Chromium one or the Chrome one?
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA#examples
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.
We send "Chromium";v="103", ".Not/A)Brand";v="99"
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.
Ok, so we will look different from Chrome then.
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.
@mkarolin shouldn't this be the same as whats in navigator.userAgentData (which is different from both Chrome and Chromium)
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.
Doesn't seem like it. There's a whole bunch of code that determines branding for client hints, specifically in blink::UserAgentBrandList GetUserAgentBrandList. We get the Chromium one because we don't unset CHROMIUM_BRANDING
when building. If we unset it we would get ".Not/A)Brand";v="99", "Brave Browser";v="103", "Chromium";v="103"
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.
I think thats what we want, as long as it wouldn't change the standard UA string (do you know if it would?)
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.
Doesn't appear so, the UA string is Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
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.
Added a patch to apply branding to the UA CH.
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.
This looks good to me. Thanks Max!
(slightly modified from Slack) Looks great, though, either in this or in a follow up PR, would it be possible to:
|
a1f6c08
to
28219c5
Compare
28219c5
to
b373ae1
Compare
b373ae1
to
f5737fa
Compare
@iefremov would you mind taking another look, please? |
Allowed hints are: kUA kUAMobile kUAPlatform Fixes brave/brave-browser#24009
Allows using brand name in the client hint so that our UACH is ".Not/A)Brand";v="99", "Brave Browser";v="103", "Chromium";v="103" instead of "Chromium";v="103", ".Not/A)Brand";v="99"
f5737fa
to
b6cdc2d
Compare
We will roll out via Griffin.
…opyValues Fixes brave/brave-browser#23491 It seems uaFullVersion was always leaking but the fullVersionList started leaking because of the change in #14155 where brand was added to GetUserAgentBrandList function in components/embedder_support/user_agent_utils.cc which broke the BraveContentBrowserClient::GetUserAgentMetadata expectation that the brand list would only contain 2 items (instead of now 3). This fix adjusts the BraveContentBrowserClient::GetUserAgentMetadata expectations and removes adding the Brave brand to the lists because it's already there. Now we just need to zero out 3 last components of the full versions list and uaFullVersion string. Also, adds a browser test to check the sizes of the lists and versions values.
Fixes brave/brave-browser#24009
Per @pes10k we can allow
sec-ch-ua
,sec-ch-ua-mobile
, andsec-ch-ua-platform
client hints since theyaren’t privacy harming, since they’re already in the UA effectively
. This change makes us fall back onto Chromium code for those 3 client hints.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
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: