mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-19 00:12:18 +00:00
fix(image): ship the operator scripts the runbooks run in the container
The password-reset runbook tells an operator to run `docker compose exec app node scripts/reset-password.mjs`, and the intake-repair runbook runs `healthlog-tsx scripts/repair-intake-anomalies.ts` inside the container. The runner stage copied nothing from scripts/, so both failed with "Cannot find module", the reset at the moment an admin is locked out. The runner stage now copies both scripts and the Argon2 parameter module the reset imports, and proves at build time that each reaches its own first check with every import resolved. A structural test holds every in-container command in docs/ and the Dockerfile copies in step. Key rotation is documented the way it works on the published image: the Rotate now button under Admin > Encryption is the primary path. The rotation script imports the application graph and runs from a source checkout of the same release; the runbook, the admin hint in all seven languages and the decrypt error now say so.
This commit is contained in:
1 parent
3c3e5ceab7
commit
13db7935f6
16 files changed
+203
-44
No files matched your search
+1
-1
@@ -255,7 +255,7 @@ export function decrypt(encoded: string): string {
|
||||
throw new Error(
|
||||
"Found a legacy-format ciphertext but no v1 key is configured. " +
|
||||
"Restore the original ENCRYPTION_KEY (or add a 'v1' entry to " +
|
||||
"ENCRYPTION_KEYS) and run scripts/rotate-encryption-key.ts before " +
|
||||
"ENCRYPTION_KEYS) and run the key rotation (Admin > Encryption) before " +
|
||||
"removing it.",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
* `rotateCorpus()` to re-encrypt every row that is not already on the
|
||||
* active key.
|
||||
*
|
||||
* The standalone CLI (`scripts/rotate-encryption-key.ts`) remains the canonical
|
||||
* rotation path and stays independent (its own Prisma client). This module is
|
||||
* the in-app convenience that reuses the SAME registry, so the guard test keeps
|
||||
* both in lock-step.
|
||||
* The admin-triggered job is the primary rotation path on the published image.
|
||||
* The standalone CLI (`scripts/rotate-encryption-key.ts`) runs from a source
|
||||
* checkout with its own Prisma client and reuses the SAME registry, so the
|
||||
* guard test keeps both in lock-step.
|
||||
*
|
||||
* GUARANTEES (the security review must confirm these on the rotation path):
|
||||
* - ACTIVE-KEY-ONLY. Re-encryption is `encrypt(decrypt(value))`; `encrypt()`
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
* v1.23 — admin-triggered encryption-key rotation, on pg-boss.
|
||||
*
|
||||
* Re-encrypts every registered encrypted column to the configured ACTIVE key
|
||||
* id, reusing the canonical column registry via `rotateCorpus()`. This is the
|
||||
* in-app convenience the admin panel triggers; the CLI
|
||||
* (`scripts/rotate-encryption-key.ts`) remains the documented canonical path.
|
||||
* id, reusing the canonical column registry via `rotateCorpus()`. The admin
|
||||
* panel triggers it, and it is the documented primary path; the CLI
|
||||
* (`scripts/rotate-encryption-key.ts`) does the same from a source checkout.
|
||||
* pg-boss is the right home because the standalone production image strips
|
||||
* `tsx`, so a button that ran the CLI inside the container would fail.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user