fix(cookie-banner): detect browser-extension stack frames

STACK_URL_RE only matched `https?://` URLs, so extension URLs
(`chrome-extension://`, `moz-extension://`, `safari-web-extension://`)
never reached the EXTENSION_URL_RE classifier. The `fromExtension`
flag was effectively always false and extension-originated cookie
and storage activity was misattributed as `script`.

Broaden STACK_URL_RE to also match the three extension schemes so
the existing classifier branch fires and sets `fromExtension = true`
before the URL parsing path runs.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-05-26 10:07:53 +02:00
parent 1c3ce56b48
commit 8ff68798fb

View File

@@ -13,7 +13,8 @@
// PERFORMANCE OF THIS SOFTWARE.
const EXTENSION_URL_RE = /(?:chrome|moz|safari-web)-extension:\/\//;
const STACK_URL_RE = /https?:\/\/[^\s)'"`]+/g;
const STACK_URL_RE =
/(?:https?|(?:chrome|moz|safari-web)-extension):\/\/[^\s)'"`]+/g;
const LINE_COL_SUFFIX_RE = /:\d+(?::\d+)?$/;
const MAX_INITIATOR_URL_LENGTH = 1024;