1
0
mirror of https://github.com/lancedikson/bowser synced 2026-09-23 20:44:24 +00:00
Commit Graph

44 Commits

Author SHA1 Message Date
naorpeled
982a91d5e8 fix: resolve open GitHub security findings
Code scanning (js/polynomial-redos, alerts #16 and #17)
-------------------------------------------------------
bowser applies these regexps to attacker-controlled User-Agent strings, and
four of them ran in quadratic time:

  * The "Something else" fallback used /^(.*)\/(.*) / and
    /^(.*)\/(.*)[ \t]\((.*)/. Two unbounded `.*` before a required literal
    make the split ambiguous, so a UA of "/a" repeated backtracks O(n^2).
    Greedy `(.*)` always picks the last `/` that still has the delimiter
    after it, so the second group can never span a `/` -- narrowing it to
    `[^/]*` is exactly equivalent and removes the ambiguity. Verified
    identical on 1,000,000 fuzzed inputs and on the full acceptance corpus.

  * The Linespider and SlackBot version regexps used `(?:-[-\w]+)?` before a
    required `[\s/]`. Since `[-\w]` and `[\s/]` are disjoint the backtracking
    is pure waste, but the engine still walks it once per start position, so
    "linespider-" repeated is quadratic. Bounding the run to `{1,64}` makes
    it linear; no real bot-name suffix approaches 64 characters.

A sweep of all 253 regexp literals in src/ (fuzzed for superlinear scaling,
with the four pre-fix patterns used to confirm the detector works) reports no
remaining superlinear regexps. test/unit/redos.js locks this in.

Actions (actions/missing-workflow-permissions, alerts #5 and #15)
-----------------------------------------------------------------
merge-to-master.yml and draft-or-update-next-release.yml had no `permissions`
block and so inherited the default token. Both now declare least privilege,
matching publish.yml and pull-request.yml.

Dependabot (22 open alerts, all development scope)
--------------------------------------------------
bowser ships no runtime dependencies, so none of these reached consumers, but
they were live in CI. `pnpm audit` goes from 29 advisories to 0:

  * jsdoc 3 -> 4 (with docdash 1 -> 2) drops taffydb, which has no patched
    release, and picks up current markdown-it/linkify-it.
  * coveralls -> coveralls-next 6 drops `request`, which is deprecated with no
    patched release, along with form-data, qs 6.5.x, uuid 3 and tough-cookie 2.
    Same `coveralls` bin and same stdin contract; lcov conversion verified.
  * gh-pages 3 -> 6 clears the critical prototype pollution advisory.
  * pnpm overrides pin the remaining transitive-only advisories to the lowest
    patched release on each existing major.

Verified: pnpm audit clean, lint clean, 346 tests pass (the acceptance corpus
runs against both src/ and the built es5.js), build, package smoke test, and
doc generation.
2026-08-30 21:00:59 +03:00
Jelle Raaijmakers
a37b8be8a7 feat: add Ladybird browser support (#627) 2026-07-31 12:10:10 +03:00
naorpeled
cf397a4b50 feat: add Vivaldi client hints support 2026-02-13 23:09:48 +02:00
Stas Tolpekin
8ddb4f5a0d feat: add the ability to use an array of versions in Parser.satisfies() (#466) 2026-02-13 22:15:55 +02:00
Copilot
227f5ecd4b feat: add Brave browser support via clientHints (#597) 2026-02-07 18:29:20 +02:00
Jonathan Kingston
aaa67db25e feat: add clientHints support + DuckDuckGo detection (#595) 2026-02-01 23:50:33 +02:00
Naor Peled
1df8838756 revert: rollback addition of named exports (#591) 2025-11-29 02:01:44 +02:00
Naor Peled
514510d847 feat: add support for latest MacOS (#580)
Co-authored-by: Seiji Kohara <9543980+seijikohara@users.noreply.github.com>
2025-11-22 23:50:54 +02:00
Copilot
bd5cb7186c feat: add named exports for tree shaking support with modern bundlers (#566)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: naorpeled <6171622+naorpeled@users.noreply.github.com>
Co-authored-by: naorpeled <me@naor.dev>
2025-11-22 15:15:13 +02:00
Will Soares
a9c4677c86 feat: add support for using alias in 'is' method 2020-08-23 16:55:29 -03:00
Oliver foster
5a6af193d2 Extended test cases and fixed bug 2019-12-19 12:00:46 +00:00
Oliver foster
b74bb0caa2 Added polyfill tests 2019-12-19 11:46:15 +00:00
Oliver foster
cad365b53e Fixed getSecondMatch test 2019-12-19 11:38:49 +00:00
Oliver foster
64bbd2a9b1 Fixed tests 2019-12-19 11:26:52 +00:00
Oliver foster
3cdfd7de02 Expanded test coverage for utils.js 2019-12-19 11:22:40 +00:00
Jörg Leis
496136fd83 Fixes, refactor, new test cases 2019-07-17 17:33:48 +02:00
Jörg Leis
b2b36e6adb Add unit test for OS version names 2019-07-17 14:13:17 +02:00
王涛
fbc32e6736 Add constant output so that users can quickly get all types 2019-05-20 15:33:10 +08:00
Denis Demchenko
8212e48e02 Add tests for a browser without an alias 2019-04-12 21:35:17 +03:00
Will Soares
064aa812fc Use snake case for alias names 2019-03-09 19:14:03 -03:00
Will Soares
a307533f74 Add support for using short version for browser name in satisfies 2019-03-09 19:14:03 -03:00
Frank Faubert
83e8f61109 Add getEngineName and isEngine API calls 2019-01-24 09:04:37 -05:00
Dariusz Rzepka
3729f6f92e Support non strict equality in satisfies method 2018-12-28 08:36:32 +01:00
Denis Demchenko
ace0ce17ea Fix the issue with undefined browser version string
fixes #243
2018-09-09 15:02:29 +03:00
udivankin
6204d9f417 Adds loose comparison support 2018-08-16 19:04:10 +03:00
Matías Lescano
0224f26bfc Add parser.some function 2018-07-22 19:41:48 +03:00
Denis Demchenko
d12a988d7c Rewrite Parser.satisfies and fix some related methods 2018-07-08 12:08:49 +03:00
Denis Demchenko
a175f7c8bd Rename Parser.compare to Parser.satisfies 2018-07-07 18:35:18 +03:00
Denis Demchenko
c79b71736e Fix tests after changes 2018-07-05 22:58:14 +03:00
Denis Demchenko
e759592884 Fix getPlatformType, write tests 2018-07-04 23:09:33 +03:00
Denis Demchenko
48638e7363 Change Parser.check to Parser.compare 2018-07-04 22:43:57 +03:00
Denis Demchenko
4ab0d9dfd3 Get rid of semver and use old comparison which is more applicable 2018-07-02 23:30:48 +03:00
Denis Demchenko
6030eb9e5d Add semverCheck and related methods 2018-07-02 22:24:02 +03:00
Denis Demchenko
9cb04fcbae Move getWindowsVersionName to utils 2018-06-30 19:40:10 +03:00
Denis Demchenko
e7e6abff8b Fix Bowser constructor, add some tests 2018-06-30 17:25:47 +03:00
Denis Demchenko
98007768b4 Make Parser.parse-anything methods public 2018-06-30 15:58:34 +03:00
Denis Demchenko
f202c1cd30 Eslint fixes 2018-06-27 23:11:52 +03:00
Denis Demchenko
99fde0a154 Add a new test for Parser and fix the names of existed ones 2017-08-19 19:55:41 +03:00
Denis Demchenko
b057077b68 Add OS parsing 2017-04-15 22:50:07 +03:00
Denis Demchenko
c50d0449d3 Add Parser#getBrowserName and Parser#getBrowserVersion 2017-04-09 22:46:23 +03:00
Denis Demchenko
b5aa54553f Add a spy to track calling Parser._parseBrowser when Parser.getBrowser called 2017-04-09 22:36:03 +03:00
Denis Demchenko
ce885847ce Fix version matching 2017-04-09 22:30:19 +03:00
Denis Demchenko
d57094d857 Finish Parser#_parseBrowser function 2017-04-09 22:09:47 +03:00
Denis Demchenko
3bb6654320 Continue writing 2017-04-09 17:13:00 +03:00