Repository navigation
Scrub leaked tokens from test-quarantine Part 1 output - #67322
Merged
Merged
Conversation
The daily test-quarantine workflow gathers flaky-test failure data into
part1_data and injects it into the agent prompt via job outputs. Some
aspnetcore E2E tests run as Helix work items, and on failure the Helix
result-upload step logs a live Azure DevOps bearer JWT into the console
log. Part 1 captures Helix [FAIL] blocks and test stack traces verbatim,
so the JWT lands in the output. GitHub's GITHUB_OUTPUT secret detector
then skips the entire part1_data value ("may contain secret"), leaving
the agent with empty data and producing a false noop every run.
Redact token-shaped strings (JWTs, GitHub tokens, Bearer headers, SAS
signatures, basic-auth URLs, connection-string secrets, long base64
runs) from the captured error/stack/[FAIL]-block text before emitting,
plus a final pass over the serialized payload as a safety net. This
removes the detector trigger and avoids surfacing live tokens in the
prompt and uploaded artifacts.
Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR prevents the daily test-quarantine workflow from leaking token-shaped secrets (notably an Azure DevOps bearer JWT that can appear in Helix failure logs) into the part1_data job output, which can cause GitHub’s GITHUB_OUTPUT secret detector to skip the entire output and leave the agent with empty Part 1 data.
Changes:
- Add regex-based secret scrubbing for captured failure text (
errorMessage,stackTrace, and extracted Helix[FAIL]blocks) before applying existing length caps. - Add a final “safety net” scrub over the fully serialized
part1_dataJSON payload before writing toGITHUB_OUTPUT. - Regenerate the gh-aw compiled workflow lock file.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/test-quarantine.md | Adds scrub_secrets() and applies it to captured failure text + final serialized payload before emitting part1_data. |
| .github/workflows/test-quarantine.lock.yml | Regenerated compiled workflow reflecting the .md updates (and updated pinned action SHAs/versions). |
| re.compile(r'(?i)\bhttps?://[^/\s:@"]+:[^@\s/"]{6,}@'), # basic-auth credentials in URL | ||
| re.compile(r'(?i)[?&]sig=[A-Za-z0-9%/+_=-]{20,}'), # Azure SAS signature | ||
| re.compile(r'(?i)\b(?:AccountKey|SharedAccessKey|AccessKey|Password|Pwd)=[^;\s"\']{12,}'), # connection-string secret | ||
| re.compile(r'[A-Za-z0-9+/=_-]{52,}'), # long high-entropy run (AzDO PAT, base64) |
Comment on lines
34
to
36
| # Custom actions used: | ||
| # - actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| # - actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| # - actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
Require the generic token pattern to start with an alphanumeric so it no longer redacts long ===/---/___ separator lines in stack traces and [FAIL] blocks, while still catching base64/PAT-like tokens. Co-authored-by: Copilot <[email protected]>
wtgodbe
added a commit
that referenced
this pull request
Jun 21, 2026
#67338) The daily test-quarantine workflow's activation job was failing with "An error occurred trying to start process '/usr/bin/bash' ... Argument list too long" (E2BIG). The pre_activation step computes ~225 KB of CI failure data (part1_data) and gh-aw passes it to the prompt-building steps as a single environment variable. Linux caps one env-var string at MAX_ARG_STRLEN (32 * 4 KiB page = 131072 bytes) during execve, so merely declaring that variable on a step makes the step die before it runs. This was latent until #67322 fixed token scrubbing: previously GitHub's secret detector skipped the whole output, so the env var resolved empty and never hit the limit; with scrubbing fixed the data now flows at full size and trips MAX_ARG_STRLEN. Split part1_data into 16 fixed, byte-bounded chunks (<=80000 bytes each, well under the limit), one per job output (part1_data_0..15), and concatenate the placeholders adjacently in the prompt so gh-aw's exact-string substitution reconstructs the JSON verbatim. Empty slots cost nothing, so total environment size is unchanged. Chunks split on UTF-8 character boundaries; a loud FATAL guards the (unreachable in practice, since json.dumps emits ASCII) case of overflow rather than silently truncating. Recompiled the lockfile with gh aw v0.79.8. Co-authored-by: Copilot <[email protected]>
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.
The daily test-quarantine workflow gathers flaky-test failure data into
part1_dataand injects it into the agent prompt via job outputs. Some aspnetcore E2E tests run as Helix work items, and on failure the Helix result-upload step logs a live Azure DevOps bearer JWT into the console log. Part 1 captures Helix[FAIL]blocks and test stack traces verbatim, so the JWT ends up in the output.GitHub's
GITHUB_OUTPUTsecret detector then skips the entirepart1_datavalue (Skip output 'part1_data' since it may contain secret), leaving the agent with empty data and producing a false noop on every run.Fix
Redact token-shaped strings from the captured
error/stack/[FAIL]-block text before the length caps, plus a final pass over the serialized payload as a safety net (GitHub's skip is all-or-nothing, so any field can trip it). Patterns cover JWTs, GitHub tokens,Bearerheaders, Azure SAS signatures, basic-auth URLs, connection-string secrets, and long base64 runs.This removes the detector trigger and also avoids surfacing live tokens in the agent prompt and uploaded artifacts.
Validated by replaying a real ~190 KB Part 1 payload end-to-end: the leaked JWT and other token-shaped runs are removed, git SHAs are preserved, and the JSON stays valid.
The
.lock.ymlis regenerated withgh aw compile.