Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion libdd-trace-obfuscation/src/ip_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
use regex::Regex;
use std::{borrow::Cow, collections::HashSet, net::Ipv6Addr, sync::LazyLock};

const ALLOWED_IP_ADDRESSES: [&str; 4] = [
const ALLOWED_IP_ADDRESSES: [&str; 5] = [
// localhost
"127.0.0.1",
"::1",
// link-local cloud provider metadata server addresses
"169.254.169.254",
"fd00:ec2::254",
// ECS task metadata
"169.254.170.2",
];

const PREFIX_REGEX_LITERAL: &str = r"^((?:dnspoll|ftp|file|http|https):/{2,3})";
Expand Down Expand Up @@ -195,6 +197,7 @@ mod tests {
quantize_peer_ip_addresses("169.254.169.254"),
"169.254.169.254"
);
assert_eq!(quantize_peer_ip_addresses("169.254.170.2"), "169.254.170.2");
// blocking cases
assert_eq!(quantize_peer_ip_addresses(""), "");
assert_eq!(quantize_peer_ip_addresses("foo.dog"), "foo.dog");
Expand Down
Loading