LifeRPG_v2.0/modern/backend
Copilot 90750ee8df
Strip emoji from docs, fix XSS/hashing vulnerabilities, remediate all failing CI checks (#1)
* Initial plan

* Fix security vulnerabilities: MD5→SHA-256, XSS via dangerouslySetInnerHTML/innerHTML, insecure randomness, CodeQL config

Co-authored-by: TLimoges33 <125313326+TLimoges33@users.noreply.github.com>

* Clean up README: remove decorative emojis for a professional tone

Remove all emojis from section headers, list item prefixes, and
decorative positions. Replace  phase status markers with '(Complete)'
text. Keep the  in the final call-to-action line. No changes to
links, badges, code blocks, or technical content.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: remove emoji characters from CONTRIBUTING.md

Remove all emoji from section headers and closing line while
preserving links, code blocks, and technical content.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: remove emoji characters from documentation files

Remove all emoji characters from 8 documentation files in docs/.
Replace status-marker checkmarks () with '(Done)' text.
Remove decorative emojis from headers and body text entirely.
Preserve emojis inside code blocks unchanged.
Clean up trailing whitespace introduced by removals.

Files modified:
- DEPLOYMENT_GUIDE.md
- IMPLEMENTATION_PLAN.md
- MILESTONE_6_SUMMARY.md
- PRODUCTION_ROADMAP.md
- PROJECT_STATUS.md
- REPOSITORY_ENHANCEMENT.md
- ROADMAP.md
- SECURITY_AUDIT_ROADMAP.md

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: remove emoji characters from documentation files

Remove all emoji characters from 9 markdown files while preserving
code block content (box-drawing characters, indentation). Emojis
removed from headers, list items, and body text across READMEs,
issue templates, PR template, runbook, and mobile docs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Remove excessive emoji from all documentation for professional presentation

Co-authored-by: TLimoges33 <125313326+TLimoges33@users.noreply.github.com>

* Fix PluginWidget initial state and remove || true from security audit steps

Co-authored-by: TLimoges33 <125313326+TLimoges33@users.noreply.github.com>

* Remediate all failing CI checks: update deprecated actions, fix npm vulnerabilities, fix migrations YAML

Co-authored-by: SynOSdev <257853113+SynOSdev@users.noreply.github.com>

* Fix all remaining CI failures: Node 18→20, fix test API contract, fix pytest version, fix Postgres health checks

Co-authored-by: SynOSdev <257853113+SynOSdev@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: TLimoges33 <125313326+TLimoges33@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: SynOSdev <257853113+SynOSdev@users.noreply.github.com>
2026-03-14 08:59:37 -04:00
..
ai_models 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
alembic 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
tests Strip emoji from docs, fix XSS/hashing vulnerabilities, remediate all failing CI checks (#1) 2026-03-14 08:59:37 -04:00
.dev_liferpg_key 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
.env.dev 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
.env.example 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
adapters.py 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
advanced_analytics.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
advanced_cache.py Strip emoji from docs, fix XSS/hashing vulnerabilities, remediate all failing CI checks (#1) 2026-03-14 08:59:37 -04:00
advanced_gamification.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
advanced_rate_limiting.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
ai_assistant.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
ai_insights.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
ai_monitoring.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
ai_test_api.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
alembic.ini 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
analytics.py 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
api_docs.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
api_versioning.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
app.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
auth.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
authorization.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
backup_security.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
community_features.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
compliance_framework.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
config.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
crypto.py security(kms+refresh): optional KMS envelope keys + token refresh flow for Google 2025-08-28 17:14:49 +00:00
data_retention.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
db_security.sql 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
db.py 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
demo_app.py 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
development_config.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
Dockerfile 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
gamification.py 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
gdpr_api.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
gdpr_compliance.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
health_monitoring.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
hooks.py 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
huggingface_ai.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
kms_rotate.py auth: add JWT email/password auth + Login UI; security: kms rotate helper; preview sync endpoint + UI 2025-08-28 17:26:02 +00:00
legacy_import_api.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
legacy_importer.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
metrics.py 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
middleware.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
mobile_api.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
models.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
modern_dev.db 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
momentum_system.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
notifier.py 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
oauth.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
plugin_runtime.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
plugins.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
rbac.py 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
README_ENCRYPTION.md security: encrypt OAuth tokens at rest (Fernet) + docs 2025-08-28 17:13:30 +00:00
README_OAUTH.md Strip emoji from docs, fix XSS/hashing vulnerabilities, remediate all failing CI checks (#1) 2026-03-14 08:59:37 -04:00
README.md 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
realtime_notifications.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
request_limiter.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
requirements_ai.txt 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
requirements_full.txt Strip emoji from docs, fix XSS/hashing vulnerabilities, remediate all failing CI checks (#1) 2026-03-14 08:59:37 -04:00
requirements.txt Strip emoji from docs, fix XSS/hashing vulnerabilities, remediate all failing CI checks (#1) 2026-03-14 08:59:37 -04:00
schema.sql backend: add FastAPI scaffold, models, oauth flow, schema 2025-08-28 17:07:21 +00:00
schemas.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
secure_logging.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
security_monitor.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
security_tests.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
server.py scaffold: modern rewrite skeleton (backend + frontend PWA) + roadmap 2025-08-28 17:05:19 +00:00
setup_ai.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
simple_app.py 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
simple_demo.py 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
simple_gdpr.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
start.sh 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
telemetry.config 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
telemetry.py 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
test_utils.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00
tokens.py 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
totp.py 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
transaction.py 🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application 2025-08-30 17:32:42 +00:00
worker.py 🚀 Major Enhancement: Complete AI-Powered LifeRPG Platform with Git LFS 2025-09-28 21:29:19 +00:00

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 apps rate limiter reads the first address
  • Configure CORS at the proxy if you prefer, or rely on the apps 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 arent 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 admins 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 session cookie is set for the newly created user.
    • If an admin (or any logged-in user) creates a new user, the backend preserves the admins session and additionally sets session_alt for the newly created user.
  • 2FA endpoints:

    • /api/v1/auth/2fa/setup, /api/v1/auth/2fa/enable, /api/v1/auth/2fa/disable prefer session_alt when present. This lets admins guide users through TOTP setup immediately after signup in admin-driven flows.
  • Logout:

    • /api/v1/auth/logout clears both session and session_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.
  • POST /api/v1/auth/2fa/enable with body { code }

    • Verifies the current TOTP code and enables 2FA for the account.
  • POST /api/v1/auth/2fa/disable with 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/login with body { email, password, totp_code? | recovery_code? }

    • If 2FA is enabled on the account, a valid totp_code or a one-time recovery_code is required.
    • Recovery codes are consumed on use and cannot be reused.

Frontend UX tips:

  • After admin-driven signup, read session_alt to 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.