Skip to content

Comments

Add client hints and DuckDuckGo detection#183

Open
jonathanKingston wants to merge 2 commits intobiggora:masterfrom
jonathanKingston:jkt/ddg
Open

Add client hints and DuckDuckGo detection#183
jonathanKingston wants to merge 2 commits intobiggora:masterfrom
jonathanKingston:jkt/ddg

Conversation

@jonathanKingston
Copy link

@jonathanKingston jonathanKingston commented Jan 29, 2026

Adds User-Agent Client Hints support with DuckDuckGo browser detection.

  • Parses Sec-CH-UA-* headers into structured ClientHints object (brands, mobile, platform, etc.)
  • Detects DuckDuckGo browser via two methods:
    • Chromium platforms (Android, Windows): "DuckDuckGo" brand in Sec-CH-UA
    • WebKit platforms (iOS, macOS): Ddg/X.Y.Z suffix in UA string
  • New isDuckDuckGo flag and clientHints property on AgentDetails
  • Express middleware automatically parses client hints when present
  • Exports new types: ClientHints, ClientHintBrand

@biggora
Copy link
Owner

biggora commented Jan 29, 2026

@jonathanKingston
The code processes external HTTP headers without adequate error handling, creating multiple vectors for application crashes.

  1. Add error handling to all parseClientHints() helper functions with try-catch blocks
  2. Add input validation - length limits, type checks, iteration limits
  3. Add DuckDuckGo to browsers object for consistency with existing pattern
  4. Fix line endings - run npm run lint:fix
  5. Add test for DuckDuckGo in fullVersionList only (currently untested code path)

@jonathanKingston
Copy link
Author

Hey @biggora thanks for the feedback, I think I've addressed it all. Let me know if there's further concerns.

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.

2 participants