Overview
| Artifact ID: | 1d66de132691859d37fc17589c3e59cb323a843849d9d485784589969db15ffc |
|---|---|
| Ticket: | ed5bdd89c39a993313f99f17685d3612081ebc4e
Audit follow-ups from the RFC 0008 permissions strata (two MEDIUMs: acct- guard bypass, fleet-default leak into repo-less caps) |
| User & Date: | dmestas on 2026-08-28 10:09:44 |
Changes
- comment changed to:
Post-merge audit of the RFC 0008 strata (range 2dccc0cb → 04b13673, landed 2026-08-27). Every finding verified against merged trunk; the two MEDIUMs are the actionable core. **MEDIUM 1 — leftover `acct-` handler bypasses the lockout guard.** `internal/web/web.go` (~:12250), `POST /r/{repo}/settings/caps`: rung 4 removed the per-account raw-string inputs from the Settings template but the handler still accepts `acct-*` keys and writes them via `SetCaps` with no `GuardCaps`. An admin session posting a crafted form can remove its own `a` or the last admin's — the exact saves rung 4 promises to refuse. Fix: run the `acct-` branch through `GuardCaps` (refusal → `?e=` redirect), or delete the branch since the UI no longer emits those fields. **MEDIUM 2 — fleet default leaks into repo-less caps resolution.** The API router resolves caps for repo-less ops as `capsFor(user, "")`; `EffectiveCaps(user, "")` reads `CategoryCaps("", …)`, which since rung 5 is the seeded fleet default (`gjorzh2` / `mnc3C`), not fossil stock. Regression: `people.list` (Caps `h`, `GET /api/v1/people`) is now satisfied for signed-out visitors — on an all-private forge, contributor and account names leak. Pre-strata, stock nobody (`gjorz`) lacked `h`, so it took a session. Fix shape: the `""` row is the template new repositories copy, not the empty repo's own categories — resolve repo-less ops against stock (or an explicit fleet-ops string) instead of the `""` row. **LOW — guard not consulted on API/account paths.** `account.grant` / `account.revoke` / `DeleteAccount` reach `SetCaps`/row deletion with no `GuardCaps`; a site admin can demote or delete the last repo admin with no warning. `s`-gated so contained, but inconsistent with the guard's promise. **LOW — migration drops unknown role rows.** `MigrateRolesToCaps` migrates only `read/write/admin` then `DROP TABLE repo_role`; any other value would be lost silently. None exist in practice (old `ParseRole` wrote nothing else); retry-safe via `INSERT OR IGNORE`. **NIT — no charset restriction on account/repo names** (only `max=64`). The live editor's `template.HTMLAttr` is safe today solely because `url.PathEscape` escapes quotes (verified `' → %27`); a name charset or template-built attribute would be sturdier. **NIT (pre-existing, not a strata defect) — `chat.post` is `Anonymous` with no Caps** (`internal/api/register.go` ~:7888, commented v1 decision). Now contradicts RFC 0008's presets, which say chat needs `C` and a sign-in. Deserves its own ticket when chat leaves v1. **Verified as intended (not defects):** the Token-floor change (`MayAt` = signed-in; per-op letters gate the rest, enforced at the router when `capsFor` is wired); the Public-project widening for signed-in accounts (`n c 3 C`) and visitors (`h 2`), documented in the perm-5 landing; route gating on all new endpoints (`gateCap "a"` / site-admin `gateAt`). The compiler's preset tables and `Infer` are covered by unit tests but got no independent re-derivation in this audit. Suggested order: MEDIUM 1 and 2 together as one small landing; LOWs and NITs opportunistic. - priority changed to: "High"
- severity changed to: "Important"
- status changed to: "Open"
- subsystem changed to: "web"
- title changed to:
Audit follow-ups from the RFC 0008 permissions strata (two MEDIUMs: acct- guard bypass, fleet-default leak into repo-less caps)
- type changed to: "Defect"