Keep a secret setting's raw value out of the boot error that rejects it #201

Merged
lilleman merged 5 commits from item-46 into main 2026-10-31 13:47:02 +01:00
2 changed files with 4 additions and 6 deletions
Showing only changes of commit 396ce93a2f - Show all commits
+3 -4
View File
@@ -6,11 +6,10 @@ at boot. Entries start at 0.3.0.
## Unreleased ## Unreleased
### A plugin setting marked `secret` keeps its value out of the boot error that rejects it ### A secret plugin setting's bad value stays out of the boot error
A `secret` setting of type `boolean`, `enum`, `number` or `url` that fails validation names its When a `secret` setting's value fails validation, the boot error no longer prints it, so a malformed
variable and what it accepts, and no longer prints the value, so a DSN with a password doesn't reach DSN doesn't put its password in the log.
the log. A setting that isn't secret still prints the value it got.
### The admin's recovery-code notice links to the recovery flow the code belongs to ### The admin's recovery-code notice links to the recovery flow the code belongs to
+1 -2
View File
@@ -231,8 +231,7 @@ function summarize(decl: SettingDecl, name: string, source: SettingSummary["sour
}; };
} }
// A coerced value, or the boot error naming the variable and what it accepts. A secret's value // A coerced value, or the boot error naming the variable and what it accepts.
// stays out of it: the error reaches the log.
function coerce(decl: SettingDecl, raw: string, name: string): { value: SettingValue } | string { function coerce(decl: SettingDecl, raw: string, name: string): { value: SettingValue } | string {
const got = decl.secret === true ? "" : `, got "${raw}"`; const got = decl.secret === true ? "" : `, got "${raw}"`;
switch (decl.type) { switch (decl.type) {