sirwart / ripsecrets

A command-line tool to prevent committing secret keys into your source code
MIT License
805 stars 24 forks source link

`.secretsignore` without `[secrets]` isn’t used #60

Closed adamchainz closed 1 year ago

adamchainz commented 1 year ago

Say my .secretsignore should ignore everything:

$ cat .secretsignore
*

It doesn't unfortunately work:

$ pre-commit run ripsecrets --all-files --verbose
Found existing alias for "pre-commit run". You should use: "prcr"
ripsecrets...............................................................Failed
- hook id: ripsecrets
- duration: 0.01s
- exit code: 1

credentials.toml:3:password = 'uJSU7Kxquv5FXDRLF7SCBaksmo9o2Zp8'

Adding an empty [secrets] section makes it work though:

$ echo "[secrets]" >> .secretsignore

$ pre-commit run ripsecrets --all-files --verbose
Found existing alias for "pre-commit run". You should use: "prcr"
ripsecrets...............................................................Passed
- hook id: ripsecrets
- duration: 0.01s

This seems to be due to missed creation of the Gitignore object in one branch in https://github.com/sirwart/ripsecrets/blob/main/src/ignore_info.rs