Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply custom-detectors to specific file types (via inclusion or exclusion) #3302

Open
mtcolman opened this issue Sep 17, 2024 · 1 comment
Open

Comments

@mtcolman
Copy link

mtcolman commented Sep 17, 2024

Please review the Community Note before submitting

Description

Is it possible to apply regex detectors to specific filetypes? the main use case I have for this is that some filetypes specify password/secret strings without quotes around them, whilst in other filetypes this would be a parameter and thus safe for inclusion.

Preferred Solution

If we could specify in the config.yaml:

detectors:
- name: custom password detector
  keywords:
  - username
  - password
  - token
  regex:
    adjective: "[a-zA-Z0-9]{32}"
  exclude_types: [".py", ".txt", ".example"]

Additional Context

So that I could define many detectors and for each individually specify whether to apply this to certain file types. Then I can run this against an entire directory. I don't want to exclude the files from a scan, I just want to exclude them from specific detectors.

References

N/A

Thanks!

@rgmz
Copy link
Contributor

rgmz commented Sep 17, 2024

Being able to exclude detectors from specific files is a useful capability. I hope the team can add it.

I created a POC in #1741, though it wouldn't work for custom detectors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants