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
config: deny_unknown_fields missing on FileConfig and 7 section structs — typos in [blockchain]/[network]/[gossip]/[observability] silently no-op #842
kind:bugSomething does not behave as documentedkind:securitySecurity impact; report a vulnerability to [email protected], not hereprio:mediumScheduledrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Surfaced by a full-repository review (2026-06-09).
Finding
The config schema's stated policy is that operator typos fail at load (doc comments at crates/common/src/config/types.rs:143-148 and :273-278), and CacheConfig, OriginConfig, S3OriginConfig, S3Credentials, DhtConfig, DhtRateLimitConfig, ReceiptsConfig, and PrefetchConfig all set #[serde(deny_unknown_fields)] accordingly. But the top-level FileConfig (types.rs:14) and seven section structs do not: NetworkConfig:53, IdentityConfig:44, BlockchainConfig:76, PaymentConfig:454, GossipConfig:479, ObservabilityConfig:643, SecurityConfig:543.
RetryPolicy in crates/config-types/src/retry.rs:45 has the same gap (a typo'd max_retires inside [cache.origin_retry] silently keeps the default).
Impact
A typo'd [blockchain] slash_judge_addres = "0x…", [network] relay_ur1s = […], [gossip] subscribe_globall = false, or a whole-section typo like [netork] is silently dropped — the node then either fails on a confusing "missing required" error or silently runs with wrong defaults for security-relevant knobs.
Fix
Add #[serde(deny_unknown_fields)] to FileConfig (highest value — catches whole-section typos) and the seven section structs, plus RetryPolicy (it composes fine with #[serde(default)]). Watch for back-compat with any legacy keys intentionally tolerated; if any exist, alias them explicitly instead.
The config schema promises fail-fast on typos (documented in types.rs doc comments) and partially delivers it — 8 inner structs carry #[serde(deny_unknown_fields)] — but the top-level FileConfig and 7 section structs (NetworkConfig, IdentityConfig, BlockchainConfig, PaymentConfig, GossipConfig, ObservabilityConfig, SecurityConfig) do not. The same gap exists in RetryPolicy. This means a whole-section typo ([netork]) or a key typo on a security-relevant field (e.g. slash_judge_addres, relay_ur1s) silently no-ops, potentially leaving the node running with wrong defaults on blockchain addresses, relay lists, or gossip flags.
📊 Assessment
Dimension
Value
Reasoning
Type
Bug
Policy stated and partially implemented; gap causes silent misconfiguration
Labels
security, rust added (existing: bug, medium)
Security-relevant config fields can silently misconfigure; purely Rust implementation fix
Coding agent
Suitable
Precise file locations, mechanical fix (add one attribute to 9 structs), clear success criteria, no design decisions needed
🔗 Similar issues
No similar open issues found.
💡 Notes and suggestions
Files to change:
crates/common/src/config/types.rs — add #[serde(deny_unknown_fields)] to:
FileConfig (line 14) — highest value: catches whole-section name typos like [netork]
NetworkConfig (line 53)
IdentityConfig (line 44)
BlockchainConfig (line 76)
PaymentConfig (line 454)
GossipConfig (line 479)
ObservabilityConfig (line 643)
SecurityConfig (line 543)
crates/config-types/src/retry.rs — add #[serde(deny_unknown_fields)] to RetryPolicy (line 45)
#[serde(flatten)] check:grep found zero uses of serde(flatten) in crates/common/src/, so there is no serde compatibility blocker (serde does not support deny_unknown_fields combined with flatten). Verify the same for config-types before landing.
Back-compat sweep: Before landing, grep the test fixtures, example configs in docs/, and any TOML files in the repo for keys that aren't in the current struct definitions. Any intentionally tolerated legacy key needs an explicit #[serde(alias = "...")] or a struct field addition; otherwise tests will start failing.
Suggested sub-tasks:
Audit all .toml / .yaml / .json test fixtures and example configs for unknown keys
Add #[serde(deny_unknown_fields)] to FileConfig + 7 section structs in types.rs
Add #[serde(deny_unknown_fields)] to RetryPolicy in retry.rs
Add a unit test with a TOML snippet containing an unknown key to confirm the error is surfaced (one test at the FileConfig level is sufficient as a regression guard)
Run cargo nextest run -p decdn-common -p decdn-config-types to validate
Priority note: The medium label seems appropriate for day-to-day operation, but operators misconfiguring BlockchainConfig keys (contract addresses, RPC endpoints) may not notice until a transaction fails — worth flagging to the team whether this warrants a bump to high.
kind:bugSomething does not behave as documentedkind:securitySecurity impact; report a vulnerability to [email protected], not hereprio:mediumScheduledrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Activity
github-actions commentedon Jun 9, 2026
🎯 Triage report
The config schema promises fail-fast on typos (documented in
types.rsdoc comments) and partially delivers it — 8 inner structs carry#[serde(deny_unknown_fields)]— but the top-levelFileConfigand 7 section structs (NetworkConfig,IdentityConfig,BlockchainConfig,PaymentConfig,GossipConfig,ObservabilityConfig,SecurityConfig) do not. The same gap exists inRetryPolicy. This means a whole-section typo ([netork]) or a key typo on a security-relevant field (e.g.slash_judge_addres,relay_ur1s) silently no-ops, potentially leaving the node running with wrong defaults on blockchain addresses, relay lists, or gossip flags.📊 Assessment
security,rustadded (existing:bug,medium)🔗 Similar issues
No similar open issues found.
💡 Notes and suggestions
Files to change:
crates/common/src/config/types.rs— add#[serde(deny_unknown_fields)]to:FileConfig(line 14) — highest value: catches whole-section name typos like[netork]NetworkConfig(line 53)IdentityConfig(line 44)BlockchainConfig(line 76)PaymentConfig(line 454)GossipConfig(line 479)ObservabilityConfig(line 643)SecurityConfig(line 543)crates/config-types/src/retry.rs— add#[serde(deny_unknown_fields)]toRetryPolicy(line 45)#[serde(flatten)]check:grepfound zero uses ofserde(flatten)incrates/common/src/, so there is no serde compatibility blocker (serde does not supportdeny_unknown_fieldscombined withflatten). Verify the same forconfig-typesbefore landing.Back-compat sweep: Before landing, grep the test fixtures, example configs in
docs/, and any TOML files in the repo for keys that aren't in the current struct definitions. Any intentionally tolerated legacy key needs an explicit#[serde(alias = "...")]or a struct field addition; otherwise tests will start failing.Suggested sub-tasks:
.toml/.yaml/.jsontest fixtures and example configs for unknown keys#[serde(deny_unknown_fields)]toFileConfig+ 7 section structs intypes.rs#[serde(deny_unknown_fields)]toRetryPolicyinretry.rsFileConfiglevel is sufficient as a regression guard)cargo nextest run -p decdn-common -p decdn-config-typesto validatePriority note: The
mediumlabel seems appropriate for day-to-day operation, but operators misconfiguringBlockchainConfigkeys (contract addresses, RPC endpoints) may not notice until a transaction fails — worth flagging to the team whether this warrants a bump tohigh.Add this agentic workflows to your repo
To install this agentic workflow, run
Merge pull request #865 from decdn/fix/quick-win-medium-batch
fix: batch of six quick-win MEDIUM bug fixes (#865)