NextMyDay/internal/core
Claus Lohmar 03a9db03dc fix(security): harden httpx — XFF hops, __Host- cookie, isolation headers
REVIEW-001 (M0) perimeter findings:

- H1: resolveForwarded walked X-Forwarded-For left→right and returned the
  leftmost untrusted entry. An append-style proxy (nginx's default) appends
  the peer it saw to the RIGHT of whatever the client sent, so the leftmost
  entry is attacker-controlled — a fresh rate-limit bucket per request (A3)
  and a forged client_ip in the audit trail (A11/D-031). Walk right→left and
  return the first untrusted entry, falling back to the peer.
- L1s: the session cookie now carries the `__Host-` prefix when it is Secure
  (https), so it is pinned to the exact origin and cannot be shadowed from a
  sibling subdomain. Conditional on purpose: a browser rejects a `__Host-`
  cookie without Secure, which would break the http loopback bootstrap.
- L4s: add Permissions-Policy, Cross-Origin-Opener-Policy and
  Cross-Origin-Resource-Policy.
- Add httpx.IsLoopbackIP: a RESOLVED client IP test that fails closed on an
  empty/unparseable value (the setup-mode gate, H2), sharing a classifier
  with IsLoopbackHost whose "unknown" direction is the opposite, each
  fail-closed for its own decision.

Tests updated: the unit test encoding the vulnerable leftmost expectation is
rewritten, plus right→left/forged-entry/host-classification coverage.
2026-10-14 11:29:52 +00:00
..
audit feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
auth feat(auth): add WebAuthn, TOTP and the enroll/login flow (SPEC-004/006) 2026-10-14 10:53:53 +00:00
config feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
httpx fix(security): harden httpx — XFF hops, __Host- cookie, isolation headers 2026-10-14 11:29:52 +00:00
mail feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
middleware feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
module feat(module): add the module registry, discovery and the home module (SPEC-008) 2026-10-14 10:53:57 +00:00
recovery feat(recovery): add the admin recovery flow (SPEC-007) 2026-10-14 10:53:53 +00:00
routing feat(routing): add the pure routing model (SPEC-002) 2026-10-14 10:53:48 +00:00
server feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
setup feat(setup): add the /setup bootstrap wizard (SPEC-005) 2026-10-14 10:53:53 +00:00
store feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
users feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
web feat(web): add the web shell and the PWA (SPEC-009) 2026-10-14 10:53:57 +00:00