Repository navigation
Lower the direct GCP WIF token lifetime threshold to four minutes - #328
Closed
loganvolkers wants to merge 3 commits into
Closed
loganvolkers wants to merge 3 commits into
loganvolkers wants to merge 3 commits into
Conversation
Use a matching four-minute refresh buffer for direct GCP WIF tokens so newly accepted short-lived tokens remain reusable. Keep service-account impersonation and other providers unchanged, and cover lifetime and cache boundaries with a fake clock. Fixes dependabot#262. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Explain why exchange latency requires a minimum below GitHub's five-minute OIDC lifetime, and why a five-minute refresh buffer immediately expires fresh direct WIF tokens. Reference the public issue and authentication documentation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep the existing time.Add style when applying the provider-specific refresh buffer. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The narrow changes align acceptance and caching behavior, with regression coverage and no unresolved findings.
No open issues 🎉
What changed in this PR
Fixes #262 by accepting short-lived direct GCP Workload Identity Federation tokens and aligning their cache refresh buffer.
Changes:
- Lowers direct WIF acceptance and refresh thresholds to four minutes.
- Preserves five-minute buffers for impersonation and other providers.
- Adds boundary and cache-reuse tests and updates documentation.
| File | Description |
|---|---|
| internal/oidc/oidc_credential.go | Applies the direct WIF refresh buffer. |
| internal/oidc/oidc_credential_test.go | Tests token reuse, refresh boundaries, and impersonation behavior. |
| internal/oidc/actions_oidc.go | Lowers the direct WIF minimum lifetime. |
| internal/oidc/actions_oidc_test.go | Updates the exact-boundary rejection test. |
| .github/copilot-instructions.md | Documents the direct WIF buffer exception. |
Review effort: Balanced
4 of 5 tasks
Contributor
|
Covered here: #342 |
Author
|
Thanks @v-thavaahariharangit -- although not sure why you duplicated my PR exactly including files and PR description 🤔 |
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