Skip to content

Allow for more clock drift when generating the JWT#9

Open
dscho wants to merge 2 commits into
mainfrom
jwt-9min-clock-drift
Open

Allow for more clock drift when generating the JWT#9
dscho wants to merge 2 commits into
mainfrom
jwt-9min-clock-drift

Conversation

@dscho

@dscho dscho commented Jun 29, 2026

Copy link
Copy Markdown
Member

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-app since 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.

dscho added 2 commits June 29, 2026 16:59
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant