Repository navigation
Description
Problem
#204's fork_pool_token is a classic token with the public_repo scope, of an account that belongs to the bot fork organisations. A classic token cannot be limited to organisations: it can write to every repository the account can, which includes the forks whose branches are the heads of Code Monkey's open pull requests. A leaked token could add commits there, and commits made through the API are signed by GitHub. Human approval, last-push approval and stale-review dismissal still stand between such a commit and a merge, but the exposure lasts as long as the token does, and a classic token may be created with no expiry.
check_token holds the scopes to public_repo alone and says nothing of expiry. GitHub reports a classic token's expiry in the GitHub-Authentication-Token-Expiration header of any API reply (for example 2027-01-18 10:39:33 UTC) and omits it for a token that never expires; checked on 22 November 2026 against GET /user.
Required behaviour
check_tokenreads the header from the reply it already reads (gh api --include user).- No expiry fails the job:
"the fork pool token never expires; create it with an expiry", before any write. - An expiry more than 90 days ahead fails the same way, naming the date, so the token is rotated at least that often.
- An expiry within 14 days passes with a
::warningnaming the date, on every run, so the rotation is due before the job stops. - A header the job cannot parse fails, as an absent scope header does.
docs/DESIGN.md§10.6 (added by Feat(publish): Prepare forks in a separate job #204) and the README's rollout state the expiry rule and the rotation it implies.
Acceptance criteria
- Tests in
tests/test_fork_pool.py: no header, an unparsable one, and one more than 90 days ahead each fail before any write; one within 14 days warns and goes ahead; one in between passes silently; the scope check still runs and still refuses extra scopes. -
uv run python -B -m unittest discover -s testspasses. -
prek run --files <changed files>and the aislop gate report no findings.
Depends on
#204, which adds scripts/fork_pool.py.
Out of scope
- Replacing the classic token with another kind of credential.
- The App's own permissions (tracked separately).
Activity
lf-releng-code-monkey-bot commentedon Nov 23, 2026
🐒 An AI agent has proposed a change for this issue: pull request #232 (head 325ed9e). The Copilot review of it is clean. Checks failed on its head: Audit changes.
lf-releng-code-monkey-bot commentedon Nov 23, 2026
🐒 Round 1: an AI agent revised pull request #232 (head 1a10fb6). Round 1 fixed the one failing check:
Audit changes(aislopcomplexity/file-too-largeonscripts/fork_pool.py, 445 lines, flagged above 441). - Moved the token check into a newscripts/pool_token.pythatfork_pool.pyimports (328 and 137 lines now). Behaviour has not changed. DESIGN.md §10.6 and its script table name the new module. The fix is amended into the Feat commit. - There were no review threads or maintainer comments. Copilot's review was clean. - No rebase: the base is still the default branch's head and the PR is mergeable. - Ran the unit tests (1719 OK),prek run --filesover the changed files (all passed) andaislop scan(no diagnostics). It set out to fix the failing checks: Audit changes. The Copilot review of it is clean. An antagonistic review was requested from the review bot.