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/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

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

Phase 4: the runner signs the result it reports

22528ac3da576387a8311969641a7b5783b04924 · Keenan Nemetz · 17d ago · parent 86fe5bb4

Phase 4: the runner signs the result it reports

An instance-key signature is the server witnessing itself. It cannot be checked
without trusting the box that produced it, and it says nothing about the party that
ran the steps — so a record signed that way would have been paperwork. The runner
already holds a key, the one it connects with, so the runner is what signs.

At finish the runner signs a claim: run, repo, ref, SHA, workflow blob, the digest of
the steps pinned when the job was queued, exit code, the log's {oid, size}, the
artifacts it published, and its own finishing time. The server rebuilds the same claim
from its own row plus what the runner reports, verifies the signature, and stores the
payload and signature verbatim — so a verifier re-checks the bytes that were signed
rather than re-deriving them from a format that might have drifted.

Who the signer is comes from the channel, not the claim: the account is the one the
SSH key resolved to, and the signature must verify under one of that account's keys.
A runner may therefore sign with a different key from the one it connected with — an
agent-held key to connect, a file to sign — but not as somebody else.

Refusals, all before anything is recorded, because half a record is worse than none:
an unsigned finish (an unattributed result is what the queue already had), a signature
by another account's key, and a signature over a different claim. The run page shows
`attested by <name> · key <fingerprint>`, and `vole runner` now pings first and refuses
to start work when the key it will sign with is not one its account holds — discovering
that after a ten-minute build is a wasted build.

`steps_sha` is recorded at enqueue and travels with the lease, so the claim covers the
steps that ran and not merely the workflow file they came from.

What this does not buy: truth. A runner can still lie about an exit code. It buys
accountability — the record is attributable to a party other than the instance.
Whether a required check must be attested by a particular runner (an ACL key defaulting
to the instance's own) is the next policy question and is deliberately not answered
here; any admin of the repository may still supply the signature.

Verified: TestAFinishedRunBelongsToTheRunnerThatSignsIt drives the real protocol over
SSH — the lease carries what the claim names, ping names the account and its keys,
unsigned and wrong-account and wrong-claim finishes are all refused with nothing
recorded, the correct one is accepted, and the stored payload still verifies under the
stored signature; TestClaimRendersOneWay pins the byte form (including artifact
ordering and an empty log) and TestClaimRefusesToForgeItself refuses a field carrying a
newline; TestStepDigestFollowsTheSteps shows the digest covering the steps themselves;
the cmd tests cover key discovery from VOLE_SSH_COMMAND/GIT_SSH_COMMAND, the missing-key
message, a non-key file, and the pre-work refusal; and the end-to-end test that runs the
real binary asserts the claim names the run, its log and its exit, and that the run page
says who attested it. scripts/ci.sh green (gofmt, vet, build, markdown links, go test
-race ./...).

internal/sshserver/sshserver_test.go +17

@@ -19,7 +19,9 @@ import (
19 19
20 20 "github.com/rodent-software/vole/internal/acl"
21 21 "github.com/rodent-software/vole/internal/identity"
22 "github.com/rodent-software/vole/internal/lfs"
22 23 "github.com/rodent-software/vole/internal/repo"
24 "github.com/rodent-software/vole/internal/runs"
23 25 )
24 26
25 27 var binPath string
@@ -55,6 +57,9 @@ type harness struct {
55 57 pubLine string // authorized_keys line for the writer
56 58 roKey string // private key file for the read-only user
57 59 repoName string
60 runs *runs.Store // the CI queue the runner verb serves
61 objects *lfs.Store // where a run's log and artifacts are checked for
62 writerID string // the account id the writer's key belongs to
58 63 }
59 64
60 65 func newHarness(t *testing.T) *harness {
@@ -106,10 +111,21 @@ func newHarness(t *testing.T) *harness {
106 111 t.Fatal(err)
107 112 }
108 113
114 // The runner verb needs a queue and an object store: a finished attempt names a log
115 // and its artifacts, and those claims are checked against the store.
116 queue, err := runs.Open(filepath.Join(dir, "runs.db"))
117 if err != nil {
118 t.Fatal(err)
119 }
120 t.Cleanup(func() { queue.Close() })
121 objects := lfs.New(filepath.Join(dir, "objects"), 1<<20)
122
109 123 log := slog.New(slog.NewTextHandler(io.Discard, nil))
110 124 srv, err := New(Config{
111 125 Identity: ident,
112 126 Repos: rs,
127 Runs: queue,
128 LFS: objects,
113 129 Log: log,
114 130 HostKeyPath: filepath.Join(dir, "host_key"),
115 131 })
@@ -126,6 +142,7 @@ func newHarness(t *testing.T) *harness {
126 142 return &harness{
127 143 t: t, dir: dir, addr: ln.Addr().String(), ident: ident, repos: rs,
128 144 srv: srv, keyPath: writer, roKey: reader, repoName: "demo",
145 runs: queue, objects: objects, writerID: writerID,
129 146 }
130 147 }
131 148