awslabs / git-secrets

Prevents you from committing secrets and credentials into git repositories
Apache License 2.0
12.36k stars 1.17k forks source link

Successful exit code if a regex is invalid #151

Open dizzersee opened 4 years ago

dizzersee commented 4 years ago

If an invalid regex pattern is added to config, e.g. "(" not escaped, git-secrets exits with exit code 0. Because the regex is invalid, it does not scan anything. This is not good for integrating it into a CI/CD-pipeline. As there is an error, shouldn't git-secrets exit with another exit code?

sparr commented 1 year ago

I agree that git-secrets should exit with a non-zero exit code in the case of encountering an error in a pattern.

Also, --add should attempt to validate the pattern, although invalid patterns could still be added via git config or directly editing the config file.