Skip to content

Commit

Permalink
Merge pull request #885 from jfagoagas/fix_ip_public_link_local
Browse files Browse the repository at this point in the history
fix(ip_public): Exclude IPv4 Link Local
  • Loading branch information
lorenzodb1 authored Oct 7, 2024
2 parents 6cdb79b + 3025a07 commit 7b162a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions detect_secrets/plugins/ip_public.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/plugins/ip_public_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 7b162a7

Please sign in to comment.