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.

Give a job a credential for the bot it acts as

6e1fca5115b709d31eeb51864b187d79aa104e5f · Keenan Nemetz · 6d ago · parent 446542e6

Give a job a credential for the bot it acts as

A workflow can name a bot account with `bot:`. When the job is leased the
instance generates a key for that run, stores the public half with the run,
repository and expiry, and sends the private half on the lease channel. The
runner writes it into the job's run directory with a known_hosts entry for the
instance, so a step's `git push` or `vole issue comment` authenticates as the
account and nothing has to be wired per job.

The account's role is the permission, in full. The credential replaces exactly one
requirement — that writing to the issues branch needs `maintain` — and adds no rule
of its own. What a job may write there is what its account may do, asked the same
way the browser asks: discuss, file an issue, manage an item it wrote, open a
change from a branch it may push, triage and approve when the role allows it. Those
are the ACL's own capabilities (`CanDiscuss`, `CanOpenRequest`, `CanTriage`,
`CanApprove`), so a maintainer's job may do everything a maintainer's key may do,
including labels, states, and other people's items.

A session is scoped only when the fingerprint it authenticated with is a live
credential row; an expired one reads as absent, so the push falls back to the
account's own role and is refused where a contribute account cannot write.

Two things end the key: the run finishing, which drops the row, and the expiry,
which is what stops a credential whose runner was killed and never reported. The
key is also masked in the log like a secret, since a step that cats it should not
leave it in the attempt.

Closes #165.

server/hook/hook_test.go +14

@@ -105,6 +105,20 @@ func (f *fixture) runWith(cfg Config, ref string) (int, string) {
105 105 return PreReceive(cfg), out.String()
106 106 }
107 107
108 // runFrom is a push that starts at an existing metadata commit, which is what a job's
109 // write looks like: the branch is already there and the push adds to it.
110 func (f *fixture) runFrom(cfg Config, old, ref string) (int, string) {
111 f.t.Helper()
112 cfg.RepoDir = f.m.Dir
113 if cfg.UsersDB == "" {
114 cfg.UsersDB = f.usersDB
115 }
116 var out bytes.Buffer
117 cfg.In = strings.NewReader(old + " " + f.head + " " + ref + "\n")
118 cfg.Out = &out
119 return PreReceive(cfg), out.String()
120 }
121
108 122 func (f *fixture) setACL(mut func(*access.ACL)) {
109 123 f.t.Helper()
110 124 a, err := f.m.ACL()