10 Commits

Author SHA1 Message Date
Sebastion
271eaed9f8 address review: allow same-origin requests, only enforce CORS on cross-origin 2026-05-01 11:10:59 +01:00
Sebastion
d20921e9d0 fix(httpServer): restrict CORS to allow-listed origins (CWE-942)
Previously the file server unconditionally returned
Access-Control-Allow-Origin: * together with
Access-Control-Allow-Credentials: true. While most browsers reject
that combination, several edge cases (HTTP/2 intermediaries, non-
browser clients, and reverse proxies that rewrite ACAO) still permit
cross-origin authenticated requests, allowing CSRF-style abuse of
/upload, /delete, etc.

This change introduces an ALLOWED_ORIGINS env var. The server now:
  * Echoes the request Origin only when it appears in the allow list
  * Sends Allow-Credentials: true only alongside an explicit origin
  * Adds Vary: Origin to prevent cache poisoning
  * Rejects cross-origin requests with a non-allow-listed Origin
  * Defaults to no allow-listed origins (same-origin only)
2026-05-01 03:34:38 +01:00
troyeguo
529bc0cc19 refactor: replace console.log with console.info for consistent logging 2026-04-14 09:10:18 +08:00
troyeguo
8a799e2a81 format with prettier 2026-01-28 16:10:13 +08:00
troyeguo
b2b8b14310 feat: add support for Docker Secrets to manage server credentials securely 2025-06-13 16:28:28 +08:00
troyeguo
936eef8379 feat: update Docker configuration to use port 8080, enhance README and docker-compose for new settings 2025-06-08 15:25:09 +08:00
troyeguo
95e355ffb7 feat: enhance Docker support, improve file upload handling, and update UI for Docker configuration 2025-06-04 16:39:30 +08:00
troyeguo
8ba74a80a8 feat: add file deletion and listing functionality, enable server control via environment variable 2025-06-04 10:46:53 +08:00
troyeguo
b7fcc841a5 feat: enhance file upload and download functionality with authentication, improve directory handling, and set environment variables in Dockerfile 2025-06-02 21:37:50 +08:00
troyeguo
ebda293d55 feat: add Node.js support in Caddy Docker image, implement file upload and download functionality 2025-06-02 21:10:15 +08:00