From 3025a07fd55db19d0e77c4b626e0c4defdaf853f Mon Sep 17 00:00:00 2001 From: Pepe Fagoaga Date: Mon, 7 Oct 2024 22:30:43 +0200 Subject: [PATCH] fix(ip_public): Exclude IPv4 Link Local --- detect_secrets/plugins/ip_public.py | 2 ++ tests/plugins/ip_public_test.py | 1 + 2 files changed, 3 insertions(+) diff --git a/detect_secrets/plugins/ip_public.py b/detect_secrets/plugins/ip_public.py index 287ea9f39..f9a435904 100644 --- a/detect_secrets/plugins/ip_public.py +++ b/detect_secrets/plugins/ip_public.py @@ -11,6 +11,7 @@ class IPPublicDetector(RegexBasedDetector): - 10. - 172.(16-31) - 192.168. + - 169.254. - Link Local Address IPv4 Reference: https://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xhtml @@ -25,6 +26,7 @@ class IPPublicDetector(RegexBasedDetector): 192\.168\. # Exclude "192.168." |127\. # Exclude "127." |10\. # Exclude "10." + |169\.254\. # Exclude IPv4 Link Local Address (169.254.0.0/16) |172\.(?:1[6-9]|2[0-9]|3[01]) # Exclude "172." with specific ranges ) (?: # Non-capturing group for octets diff --git a/tests/plugins/ip_public_test.py b/tests/plugins/ip_public_test.py index 5480f093b..77c9da95b 100644 --- a/tests/plugins/ip_public_test.py +++ b/tests/plugins/ip_public_test.py @@ -37,6 +37,7 @@ class TestIPv4: ('10.0.0.1', False), ('172.16.0.1', False), ('192.168.0.1', False), + ('169.254.169.254', False), # Invalid IPv4 addresses ('256.256.256.256', False), ('1.2.3', False),