ulysses/core
Giuseppe 95c2dca4b5
fix(security): add HSTS and Permissions-Policy to SecurityHeadersMiddleware (#3081)
* fix(security): add HSTS and Permissions-Policy headers to SecurityHeadersMiddleware

Strict-Transport-Security is sent only when the connection is HTTPS
(detected via request.url.scheme or X-Forwarded-Proto: https), so
plain-HTTP dev deployments behind a reverse proxy are unaffected.

Permissions-Policy disables camera, microphone, and geolocation APIs
unconditionally — Odysseus does not use them, and this prevents a
successful XSS from requesting browser-native sensor access.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(security): scope Permissions-Policy microphone directive to same-origin

Reviewers on PR #3081 (alteixeira20, NubsCarson) flagged that
microphone=() blocks mic access for same-origin (self) too, breaking
Odysseus's own voice/STT flow (getUserMedia({audio: true}) in
static/js/voiceRecorder.js). Scope it to microphone=(self) so
third-party origins stay locked out while the app's own UI keeps mic
access; camera and geolocation remain fully disabled as unused.

Adds focused middleware tests covering HSTS scoping (HTTPS direct,
X-Forwarded-Proto, absent on plain HTTP) and the Permissions-Policy
same-origin microphone contract.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 04:58:33 +01:00
..
__init__.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
atomic_io.py Add native Windows compatibility layer 2026-06-01 15:09:47 +09:00
auth.py fix(auth): distinguish empty model allowlists (#2938) 2026-06-05 20:27:10 +02:00
constants.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
database.py feat(search): unify session transcript search (#2877) 2026-06-05 18:08:31 -06:00
exceptions.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
middleware.py fix(security): add HSTS and Permissions-Policy to SecurityHeadersMiddleware (#3081) 2026-06-07 04:58:33 +01:00
models.py fix: exclude slash-command/setup messages from LLM context (#2634) (#2640) 2026-06-04 21:42:23 +02:00
platform_compat.py Fix Windows Cookbook background tasks, exit statuses, and empty SSH logs wrapper (#1389) 2026-06-05 14:41:07 +02:00
session_manager.py Fix session cleanup cutoff timezone (#2488) 2026-06-05 09:52:34 +02:00