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
- 097c52baStyle the login error through its View idmre
- c6d9c86aOwn the not-found code rule in its componentmre
- 055424c2Record W61 replacement theme gates, sidebar repro and baselinemre
- 2ed09441Use layouts theme 17e0f03 for W61 compatibilitymre
- b8609a91Merge branch 'main' into w61-stylemre
- 4639caf7Report W61 theme startup blocker and day39 Style probemre
- 81f0a0bbREADME: two caches were restored by 90b4f72; log W62mre
- 4a3f557eImport layouts theme ebd00b6 for W61 (startup blocked)mre
- ab12a257Merge W62: #25 commit page measurements and proc repromre
- 41323e49gitoria#25: measure commit request costs and reproduce blocking process waitsmre
- 53ca42b2log: W60 merged, W61 W62 startedmre
- 80870a33mission W61: style passmre
- 560fd208Merge W60: helpers, bound forms, login in topics, two form fixes (gitoria#28 #32 #33)mre
- ac5ba6a4log: W60, #25 measuredmre
- 220f6342W60: record corrected form proof, full AE and remaining gapsmre
- 7e31cac5gitoria#28: restrict reply form layout to reply formsmre
- ae373cfdgitoria#28: keep each reply draft in its thread componentmre
- eeeebd5agitoria: insert a newly created organization oncemre
- 34d2d5cagitoria: clear the bound public-key textarea after creationmre
- 119e54c0W60: restore conductor-owned tracking filesmre