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

Skip matches containing strings using blacklisted_strings #44

Closed
j0k2r opened this issue Mar 29, 2022 · 3 comments
Closed

Skip matches containing strings using blacklisted_strings #44

j0k2r opened this issue Mar 29, 2022 · 3 comments
Assignees

Comments

@j0k2r
Copy link

j0k2r commented Mar 29, 2022

Hi,

I'm running the SecretScanner in local mode using the docker image:
docker run --rm -v /tmp/vulnerable_repo:/target -v /tmp/test_sec:/artifacts deepfenceio/deepfence_secret_scanner -config-path /artifacts -debug-level DEBUG -multi-match -maximum-file-size 512 -max-multi-match 5 -json-filename report.json -output-path /artifacts -local /target

The tool works perfectly, and it detect all the repository secrets.

But in some cases the target repositories may contain files with meta attributes. For example:

{
    "mariadb": {
        "host": "MARIADB_HOST",
        "port": "MARIADB_PORT",
        "rootMariaPwd": "MYSQL_ROOT_PASSWORD_EXAMPLE",
    },
}

I'm triying to whitelist all the matches containing the string _EXAMPLE with no success:

# Secret Scanner Configuration File

blacklisted_extensions: []
blacklisted_paths: []
blacklisted_strings:
- _EXAMPLE

signatures:
- name: Generic credentials
  part: contents
  regex: (?i)(?:'|"){0,1}(?:[a-z0-9\-_.]{0,25})(?:key|api|apikey|token|secret|client|pass|pwd|passwd|password|auth|cred|authentication)(?:[0-9a-z\-_\s.]{0,20})(?:'|"){0,1}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=){0,5}([0-9a-z\-_\.=:@!]{8,512})['|\"|\n|\r|\s]
  regextype: 'large'
  severity: high
  severityscore: 10

Is there something wrong with my configuration ? or it is a SecretScanner bug ?

@j0k2r
Copy link
Author

j0k2r commented Mar 29, 2022

I tested the configuration file using shhgit and the scan works fine and all the matches containing _EXAMPLE are whitelisted.

@mukuldeepfence
Copy link
Contributor

mukuldeepfence commented Apr 11, 2022

We have validated this scenario is working fine

please try this in the config file -

Secret Scanner Configuration File

blacklisted_extensions: []
blacklisted_paths: []
blacklisted_strings: ['_EXAMPLE']

and entries in the list object blacklisted_strings is case sensitive.

Please feel free to comment back if you find the issue still

@j0k2r
Copy link
Author

j0k2r commented Apr 19, 2022

Thanks for the answer, but I ended up creating a new secret scanner project: Secrets Hunter

@j0k2r j0k2r closed this as completed Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants