@getbourdon/redaction

中文文档
0.3.7发布于 2026/10/16BUSL-1.1TypeScriptESM + CJS构建来源已验证近 30 天下载 2610

Bourdon credential-redaction SSOT + federation leak auditor — the security keystone of the TS mirror. 12 keyword + 14 token credential patterns (exact per-pattern case flags), redactText/containsSecret, and the static L5 leak audit (credential + visibilit

原始使用文档
文档目录4 节
  1. The pattern set (the boundary)
  2. Determinism / security gotchas (parity-critical)
  3. Leak audit
  4. License

@getbourdon/redaction

The credential-redaction SSOT + federation leak auditor of Bourdon — the security keystone of the TS mirror.

Python (pip install bourdon) is the oracle (core/redaction.py + core/leak_audit.py). This TypeScript mirror is conformant iff it reproduces the oracle's output on the shared @getbourdon/conformance fixtures: redactText byte-identical + containsSecret boolean-identical on every secret and benign string in redaction_battery.json (incl. the per-pattern case_variants probes), and [kind, location]-identical findings on leak_cases.json. A pattern that fires in Python but not here leaks a credential across machines.

The pattern set (the boundary)

  • 12 keyword patterns, ALL case-insensitive — a nearby word implies a secret even when the value is unrecognizable (api_key, service_role, bearer token, password, .env, …).
  • 14 token patterns — the literal token, no keyword needed. Case-SENSITIVE except appl_ (RevenueCat) and hf_ (HuggingFace), which are /i. These are the keyword-less leak class the pre-SSOT sets missed: AWS AKIA/ASIA, GitHub gh[pousr]_ / github_pat_, GitLab glpat-, Slack xox[baprs]-, OpenAI/Anthropic sk-/sk-ant-, Google AIza/ya29., Stripe [sprk]k_live|test_, npm_, JWT (eyJ…, covers Supabase service_role/anon), and PEM -----BEGIN … PRIVATE KEY-----.

Keyword-less leak class. The whole reason this package exists: a secret with no surrounding keyword (a bare AKIA…, ghp_…, a raw JWT, a PEM block) was federating verbatim because the weak federation/recognition redaction sets only had keyword rules. The token patterns close that.

Determinism / security gotchas (parity-critical)

  • SENSITIVE_PATTERNS are NON-GLOBAL. A /g RegExp carries lastIndex across .test() calls and yields intermittent false negatives — and the leak auditor calls containsSecret once per string in a loop, so a sticky lastIndex would intermittently miss a credential. Only the internal whitespace/URL regexes are /g, used solely with .replace().
  • Per-pattern case flags are load-bearing. An over-eager /i on a case-sensitive token (AWS, Stripe, GitHub) or a missing /i on appl_/hf_ is a parity break — case_variants probes each.
  • \b is ASCII in JS, matching Python re for these patterns; mid-word boundaries don't fire, so benign survivors (task/risk/disk) must NOT redact.

Leak audit

auditManifest(manifest, agentFile) walks every string in an L5 manifest tree (not a curated key list, so it can't silently forget a field) and flags two classes: CREDENTIAL (a value matching the patterns above) and VISIBILITY (an entity/session that resolves to private — PRIVATE_TAG_FAMILIES ∪ the manifest's own declared private_tags — but rides in a federated manifest). Emission order is contract: visibility(entities) → visibility(sessions) → credentials(whole tree). It never throws: a non-dict manifest or malformed collection yields []; auditLibrary reports an unparseable *.l5.yaml as a finding, not a silent skip.

License

BUSL-1.1 (Business Source License 1.1) — engine code, not the permissive wire/interop surface. See LICENSE and LICENSE_FAQ.md. (@getbourdon/redaction may depend on Apache-2.0 packages; the reverse — Apache importing BUSL — is forbidden.)

版本与发布记录

@getbourdon/redaction 共发布 18 个版本,首次发布于 2026/06/30;过去 12 个月发布了 18 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.3.7latest2026/10/161 个月前
0.3.62026/10/151 个月前
0.3.52026/10/131 个月前
0.3.42026/10/131 个月前
0.3.32026/10/081 个月前
0.3.22026/10/011 个月前

其他发布通道:rc → 0.3.0-rc.3。

关于 @getbourdon/redaction 的常见问题

@getbourdon/redaction 是什么?

Bourdon credential-redaction SSOT + federation leak auditor — the security keystone of the TS mirror. 12 keyword + 14 token credential patterns (exact per-pattern case flags), redactText/containsSecret, and the static L5 leak audit (credential + visibilit

如何安装 @getbourdon/redaction?

在项目目录运行 npm install @getbourdon/redaction,或使用 pnpm add / yarn add / bun add。

@getbourdon/redaction 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@getbourdon/redaction 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@getbourdon/redaction 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@getbourdon/redaction 可以商用吗?

@getbourdon/redaction 使用 BUSL-1.1 许可。声明的许可为 BUSL-1.1,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@getbourdon/redaction 的下载量有多少?

根据 npm 官方下载统计,@getbourdon/redaction 在 2026/10/17 – 2026/11/15 这 30 天内被下载 2,610 次,日均约 87 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@getbourdon/redaction 还在维护吗?

最新版本 0.3.7 发布于 2026/10/16(1 个月前);至今共发布 18 个版本,其中过去 12 个月发布了 18 个;首次发布于 2026/06/30。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。