diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f2f363a..fbdcdca0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,11 @@ If you love `detect-secrets`, please star our project on GitHub to show your sup ### v1.4.0 diff --git a/README.md b/README.md index cf734df9..72c114f8 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ Base64HighEntropyString HexHighEntropyString IbmCloudIamDetector IbmCosHmacDetector +IPPublicDetector JwtTokenDetector KeywordDetector MailchimpDetector diff --git a/detect_secrets/plugins/ip_public.py b/detect_secrets/plugins/ip_public.py new file mode 100644 index 00000000..287ea9f3 --- /dev/null +++ b/detect_secrets/plugins/ip_public.py @@ -0,0 +1,45 @@ +import re + +from .base import RegexBasedDetector + + +class IPPublicDetector(RegexBasedDetector): + """Scans for public ip address (ipv4) + + Some non-public ipv4 addresses are ignored, such as: + - 127. + - 10. + - 172.(16-31) + - 192.168. + + Reference: + https://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xhtml + https://en.wikipedia.org/wiki/Private_network + """ + secret_type = 'Public IP (ipv4)' + + denylist_ipv4_address = r""" + (?