Skip to content

Conversation

@codedsultan
Copy link

@codedsultan codedsultan commented Sep 25, 2025

What
Replace the unmaintained useragent dependency(with security concerns) with ua-parser-js.
Github Security Advisory Link

Why
useragent has longstanding ReDoS concerns and is effectively unmaintained. This PR removes the risk surface without changing Kutt’s analytics outputs.

How

  • New helper server/utils/ua.js maps ua-parser-js results to existing values.
  • browser remains ie|firefox|chrome|opera|safari|edge|other (lowercase).
  • os remains windows|macos|linux|android|ios|other (lowercase).
  • UA string is capped to 512 chars before parsing (defence in depth).

Behaviour change?
None intended. Verified locally with common UA strings; DB rows match previous normalisation.

Follow-ups
Optional: add isbot behind SKIP_BOTS=false (separate PR) to avoid counting obvious bots.

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.

1 participant