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
- 6372b06dTickets conductor: worker port slotmre
- 836af31cTickets conductor: token pathsmre
- b03f11b6Tickets conductor: CONDUCTOR.md (project part), short STATUS.md, old STATUS to archive/2026-10-31mre
- a4123831tickets#42: the /connect and /login/callback error pages are app pages: the function routes redirect to /connect/failed/<code> and /login/failed/<code> (components/problem.hl, sentences in lib/problems.hl), htmlPage and its hand-written stylesheet are gone; gate tests/error-pages.mjsmre
- cefc7b4atickets: a startup error prints its message before exit 1 (hybriel#247)mre
- 99bd6570tickets: lib/migrate.hl writes no table of another topic any more: projects.hl rewriteSlug / addProjectNamed / hasMembers, tickets.hl moveToProject / ticketRecords / ticketRecordsOf, events.hl renameStates / eventRecords / eventRecordsOf; the migration calls them (tickets#47)mre
- b57161e3tickets: the markup names its own rules (Style.pMessage, Style.olTickets, ...) instead of hand-written class strings that copy a stylesheet rule; the shared bodies sit in lib/looks.hl (tickets#38)mre
- f767b24dtickets: 111 needless let became plain declarations (3 in ticket.hl, ticket_list.hl, comments.hl and 108 never-reassigned, not captured loop-body ones); the 212 really reassigned lets stay (tickets#44)mre
- 16c0d3b5tickets: the modal window is phone first: the full-screen sheet is the base rule, the centred window sits in the min-width 60rem block (tickets#39)mre
- 090ee809tickets: every component's styles in its own nested Style {} block; styles.hl keeps only the theme inherit, the accent and the site-wide rules (tickets#36)mre
- d395763ftickets: ident-access gate ports 8769/8768 (8797 is taken on loreana)mre
- afb9a403tickets: an ident access key (Authorization: Bearer idt_…) works in the API (ident#27 app side): lib/ident-access.hl copied from components, read keys GET only, ident down 503; gate tests/ident-access-tickets.mjsmre
- 48c1ba79tickets: md-paste-files gate with the file manager casesmre
- f04afc43tickets: MdEditor from components 59704ce (a file manager copy still attaches, pipe rows, tickets#49)mre
- 06599fa0tickets: MdEditor from components b0f1ec2 (a clipboard with text always pastes the text, tickets#49); real Ctrl+V gatemre
- 2e1b116ftickets: re-vendor Hybriel master acaceaf3 (framework ec8d6c1d): plugins/web patch queue while a page is built, anonymous session cookies refresh; gate waits for the comment editors to draw (W174) and clicks the form editor when it stands still; security gate: main's code runs on its own binary, lazy-session cookie checksmre
- 361bc0fetickets: re-vendor Hybriel 7a684920 (WIP, not deployed); on Error exits 1 at startup; migrate passes its log by reference; gate checks follow lazy sessions and the 413 refusalmre
- 8a69999cident#28: /login/callback never signs out the session it finds; a valid code puts the user on the same sessionmre
- 337e9b21tickets#37: a comment's files are open to everyone who can read the commentmre
- 1800600ftickets: write the standby service out in full so the boot gate can read the main servicemre