tickets
All repositories: gitoria
6.3 KB
# ST — tickets security audit (2026-10-23)Method: a real local instance (own store, ident stub, ports 8840–8859), real HTTP (fetch), page faces via POST /__hl/emit, real headless Chrome (390×844 touch DPR 3 and 1280×800). Users: alice (admin sa), bob (use), carol (admin sc, none in sa), dave, signed out. Live site never touched. Branch `st-sec`. Gate: `tests/security.mjs` (~300 checks).Reads are public by design (tickets, projects, history, events); attachments are members-only.| # | check | result | severity | fixed | test (tests/security.mjs) ||---|---|---|---|---|---|| 1a | AuthZ signed out: 17 write routes → 401; /api/inbox, /api/events, attachments 401; 19 faces refused | ok | – | n/a | §1 || 1b | AuthZ outsider / role `use`: every write route and face (ticket, comment, state, edit, assign, members, invites, settings, connections) 403; bob may comment + like only; comment edit/delete author-only; others' token revoke refused; forged `session` arg refused | ok | – | n/a | §1b/1c || 1c | **Relations across projects**: `mayLink` wanted edit in EITHER ticket's project, so a member of any project could set a parent / blocker on (and write a history event into) a ticket of a project where they have no role, e.g. block someone else's ticket | real | **Medium** | y: edit/admin needed in the project of the ticket whose relation changes (README + messages updated) | "authz relations" ×8 [fix] || 2a | Injection: subject/summary/comment/project title/connect label with `<img onerror>`, `<script>`, `javascript:` / `data:` links → text only (real Chrome: nothing ran, no javascript:/data: href, https link has noopener noreferrer); filenames (`../`, CRLF, quotes) cleaned, headers clean; connect return URL (userinfo, suffix, `\`, `#`, `//`, javascript:); login `next=` (open redirect, CRLF); traversal (`..`, `%2e%2e`, `.env`, sources, storage); no SSRF (only fetch is the configured ident) | ok | – | n/a | §2, §7 || 2b | Connect return host accepted `%` (`evil.com%2F.worldapi.org`; browsers reject it, still wrong) | real | Low | y | "inject connect return" || 2c | A subject could hold line breaks / control chars (`## injected` line in the Markdown view that programs read) | real | Low | y: `oneLine` on create + edit | "inject [fix ST]" ×3 || 3a | Uploads: 10 MiB/file → 413, 11 files → 400, 27 MB → 413, empty → 400, content decides type (HTML/SVG named .png refused; svg/html/txt served as download), nosniff + sandbox CSP + CORP + private cache, only members (cookie, token) fetch | ok | – | n/a | §3 || 3b | **5 MB JSON body (any token holder) froze the single-threaded server for 18+ min at 100 % CPU** (jsoncheck.hl walks it character by character) | real | **High** (DoS) | y: JSON body > 1 MiB → 413 before it is read (`maxJsonBytes`) | "limits [fix ST]" ×2 || 3c | `/__hl/upload` over uploadMax answers 500; no body cap in hl:http1 | hl:web/http1 | Medium | no – Arachne (known) | note || 4a | Cookie `hlsid`: HttpOnly + SameSite=Lax, **no Secure**, default name shared with sibling hosts' fixation | real | Medium | y: `ticketssid`; behind https `__Host-ticketssid` + Secure (TICKETS_PUBLIC_URL). **At deploy every browser signs in once again; API tokens/keys unaffected** | "cookie [fix ST]" || 4b | **Session fixation** in /login/callback (cookie planted before login became the signed-in one) | real | Medium | y: new session per login, old one logged out (as gitoria SG). Face `identLogin` rotation = hl:web (known) | browser.mjs "login (ST)", security "session fixation" ×2 || 4c | CSRF: JSON API takes only bearer tokens (cookie ignored, 401); faces/ws Origin check = hl:web (known) | ok / known | – | n/a | §4 || 4d | Logout kills the cookie session (youData null, faces refused); tokens live until revoked on /you | ok | – | n/a | §4 || 4e | Rate limits: none on /login/callback (ident code single use), /api/connect/exchange (192-bit code). **`/connect` (open to anyone) added a stored row per call, forever** | real | Low–Medium | y: expired requests dropped, max 300 waiting → 429 | "limits [fix ST]" || 4f | Every first visit mints a session file (anonymous disk growth) | hl:web | Low | no – Arachne | note || 5 | Secrets: pages/seeds/JSON hold no secret, token, hash, identity id of others (only /you shows own); log has none; ident key `pk_` is public; git history: no .env/storage/sessions/real keys (test fixtures only — checked by pattern, nothing printed) | ok | – | n/a | §5 || 6a | Headers on function routes (JSON, markdown, 401, redirects, error pages, 404s): none | real | Low | y: nosniff, X-Frame-Options DENY, Referrer-Policy no-referrer, CSP default-src 'none'; inbox no-store | "headers [fix ST]" ×5 || 6b | Pages: no CSP / nosniff / XFO / frame-ancestors / Referrer-Policy from hl:web (Arachne w115 hook pending) | hl:web | Medium (clickjacking) | partly: CSP `<meta>` (object/base/frame/form restricted; script/connect allow IDENT_URL for selector.js) + referrer meta; real Chrome: no CSP violation, attachment pictures load. frame-ancestors/XFO = hl:web or nginx | "page [fix ST]", §7; strict notes with SEC_STRICT=1 || 6c | `/api/events` answers `Access-Control-Allow-Origin: *` (hl:http1 native SSE); bearer-only, no credentials | accepted | Info | n/a | "cors" |Old code on the same file: 201 passed, 13 failed + crash at the 5 MB body (server wedged). New: see below.## Gate counts (new code)security (new) 300 passed + 2 stub-only (selector.js 404 from the ident stub, filtered afterwards, not re-run: quota) · browser 406/0 (MT 405 + 1) · events 52/0 · check-theme 46 files 0 problems.Test edits forced by the cookie name / rotation: `hlsid`→`ticketssid` in browser/events/e2e-*/realdata tests; browser.mjs follows the rotated cookie.**deploy.sh**: add `"node tests/security.mjs"` to GATES. Env for deploy-init: `TICKETS_SEC_PORT=8767` (uses P, P+1 ident stub, P+2 https server), `TICKETS_SEC_CHROME=8770-8774` (default 8855-8859).## Open items1. hl:web: page response headers (frame-ancestors, nosniff, XFO), Origin check on emit/ws, face-level session rotation, upload/body caps, 500 on oversize /__hl/upload, anonymous session minting (Arachne w115 pending re-vendor). 2. No per-IP rate limit on login callback / exchange (nginx). 3. No length cap on subject/summary/comment text beyond 1 MiB body. 4. API tokens never expire; unlimited projects/tokens per user. 5. Login CSRF via the ident code (low, as gitoria). 6. Page seeds list `file.hl:line` site markers (hl:web).
Branches
Latest commits
- 5d144817Merge branch 'records-t40' into mainTickets
- 44ee6f06|||PR records: #43 #45 livemre
- b8fdeee9Merge branch 'p39-routes' into mainTickets
- a0187a0a|||PR Remove redundant route-order loopmre
- 369e4b9cMerge branch 'k40-lists' into mainTickets
- 9af8e780|||PR Use keyed list mutations for live ticket updatesmre
- 610d8e8aMerge branch 'records-t39' into mainTickets
- 32bcdf24|||PR records: GO P39 K40mre
- 4123c6d1Merge branch 'records-t38' into mainTickets
- cd3641a1|||PR records: day72 deploy live, tickets closedmre
- 7d44d852Merge branch 'records-t37' into mainTickets
- 926f7061|||PR records: merges, D36 deploymre
- bf58534eMerge branch 'l33-final' into mainTickets
- 759a9ac3|||PR thin login (tickets#46, #45): merge main, route entry cleanupmre
- 239436d8Merge remote-tracking branch 'origin/main' into l33-finalmre
- 5822cb3aMerge branch 'o34-clean' into mainTickets
- 0870653c|||PR offline note from __hlOnline, no polling (tickets#41)mre
- 14cf96b4Merge branch 'records-t36' into mainTickets
- 07749fa1|||PR records: day72 + #40 mergedmre
- ecd7e226|||PR Consolidate login and move handler logic into topic libraries (partial)mre