Skip to content

rebuild: cli: a sign-in step's message redacts every value of the block's environment from the provider's error - #1684

Merged
odgrim merged 1 commit into
rebuild/p6-classb-fix-gitlab-mrfrom
rebuild/p6-classb-fix-env-redact
Dec 2, 2026
Merged

odgrim merged 1 commit into
rebuild/p6-classb-fix-gitlab-mrfrom
rebuild/p6-classb-fix-env-redact

Conversation

@odgrim

@odgrim odgrim commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Stack: rebuild phase 6, in GitHub stack #1632, rows class B skips, part 39 of 39: a sign-in step's message redacts every value of the block's environment from the provider's error (review of #1635 and #1665). Base: #1679. Map: .more9s/rebuild.md on rebuild/main.

268 changed lines, 150 of them tests and test runbooks.

Change

Review of #1665 (f6db26f).

  • packages/cli/src/testRun.ts: credentialFailure, the one place a credential error becomes step text (a Failed block's CredentialError in endedAs, a SignedOut block's lastError in noLogin's skip, and the refused-confirm fail of rebuild: cli: a sign-in step fails naming the provider's error when its confirmed login is refused, and one still running at its bound says what it was doing #1675), now runs it through redactSecrets with every value of the environment the block's run reads. A provider error that quotes a token it read from the environment printed it in text, json, junit and --output-file; it now shows [REDACTED].
  • That environment is the test case's env on top of the one runbooks test started with. openInProcess merges it once, gives it to the engine, and returns it on CaseSession (environment). runCase puts it on Session, and every endedAs, readiness, credentialEnded and noLogin call passes it. The other two openers return theirs: baseline/step3Fixtures.test.ts the environment it starts runbooks mcp with, testRun.test.ts's stub {}.
  • credentialFailure's comment said the client "has taken out of it each secret it knows". It now says what the code does: the client scrubs only the secrets it was handed, and the runner redacts every value of the block's environment.
  • packages/core/src/domain/vcs/redact.ts: redactSecrets takes values besides the registered ones, each at least MIN_SECRET_LENGTH (8) long, and replaces the longest first. MIN_SECRET_LENGTH is exported, and plugin.ts's client reads it in place of its own MIN_SCANNED_SECRET, also 8, so the client and the runner share one threshold.
  • docs testing.mdx, Testing sign-in blocks: a step's message that quotes a sign-in block's error never prints a value 8 characters or longer from the test's environment, and shows [REDACTED] in its place.
  • testCommand.test.ts: a provider whose error quotes a value of the block's environment (the fake's refuse): SignedOut skip, Failed (toolMissing in Detecting), the refused-confirm fail, and a value only the process environment holds. Each runs text with --verbose, json, junit and junit to --output-file: every report holds [REDACTED] and not the value, stderr not the value, and the json message is exact. A boundary test: an 8-character value goes, a 7-character one stays, and a value another one starts with does not leave the longer one's tail.

Decisions

    1. Values of the process environment are redacted too, as the brief asks, so a credential error that quotes a path under HOME, PWD or TMPDIR, or SHELL, shows [REDACTED] there. Reverting it is the M4 line below. 2. The threshold is one constant: plugin.ts now imports MIN_SECRET_LENGTH from redact.ts instead of keeping MIN_SCANNED_SECRET, so "the same threshold the client uses" cannot drift. Same value, no behaviour change in the client. 3. Longest first is not in the brief. Without it, an 8-character value that starts a longer secret is replaced first and the secret's tail is printed (M5). It applies to redactSecrets' registered values as well. 4. Only credential error text is redacted, as the brief scopes it. A task's message, a step's log and assertion messages are not: a path in a Command's failure would lose its HOME prefix for no leak shown. 5. The docs sentence says "a step's message that quotes a sign-in block's error", not every step message, since that is what the code promises.

Gaps

  1. The words are redactSecrets' "[REDACTED]". testRun.ts writes "" for a sensitive output and a secret a condition reads, so a report can hold both spellings. Index row at the next index commit. 2. The app window and runbooks mcp still show a provider's error as the client passes it. They are not CI logs; not in this brief. Index row at the next index commit.

Evidence

Local, in a scratch worktree with a scratch HOME. CI's run on this head is the gate.

    • Reproduction, red before the fix (the new tests, testRun.ts as at 48dfc94; fake values): Expected: "...accessDenied: The token [REDACTED] is not one the cloud knows." Received: "...accessDenied: The token fake-secret-0042 is not one the cloud knows." and the same for toolMissing, the refused-confirm "The key fake-key-0001 was revoked." and the boundary test: 5 fail (bun test -t environment; its sixth match, an existing env_prefix test, passed). After: they pass.
    • Mutants (bun test packages/cli/src/testCommand.test.ts packages/cli/src/testRun.test.ts; control 85 pass, 0 fail): M1 redaction removed (credentialFailure unredacted): 80 pass, 5 fail M2a MIN_SECRET_LENGTH 9: 84 pass, 1 fail M2b MIN_SECRET_LENGTH 7: 84 pass, 1 fail M3 test env not included (CaseSession environment: options.env): 81 pass, 4 fail M4 process env not included (CaseSession environment: env): 84 pass, 1 fail M5 not longest first (no sort): 84 pass, 1 fail
    • bun test packages/cli packages/core scripts baseline blocks: 4570 pass, 0 fail, no error line
    • RUNBOOKS_FAKE_CREDENTIALS=1 bun packages/cli/src/main.ts test blocks/{azure,aws,google,git}-auth/testdata/...: "Results: 30 passed, 0 failed, 0 skipped"
    • bun run lint: exit 0; bun run fmt:check: "All matched files use the correct format."; bun run knip: exit 0; bun check: "No type errors in 2,103 files across 23 projects"
    • cd docs && bunx --bun cspell@10.4.0 --no-progress src/content/docs/authoring/testing.mdx: "Files checked: 1, Issues found: 0 in 0 files."

@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
runbooks Ready Ready Preview Dec 2, 2026 2:03am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8d3a4222-f05d-4772-8722-3359d1606c24

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

…ck's environment from the provider's error

Review of #1665 (f6db26f).

Change
- packages/cli/src/testRun.ts: credentialFailure, the one place a
  credential error becomes step text (a Failed block's CredentialError in
  endedAs, a SignedOut block's lastError in noLogin's skip, and the
  refused-confirm fail of #1675), now runs it through redactSecrets with
  every value of the environment the block's run reads. A provider error
  that quotes a token it read from the environment printed it in text,
  json, junit and --output-file; it now shows [REDACTED].
- That environment is the test case's env on top of the one runbooks test
  started with. openInProcess merges it once, gives it to the engine, and
  returns it on CaseSession (`environment`). runCase puts it on Session,
  and every endedAs, readiness, credentialEnded and noLogin call passes it.
  The other two openers return theirs: baseline/step3Fixtures.test.ts the
  environment it starts runbooks mcp with, testRun.test.ts's stub {}.
- credentialFailure's comment said the client "has taken out of it each
  secret it knows". It now says what the code does: the client scrubs only
  the secrets it was handed, and the runner redacts every value of the
  block's environment.
- packages/core/src/domain/vcs/redact.ts: redactSecrets takes `values`
  besides the registered ones, each at least MIN_SECRET_LENGTH (8) long,
  and replaces the longest first. MIN_SECRET_LENGTH is exported, and
  plugin.ts's client reads it in place of its own MIN_SCANNED_SECRET, also 8,
  so the client and the runner share one threshold.
- docs testing.mdx, Testing sign-in blocks: a step's message that quotes a
  sign-in block's error never prints a value 8 characters or longer from
  the test's environment, and shows [REDACTED] in its place.
- testCommand.test.ts: a provider whose error quotes a value of the
  block's environment (the fake's `refuse`): SignedOut skip, Failed
  (toolMissing in Detecting), the refused-confirm fail, and a value only
  the process environment holds. Each runs text with --verbose, json,
  junit and junit to --output-file: every report holds [REDACTED] and not
  the value, stderr not the value, and the json message is exact. A
  boundary test: an 8-character value goes, a 7-character one stays, and
  a value another one starts with does not leave the longer one's tail.

Decisions
1. Values of the process environment are redacted too, as the brief asks,
   so a credential error that quotes a path under HOME, PWD or TMPDIR, or
   SHELL, shows [REDACTED] there. Reverting it is the M4 line below.
2. The threshold is one constant: plugin.ts now imports MIN_SECRET_LENGTH
   from redact.ts instead of keeping MIN_SCANNED_SECRET, so "the same
   threshold the client uses" cannot drift. Same value, no behaviour change
   in the client.
3. Longest first is not in the brief. Without it, an 8-character value
   that starts a longer secret is replaced first and the secret's tail is
   printed (M5). It applies to redactSecrets' registered values as well.
4. Only credential error text is redacted, as the brief scopes it. A task's
   message, a step's log and assertion messages are not: a path in a
   Command's failure would lose its HOME prefix for no leak shown.
5. The docs sentence says "a step's message that quotes a sign-in block's
   error", not every step message, since that is what the code promises.

Gaps
1. The words are redactSecrets' "[REDACTED]". testRun.ts writes
   "<redacted>" for a sensitive output and a secret a condition reads, so a
   report can hold both spellings. Index row at the next index commit.
2. The app window and runbooks mcp still show a provider's error as the
   client passes it. They are not CI logs; not in this brief. Index row at
   the next index commit.

Evidence
- Reproduction, red before the fix (the new tests, testRun.ts as at
  48dfc94; fake values):
    Expected: "...accessDenied: The token [REDACTED] is not one the cloud knows."
    Received: "...accessDenied: The token fake-secret-0042 is not one the cloud knows."
  and the same for toolMissing, the refused-confirm "The key fake-key-0001
  was revoked." and the boundary test: 5 fail (bun test -t environment;
  its sixth match, an existing env_prefix test, passed). After: they pass.
- Mutants (bun test packages/cli/src/testCommand.test.ts
  packages/cli/src/testRun.test.ts; control 85 pass, 0 fail):
  M1 redaction removed (credentialFailure unredacted): 80 pass, 5 fail
  M2a MIN_SECRET_LENGTH 9: 84 pass, 1 fail
  M2b MIN_SECRET_LENGTH 7: 84 pass, 1 fail
  M3 test env not included (CaseSession environment: options.env): 81 pass, 4 fail
  M4 process env not included (CaseSession environment: env): 84 pass, 1 fail
  M5 not longest first (no sort): 84 pass, 1 fail
- bun test packages/cli packages/core scripts baseline blocks: 4570 pass,
  0 fail, no error line
- RUNBOOKS_FAKE_CREDENTIALS=1 bun packages/cli/src/main.ts test
  blocks/{azure,aws,google,git}-auth/testdata/...: "Results: 30 passed,
  0 failed, 0 skipped"
- bun run lint: exit 0; bun run fmt:check: "All matched files use the
  correct format."; bun run knip: exit 0; bun check: "No type errors in
  2,103 files across 23 projects"
- cd docs && bunx --bun cspell@10.4.0 --no-progress
  src/content/docs/authoring/testing.mdx: "Files checked: 1, Issues found:
  0 in 0 files."
@odgrim
odgrim force-pushed the rebuild/p6-classb-fix-env-redact branch from 8c33677 to 85df722 Compare December 2, 2026 02:03
@odgrim
odgrim marked this pull request as ready for review December 2, 2026 02:22
@odgrim
odgrim requested a review from yhakbar as a code owner December 2, 2026 02:22
@odgrim
odgrim merged commit 5dfae73 into rebuild/main Dec 2, 2026
15 of 16 checks passed

This branch was successfully deployed

1 active deployment
Preview — 85df722b Deployed Dec 2, 2026 by vercel[bot]
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