Skip to content

fix(web): filter browser extension probe errors from window.onerror handler #SUPERLOG - #451

Open
superlog-app[bot] wants to merge 1 commit into
mainfrom
superlog/browser-extension-noise-filter
Open

fix(web): filter browser extension probe errors from window.onerror handler #SUPERLOG#451
superlog-app[bot] wants to merge 1 commit into
mainfrom
superlog/browser-extension-noise-filter

Conversation

@superlog-app

@superlog-app superlog-app Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

The @superlog/web production app is capturing browser extension and browser-native script errors as real application exceptions, creating noisy incidents for errors like ReferenceError: Can't find variable: __firefox__ and TypeError: undefined is not an object (evaluating 'window.ethereum.selectedAddress = undefined').

Root Cause

Browser extensions (MetaMask, crypto wallets) and Firefox iOS's internal bridge inject short probe scripts that run as global code at line 1 of the page URL (https://superlog.sh/). When these probes throw — because window.__firefox__ or window.ethereum don't exist on the page — window.onerror fires. The window.addEventListener("error", ...) handler in instrumentation.ts had no guard to distinguish these external probes (filename = page href, lineno = 1) from real application JS errors (filename = /assets/index-*.js, specific lineno). All three grouped issues show code.file: "https://superlog.sh/" and code.line.number: 1 with column numbers ≤ 19 — unmistakably inline/injected scripts, not application bundle code.

Remediation

Added a one-line guard in the window.error listener to skip events where event.lineno === 1 && event.filename === window.location.href. This is the canonical signature of browser-injected/extension script errors. Application bundle errors always reference a path under /assets/, so they are unaffected.

Related incident: d0faa423-c322-4197-90e2-4531c243501f


Was this PR helpful? Leave feedback — goes straight to the Superlog team.


Summary by cubic

In @superlog/web, ignore browser extension and browser-native probe errors so they don’t create noisy incidents. Adds a guard in window.onerror to skip events that come from line 1 of the page URL (injected probes), not app code.

  • Bug Fixes
    • Skip window.onerror events where event.lineno === 1 and event.filename === window.location.href.
    • Prevents false positives from MetaMask/crypto wallets and Firefox iOS bridge probes; app bundle errors under /assets/ are unaffected.

Written for commit e100202. Summary will update on new commits.

Review in cubic

…andler #SUPERLOG

Delivery-Id: f9a7e142a6be3081816cea06c8eb3f45c0d36771531d8ac0ba744c09a59044c6
Delivery-Base: main

@superlog-app superlog-app Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Observability review

  • 1 warning

// Browser extensions and browser-native bridges (e.g. Firefox reader mode,
// MetaMask) inject short probe scripts that execute as "global code" at
// line 1 of the page URL — not inside any application JS bundle. When those
// probes throw, window.onerror fires with filename === the page href and

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

metrics · warning — Count filtered browser-extension probe errors

Increment a counter (e.g. browser_extension_probe_errors_filtered_total) at the filter return so operators can detect if the heuristic is over-broad or if legitimate errors are being silently dropped. Without it, a regression where real errors match lineno === 1 && filename === window.location.href would be invisible.

Suggested change
// probes throw, window.onerror fires with filename === the page href and
if (event.lineno === 1 && event.filename === window.location.href) {
filteredProbeErrorsCounter.add(1, { "filter.reason": "extension_probe" });
return;
}

Useful? React with 👍 / 👎.

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