Repository navigation
Lower the direct GCP WIF token lifetime threshold to four minutes - #342
Merged
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The narrow validation and caching changes are consistent, with focused regression coverage and no unresolved findings.
No open issues 🎉
What changed in this PR
Fixes #262 by allowing direct GCP Workload Identity Federation tokens with more than four minutes remaining and aligning their cache refresh buffer with that threshold.
Changes:
- Lowers direct WIF validation and refresh buffers to four minutes, preserving five-minute behavior for impersonation and other providers.
- Adds regression coverage for token reuse, refresh timing, rejected lifetimes, and unchanged impersonation behavior.
- Documents the direct GCP WIF exception.
| File | Description |
|---|---|
internal/oidc/oidc_credential.go |
Applies the four-minute cache buffer to direct GCP WIF. |
internal/oidc/oidc_credential_test.go |
Tests lifetime boundaries, caching, refresh, and impersonation. |
internal/oidc/actions_oidc.go |
Defines and applies the four-minute direct WIF threshold. |
internal/oidc/actions_oidc_test.go |
Updates the exact rejection-boundary test to four minutes. |
.github/copilot-instructions.md |
Documents the provider-specific cache buffer. |
Review effort: Balanced
alhss
approved these changes
Oct 27, 2026
v-thavaahariharangit
deleted the
copilot/gcp-wif-four-minute-threshold
branch
October 27, 2026 15:37
This was referenced Oct 27, 2026
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.
What are you trying to accomplish?
Lower the minimum remaining lifetime for direct GCP Workload Identity Federation tokens from five minutes to four minutes. Use the same four-minute refresh buffer so accepted, approximately five-minute tokens can be reused instead of immediately expiring in the cache.
Fixes #262.
Anything you want to highlight for special attention from reviewers?
Tokens with exactly four minutes or less remaining are still rejected. Service-account impersonation and other providers retain their five-minute refresh buffer. Comments link to the issue and the documented five-minute GitHub OIDC token lifetime to explain why this must remain below five minutes. This source change does not update GitHub's deployed proxy.
How will you know you've accomplished your goal?
Synthetic HTTP mocks and Go's fake clock cover 4m58s token reuse, refresh at the cache boundary, the exact four-minute rejection boundary, shorter and expired tokens, longer-lived tokens, and unchanged impersonation behavior. No cloud credentials or services are used by these regression tests.
Validation with Go 1.26.0:
go test -mod=vendor ./internal/oidc -run '^(TestGetOrRefreshGCPToken|TestGetGCPAccessToken)$' -count=1- passed.go test -mod=vendor -race -shuffle=on -count=2 ./internal/oidc- passed.go test -mod=vendor -race -shuffle=on -count=2 ./...- passed.go build -mod=vendor ./...- passed.go vet -mod=vendor ./...- passed.gofmt -l internal/oidc/actions_oidc.go internal/oidc/oidc_credential.go internal/oidc/actions_oidc_test.go internal/oidc/oidc_credential_test.go- clean.git diff --check- passed.script/test- blocked: Docker buildx is unavailable; the Docker daemon is also unavailable. The complete race-enabled Go test suite passed locally as listed above.Checklist