fix(security): redact secret fields in IbctKey(Config)/McpTransport Serialize - #6165
Merged
Conversation
…erialize Serialize on IbctKeyConfig, IbctKey, and McpTransport left key_hex, key_bytes, env, and headers exposed in plaintext to any JSON/log/status output, mirroring the Debug leak fixed in #6005. Replace derived Serialize with hand-written impls that redact the secret fields while keeping Deserialize intact for config load and ACP mcp/add. No live leak existed (no serialize-to-output path reaches these types today), but the gap was latent and shared the same defect class as prior Debug leaks. Closes #6006
bug-ops
force-pushed
the
fix/6006-serialize-secret-leak
branch
from
July 12, 2026 19:38
a7b4b13 to
b256c0f
Compare
bug-ops
enabled auto-merge (squash)
July 12, 2026 19:38
This was referenced Jul 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SerializeonIbctKeyConfig,IbctKey, andMcpTransportwith hand-written impls that redact their secret fields (key_hex,key_bytes,envvalues,headersvalues) to"[REDACTED]", closing the residual gap PR fix(config,mcp,a2a): redact three more secret-bearing Debug/Serialize leaks #6005 intentionally left when it fixed onlyDebug.Deserializeis untouched on all three types — config load,--init/--migrate-config, and ACPmcp/addare unaffected.hex_bytes::serializefunction incrates/zeph-a2a/src/ibct.rs(onlydeserializeis referenced onceSerializeis no longer derived onIbctKey).ServerEntryneeds no change — it nestsMcpTransportand inherits the redaction automatically (verified, not assumed).A security audit confirmed this was a latent risk, not a live leak: no code path today serializes these types to JSON/logs/status output (ACP
mcp/listonly serializes server IDs asVec<String>;mcp/addonly deserializes). No round-trip/persistence path exists for any of the three types, so the redaction is behavior-preserving.A same-defect-class cohort (
TelegramConfig.token,DiscordConfig.token,SlackConfig.bot_token/signing_secret,A2aServerConfig.auth_token,McpServerConfig.env/headers) was identified but intentionally scoped out of this PR — those legitimately serialize to TOML via the--initwizard and need per-field assessment before a fix (blanket redaction would corrupt generated configs). Filing a follow-up tracking issue.Closes #6006
Test plan
IbctKeyConfig,IbctKey,McpTransport::Stdio,McpTransport::Http) asserting the serialized output contains"[REDACTED]"and does not contain the raw secret valuecargo +nightly fmt --check— cleancargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins— 13213 passed, 0 failedRUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"— cleancargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings— fails, but on a pre-existing, unrelatedclippy::large_futuresissue insrc/serve/handlers.rs/src/serve/agent_factory.rs. Confirmed viagit stash+ clippy against plainorigin/mainHEAD that the failure predates this branch; this PR touches neither file. Will file separately.