diff --git a/packages/browser-core/src/transport/eventBridge.spec.ts b/packages/browser-core/src/transport/eventBridge.spec.ts index a719977ee3..043e58326f 100644 --- a/packages/browser-core/src/transport/eventBridge.spec.ts +++ b/packages/browser-core/src/transport/eventBridge.spec.ts @@ -50,6 +50,10 @@ describe('matchesHostEntry', () => { ['evil.com', '*.shopist.io', false], ['app.shopist.io.evil.com', '*.shopist.io', false], ['anything.foo.anything.bar', '*.foo.*.bar', false], // multiple wildcards → invalid + ['preview-.shopist.io', 'preview-*.shopist.io', false], // wildcard must match at least one character + ['.shopist.io', '*.shopist.io', false], // wildcard must match at least one character + ['app.shopist.io', '*', true], // bare "*" matches any host + ['shopist.io', '*', true], // bare "*" matches any host ] cases.forEach(([host, pattern, expected]) => { diff --git a/packages/browser-core/src/transport/eventBridge.ts b/packages/browser-core/src/transport/eventBridge.ts index 8372efd3a9..7e2d2f0bff 100644 --- a/packages/browser-core/src/transport/eventBridge.ts +++ b/packages/browser-core/src/transport/eventBridge.ts @@ -65,7 +65,7 @@ export function matchesHostEntry(host: string, entry: string): boolean { return false } const [prefix, suffix] = parts - return host.length >= prefix.length + suffix.length && host.startsWith(prefix) && host.endsWith(suffix) + return host.length > prefix.length + suffix.length && host.startsWith(prefix) && host.endsWith(suffix) } function getEventBridgeGlobal() {