Skip to content
Prev Previous commit
Next Next commit
Added scan_string method to SecretsCollection
  • Loading branch information
issabayevmk authored Jun 7, 2024
commit d1786cf2279fe62496c9476ca09fbf7f40bcfbdc
4 changes: 4 additions & 0 deletions detect_secrets/core/secrets_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def scan_file(self, filename: str) -> None:
for secret in scan.scan_file(os.path.join(self.root, convert_local_os_path(filename))):
self[convert_local_os_path(filename)].add(secret)

def scan_string(self, string: str) -> None:
for secret in scan.scan_line(string):
self['adhoc-string-scan'].add(secret)

def scan_diff(self, diff: str) -> None:
"""
:raises: UnidiffParseError
Expand Down