-
Notifications
You must be signed in to change notification settings - Fork 479
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
Bugfix of Yaml exception with simple quotes #414
Conversation
@syn-4ck , what version of |
Hi @domanchi, I detect the bug in the v1.0.3. |
Ok, I had a chance to look this over. Couple of comments:
|
Thanks for checking the changes. I would like to answer your comments below:
I hope this comment helps you @domanchi. |
Thanks for your feedback @pablosantiagolopez! |
Ah, I see it now. You need both the Yes, let's not remove the |
Hi @domanchi! I have just uploaded the changes, now the FALSE_POSITiVES list is commented for a future deprecation. In effect, you need both changes to correct it. I look forward to more comments or to the merge. |
There is a test failing, but is not related to this branch. Will fix on master. |
In a quick test of this new
where We will need to change this to exclude quote marks. |
In further comparisons (within this repo alone), it looks like it does have better signal, but with some trade-offs. For example:
I think our previous assumption is a whitespace delineated secret, but it's acting funky now that we're changing that assumption. 🤔 |
We are currently checking this.
Do you detect more "random things"? :( |
That's a good point. I guess the only bad thing here is that there's no ascii characters in this (if we assume that secrets should have some ascii letters in it). Another way we might be able to address this is through filters, and write a filter that ensures the secret meets this bar. However, I remember that y'all were saying how you found that there were several real cases you found where secrets were just blank strings. How does this work in this case? |
We are totally agree with you! We consider do a filter or change the
In this version with the fix, detect-secrets doesn't report empty passwords (like |
* Catch more cases for IAM * Fix build
The following exception has been raised during a Yaml file scan:
The YAML file has the following content:
To fix the bug, I just remove the
?
in the following keyword plugin line:OPTIONAL_WHITESPACE = r'\s*?'
I think that the
?
in this regex is not necessary because the*
matches from 0 to n times.Also, in our experience, it is very common for developers to use passwords with whitespaces. Currently, detect-secrets doesn't report the secrets if the value has been defined between quotes and report the first string in other cases. I suggest the change of
SECRET = r'[^\s]+'
regex toSECRET = r'[^\r\n]+'
.In closing, I remove the FALSE_POSITIVES list to clear the code, I think it is unused and it has been replaced by the filters.