No description
Find a file
goose bf5aeedbc2
Some checks failed
Lint and Build / format (pull_request) Successful in 40s
Lint and Build / clippy (pull_request) Successful in 1m56s
Lint and Build / build (pull_request) Successful in 3m47s
Lint and Build / test (pull_request) Failing after 3m51s
feat: hard revoke / re-key (Phase C, #3)
An owner can now rotate a profile's DEK — generating a fresh key,
re-encrypting all the profile's data under it (client-side), and
re-wrapping to the owner share + kept recipients. A revoked recipient's
cached old DEK stops working, closing the soft-revoke window the ADR
requires for graduation / suspected compromise.

The server stays a blind store: it sees opaque old→new ciphertext blobs
flow through, never the DEK or plaintext. No backend crypto.

Backend:
- ProfileRepository::update_wrapped_dek — rotate the owner share
  (account-wrapped profile DEK), owner-scoped.
- ProfileShareRepository::find_active_for_profile +
  delete_for_profile_excluding — list current recipients and hard-delete
  omitted ones.
- POST /api/profiles/:id/rekey: validates each submitted envelope
  against existing active shares (no smuggling new recipients in via
  rekey), rotates the owner share, upserts recipient envelopes with
  fresh ephemeral ECDH keys, hard-deletes omitted recipients.
- rekey_tests.rs: rotation, hard-revoke-from-recipient-view, no-share
  rejection, non-owner rejection, revoke-all.

Frontend:
- useProfileStore.rekeyProfile: fetches all profile data, re-encrypts
  each row under a new DEK (resume-safe — rows already on the new DEK
  are skipped), builds fresh ECDH envelopes per kept recipient, commits
  via POST /rekey, swaps the in-memory DEK.
- ProfileSharing: 'Rotate encryption key (hard revoke)' action with a
  strong confirmation dialog explaining the cost and the resume-safe
  retry.

Best-effort + resumable retry (per design decision); no server-side
write lock.

Verification: backend cargo build/clippy (-D warnings)/fmt clean, tests
compile (integration tests run in CI — Mongo is fixed there). Frontend
tsc clean, 31/31 tests pass.

⚠️ Backend integration tests not run locally (no Mongo in this sandbox);
CI will run them — I'll fix any failures.

Admin-initiated rekey (ADR §5c reserves the permission) is out of scope
— handler is owner-only until admin shares are creatable in Phase D.
Refs #3.
2026-07-19 15:15:39 -03:00
.forgejo/workflows ci: drop host port mapping for Mongo service container 2026-07-18 21:02:46 -03:00
backend feat: hard revoke / re-key (Phase C, #3) 2026-07-19 15:15:39 -03:00
docs docs: decide multi-person ZK sharing ADR; reconcile jwt/encryption docs 2026-07-18 19:26:43 -03:00
scripts fix(backend): P1 — handler unwrap cleanup + rewrite integration tests 2026-06-27 14:26:39 -03:00
web feat: hard revoke / re-key (Phase C, #3) 2026-07-19 15:15:39 -03:00
.cursorrules docs: reconcile documentation with reality (P3) 2026-06-27 16:02:16 -03:00
.gitignore feat(auth): add per-account X25519 identity keypair (#3) 2026-07-18 20:00:01 -03:00
.gooserules docs: add AGENTS.md and document issue-driven workflow 2026-07-18 11:20:14 -03:00
AGENTS.md docs: add AGENTS.md and document issue-driven workflow 2026-07-18 11:20:14 -03:00
README.md fix(backend): P2 config & Docker consistency 2026-06-27 19:54:32 -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 (default port is 6500 via NORMOGEN_PORT; Solaria maps it to host 6800)
curl http://localhost:6500/health

📊 Current Status

  • Backend: Phase 2.x feature-complete (Rust + Axum + MongoDB), including drug interactions (Phase 2.8). Security-hardened: token-version validation, hashed refresh-token persistence, fail-fast config, real-IP audit logging. Deployed on Solaria.
  • Frontend: 🚧 Early (React + TypeScript) — Login/Register pages + API/store layer exist; router not yet wired.
  • Tests: 18 unit + 13 integration (auth + medication), CI-gated with MongoDB.
  • Deployment: Docker on Solaria (image built manually — CI can't run DinD on Forgejo).
  • See docs/product/STATUS.md for the full breakdown.

🗂️ 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-06-27