Skip to content

fix: redact secrets in live-streamed subprocess output - #304

Open
armadavalor wants to merge 1 commit into
game-ci:mainfrom
armadavalor:fix/redact-streamed-output
Open

armadavalor wants to merge 1 commit into
game-ci:mainfrom
armadavalor:fix/redact-streamed-output

Conversation

@armadavalor

Copy link
Copy Markdown

Changes

System.run() wrote the child's stdout/stderr straight to the CI log, so a registered secret (e.g. the Unity password echoed back by the container) was never redacted there.

  • Add createStreamRedactor() to secret-redaction.ts. It holds back a tail of the stream (twice the longest registered secret, minus one) so a secret split across two chunks is still caught, and never emits a half-matched secret.
  • System.run() pipes the live write-out through it. runResult.output stays unredacted, so callers such as build validation still match on the real text. Chunks are decoded with StringDecoder so multi-byte characters are not split. With no secrets registered the text passes through unchanged.

Checklist

  • Read the contribution guide and accept the code of conduct
  • Readme (not needed)
  • Tests (added: secret split across chunks, one char at a time, no prefix leak, flush, and an end-to-end System.run test)

Tested with bun test src/model/secret-redaction.test.ts src/model/system/system.test.ts: 21 pass. Note that the existing System.run tests spawn node and time out at bun's default 5s on my Windows machine; they pass with --timeout 60000.

Closes #247

@coderabbitai

coderabbitai Bot commented Oct 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 24 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 52ebb9a8-5c76-44ec-ae3d-bd9fe3593504
Commits

Reviewing files that changed from the base of the PR and between 9e2a4a2 and e9b2662.

Files selected for processing: 4
  • src/model/secret-redaction.test.ts
  • src/model/secret-redaction.ts
  • src/model/system/system.test.ts
  • src/model/system/system.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

Redact live-streamed subprocess output in System.run()

1 participant