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
- 00517fafgitoria: shell 404 page for unknown paths (catch-all route, status 404, JSON 404 under /api), 390 gate checksMG
- d9e977f0reports/MG-mobile.md, LOGMG
- 2f2725actests/browser.mjs: commit-row check (one row, centred date)MG
- 4df1ea01tests/browser.mjs: MG phone checks (list first, no dead strip, one branch heading, tab grid, commit rows, PR title row, ticket columns, wrapping commands)MG
- c52424e9gitoria mobile: repo list before the forms, 3x2 tab grid, no duplicate branch heading, ordered commit rows, aligned ticket rows, pull title on its own row, wrapping clone commands, no dead strip under formsMG
- 3a95252dG3: cache parsed README blocks by sha256 of the text (bounded LRU), reportmre
- 570138cddeploy: security gate (tests/security.mjs)mre
- da6b20fcgitoria SG: security audit fixes (uploadMax 0, Secure cookie on https, session rotation at login, nosniff on function routes, no identity in page data) + tests/security.mjs gate + reportmre
- f98c981fgitoria B1: report wordingmre
- c6364cedgitoria B1: compact Markdown blocks (one kind flag per block/span, empty and false fields omitted); same rendered HTML, page values -67%mre
- cd99d2feWIP gitoria#22: always render the repo level's slot (missing-repo boot hang), pages render nothing without a repo; hydration diagnosis in reports/G2-hydrate.mdmre
- e5404b9breport: commit idsmre
- 63cfa21ereports/G2-repotabs.mdmre
- 9b0516fdgitoria#22: mark the tab underline functional (check-theme), chain E2E: serve/measure split, bring the lisbeth tab to frontmre
- 19bc1df8gitoria#22: all repo pages under ONE layout level (components/repo.hl, hl:web D-CHAIN): a tab click replaces only the page in the slot; head and tab nav stay the same DOM nodesmre
- 40658417tests/browser.mjs: wait for the page to be live (hydrated) before clicking Merge — a click on the server-rendered button before the client mounted was lost (flaky 'Clashing change' under load)mre
- 48a6154bre-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
- e972e8d7tests: short-id-switch (GITORIA_SWITCH_IDENT_PORT/_PORT) and ssh tunnel (GITORIA_GATE_TUNNEL_PORT) ports from env, defaults unchangedmre
- f06f5349re-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
- c7d3cc87docker-compose: nofile 65536 (Hybriel int 6+ boot opened >1024 files in the tracker)mre