H: deny IPv6 link-local and metadata addresses by default Add fe80::/10, ::/128 and fd00:ec2::254/128 to the default deny_cidrs and sync config.example.toml, README and docs/consolidator.md

This commit is contained in:
ari committed 2026-10-20 16:13:25 -04:00
1 parent 6e74d3d99b
commit 97c81f899c
6 files changed
+54 -5

No files matched your search

+24
View File
@@ -516,6 +516,30 @@ mod tests {
assert!(!url_is_loopback(&Url::parse("http://beta:1984").unwrap()));
}
#[test]
fn the_default_deny_list_covers_metadata_in_both_families_but_allows_lans() {
let deny = deny_networks(&PeersConfig::default().deny_cidrs).unwrap();
for refused in [
"169.254.169.254",
"0.0.0.0",
"fe80::1",
"::",
"fd00:ec2::254",
"::ffff:169.254.169.254",
] {
assert!(denied(refused.parse().unwrap(), &deny), "{refused}");
}
for allowed in [
"10.1.2.3",
"192.168.1.10",
"::1",
"fd00:1::5",
"2001:db8::1",
] {
assert!(!denied(allowed.parse().unwrap(), &deny), "{allowed}");
}
}
#[test]
fn deny_networks_rejects_a_bad_cidr_once_for_every_caller() {
assert!(deny_networks(&["10.0.0.0/8".into()]).is_ok());
+22 -2
View File
@@ -141,6 +141,17 @@ pub struct PeersConfig {
pub peer: Vec<PeerConfig>,
}
/// Refused by default: link-local and cloud metadata addresses in both
/// families, plus the unspecified address. Private LAN ranges stay allowed,
/// since that is where peers live.
pub const DEFAULT_DENY_CIDRS: [&str; 5] = [
"169.254.0.0/16",
"0.0.0.0/8",
"fe80::/10",
"::/128",
"fd00:ec2::254/128",
];
impl Default for PeersConfig {
fn default() -> Self {
Self {
@@ -154,7 +165,7 @@ impl Default for PeersConfig {
max_response_bytes: 8 * 1024 * 1024,
max_concurrent_per_peer: 4,
max_concurrent_total: 16,
deny_cidrs: vec!["169.254.0.0/16".into(), "0.0.0.0/8".into()],
deny_cidrs: DEFAULT_DENY_CIDRS.iter().map(|c| c.to_string()).collect(),
peer: Vec::new(),
}
}
@@ -290,7 +301,16 @@ mod tests {
assert_eq!(c.tcp_interval_secs, 10);
assert_eq!(c.request_timeout_secs, 10);
assert_eq!(c.max_response_bytes, 8 * 1024 * 1024);
assert_eq!(c.deny_cidrs, vec!["169.254.0.0/16", "0.0.0.0/8"]);
assert_eq!(
c.deny_cidrs,
vec![
"169.254.0.0/16",
"0.0.0.0/8",
"fe80::/10",
"::/128",
"fd00:ec2::254/128",
]
);
}
#[test]