mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
fix(encryption): sample several stored values before declaring a key mismatch
The boot check decided on the first value it found under a key id, so one damaged or foreign-sealed row could take a correctly keyed server down with 503 on every request. The probe now samples up to five values, one per column first. One value that opens clears the key; a mismatch needs at least two values and none opening. A single value that does not open is inconclusive: the server keeps serving, writes no canary, logs a warning and probes again at the next start. Integration setup truncates encryption_key_canaries between tests.
This commit is contained in:
1 parent
ced17569bf
commit
b04b1f2995
5 files changed
+215
-37
No files matched your search
@@ -33,10 +33,19 @@ export async function runBootKeyCheck(client: CanaryClient): Promise<boolean> {
|
||||
console.warn(
|
||||
`[boot] Encryption key check skipped: ${outcome.message.slice(0, 300)}`,
|
||||
);
|
||||
} else if (outcome.written.length > 0) {
|
||||
console.info(
|
||||
`[boot] Encryption key check: recorded key id(s) ${outcome.written.join(", ")}`,
|
||||
);
|
||||
} else {
|
||||
if (outcome.inconclusive.length > 0) {
|
||||
console.warn(
|
||||
`[boot] Encryption key check inconclusive for key id(s) ${outcome.inconclusive.join(", ")}: ` +
|
||||
"the only stored value found under that id did not open. Serving; " +
|
||||
"no canary written; the check runs again at the next start.",
|
||||
);
|
||||
}
|
||||
if (outcome.written.length > 0) {
|
||||
console.info(
|
||||
`[boot] Encryption key check: recorded key id(s) ${outcome.written.join(", ")}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in new issue
Block a user