No description
Find a file
goose 7ba78a31fb fix(backend): P0 security hardening pass
Address the four P0 security items from the project review:

* token_version validation (#1): the JWT middleware now rejects access tokens
  whose token_version claim is stale (e.g. issued before a password change).
  A short-TTL (30s) in-memory cache (TokenVersionCache) avoids a Mongo lookup
  per request; credential changes invalidate the cache immediately on the
  handling instance.

* Fail-fast config (#2): add APP_ENVIRONMENT (development|production). In
  production the server refuses to boot unless JWT_SECRET and ENCRYPTION_KEY
  are set to non-default values; development keeps the insecure defaults with
  a warning.

* Real client IP in audit logs (#4): new client_ip middleware resolves the
  originating IP (X-Forwarded-For > X-Real-IP > ConnectInfo socket) and
  exposes it via a ClientIp extractor. All five hardcoded "0.0.0.0" audit
  calls are replaced, and the missing PasswordChanged audit event is added to
  change_password. axum::serve now uses into_make_service_with_connect_info.

* Refresh token persistence (#5): refresh tokens are now stored hashed in
  MongoDB (RefreshTokenRepository) instead of an in-memory map lost on restart.
  Added /api/auth/refresh (with rotation + token_version check) and
  /api/auth/logout routes; register/login return a refresh_token; password
  change/recovery revoke all of a user's refresh tokens. JwtService now honors
  JwtConfig expiries instead of hardcoding 15min/30d, and the dead in-memory
  refresh store is removed.

Also: wire up DatabaseInitializer (was never called), fix the refresh_tokens
index to tokenHash + add an expiresAt TTL index, add sha2 dep.

Rate limiting (#3) is deferred per scope; the stub remains.

Verified: cargo fmt --check clean, cargo build/clippy --all-targets clean,
18 unit tests pass (9 new). Integration tests (tests/*) still need a live
server — fixing them is tracked as P1.

BREAKING CHANGE: AuthResponse now includes a refresh_token field.
2026-06-27 13:12:19 -03:00
.forgejo/workflows revert(ci): remove docker-build, acknowledge Forgejo limitations 2026-03-19 09:10:55 -03:00
backend fix(backend): P0 security hardening pass 2026-06-27 13:12:19 -03:00
docs feat(ci): add format check, PR validation, and Docker buildx 2026-03-17 10:44:42 -03:00
scripts feat(ci): add format check, PR validation, and Docker buildx 2026-03-17 10:44:42 -03:00
thoughts chore: Clean up temporary docs and start Phase 2.4 2026-02-15 16:33:36 -03:00
web/normogen-web docs(ai): reorganize documentation and update product docs 2026-03-09 11:04:44 -03:00
.cursorrules docs(ai): reorganize documentation and update product docs 2026-03-09 11:04:44 -03:00
.gitignore chore: Update .gitignore to exclude tmp and log files 2026-02-20 13:13:29 -03:00
.gooserules docs(ai): reorganize documentation and update product docs 2026-03-09 11:04:44 -03:00
CI-CD-COMPLETION-REPORT.md fix(ci): make clippy non-strict and fix domain spelling 2026-03-17 23:00:08 -03:00
CI-CD-FINAL-SOLUTION.md docs: add comprehensive CI/CD final solution documentation 2026-03-18 23:27:48 -03:00
CI-CD-IMPLEMENTATION-SUMMARY.md fix(ci): make clippy non-strict and fix domain spelling 2026-03-17 23:00:08 -03:00
CI-CD-STATUS-REPORT.md fix(ci): make clippy non-strict and fix domain spelling 2026-03-17 23:00:08 -03:00
README.md docs(ai): reorganize documentation and update product docs 2026-03-09 11:04:44 -03:00

Normogen

Normogen (Mapudungun for "Balanced Life") is an open-source health data platform for private, secure health data management.

📚 Documentation

All project documentation has been organized into the docs/ directory:

🚀 Quick Start

# Clone repository
git clone <forgejo-url> normogen
cd normogen/backend

# Setup configuration
cp .env.example .env
# Edit .env with your values

# Run with Docker Compose
docker compose up -d

# Check status
curl http://localhost:6800/health

📊 Current Status

  • Phase: 2.8 (Planning - Drug Interactions & Advanced Features)
  • Backend: Rust + Axum + MongoDB (~91% complete)
  • Frontend: React + TypeScript (~10% complete)
  • Deployment: Docker on Solaria

🗂️ Documentation Structure

docs/
├── product/          # Product definition, features, roadmap
├── implementation/   # Phase plans, specs, progress reports
├── testing/          # Test scripts and results
├── deployment/       # Deployment guides and scripts
├── development/      # Git workflow, CI/CD, development tools
└── archive/          # Historical documentation

📖 Full Documentation

See the Documentation Index for complete project documentation.


Last Updated: 2026-03-09