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/server/integration_test.go +20
| @@ -2639,6 +2639,26 @@ jobs: | |||
| 2639 | 2639 | if sum := fmt.Sprintf("%x", sha256.Sum256([]byte(body))); sum != done.LogOID { | |
| 2640 | 2640 | t.Fatalf("the served log hashes to %s, but the run names %s: the object is not the runner's bytes", sum, done.LogOID) | |
| 2641 | 2641 | } | |
| 2642 | |||
| 2643 | // The result is signed by the runner, and the record is checkable afterwards: the | ||
| 2644 | // stored claim names this job, its log and its outcome, and the signature verifies | ||
| 2645 | // under the account that ran it. The page says who, and it is the runner rather | ||
| 2646 | // than the instance. | ||
| 2647 | att, err := f.srv.Runs.Attestation(done.ID) | ||
| 2648 | if err != nil || att == nil { | ||
| 2649 | t.Fatalf("no attestation on the run: %v", err) | ||
| 2650 | } | ||
| 2651 | if att.Signer == "" || att.Fingerprint == "" { | ||
| 2652 | t.Fatalf("attestation is not attributed: %+v", att) | ||
| 2653 | } | ||
| 2654 | if !strings.Contains(string(att.Payload), "run "+done.ID) || | ||
| 2655 | !strings.Contains(string(att.Payload), "log "+done.LogOID) || | ||
| 2656 | !strings.Contains(string(att.Payload), "exit 0") { | ||
| 2657 | t.Fatalf("the claim does not describe the run:\n%s", att.Payload) | ||
| 2658 | } | ||
| 2659 | if _, page := f.get("/r/" + f.repo + "/runs/" + done.ID); !strings.Contains(page, "attested by") { | ||
| 2660 | t.Fatalf("the run page does not say who attested it:\n%s", page) | ||
| 2661 | } | ||
| 2642 | 2662 | if done.SHA != mustSHA(t, work) { | |
| 2643 | 2663 | t.Fatalf("run recorded sha %s, want the pushed commit", done.SHA) | |
| 2644 | 2664 | } | |