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.
Phase 4: access rules live in the instance database
ec5c519cb9fc4277baa8263cfd31891a95f1d7ac · Keenan Nemetz · 16d ago · parent 90fdaf39
Phase 4: access rules live in the instance database The ACL was one acl.json on refs/vole/acl: a ref only the server writes, read on every push and every request. It is configuration the instance owns, keyed by account id, and keeping it in git cost a commit, a compare-and-swap retry and a rev-parse per read to store a handful of rows — the argument that already moved the roster out of data/system.git, applied to the rules that name its accounts. It is now a row in data/users.db beside the roster, in the same file as the ids it refers to: - access.Store: repo_acl(repo_id, acl, updated, updated_by), one row per repository, keyed by the stable repository id so a rename moves nothing. - Meta.ACL reads the row; a repository with no row is deny-everything, exactly what a missing ref meant. - Meta.SetACL is one upsert, so SQLite orders concurrent edits and the CAS loop with its retries is gone. The author stays in the row and in data/audit.log, which is what the commit message used to say. - Deleting a repository forgets its rules, after the directory is gone. - repo.Store.ImportACLs reads refs/vole/acl once at startup for any repository without a row, so an existing instance keeps its rules. It never overwrites a row, and a second run imports nothing. - The index's acl_sha is a digest of the rules rather than the ACL commit id. - pre-receive reads the rules from VOLE_USERS_DB and makes GIT_DIR absolute before deriving the repository from it, since git hands a hook ".". What the ref bought — rules that travel with a clone — is what this gives up, deliberately: the rules are account ids, so a copy in a clone is unreadable without this instance's roster, and the backup that holds the accounts now holds them too. Measured: internal/repo imports rules from a real refs/vole/acl commit and is idempotent on a second run; internal/access covers round-trip, replacement, deletion and the audit line; the full suite — auth, site visibility, transport and pushes — runs against rules read from SQLite.
internal/server/server.go +15−1
| @@ -12,6 +12,7 @@ import ( | |||
| 12 | 12 | "strconv" | |
| 13 | 13 | "time" | |
| 14 | 14 | ||
| 15 | "github.com/rodent-software/vole/internal/access" | ||
| 15 | 16 | "github.com/rodent-software/vole/internal/config" | |
| 16 | 17 | "github.com/rodent-software/vole/internal/identity" | |
| 17 | 18 | "github.com/rodent-software/vole/internal/index" | |
| @@ -61,8 +62,21 @@ func New(cfg *config.Config, binPath string, log *slog.Logger) (*Server, error) | |||
| 61 | 62 | if err != nil { | |
| 62 | 63 | return nil, fmt.Errorf("open run queue: %w", err) | |
| 63 | 64 | } | |
| 64 | rs := repo.New(cfg.ReposDir(), binPath) | ||
| 65 | // Access rules live in the instance database beside the roster: only the instance | ||
| 66 | // writes them, and they are keyed by account id, so a copy inside a repository | ||
| 67 | // would be unreadable anyway. | ||
| 68 | acls, err := access.Open(cfg.UsersDB()) | ||
| 69 | if err != nil { | ||
| 70 | return nil, fmt.Errorf("open access rules: %w", err) | ||
| 71 | } | ||
| 72 | acls.AuditPath = cfg.AuditLog() | ||
| 73 | rs := repo.New(cfg.ReposDir(), binPath, acls) | ||
| 65 | 74 | rs.MaxInputBytes = cfg.ReceiveMaxBytes | |
| 75 | if n, err := rs.ImportACLs(); err != nil { | ||
| 76 | log.Warn("import access rules from refs/vole/acl", "err", err) | ||
| 77 | } else if n > 0 { | ||
| 78 | log.Info("access rules imported", "repos", n) | ||
| 79 | } | ||
| 66 | 80 | if n, err := rs.InstallAllHooks(); err != nil { | |
| 67 | 81 | log.Warn("install hooks", "err", err) | |
| 68 | 82 | } else if n > 0 { | |