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

Can't detect secret in comment line without single/double quote

Open PatrickWong-China opened this issue 4 years ago • 1 comments

I'm running detect-secrets on .tsx file and secret cannot be detected in comment line if secret without single/double quote

image

$ pre-commit run --all-files
Detect secrets...........................................................Passed

If add single/double quote , it works as expectations

image

$ pre-commit run --all-files
Detect secrets...........................................................Failed
- hook id: detect-secrets
- exit code: 1

ERROR: Potential secrets about to be committed to git repo!

Secret Type: Base64 High Entropy String
Location:    src/const/xxxxxxx.tsx:9

My detect-secrets and pre-commit version could see below:

$ pip3 list | grep 'detect\|pre'
detect-secrets        1.0.3
pre-commit            2.12.1

Is it design for this? Or it need to improve as feature?

PatrickWong-China avatar Aug 19 '21 03:08 PatrickWong-China

I also have the same problem, my version of detect-secrets is 1.1.0. but when I add these contents into a big file, the secret can be exposed and not need to add quote. but if add quote, the hard-code issue must be detected and the secret is accurate. for example:

  • secret:"nd5jm27k130m741et1e86jb6gjud3b97"&lifetime=10000|0 1637140188(1)

  • secret:nd5jm27k130m741et1e86jb6gjud3b97&lifetime=10000|application/json; charset=UTF-8|12ms 1637140285(1)

BoOuyang-TigerGraph avatar Nov 17 '21 08:11 BoOuyang-TigerGraph