Skip to content
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

To add pass as keyword for detecting secrets under label pass #658

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions detect_secrets/plugins/keyword.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
'key_?pass',
'password',
'passwd',
'pass',
'pwd',
'secret',
'contraseña',
Expand Down
7 changes: 7 additions & 0 deletions tests/plugins/keyword_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
('aws_secret_access_key: {}'.format(WHITES_SECRET), WHITES_SECRET),
('db_pass: {},'.format(COMMON_SECRET), COMMON_SECRET), # Last character is ignored
('passwd: {}`'.format(COMMON_SECRET), COMMON_SECRET), # Last character is ignored
('pass: {}`'.format(COMMON_SECRET), COMMON_SECRET), # Last character is ignored
('private_key: {}"'.format(COMMON_SECRET), COMMON_SECRET), # Last character is ignored
("secret: {}'".format(COMMON_SECRET), COMMON_SECRET), # Last character is ignored
('secrete "{}";'.format(COMMON_SECRET), COMMON_SECRET),
Expand All @@ -34,6 +35,7 @@
('if ("{}" == password) {{'.format(COMMON_SECRET), COMMON_SECRET),
('if ("{}" == my_super_password) {{'.format(COMMON_SECRET), COMMON_SECRET), # Prefix
('if ("{}" != passwd) {{'.format(COMMON_SECRET), COMMON_SECRET),
('if ("{}" != pass) {{'.format(COMMON_SECRET), COMMON_SECRET),
('if ("{}" === private_key) {{'.format(COMMON_SECRET), COMMON_SECRET),
('if ("{}" !== secret) {{'.format(COMMON_SECRET), COMMON_SECRET),
('secrete = {}'.format(LETTER_SECRET), LETTER_SECRET), # All symbols are allowed
Expand All @@ -54,10 +56,12 @@
('db_pass := {}'.format(COMMON_SECRET), COMMON_SECRET),
('db_pass_secure := {}'.format(COMMON_SECRET), COMMON_SECRET), # Suffix
('passwd := {},'.format(COMMON_SECRET), COMMON_SECRET), # Last character is ignored
('pass := {},'.format(COMMON_SECRET), COMMON_SECRET), # Last character is ignored
("private_key := {}'".format(COMMON_SECRET), COMMON_SECRET), # Last character is ignored
('secret := {}"'.format(COMMON_SECRET), COMMON_SECRET), # Last character is ignored
('password := {}`'.format(COMMON_SECRET), COMMON_SECRET), # Last character is ignored
('if ("{}" == passwd) {{'.format(COMMON_SECRET), COMMON_SECRET),
('if ("{}" == pass) {{'.format(COMMON_SECRET), COMMON_SECRET),
('if ("{}" === private_key) {{'.format(COMMON_SECRET), COMMON_SECRET),
('if ("{}" != secret) {{'.format(COMMON_SECRET), COMMON_SECRET),
('if ("{}" !== password) {{'.format(COMMON_SECRET), COMMON_SECRET),
Expand All @@ -68,6 +72,7 @@
('db_pass = {}'.format(COMMON_SECRET), COMMON_SECRET),
('password = {},'.format(COMMON_SECRET), COMMON_SECRET), # Last character is ignored
("passwd = {}'".format(COMMON_SECRET), COMMON_SECRET), # Last character is ignored
("pass = {}'".format(COMMON_SECRET), COMMON_SECRET), # Last character is ignored
('private_key = {}"'.format(COMMON_SECRET), COMMON_SECRET), # Last character is ignored
('secret = {}`'.format(COMMON_SECRET), COMMON_SECRET), # Last character is ignored
('secrete = "{}"'.format(COMMON_SECRET), COMMON_SECRET),
Expand Down Expand Up @@ -100,6 +105,7 @@
("aws_secret_access_key = @'{}';".format(COMMON_SECRET), None), # Double quotes required
("db_pass[] = '{}';".format(COMMON_SECRET), None), # Double quotes required
('passwd = {};'.format(COMMON_SECRET), None), # Double quotes required
('pass = {};'.format(COMMON_SECRET), None), # Double quotes required
('private_key = {};'.format(COMMON_SECRET), None), # Double quotes required
('secret[] = {};'.format(COMMON_SECRET), None), # Double quotes required
('api_key = ""', None), # Nothing in the quotes
Expand Down Expand Up @@ -131,6 +137,7 @@
("db_pass: '{}'".format(LETTER_SECRET), LETTER_SECRET), # All symbols are allowed
("password: '{}'".format(SYMBOL_SECRET), None), # At least 1 alphanumeric character is required
('if ("{}" == passwd) {{'.format(COMMON_SECRET), COMMON_SECRET),
('if ("{}" == pass) {{'.format(COMMON_SECRET), COMMON_SECRET),
('if ("{}" === private_key) {{'.format(COMMON_SECRET), COMMON_SECRET),
('if ("{}" === my_private_key) {{'.format(COMMON_SECRET), COMMON_SECRET), # Prefix
('if ("{}" != secret) {{'.format(COMMON_SECRET), COMMON_SECRET),
Expand Down