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/sshserver/runner.go +8−14

@@ -114,13 +114,11 @@ type runnerReply struct {
114 114 Run *runnerJob `json:"run,omitempty"`
115 115 OK bool `json:"ok"`
116 116 Lease int `json:"lease,omitempty"`
117 // Who am I: the account this channel authenticated as, and the fingerprints of
118 // its keys. A runner answers "ping" with these so it can check, before it runs
119 // anything, that the key it is going to sign with is one the server will accept.
120 // Learning that after a ten-minute build is too late to be useful.
121 Account string `json:"account,omitempty"`
122 Name string `json:"name,omitempty"`
123 Keys []string `json:"keys,omitempty"`
117 // Who am I: the account this channel authenticated as. A runner answers "ping" with
118 // this so it can say whose results it will be reporting, and so a --repos filter can
119 // be checked against what the account may run.
120 Account string `json:"account,omitempty"`
121 Name string `json:"name,omitempty"`
124 122 // Repos are the repositories this account may run jobs for, sent with "ping" so
125 123 // a runner started with --repos can find out at startup that its filter matches
126 124 // nothing — a typo it would otherwise discover as a permanently idle runner —
@@ -342,9 +340,8 @@ func (s *Server) serveRunner(ch ssh.Channel, user, accountID string) {
342 340 continue
343 341 }
344 342 attested, err := cfg.Runs.RecordAttestation(run.ID, owner, runs.Attestation{
345 Signer: rec.Signer,
346 Fingerprint: rec.Key,
347 CommitID: rec.Commit,
343 Signer: rec.Signer,
344 CommitID: rec.Commit,
348 345 }, now)
349 346 if err != nil {
350 347 _ = enc.Encode(runnerReply{Op: "finish", Error: err.Error()})
@@ -360,16 +357,13 @@ func (s *Server) serveRunner(ch ssh.Channel, user, accountID string) {
360 357 continue
361 358 }
362 359 cfg.Log.Info("run finished", "user", user, "run", run.ID, "exit", rec.Exit,
363 "signer", rec.Signer, "key", rec.Key, "commit", rec.Commit, "recorded", ok)
360 "signer", rec.Signer, "commit", rec.Commit, "recorded", ok)
364 361 _ = enc.Encode(runnerReply{Op: "finish", OK: ok})
365 362
366 363 case "ping":
367 364 reply := runnerReply{Op: "ping", OK: true, Account: accountID}
368 365 if acct, aerr := cfg.Identity.Find(accountID); aerr == nil && acct != nil {
369 366 reply.Name = acct.Name
370 for _, k := range acct.Keys {
371 reply.Keys = append(reply.Keys, k.Fingerprint)
372 }
373 367 }
374 368 // What this account may run, so a runner started with --repos can say at
375 369 // startup that its filter matches nothing rather than idling in silence.