Skip to content

Commit

Permalink
πŸ› FIX: Avoid ReDoS (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jun 20, 2022
1 parent 719f8cd commit ebe330e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cookies.js
Expand Up @@ -149,7 +149,7 @@ class Cookies {

// https://github.com/linsight/should-send-same-site-none/blob/master/index.js#L86
function parseChromiumAndMajorVersion(userAgent) {
const m = /Chrom[^ \/]+\/(\d+)[\.\d]* /.exec(userAgent);
const m = /Chrom[^ \/]{1,100}\/(\d{1,100}?)\./.exec(userAgent);
if (!m) return { chromium: false, version: null };
// Extract digits from first capturing group.
return { chromium: true, majorVersion: parseInt(m[1]) };
Expand Down

0 comments on commit ebe330e

Please sign in to comment.