fix(wif): prevent credential refresh after cleanup - #1620
Open
abhinavkr26104 wants to merge 2 commits into
Open
Conversation
Contributor
Author
|
Updated the branch with current main in ad18f67. The WIF cleanup-race regression still passes, as do the root and base-action TypeScript checks, Prettier on the changed files, and git diff --check. The only failures in the full WIF test file locally are the two pre-existing Windows permission-mode assertions; they are unrelated to this change. |
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.
Summary
Audit finding
base-action/src/workload-identity.ts starts asynchronous OIDC refreshes with setInterval. Cleanup previously called clearInterval() and removed RUNNER_TEMP/claude-workload-identity, but did not cancel a refresh already awaiting core.getIDToken().
Reproduction:
Expected: after stop(), no identity token or exchanged-credential cache is recreated.
Actual before this change: the asynchronous refresh could recreate credential material after cleanup, leaving secret-bearing files in the runner's per-job temporary directory.
The fix marks the handle stopped before cleanup and checks that state after the awaited token request, before calling setSecret() or writing files.
This is distinct from #1406/#1407, which addressed repeated OIDC exchanges across spawned Claude processes. I found no existing issue or PR covering this post-stop refresh race.
Fixes #1621
Validation
Full repository test runs were also attempted; the checkout has several pre-existing platform/environment failures on Windows (CRLF-sensitive metadata tests, POSIX symlink/permission assertions, network image fixtures, and base README parsing), documented in the audit handoff.