You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
admin: a container-valued settings write echoes its secret in the response and the settings.changed payload #1193
Found by: the security lens in review round 1 of job 033-admin-mcp-server (round-1/review-security.md, note 1), at 7a1cde0e. Note-level there because the function is byte-for-byte the HTTP surface's; filed so the fix lands once for both.
crates/nostream-admin/src/controllers/patch_settings.rs:45-50 — redacted_change redacts only a string at the exact path. A write to a container-valued path therefore echoes its secret raw: measured, settings_set on admin.notifications.targets[0].botToken returned the token in structuredContent, and the same value rides the settings.changed outbox payload that an operator's configured target then receives.
Fix direction: redact by path prefix (a sealed or secret-bearing subtree redacts everything under it), reusing the same rule settings_get already applies to the document; then one test that writes a container carrying a token and asserts the response and the outbox row both show ***.
Scope note: this reaches the HTTP console too (PATCH /admin/settings echoes the changed value), so the fix belongs in the admin crate, not in the MCP layer.
Still live at 982e6759, and the fix is smaller than the note suggests: the walking redactor the note asks for already exists two functions below the one that leaks.
crates/nostream-config/src/redaction.rs:39 — redact_settings_value(path, value) redacts only when the value at that exact path is a Value::String; anything else falls through other => other.clone() (:44). redact_settings_value is called from exactly one place, crates/nostream-admin/src/controllers/patch_settings.rs:48, and that is the echo path.
redaction.rs:49 — redact_settings_secrets(value) already walks sequences and mappings and rebuilds each path, so it redacts a whole subtree. It is what get_settings (:23), diagnostics (:22) and the notification fan-out (notifications.rs:230) use, which is why the read path is safe and the write echo is not.
So the change is: for a container-valued change, walk it instead of cloning it — redact_settings_secrets applied to the parsed value under the change's own path (or redact_settings_value delegating to the walker for non-scalars). One function, one call site, no new API, and the existing get_settings tests are the shape the new write-path test should copy.
Worth adding to the same change, since it is the same bug on a second surface: the settings.changed outbox payload built in notifications.rs:230 already redacts, so the echo in patch_settings.rs:48 is the only remaining raw path — a test that writes a container carrying targets[0].botToken and asserts it in both the controller response and the emitted payload would pin it in one go.
Activity
chappie-daemon commentedon Nov 20, 2026
Still live at
982e6759, and the fix is smaller than the note suggests: the walking redactor the note asks for already exists two functions below the one that leaks.crates/nostream-config/src/redaction.rs:39—redact_settings_value(path, value)redacts only when the value at that exact path is aValue::String; anything else falls throughother => other.clone()(:44).redact_settings_valueis called from exactly one place,crates/nostream-admin/src/controllers/patch_settings.rs:48, and that is the echo path.redaction.rs:49—redact_settings_secrets(value)already walks sequences and mappings and rebuilds each path, so it redacts a whole subtree. It is whatget_settings(:23),diagnostics(:22) and the notification fan-out (notifications.rs:230) use, which is why the read path is safe and the write echo is not.So the change is: for a container-valued change, walk it instead of cloning it —
redact_settings_secretsapplied to the parsed value under the change's own path (orredact_settings_valuedelegating to the walker for non-scalars). One function, one call site, no new API, and the existingget_settingstests are the shape the new write-path test should copy.Worth adding to the same change, since it is the same bug on a second surface: the
settings.changedoutbox payload built innotifications.rs:230already redacts, so the echo inpatch_settings.rs:48is the only remaining raw path — a test that writes a container carryingtargets[0].botTokenand asserts it in both the controller response and the emitted payload would pin it in one go.feat(cli): port the pnpm run cli surface to Rust (#1203)