gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit4348dbab4348dbabident#31: the selector's sign-in returns to the page the user started on (return attribute = the login callback with next), gate checkmre4348dbab/reports/ST-sec.md

6.3 KB

  1. # ST — tickets security audit (2026-10-23)
  2. 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).
  3. Reads are public by design (tickets, projects, history, events); attachments are members-only.
  4. | # | check | result | severity | fixed | test (tests/security.mjs) |
  5. |---|---|---|---|---|---|
  6. | 1a | AuthZ signed out: 17 write routes → 401; /api/inbox, /api/events, attachments 401; 19 faces refused | ok | – | n/a | §1 |
  7. | 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 |
  8. | 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] |
  9. | 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 |
  10. | 2b | Connect return host accepted `%` (`evil.com%2F.worldapi.org`; browsers reject it, still wrong) | real | Low | y | "inject connect return" |
  11. | 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 |
  12. | 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 |
  13. | 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 |
  14. | 3c | `/__hl/upload` over uploadMax answers 500; no body cap in hl:http1 | hl:web/http1 | Medium | no – Arachne (known) | note |
  15. | 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]" |
  16. | 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 |
  17. | 4c | CSRF: JSON API takes only bearer tokens (cookie ignored, 401); faces/ws Origin check = hl:web (known) | ok / known | – | n/a | §4 |
  18. | 4d | Logout kills the cookie session (youData null, faces refused); tokens live until revoked on /you | ok | – | n/a | §4 |
  19. | 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]" |
  20. | 4f | Every first visit mints a session file (anonymous disk growth) | hl:web | Low | no – Arachne | note |
  21. | 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 |
  22. | 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 |
  23. | 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 |
  24. | 6c | `/api/events` answers `Access-Control-Allow-Origin: *` (hl:http1 native SSE); bearer-only, no credentials | accepted | Info | n/a | "cors" |
  25. Old code on the same file: 201 passed, 13 failed + crash at the 5 MB body (server wedged). New: see below.
  26. ## Gate counts (new code)
  27. 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.
  28. Test edits forced by the cookie name / rotation: `hlsid`→`ticketssid` in browser/events/e2e-*/realdata tests; browser.mjs follows the rotated cookie.
  29. **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).
  30. ## Open items
  31. 1. 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

  • 4348dbabident#31: the selector's sign-in returns to the page the user started on (return attribute = the login callback with next), gate checkmre
  • 66ef3005Merge branch 'iw-ident-widget'mre
  • bc0ad663tickets: a gap between your name and Log out in the phone header (they touched); gate checks itmre
  • 2f818d46UX2: report, LOG line, e2e fixes, gate pause after loadmre
  • af3ef7c4gate: the legacy state line says progressmre
  • 62480a00tickets#33: a state change with a note is a comment card in the feed (same framework rendering, can be liked, edited, deleted), its state line stands alone; gate checks for a new comment with and without a state change, at once and after a reloadmre
  • 4ae80007UX: Respond is one composer (state in its footer, button says what happens); New ticket / New project windows in the list heading row; project form shared; theme copied from layouts; gates and a lisbeth e2emre
  • f03b438atickets header: the selector alone top right plus your name and Log out as before the theme missions; the user icon is gonemre
  • 81f10e4eident selector back in the header (creator 2026-10-24): selector top right signed in and out on phone and desktop, no second Log in button, new gate checks (WIP: gates not re-run after the last edits)mre
  • e9f428e7tools: reown-authors (tracker#36: every author that is not Caramboleyo or Apollo becomes the project's conductor; antcolony, miserit-anthar, hybrilior, termuplex stay) and a read-only author surveymre
  • f51029abMerge branch 'sy-sync'mre
  • eae6e8c7sync components.hybriel 4922f9c: comments like / Edit / Delete / 'edited' are 44 px targets; gate: 'edited' hit-area padding, thread targets check (SY)mre
  • 0de4750btheme: sync from layouts 4994037 (list rows stack, td word-keep, heading code, edited tap target)mre
  • 4eeb7bfeST2 report wordingmre
  • 2558f56cst2-sec: keep the hlsid session cookie name (no one is signed out), Secure flag only; gate: a cookie issued by main stays signed in; ident stub serves selector.js; security.mjs in deploy GATESmre
  • ea2e440esecurity audit (ST): JSON body cap, relation rights, login session rotation, __Host- Secure cookie, API security headers, CSP+referrer meta, /connect cap, one-line subjects, tests/security.mjs, reportmre
  • 7c8c2282sessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
  • b6277497report MT-mobile, LOGmre
  • 6709398blist paging: the newest rows come first (the sorted array was not used); filter rows hide their scrollbar; gate checks the ordermre
  • 31736a80gate: member-name check fails on the old row layout toomre