Skip to content
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 include Android model by default #7200

Merged
merged 1 commit into from
Dec 17, 2020
Merged

Conversation

pilgrim-brave
Copy link
Contributor

@pilgrim-brave pilgrim-brave commented Nov 19, 2020

Resolves brave/brave-browser#12638

Submitter Checklist:

  • There is a ticket for my issue.
  • Used Github auto-closing keywords in the commit message.
  • Wrote a good PR/commit description
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed).
  • Requested a security/privacy review as needed.

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

@pilgrim-brave pilgrim-brave requested a review from a team as a code owner November 19, 2020 21:24
@pilgrim-brave pilgrim-brave self-assigned this Nov 19, 2020
@mkarolin
Copy link
Collaborator

Are we intentionally only changing this in BuildUserAgentFromProduct, but not in BuildUserAgentFromProductAndExtraOSInfo?

If we do want to change it in both places, then there is a bit more convoluted way that avoids patching.

We could use chromium_src override to redefine HardwareModelName (in base::SysInfo::HardwareModelName, which is what ultimately gets the model name - called from BuildModelInfo) with EmptyHardwareModelName. Then use chromium_src overrides for base/system/sys_info.h and base/system/sys_info_android.cc to add that new method.

@pilgrim-brave
Copy link
Contributor Author

The thing is that we DO want the model to show in brave://version so we can't patch any "lower" than the functions that construct the user agent string.

@mkarolin
Copy link
Collaborator

I see, then we could replace the entire BuildUserAgentFromProduct function definition in chromium_src override. Though, I would be a bit reluctant to do that without at least some kind of unit test to check that we don't diverge from Chromium's original in this function. WDYT, @bridiver?

If that's undesirable, we could maybe use chromium_src override

#define BRAVE_USER_AGENT true ? IncludeAndroidModel::Exclude :

to patch after line 234 instead of doing a replacement patch.

std::string os_info;
base::StringAppendF(&os_info, "%s%s", GetUserAgentPlatform().c_str(),
BuildOSCpuInfo(IncludeAndroidBuildNumber::Exclude,
- IncludeAndroidModel::Include)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it maybe be better to override HardwareModelName to some fixed value?

@pilgrim-brave
Copy link
Contributor Author

CI failures are unrelated.

@pilgrim-brave pilgrim-brave merged commit ecb32e7 into master Dec 17, 2020
@pilgrim-brave pilgrim-brave deleted the mpilgrim_android_ua branch December 17, 2020 00:43
@pilgrim-brave pilgrim-brave added this to the 1.20.x - Nightly milestone Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fingerprinting 2.0: User Agent - follow up to #12097
3 participants