Closed perryzjc closed 1 year ago
I also have some updates on my findings about the "bug" discussed in my meeting with @riverma
Below are the cases we discussed during the meeting. Rishi and I both got the same results for each case.
built-in plugin:
my custom plugins:
sample file:
e-mail: a_email@jpl.nasa.gov
username: myuser
password: mypass
sg-12345678
After running command
detect-secrets scan ./ --all-files --exclude-files '.secrets.*' --exclude-files '.git*' > .secrets.baseline
the baseline file only showed two results (supposed to show all three) from my custom plugin:
built-in plugin:
my custom plugins:
sample file:
username: myuser
password: mypass
sg-12345678
After running the same command, the baseline file only showed one result from my custom plugin:
built-in plugin:
sample file:
username: myuser
password: mypass
After running the same command, the baseline file only showed one result from the built-in plugin:
During the meeting, we thought the "bug" came from my custom plugins based on the above results.
After the meeting and more test cases, I think it's a common issue, which also occurs for built-in plugins only
case
built-in plugin:
sample file:
username: myuser
password: mypass
'-----BEGIN RSA PRIVATE KEY-----\n'
'super secret private key here\n'
'-----END RSA PRIVATE KEY-----'
After running the same command, the baseline file only showed one result from the built-in plugin (PrivateKeyDetector):
built-in plugin:
my custom plugins:
sample file:
sg-12345678
'-----BEGIN RSA PRIVATE KEY-----\n'
'super secret private key here\n'
'-----END RSA PRIVATE KEY-----'
After running the same command, the baseline file successfully showed both results
built-in plugin:
my custom plugins:
sample file:
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
sg-12345678
After running the same command, the baseline file successfully showed both results
Based on further tests 5 and 6, detect-secrets
successfully showed all secret types even if there is a custom plugin.
So far, all the buggy test examples occur when there is a KeywordDetector
It can probably be a bug from the official 'Yelp/detect-secrets` or a feature. But anyway, this part is what I need to ask 'Yelp/detect-secrets' to improve
Although this "bug" exists at the moment, detect-secret
is still able to tell us where there is a Keyword detected. The only inconvenience is that we need to let it be the only secret type existing in a single file. But as we clean the otehr secret types further, we will find it eventually.
I also have some updates on my findings about the "bug" discussed in my meeting with @riverma
Great analysis @perryzjc! This clarifies some unexpected behavior (we think) from detect secrets. Not too worried, since this is only relevant to a single file, and resolving one of the secrets in code should make the other plugins catch other secrets within the same file. However, this discussion is great to point developers at detect secrets to, for clarification whether a bug ticket should be filed.
+1 Let's merge this PR...
Approved by @riverma and @jpl-jengelke. Merging.
Purpose
Proposed Changes
detect-secrets
under Static Application Security Testing section ofcontinuous-testing/starter-kits/README.md
Issues
Testing
UnableToReadBaselineError
. When I use the default Yelp/detect-secrets, the problem still exists. I will be further investigating this issue and open an issue ticket to Yelp/detect-secrets.Additional Notes
After discussion, I am using the forked
detect-secrets
for this documentation. Compared to the original detect-secrets from Yelp, my solution have additional plugins which are being reviewed by the Yelp/detect-secrets community. There are two pull requests for my customized pluginsOther plugins are experimental version for now, and I will be further developing in the next two weeks and have them reviewed. Once all the plugins are reviewed and merged to the Yelp/detect-secrets, I will update the documentation to use the original Yelp/detect-secrets.
Check out the documentation for more details :)