Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

One trust model: attribution at the boundary, and a log of what it decided

f50f6fabc7de2f2d33d22a4f2a8e5518ddb5becb · Keenan Nemetz · 16d ago · parent 671f2aa7

One trust model: attribution at the boundary, and a log of what it decided

The system had two answers to "who did this". Runner results were attributed
by a commit signature; issues, comments, approvals and every push were
attributed by the account the SSH handshake resolved. One was cryptographic
and lived in the object, three were boundary-based and lived in the
instance's word.

Keeping both meant keeping allowed_signers generation, ssh-keygen
-Y find-principals semantics, a --key contract in the runner, a pre-flight key
check before every build, a key column in the queue, and the standing
obligation to keep all of it agreeing with the mechanism used everywhere
else. The signature lost on three counts: it restated the handshake (a runner
signs with the key it already pushes with, so the only thing it added was
portability nobody consumes), it proved attribution rather than truth (a
runner can sign a lie), and an assurance mechanism nobody verifies is a
liability, because it looks like security.

So the signature is gone, and what replaced it is the thing a trust-the-box
model actually requires: a record. post-receive now writes one line per
accepted ref update — ref, old, new, account, repo — into the same
append-only log as the privileged acts. In post-receive rather than
pre-receive because pre-receive returning 0 is a permission and this is the
event, and it can never fail a push: the update has already landed, and
reporting it as rejected would make a client re-send something that worked.

Attribution is unchanged in substance — a record must still name the account
that pushed it, which is the rule an issue's author and an approval's owner
already follow — and the gate's three checks simplify to two, since "the
commit must be signed by that account's key" and "the signature's principal
must be that account" both went with the signature. What was a signed record
is now a plain commit on the metadata branch; the run page says "reported by"
and links the commit that carries it.

Deletions, net 467 lines: CommitFilesSigned and CommitTreeAsSigned collapse
into the unsigned forms, VerifyCommitSignature and signedByRE go,
allowedSigners/rosterKeys go with them, the runner loses loadSigningKey,
loadPrivateKey, publicKeyFile, keyFromSSHCommand and checkSigningKey along
with the --key flag and the ping round-trip that validated a key before work,
and Record.Key, Attestation.Fingerprint and their usage go from the record
format and the queue.

The docs now state the model once, in one place — README "The trust model"
and roadmap "The trust model" — including the cost, which is real: a clone
can no longer show who pushed what, and that is the wrong trade for an
instance mirrored outside its operator's control. If that arrives, the answer
is per-repository mandatory signing implemented once, not a second mechanism
kept warm in the meantime. Slices 4 and 6 of Phase 4 are marked removed with
their reasoning kept, because the proposal will come back.

Measured: TestPostReceiveRecordsThePush (both ref updates logged with actor
and account, a deletion logged as "-> none", the CI spool still written) and
TestPostReceiveSurvivesAnUnwritableLog (a full disk cannot fail a push);
TestARecordCannotBeAttributedToAnotherAccount and TestARecordNeedsNoSignature
replace the three signature tests; TestARecordMustDescribeTheLeasedJob stays,
because "the record must describe the job you were given" is a boundary check
and not a crypto one.

internal/hook/hook.go +40−3

@@ -652,9 +652,32 @@ func reject(w io.Writer, format string, args ...any) {
652 652 // update into the spool directory. It runs after the refs have moved, so what it
653 653 // records is what actually landed, and it never fails a push: a spool write that
654 654 // does not happen costs a CI run, not a commit.
655 // PostReceive records what a push changed and queues its CI.
656 //
657 // The recording is the push log, and it is the whole of this forge's audit story for an
658 // ordinary push: attribution is established once, at the boundary (the SSH handshake names
659 // the account, and pre-receive refuses anything the account may not do), so what is left
660 // for the instance to do is *write down what it decided*. One line per accepted ref
661 // update, in the same append-only log as the privileged acts.
662 //
663 // It runs here rather than in pre-receive because this is the point at which the refs have
664 // actually moved: pre-receive returning 0 is a permission, not an event.
665 //
666 // Nothing here may fail the push. A push that landed is done, and a full disk must not
667 // turn it into an error the client reports as a rejected update.
655 668 func PostReceive(cfg Config) int {
656 if cfg.SpoolDir == "" {
657 return 0
669 repo := repoNameFromDir(cfg.RepoDir)
670 actor := strings.TrimSpace(cfg.Actor)
671 actorID := strings.TrimSpace(cfg.ActorID)
672 if actorID == "" {
673 actorID = actor // tolerate callers that only set a name (tests, manual runs)
674 }
675 who := actor
676 if actorID != "" && actorID != actor {
677 who = fmt.Sprintf("%s (%s)", actor, actorID)
678 }
679 if who == "" {
680 who = "unknown"
658 681 }
659 682 sc := bufio.NewScanner(cfg.In)
660 683 for sc.Scan() {
@@ -663,8 +686,13 @@ func PostReceive(cfg Config) int {
663 686 continue
664 687 }
665 688 old, next, ref := fields[0], fields[1], fields[2]
689 auditLine(cfg.AuditPath, fmt.Sprintf("push %s %s -> %s by %s in %s",
690 ref, shortOrNone(old), shortOrNone(next), who, repo))
691 if cfg.SpoolDir == "" {
692 continue
693 }
666 694 event := runs.Event{
667 Repo: repoNameFromDir(cfg.RepoDir),
695 Repo: repo,
668 696 Ref: ref,
669 697 Old: old,
670 698 New: next,
@@ -676,3 +704,12 @@ func PostReceive(cfg Config) int {
676 704 }
677 705 return 0
678 706 }
707
708 // shortOrNone renders a sha for the log, naming the two states that are not a commit:
709 // a ref being created and one being deleted.
710 func shortOrNone(sha string) string {
711 if sha == "" || sha == gitx.ZeroSHA {
712 return "none"
713 }
714 return short(sha)
715 }