Skip to content

feat(cdk-assets): redact secret-bearing flag values from logged docker commands - #1904

Draft
iankhou wants to merge 2 commits into
mainfrom
iankhou-subprocess-log-redaction
Draft

feat(cdk-assets): redact secret-bearing flag values from logged docker commands#1904
iankhou wants to merge 2 commits into
mainfrom
iankhou-subprocess-log-redaction

Conversation

@iankhou

@iankhou iankhou commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #1763 / #1849 (the subprocess consolidation).

Description

This is not a regression. Previous to the subprocess module, we didn't have a mechanism to redact params like --build-arg and --secret either.

shell() logs the command line on the open/close events and embeds it in the failure message. For docker build, --build-arg VALUE (passed literally) and --secret specs can log secrets.

Adds opt-in option redactFlags to shell() that masks the value after each listed flag while the real value is still passed to the process. docker build opts in with ['--build-arg', '--secret'].

Also documents the single audited "quote-for-execution" boundary (quoteShellPart in toolkit-lib) in the subprocess module header.

Testing

  • shell.test.ts: 5/5 pass, including two new tests
  • Changed files lint clean.

Checklist

  • Unit tests added/updated
  • Integration tests (n/a — logging/display change)
  • No manual edits to generated files

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.

… commands

`shell()` logs the command line on open/close and embeds it in the failure
message. For `docker build`, `--build-arg VALUE` (passed literally) and
`--secret` specs could carry secrets straight into logs.

Add an opt-in `redactFlags` to `shell()` that masks the value after each
listed flag wherever the command line is surfaced to a human — the
open/close events AND the failure message (which `run()` renders from the
raw argv) — while the real value is still passed to the process. docker
`build` opts in with `['--build-arg', '--secret']`.

Also documents the one audited "quote-for-execution" boundary
(`quoteShellPart` in toolkit-lib) in the subprocess module header, so the
"nothing both escapes and executes" model is stated completely.
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@aws-cdk-automation
aws-cdk-automation requested a review from a team August 26, 2026 19:51
@iankhou
iankhou deployed to no-approval August 26, 2026 19:51 — with GitHub Actions Active
@iankhou iankhou changed the title fix(cdk-assets): redact secret-bearing flag values from logged docker commands feat(cdk-assets): redact secret-bearing flag values from logged docker commands Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants