-
-
Notifications
You must be signed in to change notification settings - Fork 147
Description
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
- setup
uaofile to something like;;;;;;142;;;142.0.0.0;;;;;;;;;;;;;;;;;;;;;and restart browser - open devtools and goto
Consoletab - execute
await window.navigator.userAgentData.getHighEntropyValues(["fullVersionList", "uaFullVersion"])- expand and compare
brandsandfullVersionList - rename/remove
uaofile, 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
supermium/components/embedder_support/user_agent_utils.cc
Lines 272 to 276 in bcab813
| 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