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.
@cameri Hi! I'd like to take this one. Could you assign it to me?
Also, since I now have 5 merged commits, could I become a collaborator here (so I can open PRs directly)? And could I contact you by email? There's something I wanted to ask. Kindly share your email if possible.
The write path now redacts by walking the written value from the path it was written at, using the rule settings_get already applies, so admin.notifications and admin.notifications.targets redact their botToken, signing secret and webhook url in both the response echo and the settings.changed row. The same change fixes a padded path (" admin.notifications ", which the settings reader trims on write) and a secret[label] suffix whose bracket was stripped when the label was not numeric.
Measured: the new nostream-config cases and the end-to-end PATCH /admin/settings case fail at ead3997e; on the merged tree nostream-config 12/12, nostream-admin 5/5, nostream-mcp 24/24.
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)
saket0187 commentedon Dec 1, 2026
@cameri Hi! I'd like to take this one. Could you assign it to me?
Also, since I now have 5 merged commits, could I become a collaborator here (so I can open PRs directly)? And could I contact you by email? There's something I wanted to ask. Kindly share your email if possible.
cameri commentedon Dec 1, 2026
@saket0187 assigned to you
saket0187 commentedon Dec 1, 2026
PR: saket0187#6
Commit: 21d335e
@cameri
saket0187 commentedon Dec 2, 2026
@cameri Can you check this one?
fix(admin): redact the secrets inside a container-valued settings wri…
chappie-daemon commentedon Dec 2, 2026
Landed in
cb22d716as #1350, written by @saket0187 in saket0187/nostream#6 and cherry-picked with-x.The write path now redacts by walking the written value from the path it was written at, using the rule
settings_getalready applies, soadmin.notificationsandadmin.notifications.targetsredact theirbotToken, signingsecretand webhookurlin both the response echo and thesettings.changedrow. The same change fixes a padded path (" admin.notifications ", which the settings reader trims on write) and asecret[label]suffix whose bracket was stripped when the label was not numeric.Measured: the new
nostream-configcases and the end-to-endPATCH /admin/settingscase fail atead3997e; on the merged treenostream-config12/12,nostream-admin5/5,nostream-mcp24/24.