|
Some checks failed
CI/CD Pipeline / Backend Tests & AI Verification (push) Has been cancelled
CI/CD Pipeline / Frontend Tests & Build (push) Has been cancelled
CI/CD Pipeline / Security Scanning (javascript) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (python) (push) Has been cancelled
Enhanced Security Scans / CodeQL Analysis (javascript) (push) Has been cancelled
Enhanced Security Scans / CodeQL Analysis (python) (push) Has been cancelled
Enhanced Security Scans / Dependency Security Scan (push) Has been cancelled
Enhanced Security Scans / Python Security Scan (Bandit) (push) Has been cancelled
Enhanced Security Scans / Semgrep Security Scan (push) Has been cancelled
Enhanced Security Scans / Frontend Security Scan (ESLint) (push) Has been cancelled
Enhanced Security Scans / Docker Security Scan (push) Has been cancelled
Enhanced Security Scans / Secrets Detection (push) Has been cancelled
Migration Drift Check / drift (push) Has been cancelled
DB Migrations / alembic-sqlite (3.10) (push) Has been cancelled
DB Migrations / alembic-sqlite (3.11) (push) Has been cancelled
DB Migrations / alembic-sqlite (3.12) (push) Has been cancelled
DB Migrations / alembic-postgres (3.10) (push) Has been cancelled
DB Migrations / alembic-postgres (3.11) (push) Has been cancelled
DB Migrations / alembic-postgres (3.12) (push) Has been cancelled
DB Migrations / drift-check (push) Has been cancelled
Generate SBOM / Generate Software Bill of Materials (push) Has been cancelled
Security Scans / CodeQL Analysis (javascript) (push) Has been cancelled
Security Scans / CodeQL Analysis (python) (push) Has been cancelled
Security Scans / Snyk Security Scan (push) Has been cancelled
Security Scans / Dependency Vulnerability Scan (push) Has been cancelled
Security Scans / Semgrep SAST (push) Has been cancelled
Security Scans / Bandit Python Security Scan (push) Has been cancelled
Security Scans / ESLint Security Scan (push) Has been cancelled
Security Scans / Docker Security Scan (push) Has been cancelled
Security Scans / Secrets Detection (push) Has been cancelled
CI/CD Pipeline / Deploy Preview (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
Enhanced Security Scans / Security Summary (push) Has been cancelled
DB Migrations / smoke-api (push) Has been cancelled
DB Migrations / smoke-api-postgres (push) Has been cancelled
Security Scans / Security Summary (push) Has been cancelled
Finish the mirror cleanup: every github.com/TLimoges33/LifeRPG reference across CONTRIBUTING, docs, source, and plugin manifests now points to the Church forge. Verified clean by full leak sweep (0 hits). churchofmalware.org |
||
|---|---|---|
| .. | ||
| ai_models | ||
| alembic | ||
| tests | ||
| .dev_liferpg_key | ||
| .env.dev | ||
| .env.example | ||
| adapters.py | ||
| advanced_analytics.py | ||
| advanced_cache.py | ||
| advanced_gamification.py | ||
| advanced_rate_limiting.py | ||
| ai_assistant.py | ||
| ai_insights.py | ||
| ai_monitoring.py | ||
| ai_test_api.py | ||
| alembic.ini | ||
| analytics.py | ||
| api_docs.py | ||
| api_versioning.py | ||
| app.py | ||
| auth.py | ||
| authorization.py | ||
| backup_security.py | ||
| community_features.py | ||
| compliance_framework.py | ||
| config.py | ||
| crypto.py | ||
| data_retention.py | ||
| db_security.sql | ||
| db.py | ||
| demo_app.py | ||
| development_config.py | ||
| Dockerfile | ||
| gamification.py | ||
| gdpr_api.py | ||
| gdpr_compliance.py | ||
| health_monitoring.py | ||
| hooks.py | ||
| huggingface_ai.py | ||
| kms_rotate.py | ||
| legacy_import_api.py | ||
| legacy_importer.py | ||
| metrics.py | ||
| middleware.py | ||
| mobile_api.py | ||
| models.py | ||
| modern_dev.db | ||
| momentum_system.py | ||
| notifier.py | ||
| oauth.py | ||
| plugin_runtime.py | ||
| plugins.py | ||
| rbac.py | ||
| README_ENCRYPTION.md | ||
| README_OAUTH.md | ||
| README.md | ||
| realtime_notifications.py | ||
| request_limiter.py | ||
| requirements_ai.txt | ||
| requirements_full.txt | ||
| requirements.txt | ||
| schema.sql | ||
| schemas.py | ||
| secure_logging.py | ||
| security_monitor.py | ||
| security_tests.py | ||
| server.py | ||
| setup_ai.py | ||
| simple_app.py | ||
| simple_demo.py | ||
| simple_gdpr.py | ||
| start.sh | ||
| telemetry.config | ||
| telemetry.py | ||
| test_utils.py | ||
| tokens.py | ||
| totp.py | ||
| transaction.py | ||
| worker.py | ||
Backend README
FastAPI backend for LifeRPG with SQLAlchemy, Alembic, JWT auth, and security middleware.
Run (dev):
- Use the app module: uvicorn modern.backend.app:app --reload
- Or via docker-compose: see modern/docker-compose.yml
Security configuration (env):
- FRONTEND_ORIGINS or FRONTEND_ORIGIN: Allowed CORS origins
- FORCE_HTTPS=true: Redirect http->https when behind a reverse proxy
- HSTS_ENABLE=true: Add Strict-Transport-Security header (TLS-only deployments)
- COOKIE_SECURE=true and COOKIE_SAMESITE=none|lax|strict: Configure session cookie
- MAX_BODY_BYTES=1048576: Request body size limit (bytes)
- REQUESTS_PER_MINUTE=120: Naive per-IP rate limit
- CSRF_ENABLE=false: Enable CSRF protection for cookie-based state-changing requests
- CSRF_HEADER_NAME=x-csrf-token and CSRF_COOKIE_NAME=csrf_token
Reverse proxy notes (production):
- Terminate TLS at your proxy (nginx/Traefik/ALB) and forward to the app over HTTP
- Set and trust X-Forwarded-Proto to preserve original scheme; enable FORCE_HTTPS for redirects
- Forward client IP via X-Forwarded-For; the app’s rate limiter reads the first address
- Configure CORS at the proxy if you prefer, or rely on the app’s CORS middleware
CSRF guidance:
- If you rely on cookie-based auth for state-changing requests, enable CSRF (double-submit cookie pattern)
- For pure Bearer token APIs from JS, CSRF is not required if cookies aren’t used
Two-Factor Auth (2FA) and session_alt
Flows that create users while an admin is already logged in need to configure 2FA for the new user without replacing the admin’s session. To support this, the backend issues an alternate cookie named session_alt on signup when a session already exists.
-
Signup:
- If no existing session is present, the normal
sessioncookie is set for the newly created user. - If an admin (or any logged-in user) creates a new user, the backend preserves the admin’s
sessionand additionally setssession_altfor the newly created user.
- If no existing session is present, the normal
-
2FA endpoints:
/api/v1/auth/2fa/setup,/api/v1/auth/2fa/enable,/api/v1/auth/2fa/disableprefersession_altwhen present. This lets admins guide users through TOTP setup immediately after signup in admin-driven flows.
-
Logout:
/api/v1/auth/logoutclears bothsessionandsession_alt.
TOTP setup and recovery codes
Endpoints:
-
POST /api/v1/auth/2fa/setup- Requires an authenticated session (or
session_alt). - Generates a new TOTP secret and a set of plaintext recovery codes.
- Returns
{ otpauth_uri, recovery_codes }. Only bcrypt hashes of recovery codes are stored server-side.
- Requires an authenticated session (or
-
POST /api/v1/auth/2fa/enablewith body{ code }- Verifies the current TOTP code and enables 2FA for the account.
-
POST /api/v1/auth/2fa/disablewith body{ password, code? }- Validates password and (if enabled) optionally validates a TOTP code.
- Disables 2FA and clears the TOTP secret and recovery codes.
-
POST /api/v1/auth/loginwith body{ email, password, totp_code? | recovery_code? }- If 2FA is enabled on the account, a valid
totp_codeor a one-timerecovery_codeis required. - Recovery codes are consumed on use and cannot be reused.
- If 2FA is enabled on the account, a valid
Frontend UX tips:
- After admin-driven signup, read
session_altto complete TOTP setup for the new account in the same browser without disrupting the admin session. - Display the recovery codes exactly once at the end of setup and prompt the user to store them securely. The server cannot show them again.