Commit graph

9 commits

Author SHA1 Message Date
Johan Lundberg
519e3659a1
feat(security): add baseline security-header middleware
No security headers were set. Add SecurityHeadersMiddleware applying
Content-Security-Policy (configurable), X-Content-Type-Options: nosniff,
X-Frame-Options: DENY, Referrer-Policy, and Strict-Transport-Security on
HTTPS deployments. Verified HTMX/WebAuthn/forms still work under the CSP.

Refs: porchlight-1ph

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 08:53:49 +02:00
Johan Lundberg
cba63280fb
fix(security): set an explicit session cookie lifetime
The session cookie relied on Starlette's default max_age (two weeks), which is
easy to miss and longer than an OP session should live. Add a session_max_age
setting (default 8 hours) and pass it to SessionMiddleware.

Refs: porchlight-1lg

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 10:26:57 +02:00
Johan Lundberg
cf2754f302
fix(security): require a configured session secret in production
session_secret defaulted to a random per-process value, which silently
invalidates all sessions on restart and rotates the management client secret.
Add _resolve_session_secret(): use the configured secret; allow a generated
one only in debug or for a localhost issuer; otherwise fail startup. The
management client secret is now tied to the resolved session secret.

Refs: porchlight-wvx

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 14:12:54 +02:00
Johan Lundberg
01e3382aaf
fix: resolve all ruff lint errors and type checker warnings
- Use Annotated[str, Form()] for FastAPI dependencies (FAST002)
- Add missing type annotations across src/ and tests/ (ANN001/003/201/202)
- Reduce function arguments via request.form() reads (PLR0913)
- Combine return paths to reduce return statements (PLR0911)
- Use anyio.Path for async-safe filesystem operations (ASYNC240)
- Extract constants, helpers, and dict comprehensions for clarity
- Move inline imports to top-level (PLC0415)
- Use raw strings for regex match patterns (RUF043)
- Fix redundant get_session_user call in delete_user (not-iterable)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 15:48:46 +02:00
Johan Lundberg
0435b81c5a
feat: add landing page at / with navigation links
Route GET / to a landing page with the Porchlight logo, tagline,
and card-style navigation links to My Account and Administration.
2026-02-19 15:38:09 +01:00
Johan Lundberg
7cb1adbd06
update all imports in test files: fastapi_oidc_op → porchlight 2026-02-16 15:34:53 +01:00
Johan Lundberg
84e61464c7
feat: add Porchlight branding with logo, favicon, and redesigned CSS theme
Rebrand from FastAPI OIDC OP to Porchlight with warm amber/gold identity:
- Add doorway-with-light SVG logo and 32x32 PNG favicon
- Rewrite style.css with full design system (color tokens, spacing scale,
  typography scale, section cards, button variants, dark mode)
- Update base template with site header, logo, and favicon
- Update all page titles and FastAPI app title to Porchlight
2026-02-16 12:08:19 +01:00
Johan Lundberg
a45604ff2f
feat: add lifespan integration and dependency injection 2026-02-13 13:59:59 +01:00
Johan Lundberg
6a8b41cd38
feat: add app factory with health endpoint and test infrastructure 2026-02-12 15:09:27 +01:00