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
common: [network.discovery] is skipped by ${VAR} env expansion, unlike its sibling relay_urls — dns_origin passes through as a literal string #863
Severity: MEDIUM — from the 2026-06-10 full-repository review (#829/#818 surface).
Location
crates/common/src/config/mod.rs:2432-2439 — the expand_env network block expands relay_url + relay_urls only; there is no leg for discovery.pkarr_url, discovery.dns_origin, or discovery.peers.*.{relay_url,addrs}.
Scenario
An operator reusing the documented single-TOML-template-across-deployments pattern (expand_env doc, mod.rs:2411-2414) writes:
pkarr_url = "${PKARR_URL}" → fails URL parse with a confusing invalid URL "${PKARR_URL}"
dns_origin = "${DNS_ORIGIN}" → worse: it passes resolution (only checked non-empty, mod.rs:605-612) and reaches node bring-up as the literal string, silently breaking peer resolution
peer addrs = ["${NODE1_ADDR}"] → fails late with a misleading parse error
Not a duplicate
#842 is deny_unknown_fields; #843 is the relay env override; neither touches env expansion of the new discovery knobs.
Fix direction
Add a discovery block to expand_env mirroring the relay_urls loop (pkarr_url, dns_origin, per-peer relay_url + addrs), with indexed ctx labels.
expand_env in crates/common/src/config/mod.rs handles the [network] block at lines 2432-2439 but stops after relay_url/relay_urls — the entire [network.discovery] sub-block (pkarr_url, dns_origin, per-peer relay_url and addrs) is never processed. The silent failure for dns_origin is the most dangerous case: it passes the non-empty check at resolution and propagates to node bring-up as the literal string ${DNS_ORIGIN}, silently breaking peer discovery with no diagnostic. The other fields (pkarr_url, peer addrs) at least fail fast with confusing parse errors.
📊 Assessment
Dimension
Value
Reasoning
Type
Bug
Missing env-expansion leg causes silent misconfiguration (dns_origin) or misleading parse failures
Verified in code: expand_env network block (lines 2432-2439) handles only relay_url and relay_urls. The DiscoveryConfig struct has three fields needing expansion:
After the relay_urls loop, add a if let Some(d) = n.discovery.as_mut() block
Expand d.pkarr_url with ctx "network.discovery.pkarr_url"
Expand d.dns_origin with ctx "network.discovery.dns_origin"
Iterate d.peers (if Some): for each (node_id, peer), expand peer.relay_url with ctx "network.discovery.peers[{node_id}].relay_url" and each entry in peer.addrs with ctx "network.discovery.peers[{node_id}].addrs[{idx}]"
Add a regression test in the existing expand_env test block mirroring the relay_urls env-expansion test (set PKARR_URL, DNS_ORIGIN, NODE1_ADDR env vars, call expand_env, assert substitution)
Note on dns_origin: The silent passthrough makes this the higher-priority fix path. Even though pkarr_url gives a confusing error, dns_origin gives no error — the node starts with dns_origin = "${DNS_ORIGIN}" and all peer lookups quietly fail.
Activity
github-actions commentedon Jun 10, 2026
🎯 Triage report
expand_envincrates/common/src/config/mod.rshandles the[network]block at lines 2432-2439 but stops afterrelay_url/relay_urls— the entire[network.discovery]sub-block (pkarr_url,dns_origin, per-peerrelay_urlandaddrs) is never processed. The silent failure fordns_originis the most dangerous case: it passes the non-empty check at resolution and propagates to node bring-up as the literal string${DNS_ORIGIN}, silently breaking peer discovery with no diagnostic. The other fields (pkarr_url, peeraddrs) at least fail fast with confusing parse errors.📊 Assessment
technicaladded;bug,medium,rustalready appliedrelay_urlsloop pattern, all fields and their types are identified🔗 Similar issues
expand_env/ env-var handling in the network config block; different failure mode (staleDECDN_RELAY_URLcollapsing a multi-relay list vs. discovery fields not expanded at all)deny_unknown_fieldsmissing on config structs; distinct fix but same config subsystem💡 Notes and suggestions
Verified in code:
expand_envnetwork block (lines 2432-2439) handles onlyrelay_urlandrelay_urls. TheDiscoveryConfigstruct has three fields needing expansion:Fix checklist:
relay_urlsloop, add aif let Some(d) = n.discovery.as_mut()blockd.pkarr_urlwith ctx"network.discovery.pkarr_url"d.dns_originwith ctx"network.discovery.dns_origin"d.peers(ifSome): for each(node_id, peer), expandpeer.relay_urlwith ctx"network.discovery.peers[{node_id}].relay_url"and each entry inpeer.addrswith ctx"network.discovery.peers[{node_id}].addrs[{idx}]"expand_envtest block mirroring therelay_urlsenv-expansion test (setPKARR_URL,DNS_ORIGIN,NODE1_ADDRenv vars, callexpand_env, assert substitution)Note on
dns_origin: The silent passthrough makes this the higher-priority fix path. Even thoughpkarr_urlgives a confusing error,dns_origingives no error — the node starts withdns_origin = "${DNS_ORIGIN}"and all peer lookups quietly fail.Add this agentic workflows to your repo
To install this agentic workflow, run
fix(config): expand ${VAR} in [network.discovery] fields (#863)
Merge pull request #865 from decdn/fix/quick-win-medium-batch
fix: batch of six quick-win MEDIUM bug fixes (#865)