mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 03:05:51 +03:00
[PR #2375] [MERGED] Strict parsing of configuration files #2991
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#2991
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hickory-dns/hickory-dns/pull/2375
Author: @divergentdave
Created: 8/22/2024
Status: ✅ Merged
Merged: 8/26/2024
Merged by: @djc
Base:
main← Head:david/config-deny-unknown-fields📝 Commits (3)
c63c00bAdd serde(deny_unknown_fields) to config types27412a7Fix error in example config5bb8800Add mutation testing of config for unknown fields📊 Changes
9 files changed (+247 additions, -4 deletions)
View changed files
📝
crates/resolver/src/config.rs(+10 -2)📝
crates/server/src/config/dnssec.rs(+2 -0)📝
crates/server/src/config/mod.rs(+2 -0)📝
crates/server/src/store/file/config.rs(+1 -0)📝
crates/server/src/store/forwarder/config.rs(+1 -0)📝
crates/server/src/store/recursor/config.rs(+1 -0)📝
crates/server/src/store/sqlite/config.rs(+1 -0)📝
crates/server/tests/config_tests.rs(+227 -0)📝
tests/test-data/test_configs/example_forwarder.toml(+2 -2)📄 Description
This PR implements one half of #2195. I added
#[serde(deny_unknown_fields)]to all configuration types, which will cause an error if there are any unexpected keys in a table. This turned up one issue in the example forwarder config file.I also added a test that starts with all config files in
tests/test-data/test_configs, mutates them by adding an extra key to each table in turn, and confirms that it gets an "unknown field" error when trying to parse each mutated input. Since#[serde(deny_unknown_fields)]is configured on a type-by-type basis, it can be easy to forget, so this test is intended to help maintain this behavior going forward. It can't discover new tables on its own, but so long as the example/test configuration files have good coverage, it should help.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.