fix(jit): mask credentials in GitHub Actions logs via ::add-mask::#262
Open
amaechiabuah wants to merge 1 commit into
Open
fix(jit): mask credentials in GitHub Actions logs via ::add-mask::#262amaechiabuah wants to merge 1 commit into
amaechiabuah wants to merge 1 commit into
Conversation
Contributor
Contributor
Review Summary by QodoMask JIT credentials in GitHub Actions logs via ::add-mask::
WalkthroughsDescription• Mask AWS, GCP, Argo, k8s, and JWT credentials in GitHub Actions logs • Emit ::add-mask:: workflow commands to stderr for secret redaction • Skip empty/None values and only activate when GITHUB_ACTIONS=true • Add comprehensive unit tests covering all masking scenarios Diagramflowchart LR
A["JIT Commands<br/>aws, gcp, argo_wf, k8s, token"] -->|"Extract secrets"| B["_mask_in_ci()"]
B -->|"Check GITHUB_ACTIONS=true"| C{"CI Environment?"}
C -->|"Yes"| D["Emit ::add-mask::<br/>to stderr"]
C -->|"No"| E["No-op"]
D -->|"Runner reads"| F["Redact secrets<br/>in logs"]
E -->|"Return"| G["Credentials unchanged"]
File Changes1. src/duplo_resource/jit.py
|
Contributor
Code Review by Qodo
1. Unescaped mask command values
|
Contributor
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe Changes
When
GITHUB_ACTIONS=true, thejitcommands now register their secret-bearing fields with the runner's masking system by emitting::add-mask::<value>workflow commands to stderr. This stops AWS credentials (and the GCP / Argo / k8s / JWT tokens) from appearing in plain text in subsequent step logs.awsmasksAccessKeyId,SecretAccessKey,SessionToken,ConsoleUrlgcpmasksTokenargo_wfmasksTokenk8smasksstatus.tokentokenmasks the JWTstderr is used so the masks survive
>> $GITHUB_OUTPUT(which only redirects stdout); the runner reads workflow commands from both streams.End-to-end verification on a live runner: https://github.com/duplocloud/actions/actions/runs/25868854856 — the
aws-actions/configure-aws-credentials@v6with:block now showsaws-access-key-id: ***,aws-secret-access-key: ***,aws-session-token: ***, whileaws-region: us-west-2is correctly left un-masked, andaws sts get-caller-identitysucceeds (creds are intact, only their log representation is redacted).Link to Issues
PR Review Checklist
Test plan
src/tests/test_jit.pycovering: emission to stderr, empty/None skipping, no-op outsideGITHUB_ACTIONS, no-op whenGITHUB_ACTIONS=false, case-insensitiveTRUEtriggertest_aws_plugin.py::test_client_entry_point_registered, reproduces on clean origin/main with this branch stashed — not a regression)ruff check src/duplo_resource/jit.py src/tests/test_jit.pycleantest24.duplocloud.net/duplo-toolstenant: secrets masked, creds still functional