Files
bdinvite/.env.example
T
kiskaadee 30d9a889a3 feat(security): harden authentication edge cases and verify deployment independence
- Reject forged, replayed, and expired CSRF state with HTTP 400 Bad Request
- Enforce cryptographic validation rejecting tampered ID token signatures and mismatched/missing nonces with HTTP 401 Unauthorized
- Reject missing, invalid, or mismatched PKCE code_verifier with HTTP 401 Unauthorized (InvalidCodeVerifierError)
- Invalidate expired ID tokens and session cookies returning HTTP 401 Unauthorized
- Enforce role-based access control blocking authenticated non-admin users from admin APIs with HTTP 403 Forbidden
- Eliminate legacy Remote-User trust ensuring session identity strictly governs authorization
- Document and verify dual deployment modes (Standalone Mode vs Homelab Production Mode behind Traefik TLS proxy)
- Add comprehensive security hardening regression suite (tests/test_security_hardening.py) and .env.example template
- Ensure clean multi-stage Docker build
2026-10-03 01:26:05 -05:00

56 lines
2.3 KiB
Bash

# ==============================================================================
# BDInvite Environment Configuration Template (.env.example)
#
# BDInvite supports two operational deployment modes configured via environment:
# 1. Direct Standalone Mode (local dev & testing with mock-oauth2-server or Keycloak)
# 2. Homelab Production Mode (behind Traefik TLS proxy with Authelia or OIDC IdP)
# ==============================================================================
# ------------------------------------------------------------------------------
# 1. General Service Configuration
# ------------------------------------------------------------------------------
SERVICE_NAME=bdinvite
SERVICE_DOMAIN=demos.roadtotech.me
BASE_PATH=/birthday
APP_PORT=8000
DATABASE_URL=sqlite:///./data/bdinvite.db
DATA_DIR=./data
# ------------------------------------------------------------------------------
# 2. OpenID Connect (OIDC) Authentication Settings
# ------------------------------------------------------------------------------
# Mode A: Standalone Mode (Default Local Development)
# OIDC_ISSUER=http://localhost:8088/default
# OIDC_CLIENT_ID=bdinvite-client
# OIDC_CLIENT_SECRET=bdinvite-secret
# OIDC_REDIRECT_URI=http://localhost:8000/birthday/api/auth/callback
# Mode B: Homelab Production Mode (Traefik TLS + Authelia / IdP)
# OIDC_ISSUER=https://auth.roadtotech.me
# OIDC_CLIENT_ID=bdinvite
# OIDC_CLIENT_SECRET=change-me-to-production-secret
# OIDC_REDIRECT_URI=https://demos.roadtotech.me/birthday/api/auth/callback
OIDC_ISSUER=http://localhost:8088/default
OIDC_CLIENT_ID=bdinvite-client
OIDC_CLIENT_SECRET=bdinvite-secret
OIDC_REDIRECT_URI=http://localhost:8000/birthday/api/auth/callback
OIDC_GROUPS_CLAIM=groups
# OIDC_GROUP_CLAIM_PATH=realm_access.roles
# ------------------------------------------------------------------------------
# 3. Browser Session Management Settings
# ------------------------------------------------------------------------------
SESSION_COOKIE_NAME=bdinvite_session
# Set SESSION_COOKIE_SECURE to true in production behind HTTPS/TLS reverse proxy.
# Set to false only for local standalone testing over plain HTTP.
SESSION_COOKIE_SECURE=false
# Session cookie SameSite attribute ("lax", "strict", "none")
SESSION_COOKIE_SAMESITE=lax
SESSION_COOKIE_PATH=/
# SESSION_COOKIE_DOMAIN=roadtotech.me
SESSION_EXPIRE_SECONDS=86400