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

[Bug]: Possibly broken user agent client hint #30201

Closed
3 tasks done
webdevmario opened this issue Jul 19, 2021 · 7 comments · Fixed by #34481
Closed
3 tasks done

[Bug]: Possibly broken user agent client hint #30201

webdevmario opened this issue Jul 19, 2021 · 7 comments · Fixed by #34481
Assignees
Labels
13-x-y bug 🪲 platform/windows status/confirmed A maintainer reproduced the bug or agreed with the feature

Comments

@webdevmario
Copy link

Preflight Checklist

Electron Version

13.1.7

What operating system are you using?

Windows

Operating System Version

Windows 10 version 20H2

What arch are you using?

x64

Last Known Working Electron version

12.0.15

Expected Behavior

Checking navigator.userAgentData in Chrome 91 returns an array of brands appropriately. Electron 13/14 do not return anything.

This appears to then become a problem for my situation. I am posting a form with hidden variables to a third-party vendor I work with. This form post ultimately loads an iframe.

Expected: As it does in Chrome 91, load the iframe from this third-party vendor.

Actual Behavior

A header of "sec-ch-ua" is included in the request to the third-party vendor and it is blank. They are rejecting the post because of an invalid header. I suspect this is because Chrome 13/14 does not make this hint data made available correctly.

I tried loading various sites in Chrome 91 that do load brand names in Electron 13/14 and they are empty if you review navigator.userAgentData.

Testcase Gist URL

No response

Additional Information

No response

@nornagon nornagon added the status/confirmed A maintainer reproduced the bug or agreed with the feature label Jul 20, 2021
@nornagon nornagon self-assigned this Jul 20, 2021
@quanglam2807
Copy link
Contributor

I confirmed this bug.

navigator.userAgentData and navigator.userAgentData.getHighEntropyValues return empty values.

@Swastyy
Copy link

Swastyy commented Sep 16, 2021

@webdevmario Hi, is this issue fixed? If not, I want to work on this.

@nornagon
Copy link
Member

I have a branch which starts on this, but it interferes with some other UA overriding stuff, so it's not quite straightforward. https://github.com/electron/electron/compare/navigator-useragentdata is my WIP, for reference.

@phryneas
Copy link

phryneas commented Feb 16, 2022

We had problems with this as the empty sec-ch-ua header triggered a WAF.
Not really a solution, but a mitigation strategy until this gets fixed:

app.commandLine.appendSwitch('disable-features', 'UserAgentClientHint');

@jarek-foksa
Copy link

jarek-foksa commented Jun 6, 2022

I can reproduce this bug with Electron 19.0.3 running on macOS 12.4. This should have higher priority as Chrome Dev Tools are now instructing developers to migrate away from navigator.userAgent to navigator.userAgentData.

Screen Shot 2022-06-06 at 12 02 58

Screen Shot 2022-06-06 at 12 10 10

@nornagon
Copy link
Member

nornagon commented Jun 8, 2022

Cleaned up and finished off my branch, #34481 should fix this.

@Shamar
Copy link

Shamar commented Sep 10, 2023

Hi, looks like client hints are still broken in electron 25.4.0: by setting app.userAgentFallback, the User-Agent header is correctly set in requests, but clients hints such as SEC-CH-UA, SEC-CH-UA-MOBILE and SEC-CH-UA-PLATFORM are not (despite easy to reconstruct from the userAgentFallback.

Also the navigator.userAgentData completely ignores the userAgentFallback, while the navigator.userAgent seems correctly set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
13-x-y bug 🪲 platform/windows status/confirmed A maintainer reproduced the bug or agreed with the feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants