In short. Refuse regexes with nested quantifiers before they run, and run every other search in a Web Worker you terminate after 2 seconds. Mask a secret as a fixed ******** plus its public prefix, never as stars of the same length. Validate JSON with JSON.parse, but re-indent the original tokens, so 12345678901234567890 is not turned into 12345678901234567000.

Logbeam is a browser extension for Chrome and Firefox that I built for developers and platform engineers. It turns a raw log open in a tab into a fast, searchable viewer, flags leaked secrets and adds text tools for everyday platform work. Most of the interesting problems weren't in the UI. They came from the fact that logs are untrusted input.

Why can a regex freeze a browser tab?

Users type their own regex, and a pattern like (a+)+$ against a long line backtracks for minutes, on the page's main thread. There are two layers of protection. Patterns with nested quantifiers are refused before they run. Everything else runs in a Web Worker that gets terminated after 2 seconds, so the worst case is a message, not a frozen tab.

(a+)+$ refused: nested quantifier (a|aa)+$ stopped after 2 s, tab still responsive 

How to mask a secret without leaking its length

The first version kept the start and end of a secret and the right number of stars. That leaks the length and part of the value. Now a secret becomes a fixed ********, and only a public type prefix like AKIA or ghp_ stays, so you still know what leaked. Private keys are masked as whole PEM blocks, not just the BEGIN line.

What Logbeam looks for in a log:

Kind Examples
Cloud and API keys AWS access keys, Google API keys, Stripe tokens
Code and chat tokens GitHub, GitLab and Slack tokens, JWTs
Keys and passwords Private keys, postgres://user:password@… URLs, password=… and "apiKey": "…"
Ignored on purpose Placeholders like ${DB_PASSWORD}

Why does JSON.parse change big numbers?

JavaScript numbers are 64-bit floats, so anything above 2^53 loses precision. JSON.parse then JSON.stringify turns 12345678901234567890 into 12345678901234567000. For an ID in a log that's a silent bug. The formatter validates with JSON.parse, then re-indents the original tokens, so numbers are copied exactly as written. Compare uses the same rule, so two JSON documents that differ only in a huge number are reported as different.

How big a log can a browser handle?

Bigger than I expected, as long as the work stays off the main thread and out of the DOM:

What How it's handled
Log over 1 MB Parsed in a Web Worker with a progress bar
150,000+ lines Still fast: only the rows on screen are in the DOM
Page whose CSP blocks the worker Parsed in chunks between frames instead
Log still being written New lines added every 3 seconds
500 identical retry lines Collapsed into one line with a ×500 badge

How it's tested and shipped

  • 139 unit tests on the pure core (parsing, secret detection, transforms), over 100 end-to-end checks in a real Chromium with Playwright, and 28 in Firefox. The end-to-end run includes pages with strict CSP and Trusted Types.
  • A release is a tag: GitHub Actions runs every check, builds the ZIPs, creates a GitHub Release and submits them to the Chrome Web Store and addons.mozilla.org.
  • No server, no analytics, no network requests, and no access to all sites up front.

Try it: Chrome Web Store · Firefox Add-ons · GitHub

About the tool: Logbeam, a log viewer in your browser that catches leaked secrets.

Originally published at zhukovskyi.space.