Skip to content

config: deny_unknown_fields missing on FileConfig and 7 section structs — typos in [blockchain]/[network]/[gossip]/[observability] silently no-op #842

Closed

Description

@thiras

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.

Activity

  1. added
    kind:bug
    prio:medium
    on Jun 9, 2026
  2. added
    rust
    kind:security
    on Jun 9, 2026
  3. github-actions commented on Jun 9, 2026

    @github-actions

    🎯 Triage report

    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.

    Generated by Agentic Triage for issue #842 · sonnet46 561.5K · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  4. self-assigned this
    on Jun 10, 2026
  5. added 2 commits that reference this issue on Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:bugkind:securityprio:mediumrust

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions