Repository navigation
checks: verify release immutability from the releases when admin is missing - #1290
Conversation
…issing
Reading `repos/{repo}/immutable-releases` takes repository admin, on the
read and the write alike. The bot has write, so every nightly `tend check`
404s on it and reports a skip — and the nightly files an issue only for a
failure, so this was the one check nothing watched. It also kept the
"every line PASS, close the drift issue" branch unreachable in every
consumer.
Each published release carries GitHub's own `immutable` flag, which a
write-scoped token can read. When the setting endpoint 404s, read the
newest non-draft release instead and fail when it can still be rewritten.
An admin's run is unchanged.
The flag is never retroactive, so a repository that enables the setting
with an older release already published fails here until its next release.
The failure message and the install guidance both say so.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
tend-agent
left a comment
There was a problem hiding this comment.
Two things on the non-admin stand-in.
[0] isn't the newest published release. GET /repos/{repo}/releases documents no sort order, and it isn't any of the obvious ones: nodejs/node currently returns v26.5.1 (published 2026-07-29T14:02:10Z) ahead of v24.18.1 (published 2026-07-29T16:17:25Z), and that pair is out of order by created_at and by release id too. So on a repo publishing from more than one release train, index 0 can be a release published before the newest one — and with the setting turned off between the two, the check reads the older immutable release and returns PASS while a rewritable release exists. max_by(.published_at) makes it deterministic and keeps the behaviour the // empty fallback depends on; I confirmed both under gh's own jq, including the no-releases repo still printing nothing.
The security-model sentence claims more than the stand-in proves. The flag is retrospective — as _check_newest_release_immutable's docstring puts it, it records the setting "as it stood when that release was published". Turn the setting off after the last release and every nightly keeps reporting PASS on immutable-releases, filing no drift issue, until something is next published. The PASS message in the code is careful about this ("the setting was enabled when it was published"); the doc reads as if the bot path were equivalent to the admin path.
…e locked Two corrections from review. The list endpoint documents no order, and a release's `created_at` is its tag's commit date rather than its publication time. On a repository publishing from several trains, a backport published later sorts below the newer version: `grafana/grafana` serves `v13.2.2` (published 12:21) first while `v13.0.9` (12:43) is the later publication, and `elastic/elasticsearch` does the same. Reading `[0]` would report the setting as it stood at the earlier publication and pass while a rewritable release exists, so the jq takes `max_by(.published_at)`. Immutability also does not lock a release's body. `PATCH /releases/:id` with a new body succeeds on a release reading `immutable: true`, and it succeeds with the bot's own write-scoped token — the exact actor the threat model names. What is locked is the assets, the tag, and the draft/published state. The check messages and the security model both said notes were covered; they now say assets and tag. Also states the flag's retrospective limit where it was overclaimed: a non-admin pass establishes that the setting was on when the newest release was published, not that it is on now, so turning it off is unseen until the repository publishes again. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
tend-agent
left a comment
There was a problem hiding this comment.
Three points, one a decision rather than a defect.
The releases read is bounded to the first page. gh api repos/{repo}/releases
without --paginate returns 30; this repo already has 36 releases. The docstring's
case for max_by(.published_at) is that the list endpoint documents no order — and
that same argument makes the first 30 an arbitrary subset, so the maximum is taken
over whatever GitHub served rather than over the repository's releases. A release
whose tag commit sits behind 30 newer ones lands off-page, the check reads an older
release's flag, and it returns PASS while a rewritable release exists: the failure
mode the commit set out to fix. Note for whoever picks this up — --slurp is
rejected alongside --jq, and under --paginate the filter runs per page and emits
one object per page, which the json.loads below would reject, so the fix is to
paginate and take the maximum in Python.
The non-admin FAIL can't be cleared by the person it reaches. The nightly files
tend check: configuration drift on any FAIL, so a consumer that enabled immutable
releases but hasn't published since carries a standing issue whose only remedy is
publishing a release — an admin's tend check --fix reads the setting, passes, and
never enters the fix path. install-tend's SKILL.md now states the behaviour ("that
check fails until the next one"), so it's deliberate; the question is whether a drift
issue is the surface you want for it, since it lands on correctly-configured repos.
Two shipped sentences keep the claim the PR corrects elsewhere. docs/security-model.md
and references/security-model.md both move from "the release/its record is locked"
to assets-and-tag, but install-tend's SKILL.md and the README still say the release
itself is locked. Suggestions inline.
`gh api` serves 30 releases a page and this repository already has 36, so the maximum was taken over whichever page GitHub returned first. That repeats the mistake the previous commit fixed: with no documented order, a release published later can sit past the page boundary just as easily as past the first element. The call now passes `--paginate`, and `--slurp` collects the pages — gh refuses it alongside `--jq`, so the draft filter and the maximum move into Python, where they read more plainly anyway. README.md and install-tend's SKILL.md still said immutability locks the release itself; they now say assets and tag, like the other three sites. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
tend-agent
left a comment
There was a problem hiding this comment.
One leftover from the notes correction. docs/security-model.md's boundary 3 headline still asserts that published releases cannot be rewritten — the claim the paragraph directly under it now retracts. The bolded line is what a reader skimming the three boundaries takes away, so it carries the pre-PR model on its own. Suggestion inline.
The paragraph under boundary 3 says the body is not locked, while its own bolded headline still promised that a published release cannot be rewritten. `checks.py`'s module docstring and `check_immutable_releases`'s own line carried the same unqualified claim. All three now say assets and tags. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Version bump, lockfile, and the `## 0.2.11` section the release workflow publishes verbatim as the GitHub Release notes. 19 commits since 0.2.10. The headline is the skills change that just landed: the twelve cross-cutting `references/` files are now skills in their own right and `running-in-ci` is `run-tend`, so the harness's skill listing — which fires on the action rather than on picking a task — is the index ([#1305](#1305), [#1306](#1306)). Alongside it: `model:` forwards any name to the harness CLI so a consumer can pin an exact id ([#1294](#1294)), `install-tend` hands the OAuth mint to the user and drops the pty wrapper ([#1295](#1295)), the sandbox boundary's Ubuntu and npm packages resolve as of one recorded instant ([#1289](#1289), [#1291](#1291)), and `tend check` can verify release immutability from the releases when it lacks admin — a check that had never produced a verdict in a scheduled run ([#1290](#1290)). Each bullet was written from the commit's diff rather than its subject. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
GET /repos/{repo}/immutable-releasesrequires repository admin, and the bot has write. So theimmutable-releasescheck has never produced a verdict in a scheduled run — it reportsSKIPwhether the setting is on or off, and the nightly files a drift issue only for aFAIL. Here is last night's run in a consumer, from its session log:The bot's own summary from that run: "9 PASS, 1 SKIP (
immutable-releases, needs repo admin to read). No FAIL, so no drift issue filed; the SKIP means it isn't an all-pass run either, so nothing was closed." That setting was in fact disabled. It had been since the repo installed tend, which predated the check, and nothing re-rantend checkwith admin afterwards. The PUT is admin-only too, so the bot could not have repaired it either. A side effect of the permanent skip: the nightly's "every line PASS, close the drift issue" branch was unreachable in every consumer.Each published release carries GitHub's own
immutableflag, which a write-scoped token can read. When the setting endpoint 404s,check_immutable_releasesnow reads the most recently published non-draft release instead and fails when it can still be rewritten. An admin's run is unchanged, and the module docstring records the rule that an admin-only read needs a bot-readable stand-in.Verified against live GitHub with the bot's own token:
max-sixty/tend(setting on, newest release immutable) → PASS,max-sixty/worktrunk(was off) → FAIL,max-sixty/leaf(no releases) → SKIP.The flag is retrospective, so a repository that enables the setting with an older release already published fails this check until its next release, and turning the setting off goes unseen until the repository publishes again. The failure message, the security model and the
install-tendguidance all say so. The alternative — failing only when an older release is immutable and a newer one is not — detects the setting being turned off but stays silent on the case that actually occurred, where it was never on.Finding the newest release is harder than it looks
Two separate bugs, both caught in review, both now covered by tests.
The listing is not in publication order. A release's
created_atis its tag's commit date, not its publication time, and the endpoint documents no order. On a repository publishing from several trains a backport published later sorts below the newer version —grafana/grafanaservesv13.2.2(published 12:21:32) ahead ofv13.0.9(12:43:46), andelastic/elasticsearchdoes the same.And it is paginated.
gh apiserves 30 a page; this repository already has 36. Taking the maximum over page one repeats the same mistake, since a later publication can sit past the page boundary just as easily as past the first element. The call passes--paginate, and--slurpcollects the pages — gh refuses it alongside--jq, so the draft filter and the maximum moved into Python.Immutability does not lock a release's body
PATCH /repos/{repo}/releases/{id}with a new body succeeds on a release readingimmutable: true— verified against this repository's own0.2.10release with the bot's write-scoped token, the exact actor the threat model names, and the body restored byte-for-byte afterwards. What the setting locks is the assets, the tag, and the draft/published state.docs/security-model.md(both the boundary headline and its paragraph), the shippedinstall-tendreference and SKILL.md,README.md, andchecks.py's docstrings and messages all claimed notes were covered; they now say assets and tags.Repository settings
The setting is now enabled on
max-sixty/worktrunk,max-sixty/leaf,max-sixty/cargo-affectedandnumbagg/numbagg.PRQL/prqlis waiting on PRQL/prql#6332, which restructures its release workflow to upload assets to a draft — today it uploads to the already-published release across four jobs, which the setting refuses withHTTP 422: Cannot upload assets to an immutable release.