Skip to content

[UACH] Incorrect filling from custom client hints ( uao file ) + optimization request #1778

@XakerTwo

Description

@XakerTwo

Description
since 124 R2 there an ability to override client hints, but fullVersionList values of high entropy part have incorrect versions format - major version instead of full. Sec-CH-UA-Full-Version-List http header is also affected by this issue

Steps to reproduce

  1. setup uao file to something like ;;;;;;142;;;142.0.0.0;;;;;;;;;;;;;;;;;;;;; and restart browser
  2. open devtools and goto Console tab
  3. execute
await window.navigator.userAgentData.getHighEntropyValues(["fullVersionList", "uaFullVersion"])
  1. expand and compare brands and fullVersionList
  2. rename/remove uao file, restart browser and repeat steps 1-3

Expected behavior
entries in fullVersionList must contains browser version in full form, like uaFullVersion

Desktop

  • OS: Windows 7 SP1 x64
  • SM: 124.0.6367.245 R2 x64 (introduced, 1e0b769@301-302)
  • SM: 138.0.7204.298 R8 x64 (noticed)

Additional context
issue exists due to

std::string custom_brand_version = parseFile(UACHCustomVersion);
std::string brand_version =
output_version_type == blink::UserAgentBrandVersionType::kFullVersion
? full_version
: major_version;

here UACHCustomVersion is a "pointer" to major version only, but there also UACHCustomFullVersion "pointer" and it's not used here but should be

solution is something like this

std::string custom_brand_version;
std::string brand_version;

if (output_version_type == blink::UserAgentBrandVersionType::kFullVersion) {
	custom_brand_version = parseFile(UACHCustomFullVersion);
	brand_version = full_version;
} else {
	custom_brand_version = parseFile(UACHCustomVersion);
	brand_version = major_version;
}

Also
consider optimization of obtaining custom values from uao file. right now each assign of custom value calls parseFile() which in fact reads file and parses it from scratch, so single call of GetUserAgentMetadata() leads to 3 or 10 re-reads and re-parses of the uao file

Metadata

Metadata

Assignees

No one assigned

    Labels

    Minor bugA bug that does not break the browser

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions