content-scope-scripts icon indicating copy to clipboard operation
content-scope-scripts copied to clipboard

Add Windows client hint brands override to match header we override natively

Open laghee opened this issue 1 month ago • 3 comments

Asana Task/Github Issue: https://app.asana.com/1/137249556945/project/72649045549333/task/1208581002806545?focus=true

Description

Adding an override for our client hints brands in the JS API to match those we send in the Sec-CH-UA header and resolve breakage caused by current inconsistency between the two.

Testing Steps

Use privacy test page (https://github.com/duckduckgo/privacy-test-pages/pull/356) on WebView2 build from this branch of C-S-S OR Manually compare Sec-Ch-Ua header brands with output of navigator.userAgentData.brands and navigator.userAgentData.getHighEntropyValues(['brands'])

Checklist

Please tick all that apply:

  • [x] I have tested this change locally
  • [x] I have tested this change locally in all supported browsers
  • [ ] This change will be visible to users
  • [x] I have added automated tests that cover this change
  • [x] I have ensured the change is gated by config
  • [ ] This change was covered by a ship review
  • [x] This change was covered by a tech design
  • [ ] Any dependent config has been merged

[!NOTE] Introduces uaChBrands to override navigator.userAgentData brands to match Sec-CH-UA (with domain-specific overrides) and adds Playwright integration tests.

  • Feature: uaChBrands
    • Intercepts navigator.userAgentData to override brands and getHighEntropyValues/fullVersionList outputs to align with Sec-CH-UA.
    • Filters out "Microsoft Edge WebView2", replaces "Microsoft Edge" with target brand (default "DuckDuckGo"), or appends target brand using Chromium version.
    • Supports domain-scoped overrides via settings.domains (e.g., per-domain brand like "Netscape Navigator").
    • Enabled in Windows platform via injected/src/features.js.
  • Tests
    • New Playwright spec integration-test/ua-ch-brands.spec.js covering default and domain-specific overrides.
    • Test pages under integration-test/test-pages/ua-ch-brands/** validate brands and fullVersionList mutations.
    • Playwright config updated to include the new spec for the windows project.

Written by Cursor Bugbot for commit 651637f2012cd74e40e980ca1295dba48a24f260. This will update automatically on new commits. Configure here.


  • To see the specific tasks where the Asana app for GitHub is being used, see below:
    • https://app.asana.com/0/0/1212017506660681

laghee avatar Oct 21 '25 14:10 laghee

Deploy Preview for content-scope-scripts ready!

Name Link
Latest commit fcbe6e8dadc7499961933f7469e3f6feddbc7484
Latest deploy log https://app.netlify.com/projects/content-scope-scripts/deploys/692876cf96deca000859f2d0
Deploy Preview https://deploy-preview-2028--content-scope-scripts.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Oct 21 '25 14:10 netlify[bot]

Temporary Branch Update

The temporary branch has been updated with the latest changes. Below are the details:

Please use the above install command to update to the latest version.

github-actions[bot] avatar Oct 21 '25 14:10 github-actions[bot]

[Beta] Generated file diff

Time updated: Thu, 27 Nov 2025 16:06:27 GMT

Android
    - android/adsjsContentScope.js
  • android/autofillImport.js
  • android/brokerProtection.js
  • android/contentScope.js

File has changed

Apple
    - apple/contentScope.js
  • apple/contentScopeIsolated.js

File has changed

Chrome-mv3
    - chrome-mv3/inject.js

File has changed

Firefox
    - firefox/inject.js

File has changed

Integration
    - integration/contentScope.js

File has changed

Windows
    - windows/contentScope.js

File has changed

github-actions[bot] avatar Oct 21 '25 14:10 github-actions[bot]