detect-secrets icon indicating copy to clipboard operation
detect-secrets copied to clipboard

Feature Request: API for detecting secrets for sources other than files

Open JLLeitschuh opened this issue 2 years ago • 1 comments

  • I'm submitting a ...

    • [ ] bug report
    • [x] feature request
  • What is the current behavior?

The current API and implementation is heavily reliant upon the expectation that this project will be used to scan a filesystem. However, it may be useful to find secrets that have in some string that may only exist in memory.

  • What is the expected behavior?

It would be great if you could scan a given string you have in memory and determine if that string contains a secret.

  • What is the motivation / use case for changing the behavior?

This would allow this library to be used to detect secrets in context outside of just a filesystem, but more generally as a secret detection library.

JLLeitschuh avatar Sep 30 '23 18:09 JLLeitschuh

Hi @lorenzodb1. Can you please check my pull request https://github.com/Yelp/detect-secrets/pull/836 which introduces API for calling detect-secrets from python scripts. It has following features:

  • Get list of supported plugins
  • Scan string with all plugins or specified plugins
  • Scan file with all plugins or specified plugins
  • Scan git repo with options to scan all files or only git tracked repos. Also with all plugins or specified plugins

issabayevmk avatar May 17 '24 11:05 issabayevmk