gitoria
All repositories: gitoria
5.8 KB
# SG — gitoria security audit (branch sg-sec)Method: a real local gitoria + its own ident (tests/identkit.mjs), real HTTP requests (node http, git push/clone with tokens), as signed-out /another user (bob) / owner (alice). Gate: `tests/security.mjs` (69 checks). Run on the OLD code (main) it gives 56 passed, 13 failed (the fixed items below);on sg-sec 69 passed, 0 failed. Nothing live was probed.## Table| # | check | result | severity | fixed | test (tests/security.mjs) ||---|---|---|---|---|---|| 1 | AuthZ, 15 faces (create, token make/remove, key add/remove, set branch, disconnect tickets, merge, open ticket, save name, login/logout) | signed out and non-owner refused everywhere; owner works; client-only events cannot be called by a peer | ok | – | "face …" checks || 1 | AuthZ routes: /api/repos* (public read, no secret field, POST 405), /settings/connect(ed) (owner only, else → /settings), /__git/keys + /__git/access (secret, no X-Forwarded-For, owner-only write), git HTTPS (push: owner's token only; clone public; receive-pack advert 401) | correct | ok | – | route + git checks || 2 | HTML injection: description, display name, README Markdown (javascript:, data:, //evil, raw `<script>`), file / branch / commit names, seed JSON | all rendered as text; unsafe hrefs dropped; seed cannot close its script tag | ok | – | "page …", "Markdown …" || 2 | open redirect / header injection via `?next=` | only same-origin paths or this system's repo addresses; CRLF stays encoded | ok | – | "login ?next=" || 2 | path traversal / source exposure (.env, project.hl, lib, storage, .git, `..`, `%2e%2e`) | 404; client modules are stubs for server code, no secret | ok | – | "files:", "served client modules" || 2 | git argument/option injection (`-rf.txt`, `<…>` names, branch names), SSRF | paths via `--literal-pathspecs`, refs from git itself, hex ids; the only server-side fetches go to the configured ident / tickets URLs (tickets `api` must start with `<tickets>/api/projects/`) | ok | – | – || 2 | **hl:web 404 page echoes the decoded path as text/html** | reflected XSS: `/nope%3Cscript%3E…` | **HIGH** (hl:web) | **n (STOP, Hybriel)** | prints `known:` || 3 | **/__hl/upload open to anyone** (900 MB announced by a signed-out visitor, parts kept in memory) | no face takes a file | MEDIUM | **y** `uploadMax = 0` (project.hl) | "/__hl/upload … 413" || 3 | git push body: 500 MB cap checked after the body is read; temp files in storage/git/.tmp | only the owner can push (token); anonymous upload-pack bodies are small in practice | low, open | n | – || 4 | **session cookie without `Secure`** (https prod) | HttpOnly + SameSite=Lax + Domain were set; Secure was not | MEDIUM | **y** `sessionSecure = scheme == 'https'` | "cookie: Secure …" || 4 | **session fixation**: `/login/callback` reused the cookie's session | a cookie planted before the button login became the logged-in one | MEDIUM | **y** (lib/api.hl: new session per login, old one logged out) | "login rotates…", "pre-login cookie does not act" || 4 | session fixation via the selector face `gitoriaLogin` | a face cannot set a cookie | low | n (hl:web, see .scratch) | – || 4 | logout, code reuse, junk codes | logout ends the user of the session; a login code works once | ok | – | "logout", "a login code works once" || 4 | CSRF | SameSite=Lax only; /__hl/emit and the WebSocket check no Origin and faces cannot read headers | low-medium (hl:web) | n | prints `known:` || 4 | rate limits login/exchange | none in gitoria; every callback/face call causes one ident exchange (ident has its own IP limits, IDENT_IP_LIMIT); codes are one-time | low, open | n | – || 4 | login CSRF (no `state` bound to the session in ident's button flow) | an attacker's code in a victim's browser logs the victim in as the attacker | low, open (needs an ident flow change) | n | – || 5 | **ident identity id in the page data** of a signed-in user (`myUser` record in components/tokens.hl, sshkeys.hl — users.hl says it "never goes to a page") | own identity (public short id) in the seed of `/` | low | **y** (`userIdOfSession`, only the @id is kept) | "pages carry no secret" || 5 | secrets in pages / seeds / modules / API / errors / git history (57 commits, patterns for ident secret, ssh secret, gtr_/tktc_/tkt_ tokens, private keys, .env, db files) | none; only test placeholders in tests | ok | – | "pages carry no secret", "served client modules…" || 6 | **nosniff** on function-route answers (API JSON/Markdown, redirects, /__git/*, git transport, 401) | was missing | low | **y** | "X-Content-Type-Options: nosniff — …" (7) || 6 | **CSP, X-Frame-Options/frame-ancestors, Referrer-Policy, nosniff on HTML pages** | none (hl:web has no hook for page headers; maybe nginx on Byrodin adds some — not probed) | MEDIUM (hl:web) | **n (STOP)** | prints `known:` |hl:web items with repro: `.scratch/SG-hlweb-gaps.md` (5 items; also copied into the main repo's .scratch/).## Gates (ports 8900–8919)- before (main): browser gate 232 passed, 0 failed; check-theme 48 files, 0 problems.- after (sg-sec): browser gate 232 passed, 0 failed (same count); check-theme 48 files, 0 problems; security gate 69 passed, 0 failed.- NEW gate for deploy.sh GATES (Atlas adds it): `node tests/security.mjs` (env: GITORIA_SEC_PORT, GITORIA_SEC_PORT2, GITORIA_SEC_IDENT_PORT; deploy-init.sh suggestion: 8767, 8780 (second server), 8768). It starts two gitoria servers and one ident, no Chrome.## Open items1. hl:web: 404 reflected XSS (HIGH), page security headers, Origin check on emit/WebSocket, face-level session rotation, upload caps (Anton/Arachne).2. Login CSRF (state), no gitoria-side rate limit on the exchange, anonymous git POST body is read fully before the 500 MB check, anyone with an ident name may open tickets in any connected repo (design).3. Check on Byrodin (nginx, not probed): does it add security headers / body-size limits? If yes, the "pages" row drops to low.
Branches
- f1-broken-json
- f2-api-bugs
- gp-gate-ports
- heap-revert
- hl25-records
- ident-chooser-selector
- mainmain branch
- p51-public-pr-reads
- records-1112
- s25-no-session-on-login-error
- v59
- w52-person-approval
- w52b-approval-followup
- w52c-header-phone
- w53-pulls-speed-pr
- w54-repo-rename-pr
- w55-rename-org
- w56-owner-members
- w62-pr-close
- w63-force-push
- w64-org-slash
Latest commits
- 477d7bdcMerge branch 'p50'mre
- 00efc06fP50 reportmre
- e3f85afblog: commit mention slipmre
- 4d1a4cf4log: #25 numbersmre
- 1af0a60ddocs: H25 run() correctionmre
- eefa2dbcRepo setting: refuse direct pushes to the main branch (pre-receive over HTTPS and ssh)mre
- 8c8ba2f1log: PR flow announcedmre
- fa00cd35log: Kunibert pings provenmre
- 3a68cfaclog: components decisionmre
- 87de8e31log: Kunibert connected to 9 app reposmre
- c22aff69log: PR-only rollout startedmre
- 25309981log: STOP and paused workers 2026-11-08mre
- 5286803alog: worker briefs and reports of 2026-11-08mre
- 85c86605log: 2026-11-08 Arachne on list shapemre
- cb634512log: 2026-11-08 keyed lists livemre
- 07c98d4aLists: keyed rows with @id, remove(id) and one whole-list assignment instead of hand-rebuilt loopsmre
- 0db0d81elog: 2026-11-08 day52 live, W30 startedmre
- b05f6d92tests/status: the gate's 3 s app token expired during the restart; it lives 60 s like status-keyedmre
- 1e8f4f0avendor: Hybriel set-day52 (fault-path leak fix #335, keyed rows #331)mre
- f5f0fb7blog: 2026-11-08 day50/#29 live, H25 correction, V52 startedmre