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.
Merge change request 01M70WES5ZZDJ6RP226WB11BBZ: Let people rename and remove their own passkeys
keenan · 26m ago
4b8c9e1d
| 1 | package ssh |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "io" |
| 6 | |
| 7 | "rodent.software/vole/forge/access" |
| 8 | ) |
| 9 | |
| 10 | // serveWhoAmI answers the identity query. Without a repository it is the account |
| 11 | // name and the public URL, as it has always been. With one it also reports the |
| 12 | // account's effective role there, after applying the same private-repository rule |
| 13 | // as a fetch: a repository the account cannot read is reported as not found, not |
| 14 | // as a role. |
| 15 | func (s *Server) serveWhoAmI(ch io.Writer, user, repoArg string) int { |
| 16 | if repoArg == "" { |
| 17 | fmt.Fprintf(ch, "%s\t%s\n", user, s.cfg.PublicURL) |
| 18 | return 0 |
| 19 | } |
| 20 | name, ok := repoName(repoArg) |
| 21 | if !ok { |
| 22 | fmt.Fprintln(ch, "vole: invalid repository path") |
| 23 | return 1 |
| 24 | } |
| 25 | m, err := s.cfg.Repos.Meta(name) |
| 26 | if err != nil { |
| 27 | fmt.Fprintf(ch, "vole: repository %q not found\n", name) |
| 28 | return 1 |
| 29 | } |
| 30 | a, err := m.ACL() |
| 31 | if err != nil { |
| 32 | s.cfg.Log.Warn("ssh: cannot read access rules", "user", user, "repo", name, "err", err) |
| 33 | fmt.Fprintf(ch, "vole: cannot read access rules for %s\n", name) |
| 34 | return 1 |
| 35 | } |
| 36 | var admin bool |
| 37 | if s.cfg.Identity != nil { |
| 38 | admin = s.cfg.Identity.IsAdmin(user) |
| 39 | } |
| 40 | effective := a.EffectiveRole(user, admin) |
| 41 | if !a.Public() && !effective.AtLeast(access.Read) { |
| 42 | fmt.Fprintf(ch, "vole: repository %q not found\n", name) |
| 43 | return 1 |
| 44 | } |
| 45 | fmt.Fprintf(ch, "%s\t%s\t%s\n", user, s.cfg.PublicURL, effective) |
| 46 | return 0 |
| 47 | } |
| 48 |