Skip to content

Security hardening: safe previews, proxy header trust, input validation - #27

Merged
codemastervy merged 1 commit into
mainfrom
security-hardening
Nov 13, 2026
Merged

codemastervy merged 1 commit into
mainfrom
security-hardening

Conversation

@codemastervy

Copy link
Copy Markdown
Owner

Fixes found in a security review:

  • Stored XSS via inline preview – any file was served inline from the app's origin with its guessed type, so an HTML or SVG file on a share ran script with the signed-in session (which holds SMB credentials). Only inert types are shown inline now.
  • Login throttle bypass – uvicorn ran with --forwarded-allow-ips=*, so any client could forge X-Forwarded-For. Now defaults to 127.0.0.1; set FORWARDED_ALLOW_IPS to your proxy's IP if you use one.
  • Host/share validation, http(s)-only recovery link, security headers, pinned actions.

85 backend tests pass, including new regression tests.

- inline preview only serves inert types (images, video, audio, PDF, plain
  text); HTML/SVG and everything else is forced to download with nosniff and
  a sandbox CSP, so a file on a share cannot run script in this app's origin
- security headers on every response (CSP, X-Frame-Options, nosniff,
  Referrer-Policy, no-store on the API)
- stop trusting X-Forwarded-* from every peer: it let any client forge its
  address and bypass the failed-login throttle. FORWARDED_ALLOW_IPS now
  defaults to 127.0.0.1 and is documented for reverse-proxy setups
- validate host and share name (no separators), range-check port on update,
  and restrict the recovery link to http(s)
- CI: pin actions by SHA, read-only token; stop the bimonthly update from
  committing its own report files
@codemastervy
codemastervy merged commit 0f2c599 into main Nov 13, 2026
3 checks passed
@codemastervy
codemastervy deleted the security-hardening branch November 13, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant