Skip to main content
Two-pass secret scanner. The first pass matches known-format secrets against curated regexes; the second catches high-entropy opaque blobs that didn’t match any pattern. Used in the Glide Trust Console event ingestion pipeline to redact ReasoningStepEvent.excerpt before persistence, and as a CI gate on every PR via scripts/scan-secrets.mjs.

Install

npmjs.com/package/@glideco/secrets-scan

What it catches

Anthropic keys are matched before OpenAI keys in the denylist order because both share the sk- prefix — earlier rules win when ranges overlap.

Basic usage

Tuning the entropy pass

Custom redaction marker

Concurrent safety

Each scan() call clones every denylist regex so concurrent invocations cannot race on the shared lastIndex state of a stateful global RegExp. The Trust Console event ingestion path runs scan() in parallel under load — sharing lastIndex would make the second concurrent scan’s first-match index non-deterministic, silently letting secrets through.

Two-pass design

Pass 1 — denylist. 14 patterns, each with its own cloned RegExp instance. Shape-only kinds (EVM private key, Solana private key, AWS secret key, Bearer token) require a contextual word on the same line — “private”, “secret”, “key”, “seed”, “Bearer” — so the scanner doesn’t redact every transaction hash that happens to be a 64-hex string. Pass 2 — entropy. Shannon entropy (bits/character) on whitespace-tokenized fragments not already covered by a denylist redaction range. Default threshold is 4.5 bits/char over at least 30 characters — high enough to catch typical API key formats, low enough to avoid false-positives on English prose.

CI gate

The Cathedral CI pipeline runs node scripts/scan-secrets.mjs on every PR. The script calls scan() on all staged file contents and exits non-zero on any redaction. Use disableEntropy: true on directories that legitimately contain long base64 blobs (e.g. test/fixtures/).

Reading list