Skip to content

Redactor hides key=value secrets that follow a slash, so /cso history stops printing them (GST-3297) - #4571

Merged
capy-ai[bot] merged 3 commits into
mainfrom
redactor-catches-secrets-after-a-slash
Nov 20, 2026
Merged

capy-ai[bot] merged 3 commits into
mainfrom
redactor-catches-secrets-after-a-slash

Conversation

@garrytan

@garrytan garrytan commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

gstack's redactor now hides password=…, api_key=… and token=… values that come after a /, such as a symlink target ../password=…, cfg/api_key=… or a Markdown link to such a path.
Why: /cso's retained Git history went through this redactor and kept those values, so gstack-cso history printed them; review packets, telemetry and ship logs use the same redactor.
Nothing to do.

What changed
  • env.kv in lib/redact-patterns.ts may start a name right after a /, in addition to the line start, a diff marker or a comment marker. The name class excludes /, so each attempt stops at the next separator and the scan stays linear.
  • The comment-text exemption (isCommentText) now applies only when a comment marker really precedes the name, so a/token=… is checked like a line-start match. A comment marker that opens a quoted string still counts as a comment.
  • New exemption isRegexLiteralBody: a / after an operator or opening bracket starts a regex literal only when the text before the closing / holds regex syntax (an escape, a character class, a group or a {n,m} quantifier). Code such as content.match(/authtoken:\s*(.+)/) stays clean, while a Markdown link or a YAML value whose path holds a secret still reports.

Every exemption that existed before is unchanged for the matches it already handled; this PR adds a catch and narrows only the new over-catches.

Why

gstack-cso history printed key=value secrets that sat after a slash in a symlink target, a link that only exists in history, or ordinary file content. Keeping secrets out of what gstack prints and stores is the point of the shared redactor.

Blast radius

Every caller of the shared redactor: /cso history and snapshots, review packets, telemetry, ship logs and the pre-push credential scan. A scan of every tracked file in this repository finds the same 212 env.kv matches before and after the review fix, so the repository's own checks are unaffected.

Test Coverage

Test Coverage Audit: 8 new code paths, 7 covered before review (88% any test, 88% value-weighted). The one gap (a regex literal after return) got a test row in the review fix. Tests: 1838 → 1839 (+1 new file).

Pre-Landing Review

Pre-Landing Review: 4 issues — 1 auto-fixed, 0 asked, 0 deferred, 2 noted, 1 ruled note
Gate edits: none detected (1 listed, 0 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

  • Round 1 (full panel): the red-team reader found that the first regex-literal exemption also hid secrets in Markdown links, YAML values and single-slash URLs. Fixed in 060832a with four new leak rows and a return /…/ control.
  • Round 2 (full panel on the fix): no findings from the specialists or the red team. The second-model review and the adversarial reader raised the notes below.
Exploratory QA

Functional smoke on bin/gstack-redact (7 captures, synthetic values): a link-target secret reports; a Markdown-link secret after ( reported nothing before the fix (captures 002 and 003) and reports after it (005); a regex literal after return stays clean (004, 007). Verdict: pass on current inputs.

Scope Drift

Scope Check: CLEAN. Intent: hide key=value secrets that follow a slash. Delivered: the redactor change, its tests and a release note.

Review notes

Below the blocking floor or ruled as notes; recorded here and not fixed in this PR.

  • Ruled note (second-model review, lib/redact-patterns.ts:1228): isRegexLiteralBody takes the first / as the closing slash, so a regex whose character class holds / (/token=[A-Za-z0-9/]+/g) loses the exemption and is reported and redacted. This over-redacts a regex literal and loses no secret. Ruled on 2026-11-20 by the maintainers: over-redaction of a regex literal, not secret loss, so it is below the blocking floor; this PR ships at 060832a and the fix goes to the small-fix batch (the exact ruling is in the Agent notes). The fix is saved as a patch for that batch: handoffs/GSTA-675/outside-voice-1-fix.patch.
  • Low (adversarial reader, lib/redact-patterns.ts:1227): the same delimiter rule, and regex literals that use only ., *, ? or $ (/AUTH_TOKEN=.*$/), now report. Over-reports, loses nothing; no repository file is affected.
  • Low (adversarial reader, lib/redact-patterns.ts:1227): a path value after an opener whose text before the next / holds a backslash, group, class or {n} stays exempt, the same as before this change. Real tokens rarely contain those characters.
Verification Results

No plan checks (bug fix, plan exempt). Automatic QA above.

TODOS

No TODOS.md items completed or deferred.

Documentation

Status: current. The documentation already matches this release, so no edits were needed.

Scope: base a529769 to head 060832a, 3 commits, 3 files (lib/redact-patterns.ts, test/redact-kv-after-slash.test.ts, changelog.d/redactor-catches-secrets-after-a-slash.md). Nothing staged, unstaged or untracked.

Documentation health:

  • CLAUDE.md (Redaction guard): Current. It describes the engine in general terms, which this change does not affect.
  • docs/CONTRIBUTOR_REFERENCE.md (Redaction guard): Current. It lists tiers and calibration; no claim about where env.kv matches.
  • cso/SKILL.md.tmpl, cso/sections/audit-phases.md.tmpl: Current. They say history is redacted before it is shown, and this change makes that claim more accurate.
  • changelog.d/redactor-catches-secrets-after-a-slash.md: Accurate against the code (left to the parent).

Coverage debt: the new behavior is that a name=value secret after a / is now redacted, while regex literals are exempt. It is documented only in the changelog fragment and code comments, with no reference or how-to doc. It is internal engine behavior, so this is low priority.

Diagram drift: none.

Tests
  • bun run test: carried from CI run 44806444033/1 at tree 42fbe49c2050 (1720 files).
  • Focused redactor tests: 476 pass, 0 fail across 7 files, including test/redact-kv-after-slash.test.ts (written first; its four review-fix rows failed before the fix).
Agent notes

Ruled note: lib/redact-patterns.ts:1228:outside-voice at 060832a ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-675:2026-11-20T19:57:40.761Z) at 2026-11-20T19:57:41.835Z: over-redaction of a regex literal with a slash in a character class, not secret loss; fix goes to the small-fix batch (approval a-0c5968b9a89a)
Lane GSTA-675 (GST-3297). Captain GStack Minder (GSTA-36) ruled p2/outside-voice#1 a shipped note at 060832a (approval a-0c5968b9a89a).
Step 13: the release note keeps one prose-lint style note (mid-sentence colon); a rewording commit was dropped so the reviewed, CI-green head 060832a ships unchanged.

Approvals

Approved: yes (record r-f03594882b02). The full approval record stays private.
Plan: exempt: bug fix with a failing-first test (kind fix)
Plan check: exempt bug fix

{
  "schema_version": 1,
  "pr": 4571,
  "head": "060832a8e91c332eaa7f430cc3896fb649a0831e",
  "version": "1.102.0.0",
  "base": "main",
  "gate": {
    "bun run test": {
      "pass": 1720,
      "fail": 0,
      "skip": 0
    },
    "redactor": {
      "pass": 476,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "bun_run_test",
      "run": 44806444033,
      "attempt": 1,
      "tree": "42fbe49c205094cd8f07946f8f2d8f5b9ada2fae"
    }
  ],
  "calls": 32,
  "session_kind": "unattended",
  "run": "ship-4571",
  "head_tree": "42fbe49c205094cd8f07946f8f2d8f5b9ada2fae",
  "product_patch_id": "66d8ec46e428b6481ebf1ef6fe03b318cf8e3c06",
  "gstack_version": "1.102.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 40,
    "rules": "3e7e9d5d0a0d8879",
    "base": "a529769efd989ac5e83e4ee09f1ac7b199e686d3",
    "registry": "a529769efd989ac5e83e4ee09f1ac7b199e686d3",
    "gate_scan": {
      "tagged": 0,
      "head": "060832a8e91c332eaa7f430cc3896fb649a0831e"
    },
    "reasons": [
      "gate-class",
      "risk:security",
      "runtime=40"
    ],
    "risk": [
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @42fbe49c2050 (8 checks, current for 060832a8e91c)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/44806444033/attempts/1",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44806444033/attempts/1",
    "free-tests.yml/cso-windows-launcher: https://github.com/garrytan/gstack/actions/runs/44806444033/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44806444087/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=42fbe49c2050 tests=38573 skipped=92 runs=44806444033/1 profiles=ci-reuse/free-tests heads=060832a8e91c verified=2026-11-20T20:08:24.325Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/ and README.md, plus CLAUDE.md and cso templates read for redaction prose"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 1,
    "deferred": 0,
    "noted": 2,
    "fixed": 1,
    "scope": "frozen",
    "rounds": 2,
    "dispatches": {
      "specialist": 2,
      "red-team": 2
    }
  },
  "ruled_notes": [
    {
      "finding": "lib/redact-patterns.ts:1228:outside-voice",
      "head": "060832a8e91c332eaa7f430cc3896fb649a0831e",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "over-redaction of a regex literal with a slash in a character class, not secret loss; fix goes to the small-fix batch",
      "at": "2026-11-20T19:57:41.835Z",
      "approval": "a-0c5968b9a89a",
      "relayed": "GSTA-675:2026-11-20T19:57:40.761Z"
    }
  ],
  "gate_dispositions": []
}

… stops printing them (GST-3297)

The shared redactor only recognized password=, api_key= or token= at the start of a line, so the same value after a slash (a symlink target ../password=..., cfg/api_key=..., a diff header path) came back raw, and gstack-cso history printed it from retained Git history. Review packets, telemetry and ship logs use the same redactor.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 20, 2026 19:12
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…path after a slash

The regex-literal exemption now needs regex syntax before the closing slash, so values such as a Markdown link target or a YAML path keep their secret redacted.

Review-Finding: p1/red-team#1 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 6479516 into main Nov 20, 2026
53 checks passed
@capy-ai capy-ai Bot mentioned this pull request Nov 20, 2026
capy-ai Bot added a commit that referenced this pull request Nov 20, 2026
- Two /ship approval records stop needing workarounds. (#4549)
- For contributors: the paid auto-decide check counts a start step that ran while the skill loaded. (#4543)
- The destructive-command check closes three ways past its disk-wipe and force-push blocks. (#4534)
- A green CI run still counts when the repository's artifact storage is full. (#4536)
- `/cso` now audits repositories that track symlinks. (#4567)
- A doc-sync eval stops failing when the audit child drops one field from its result line. (#4555)
- The browse daemon no longer picks port 10080, which Chromium refuses to open. (#4554)
- Opted-in telemetry now says why a skill run ended, which coding agent and model family ran it, and whether an upgrade worked. (#4542)
- A preregistration with only its write-up and plain data now gets the write-up review: one reviewer, one round. (#4544)
- When owner rulings don't clear a stopped review, `gstack-review-read` now says which findings are left. (#4553)
- The prompt-routing hook now names your installed bug-fix skill on bug reports, alone, and never puts /verify ahead of it. (#4539)
- Owner rulings now close a stopped review whose findings were logged in a findings file. (#4568)
- /ship can finish after the owner accepts a stopped review's findings as open notes. (#4552)
- /ship no longer starts the full test suite on your machine when CI's earlier run can't be reused (GST-3277). (#4565)
- The prompt-routing hook no longer acts on words inside backticks. (#4566)
- In Claude Code, a gstack skill's start step now runs when the skill loads, so the model can't skip it. (#4509)
- gstack's telemetry backend only accepts writes through its own validated endpoint, and the community dashboard now counts real use. (#4537)
- gstack now says what it's adding before it adds a background job or a browser extension. (#4538)
- For contributors: every flaky pass in Free Tests is now recorded. (#4572)
- For contributors: Free Tests on pull requests starts its test shards one round of small jobs sooner. (#4570)
- Secret values written as `name=value` at the end of a path are now hidden. (#4571)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
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