Repository navigation
Description
Problem: secfoo serve binds 127.0.0.1:8787 by default, which stops other hosts, but not the user's own browser. The FastAPI app has six POST routes (src/secfoo/web/routes/assessments.py and activities.py): create assessment, bulk status, launch runs on an assessment (/assessments/{id}/runs, which starts a paid agent run), upload attachments, delete an assessment, and review a SAST finding. There is no CSRF token, no Origin/Referer check, no TrustedHostMiddleware (DNS rebinding reaches the app with a foreign Host), and no cookie or header a browser would refuse to send cross-site. A page the user visits while the dashboard is running can fetch("http://127.0.0.1:8787/assessments/1/runs", {method: "POST", body: …, mode: "no-cors"}) and trigger scans, delete case files or flip finding reviews. --allow-insecure-runtime and the runtime ingest API-key path need the same review. Markdown rendering already disables raw HTML and tests/test_web/test_no_inline_scripts.py exists, but there is no systematic XSS corpus for report content, which is agent output over untrusted repositories.
Build:
- Cross-site protection for every state-changing route: reject requests whose
Origin(orSec-Fetch-Site) is not same-origin, and addTrustedHostMiddlewareallowinglocalhost,127.0.0.1,[::1]and the--hostvalue. A double-submit CSRF token on the HTML forms is fine as a second layer, but the Origin check is what protects againstfetchfrom other sites. Tests: a cross-origin POST gets 403, a same-origin one works. - Ingest and runtime routes: confirm the API-key check applies to every mutating runtime endpoint, keys compare in constant time, and
--allow-insecure-runtimeis documented with exactly what it disables. - Response headers:
Content-Security-Policy(the app already avoids inline scripts),X-Content-Type-Options,Referrer-Policy,X-Frame-Options: DENY; tests assert them on every route. - XSS regression corpus: reports containing
<img onerror>,javascript:links, Markdown link titles with quotes, HTML entities in headings, SVG, data URIs, and Mermaid blocks with script content; assert the rendered page contains none of them executable. Cover the finding detail pages and the attachments download (Content-Disposition, served as octet-stream). - Upload handling: size limits and type checks on
/assessments/{id}/attachments(docext.pyparses PDF/DOCX/PPTX; fuzz the parsers for 60 s following thefuzz/harness pattern). - Write the findings and fixes up in
SECURITY.mdunder "Local dashboard threat model".
Where to look: src/secfoo/web/app.py, src/secfoo/web/routes/*.py, src/secfoo/web/templates/**/*.html (the method="post" forms), src/secfoo/report/markdown.py, src/secfoo/docext.py, tests/test_web/, fuzz/.
Done when: every POST route has a cross-origin rejection test; headers tested; the XSS corpus runs in pytest tests; upload limits enforced; SECURITY.md updated with what was found and fixed.
Activity
fix(context): close symlink and dashboard holes, harden brief and cov…
feat(context): --context sources with host classification, MCP reader…
security: dashboard refuses cross-site writes and foreign Host headers (
aaas72 commentedon Nov 20, 2026
Hi! I'd like to take this one too, after #112. Plan: an Origin / Sec-Fetch-Site check on every state-changing route (cross-origin POST gets 403, same-origin works) plus TrustedHostMiddleware for localhost, 127.0.0.1, [::1] and the --host value; an audit of the runtime ingest routes (API key on every mutating endpoint, constant-time compare, documented --allow-insecure-runtime); CSP, X-Content-Type-Options, Referrer-Policy and X-Frame-Options asserted on every route; and an XSS regression corpus for report content (img onerror, javascript: links, quoted link titles, entities in headings, SVG, data URIs, Mermaid with script).
security: XSS corpus, bounded uploads and runtime API audit for the d…