Signed indexes¶
A signed index is a JSON document that clients trust only with its detached signature: a plugin marketplace's list of listings, an update feed, a list of mirrors. rab signs one in the format the rs-rich plugin marketplace uses (and the rs-rich client verifies), and keeps it alive:
- every signing gives the index a serial one above the last, repeated in the signature's trusted comment, so a client can refuse an older index (rollback);
- every index expires (30 days by default), so a client stops trusting an index that someone keeps serving after it should have changed (freeze);
- keys come in generations (
keys/keys-N.json), each a main key that signs indexes and a backup key that signs only the next generation, so a key can be replaced, or revoked when it is lost or leaked; - a schedule re-signs the index before it expires, alerts in an issue when the index the site serves is about to expire or does not verify, and cancels older runs that wait for an approval nobody gave.
The last point is why this is part of rab. In November 2026 the marketplace's index expired quietly: a scheduled signing run from 2 November sat waiting for the environment's approval, every later run queued behind it or was cancelled, and on 1 December at 21:57 UTC clients started refusing the index. Nothing warned anyone in advance.
rab.yml¶
indexes:
- name: marketplace
file: index.json # the index, at the repository root
build: python3 scripts/build_index.py # writes index.json from the listings
keys: keys/ # keys-1.json, keys-2.json ...
comment_prefix: rs-rich-marketplace # "<prefix> index serial=N"
expires_after: 30d
resign_every: 7d
warn_before: 7d
environment: marketplace-signing
url: https://marketplace.example.org/index.json
deploy: [marketplace] # sites: to deploy after signing
indexes: sits next to packages: (and the coming sites:). A rab.yml
may declare only indexes (or sites): then check checks only those.
| Field | Default | Meaning |
|---|---|---|
name |
required | The index's name: lower-case letters, digits and hyphens. Commands take it as --name (needed when there is more than one index). |
file |
required | The index, relative to the repository root. |
signature |
<file>.minisig |
Its detached signature. |
build |
none | A command (in bash, at the repository root) that writes file from its sources. It runs without the signing secrets in its environment. Without one, sign re-signs the file as it is. |
signer |
minisign |
The signer. minisign is the one there is; the signer is an adapter (SIGNERS in release.py), so cosign or Sigstore can be added without changing the rest. |
keys |
required | The directory of the key chain, keys-N.json and the rotation signatures. keys-1.json must exist. |
serial |
true |
Whether the index has a serial. false writes no serial and signs with the comment <prefix> index. |
comment_prefix |
the name | The trusted comments: <prefix> index serial=N on the index, <prefix> keys generation=N on a rotation. The marketplace's is rs-rich-marketplace. |
expires_after |
30d |
How long a signed index is valid: 12h, 30d, 2w; between 1h and 365d. |
resign_every |
7d |
How old an index may get before the schedule signs it again. |
warn_before |
7d |
How long before it expires the alert opens. resign_every plus warn_before must be less than expires_after, so a healthy index is re-signed before it is ever in the alert window. |
environment |
none | The protected GitHub environment that holds the key; named in the alert and rotation instructions. The workflow's environment: is what enforces it. |
url |
none | Where the index is served (https:// only). The signature is expected beside it. alert and verify --live read it. |
deploy |
[] |
Names from sites: to deploy once the index is signed (index deploy). See Deploying the sites. |
check refuses an unknown key, a name used twice, an unknown signer, a
duration it cannot read or a window that does not fit, a URL that is not
https://, a deploy naming a site sites: does not list, and a missing
keys-1.json.
The files¶
rab writes exactly what the marketplace writes, so its clients need no change.
index.json is the build's document with three fields set by rab:
serial, generated and expires (UTC, 2026-12-01T21:57:23Z). Fields
the build wrote keep their place; missing ones go after schema_version.
It is written as two-space JSON with a newline:
{
"schema_version": 1,
"serial": 3,
"generated": "2026-12-01T23:46:16Z",
"expires": "2026-12-31T23:46:16Z",
"listings": { "...": "..." }
}
index.json.minisig is minisign's signature (the pre-hashed ED
algorithm) with the trusted comment rs-rich-marketplace index serial=3.
keys/keys-N.json is one generation:
{
"schema_version": 1,
"generation": 2,
"main": {"id": "D22F9156C0C4E262", "public_key": "RWRi4sTAVpEv..."},
"backup": {"id": "DEC3A1455D4868F6", "public_key": "RWT2aEhdRaHD..."},
"revoked": []
}
Generation 1 is the root of trust: clients ship with it. Generation N+1 is
accepted against N with keys-(N+1).json.backup.minisig (always, by N's
backup key) and keys-(N+1).json.main.minisig (by N's main key, for a
planned rotation), each with the trusted comment
rs-rich-marketplace keys generation=N+1. Without the main key's signature,
the new generation must revoke N's main key, replace it, and keep the backup
key. Revocations carry forward, and a revoked key never comes back.
rab verifies all of this itself, in pure Python (Ed25519 and BLAKE2b), the
way the client does: check, verify, status and alert need nothing
installed but PyYAML. Only signing runs the minisign binary.
Commands¶
release.py index check [--name N] # the key chain and the committed index verify
release.py index status [--name N] # serial, signer, time to expiry, committed and live; due?
release.py index verify [--name N] [--live]
release.py index sign [--name N] # build, next serial, new expiry, sign, verify
release.py index due [--name N] [--force] # writes due=true|false to GITHUB_OUTPUT
release.py index rotate [--name N] --main-pub PUB [--backup-pub PUB] [--revoke-main]
release.py index alert [--name N] # in Actions: the expiry issue
release.py index cancel-stale # in Actions: older runs waiting for approval
release.py index deploy [--name N] # the sites in `deploy:`
checkwalks the chain fromkeys-1.json, checking every rotation, then verifies the committed index against the newest generation's main key and that its serial matches the trusted comment. An expired or expiring index is a warning, not a failure, so listing pull requests still pass.signreads the committed serial, runsbuild, writes the next serial,generatedandexpires, signs, and verifies the new signature against the newest main key. If anything fails, the committed files are put back. The key and password come fromRAB_MINISIGN_KEY(the whole minisign.keyfile) andRAB_MINISIGN_PASSWORD, and nowhere else.duesays whether to sign now: the index is unsigned or does not verify, its build changes it, it is withinwarn_beforeof expiring, or it is older thanresign_every. It runs the build to compare and then puts the file back.verifyfails when the index does not verify or has expired;--livechecks the one served aturl:.rotatewrites the nextkeys-N.jsonand prints how to sign it. See Rotating a key.
The workflow¶
install writes .github/workflows/sign-index.yml (from
templates/sign-index.yml) when rab.yml declares an index and the
repository has none, and installs the sign-index action with the rest of
the kit (.github/rab/sign-index/, in the manifest, checked by vendored).
It runs on pushes that touch the listings or the keys, daily, and by hand,
in three jobs:
| Job | Runs | Permissions | Does |
|---|---|---|---|
due |
always | contents: read, actions: write |
Cancels older runs that wait for approval; says whether signing is due. No secrets. |
sign |
when due, on main |
contents: read, in the protected environment |
Signs, commits and pushes the index (with the signer App's token), then deploys its sites. One at a time (concurrency), never cancelled. |
alert |
on the schedule and by hand | contents: read, issues: write |
Checks the live index; opens, updates or closes the alert issue. |
Because the daily run asks for an approval only when the index is due, the
maintainer sees one request a week (with resign_every: 7d), not one a day.
Set up the environment (index-signing in the template; rename it to match
environment:):
- Settings → Environments → New environment. Add yourself as a required
reviewer, and limit deployment branches to
main. - Secrets:
INDEX_MINISIGN_KEY, the whole.keyfile of the newest generation's main key (it is encrypted with its password; rab refuses a key that is not), andINDEX_MINISIGN_PASSWORD. The backup key never enters GitHub. - If a ruleset protects
main, a GitHub App that may bypass it pushes the signed index: its client id as the environment variableSIGNER_APP_CLIENT_ID, its private key as the secretSIGNER_APP_PRIVATE_KEY, with one repository permission, Contents: read and write. Without a ruleset, drop the token step, give the jobcontents: writeand passpush-token: ${{ github.token }}.
The commit is the App's bot user's, <app-slug>[bot], with the noreply
address GitHub gives it, <user id>+<app-slug>[bot]@users.noreply.github.com:
the action reads the id from the users API with the App's token (its
app-slug input). The signer's commit changes only the index and its
signature, which the push trigger's paths leave out, so it starts nothing.
Deploying the sites¶
After the push, index deploy deploys each site the index names in
deploy: with rab's sites: support (release.py site), target by
target: the site is built, the host's files rendered, deployed and
verified, its verify: files fetched back and compared with the build.
- A Cloudflare target deploys from the signing job, with
CLOUDFLARE_API_TOKENandCLOUDFLARE_ACCOUNT_IDfrom the environment's secrets (the template passes both). - A GitHub Pages target is not deployed from the signing job: Pages
takes a deploy only from a workflow with an OIDC token. The repository's
Pages workflow (the
deploy-siteaction) publishes the signed commit when it lands on the branch, andindex deploysays so.
The alert names a deploy that is behind: when the committed serial is ahead of the one the site serves.
Expiry alerts¶
alert reads the index the site serves (url:), not the committed one:
a signed index that never deployed is still an expired index for every
client. It verifies it against the committed key chain and keeps one
issue, found by a marker in its body:
- opened when the live index is within
warn_beforeof expiring, has expired, does not verify, or cannot be fetched; - updated (silently) while that lasts, with what is wrong and what to do;
- closed, with a comment naming the new serial, once a fresh index is live.
The job also fails while the live index cannot be trusted (expired or not verifying), so the scheduled run is red too. When the committed serial is ahead of the live one, the issue says so: the deploy is behind.
Stuck runs¶
A run whose signing job waits for an approval holds the signing concurrency
group; later runs queue behind it or are cancelled. cancel-stale runs first,
in the due job (which has no environment and no concurrency group), and
cancels every run of the same workflow that is older than the current one
and still waiting, pending, queued or requested. Runs that are
signing (in_progress) and newer runs are left alone. If the token cannot
cancel (no actions: write), it lists the runs with their links, says how to
fix it, and the job goes on: the alert is the backstop.
Rotating a key¶
index rotate writes the next generation and prints the commands; it never
reads or writes a private key. Signing happens offline, where the backup key
lives.
Planned (replace the main key, and the backup key too if you like):
minisign -G -p main-2.pub -s main-2.key
python3 .github/rab/scripts/release.py index rotate --main-pub main-2.pub
# then, as it prints:
minisign -S -s main.key -m keys/keys-2.json -x keys/keys-2.json.main.minisig -t "rs-rich-marketplace keys generation=2"
minisign -S -s backup.key -m keys/keys-2.json -x keys/keys-2.json.backup.minisig -t "rs-rich-marketplace keys generation=2"
python3 .github/rab/scripts/release.py index check
Commit keys-2.json and both signatures together, and replace the
environment's key and password with the new main key's before the next
signing run. A run between the two fails its verification (the new
signature is not by the newest main key) and changes nothing.
Lost or leaked main key: --revoke-main writes a generation that revokes
the old main key and keeps the backup key; only the backup key signs it.
Threat model¶
What the format and the workflow protect against, and what they do not.
Rollback. An attacker (or a stale mirror or cache) serves an older,
validly signed index, to hide a yanked version or a fix. The serial is in
the signed trusted comment and in the index, and they must agree; a client
that remembers the last serial it accepted refuses a lower one, and refuses
the same serial with other bytes. rab takes each serial from the committed
index, so serials only grow while main's history does; one signing at a
time (concurrency) keeps two runs from taking the same serial.
Freeze. An attacker serves the last index forever, so clients never see
an update. Every index expires expires_after after it is signed, and
clients refuse it then. The price is that the index must be re-signed on
time: that is what resign_every, the alert and stale-run cancellation are
for. An expired index is a denial of service, not a compromise; the alert
turns a silent expiry into an open issue a week ahead.
Main key compromise. Whoever holds the main key can sign any index, with
any serial and expiry, until clients move to a generation that revokes it.
Limits: the key is a secret of a protected environment, usable only by a
workflow run on main that a reviewer approved; it is encrypted with a
password held in a second secret; rab never prints either, keeps both out of
the build's environment, and writes the key only to a private temporary file
for minisign, removed at once. Recovery: index rotate --revoke-main, signed
by the backup key alone. A leaked main key can push the serial very high, so
after recovery the index's serial must continue above anything it signed
(set serial in the committed index by hand before the next signing, if
needed).
Backup key compromise. The backup key signs only rotations, so alone it cannot sign an index, but it can sign a generation that revokes the main key and names its own new main key. Keep it offline, never in GitHub. Replacing it needs both keys (a planned rotation). If both keys are lost or leaked, the chain cannot be continued: clients need a new root (generation 1) shipped in a release.
Rotation. A new generation is trusted only through the previous one, in
order, with no gap: a client walks keys-2.json, keys-3.json ... from the
root it ships with. rab's check walks the same chain with the same rules,
so a rotation that clients would refuse fails CI before it is merged. A
rotation that has been merged but not yet signed by the environment's new
key cannot produce a bad index: sign verifies against the newest
generation and refuses.
The signing workflow. Whoever can change the workflow or rab.yml on
main, or the build command, can make the approved run sign what they like.
Protect main with reviews; the environment's branch rule keeps other
branches out. The due and alert jobs hold no secret. Every third-party
action is pinned to a commit.
Stuck approvals. One forgotten approval used to block every later run.
cancel-stale cancels older waiting runs, and the alert opens an issue if
the index still gets close to expiring.
Not covered. The listings themselves (what the index points at) are checked by the repository's own checks, not by rab. Transport security of the site is HTTPS's job; the signature protects the content whatever serves it.
Adopting it in the rs-rich marketplace¶
The marketplace keeps every file format. Its rab.yml would hold the
declaration above (with deploy: naming its site in sites:), and:
scripts/build_index.pystays thebuild. It may keep writingserial,generatedandexpires(rab overwrites them in place, with the same values), or drop them;.github/workflows/sign-index.ymlbecomes rab's template, withINDEX: marketplace, its push paths (packages/**,keys/**), the environmentmarketplace-signing, the secretsMARKETPLACE_MINISIGN_KEYandMARKETPLACE_MINISIGN_PASSWORDin place ofINDEX_MINISIGN_*, and its listings validation (rs-rich-cli'svalidate_marketplace.py) as a step of theduejob;- its inline key-shape check, signing and verification steps go: the
sign-indexaction does them; url:names where the site servesindex.json, so the alert watches it;- the README's rotation section points at
index rotate.
The rs-rich client is unchanged: the files it reads are byte for byte the same formats.