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
While reviewing #2037, I misspelled extra_allowed_purposes in the test's TOML. The config loaded without an error, and the relay then rejected the purpose (404). The setting was silently dropped.
Config, V1Config, OhttpRelayConfig and AccessControlConfig in payjoin-mailroom/src/config.rs use #[serde(default)] without deny_unknown_fields, so any misspelled key falls back to its default. For ohttp_relay, that means the relay forwards a different set of purposes from what the operator configured.
I tried adding #[serde(deny_unknown_fields)] to these structs. Typos are then rejected, but two side effects came up:
Env vars use the same deserializer, so any unrelated PJ_* variable (for example PJ_UNRELATED_THING=1) stops startup with unknown field 'unrelated_thing'.
A section for a feature that isn't compiled in (for example [acme] without the acme feature) is also rejected.
Possible directions:
(a) Hard error for unknown keys from the config file only, with env vars kept lenient.
(b) Log a warning for unknown keys instead of failing.
(c) Hard error everywhere, and document it.
Which would you prefer? I'd like to work on this.
AI disclosure: I found the original typo behaviour myself while reviewing #2037. Claude ran the two side-effect checks, and I'll rerun everything locally before opening a PR.
I happened to come across this in last few days and was leaning towards allowing unknown fields, just so a config doesn't need to be updated if you turn off a previously configured feature (like telemetry).
I didn't think about/look into the warning option though, how would that be implemented?
Activity
xstoicunicornx commentedon Dec 2, 2026
I happened to come across this in last few days and was leaning towards allowing unknown fields, just so a config doesn't need to be updated if you turn off a previously configured feature (like telemetry).
I didn't think about/look into the warning option though, how would that be implemented?
Reject unknown keys in the mailroom config file
Reject unknown keys in the mailroom config file