-
Notifications
You must be signed in to change notification settings - Fork 482
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
Support for C, C++ and C# secrets in Keyword plugin #429
Conversation
Hi @domanchi, what do you think about that? Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix and ship!
I checked ~200 of our internal repositories with the new SQUARE_BRACKETS
regex, and it looks sane to me. We don't have C++ code internally to test on, but your regex looks sane to me.
detect_secrets/plugins/keyword.py
Outdated
denylist=DENYLIST_REGEX, | ||
square_brackets=SQUARE_BRACKETS, | ||
optional_whitespace=OPTIONAL_WHITESPACE, | ||
secret=SECRET, | ||
), | ||
flags=re.IGNORECASE, | ||
) | ||
FOLLOWEB_BY_OPTIONAL_ASSIGN_QUOTES_REQUIRED_REGEX = re.compile( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FOLLOWEB_BY_OPTIONAL_ASSIGN_QUOTES_REQUIRED_REGEX = re.compile( | |
FOLLOWED_BY_OPTIONAL_ASSIGN_QUOTES_REQUIRED_REGEX = re.compile( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, thank you for report it! It's corrected
* Fix divide by zero bug Fixes user reported bug (see [Slack thread](https://ibm-whitewater.slack.com/archives/CDMGJ9QG2/p1620408289067500)) * Fix safety check
This Pull Request introduces some regex in the KeywordDetector plugin to detect secrets in C, C++ and C# files. Some examples of this secrets are:
C:
char* password = "foo";
char password[25] = "foo";
C++:
string secret = "foo";
std::string secret("foo");
secret.assign("foo",17);
C#:
string password = @"foo";
string password = "foo";
string password[] = "foo";