Repository navigation
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ery OAuth error Retry the token exchange on a network error or 5xx, up to three attempts, requesting a fresh GitHub OIDC token each time because WorkOS accepts each one once. Never retry a 4xx. Re-exchange and re-send an API call once when the API answers 401. Handle unauthorized_client, and make each OAuth error hint name the setting to change.
[Medium impact] The PR appears safe to merge, with both earlier findings addressed and no new actionable issues found. SummaryAdds bounded WIF token-exchange retries, one retry after an API 401, and clearer OAuth error hints.
Reviews (4) · Last reviewed commit: "fix(wif): say the WorkOS access token la..." · Reviewed by Greptile |
…se before re-exchanging A connection that dropped while the token response body was read ended the exchange as 'the response was not JSON' instead of being retried like any other network failure. A 401 response was cancelled only after the re-exchange, so a failed re-exchange left it open.
The exchange now issues one-hour tokens. The comment on the fallback lifetime called five minutes the documented minimum. The fallback stays at 300 seconds, used only when the server omits expires_in, so the CLI exchanges again early.
This branch has not been deployed
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.
Stacked on #268. Review this after it; the diff here is only what was added on top.
What changes
unauthorized_client: check that the client has an active trust, that workload identity federation is on for the team, and that the client targets a non-production environment.unauthorized_client, andWORKOS_ENVIRONMENT_IDbeing optional (it must match the client's bound environment when set).The branch also merges
main(release 0.24.0), so the release files show in the diff.The server now issues one-hour tokens. The CLI reads
expires_in, so only a comment changed. Its fallback when a response has noexpires_instays 300 seconds.Checked
workos apilisted organizations and created one using only the job's OIDC token. It passed again with this branch ataeaa5adagainst a later build of the server stack (b2c42179c, from before the data model rework): https://github.com/nicknisi/wif-test/actions/runs/43374371447. After the server's data model rework it passed again withaeaa5ad, the latest run against the server stack's current tip: https://github.com/nicknisi/wif-test/actions/runs/43944935844. The one commit added since (951f005) changes a comment only.Not checked
bun run build.