Allow for more clock drift when generating the JWT#9
Open
dscho wants to merge 2 commits into
Open
Conversation
Authenticating as a GitHub App means signing a JWT and presenting it
as a bearer token. GitHub allows an `exp` claim up to 10 minutes
ahead, and we have been asking for the full 10. When the runner's
wall clock drifts even slightly ahead of GitHub's, the `exp` lands
past the accepted horizon and the request is rejected with HTTP 401
and a payload of
`{"message":"'Expiration time' claim ('exp') is too far in the future", ...}`.
Backing the expiry off to 9 minutes leaves headroom for skew without
otherwise changing the auth flow.
This is a verbatim port of a two-year-old fix that has been running
cleanly in the sibling repo, see
git-for-windows/gfw-helper-github-app@ebb4adab0e37
(Allow for more clock drift when generating the JWT, 2023-11-14).
The file here was introduced in f79a22c (Add support functions
to authenticate as GitHub App, 2023-08-31) as a port of the
gfw-helper version and never picked up the November 2023 fix. The
same port is being applied in parallel to git-for-windows-automation
in git-for-windows/git-for-windows-automation#185,
which did hit the 401 in real CI.
No failure has been observed in this repo yet; the port is
preventive, because the file is a direct descendant of the one that
broke and the failure mode is intrinsic to a 10-minute `exp`.
Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The test mocks `httpsRequest` and matches on the exact `actions/runs` query string the production code builds. Since 3b7027b (Work around GitHub API changes ("timeouts" waiting for workflows), 2026-01-15), the production path was rewritten twice without a corresponding update to the mock: ff0a822 (Fix hot fix, 2026-01-23) switched from `created>=${after}` to `created=${after}..` after GitHub stopped accepting `>=`, and b216ced (Fix hot fix fix, 2026-01-27) appended the trailing `*` that GitHub requires for open-ended ranges. The test has thus been failing on `main` for about five months. Assisted-by: Opus 4.7 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
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.
For the rationale, the diff, and the symptom please see the commit message; this is a one-line preventive port, not a fix for an observed failure here. The same change has been running in
git-for-windows/gfw-helper-github-appsince git-for-windows/gfw-helper-github-app#49 (merged November 2023) and is being applied in parallel to the third descendant of the same file in git-for-windows/git-for-windows-automation#185.