Sign the distribution channel: verify release tags before self-update applies them - #29
Draft
konjoinfinity wants to merge 2 commits into
Draft
Sign the distribution channel: verify release tags before self-update applies them#29konjoinfinity wants to merge 2 commits into
konjoinfinity wants to merge 2 commits into
Conversation
… applies them self_update.sh's fast-forward-only merge stops a divergent history but does nothing against a malicious, fast-forwardable commit pushed straight to the tracked upstream -- and kiban self-distributes its own gate code and agent instructions to every consuming repo. Pre-flight found nothing was signed today (release tags were all lightweight, commits unsigned save for GitHub's own unrelated merge-commit auto-signing), so this establishes a dedicated release-signing key and ssh-based tag verification together. - security/allowed_signers: the trust anchor (git ssh-signing format). - lib/self_update.sh: unpinned updates now resolve to the newest signed tag reachable from the tracking branch (not the raw branch tip) and verify it before merging; a pinned ref is verified before checkout and refused if unsigned/invalid/mutable. Verification failures log to ~/.konjo/security.log, classified so a real tamper signal (invalid_signature) is distinguishable from an unsigned/no-op case. Every existing failure-safe property (throttling, silent no-op, ff-only, single-remote fetch) is unchanged. - .github/workflows/release.yml: cuts and pushes a signed annotated tag itself instead of relying on gh release create's unsigned, lightweight one. - docs/DISTRIBUTION.md, README.md: recommend pinning to a signed tag, document how to cut a signed release and rotate the key. - CHANGELOG.md, LEDGER.md (two entries), NEXT_SESSION_PROMPT.md, VERSION: the verification requirement and the establish-signing decision are both one-way doors, logged as such; NEXT_SESSION_PROMPT.md scopes the follow-up pin migration for existing consuming repos. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0147TLzhpqLH7bDvCfGj1znJ
…ion-channel-heg41d # Conflicts: # CHANGELOG.md # LEDGER.md # NEXT_SESSION_PROMPT.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
kiban self-distributes its own gate code and agent instructions to every consuming repo via
lib/self_update.sh.merge --ff-onlystops a divergent history but does nothing against a malicious, fast-forwardable commit pushed straight to the tracked upstream — exactly the case where an attacker with push access (or a compromised token) appends rather than rewrites. This PR closes that gap.Pre-flight (see
LEDGER.md'sSign-Distribution-1entry) confirmed nothing was signed today: release tags (v0.4.0–v1.6.0) were all lightweight tags created server-side bygh release create, and individual commits carried no signature (the only "signature" anywhere was GitHub's own auto-signing of web-UI merge commits — not a maintainer policy, and it doesn't cover tags at all). Per the sprint brief's hard gate, that finding meant the honest scope was "establish signing, then verify" — a decision reserved for the repo owner, not the agent. Asked directly, the owner chose the full scope with ssh-format git signing (no keyserver, no bespoke PKI — verifies against a flatsecurity/allowed_signersfile via git's nativegpg.ssh.allowedSignersFile).security/allowed_signers: the trust anchor (git ssh-signing format, principalrelease@kiban).lib/self_update.sh: unpinned updates now resolve to the newest signed release tag reachable from the tracking branch (not the raw branch tip — verifying every commit onmainwould mean signing every commit, out of scope) and verify it, read from the pre-update working tree, before merging. A pinned ref is verified before checkout and refused if unsigned, invalidly signed, or a mutable ref (a branch). Verification failures are logged to~/.konjo/security.log, classified (unsigned/invalid_signature/unresolvable_ref/unverifiable) so a real tamper signal is distinguishable from a transient/no-op case. Every existing failure-safe property — throttling, silent no-op, ff-only, single-remote fetch — is unchanged..github/workflows/release.yml: cuts and pushes a signed, annotated tag itself (git tag -s -a, ssh format,RELEASE_SIGNING_KEYsecret) instead of relying ongh release create's unsigned, lightweight tag creation.docs/DISTRIBUTION.md,README.md: recommend pinning to a signed tag (nevermainor another branch), document how to cut a signed release and rotate the key.CHANGELOG.md,LEDGER.md(two entries),NEXT_SESSION_PROMPT.md,VERSION(1.6.0 → 1.7.0): the verification requirement and the establish-signing decision are both one-way doors, logged as such.NEXT_SESSION_PROMPT.mdscopes the follow-up: migrating existing consuming-repo pins (lopi,miru, ...) from mutable refs to signed tags.Out of scope, deliberately: no change to the ff-only stance or the failure-safe model; no signing of every historical or future commit (only release tags); no bespoke key-management platform.
Setup required before the next release
A fresh, dedicated release-signing ed25519 keypair was generated for this sprint (not the repo owner's personal key). The public half is committed in
security/allowed_signers. The private half was not committed or pasted anywhere in git history/PR text — it was handed to the repo owner out-of-band. It needs to be added as theRELEASE_SIGNING_KEYGitHub Actions secret beforerelease.ymlcan cut a signed release (seedocs/DISTRIBUTION.mdfor the manual fallback if it isn't set yet).Test plan
bash tests/test_self_update.sh— 11 cases (up from 6): valid-signed applies, unsigned no-op + logged, invalid-signature no-op + logged (distinct from unsigned), recovery once a valid tag supersedes, signed-tag pin checks out, unsigned-tag pin refused + logged, branch pin refused + logged, plus the pre-existing skip/throttle/failure-safety/C2-reattach cases.ruff check .— all checks passed.mypy lib ledger evals packages/konjo-gates-py/src/konjo_gates_py— no issues.pytest -q— 199 passed.🤖 Generated with Claude Code
https://claude.ai/code/session_0147TLzhpqLH7bDvCfGj1znJ
Generated by Claude Code