Skip to content

Stop reusing expired GitHub App tokens after a clock rollback #1157

Done

Description

@eowca

A long-running loop-zero process can send an expired GitHub App installation token after the host clock is corrected backward. The process keeps using the expired credential while its cache still sees a token younger than 3,000 seconds.

In an offline replay at 79f92c97, the token was minted at wall time 10,000 seconds. After 3,620 seconds of real elapsed time and a 1,000-second backward wall-clock step, the clock read 12,620. The cache returned expired token reused=True true age=3620s wall age=2620s. Its negative-age guard does not trigger because the adjusted clock is still after mint time.

Measure the in-process cache age with a monotonic clock that counts suspend time, such as Linux CLOCK_BOOTTIME. Start age measurement before minting and keep the existing refresh margin before GitHub's one-hour expiry.

Acceptance criteria

  • A rollback that leaves wall time after mint time cannot extend reuse past the cache lifetime. A fake-clock test covers the replay above.
  • An ordinary cache hit still reuses a fresh token. A suspend long enough to cross the cache lifetime makes the next read mint a fresh token.

Paths: Token lookup and mint time, tests/test_gh_contract.py.

Activity

  1. eowca commented on Nov 26, 2026

    @eowca
    ContributorAuthor

    Merge-authority hold for #1209. The change governs reuse of GitHub App installation credentials. The proposed cache uses suspend-aware elapsed time and mints per call on hosts without that clock. The decisions owner can lift the hold after accepting the expiry behavior and the fallback minting cost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions