diff --git a/detect_secrets/plugins/keyword.py b/detect_secrets/plugins/keyword.py index 96c720b4e..7922912d2 100644 --- a/detect_secrets/plugins/keyword.py +++ b/detect_secrets/plugins/keyword.py @@ -45,6 +45,7 @@ 'private_key', 'secret', 'secrete', + 'token', ) FALSE_POSITIVES = { '""', diff --git a/tests/plugins/keyword_test.py b/tests/plugins/keyword_test.py index ac2062074..1e4ecd24f 100644 --- a/tests/plugins/keyword_test.py +++ b/tests/plugins/keyword_test.py @@ -18,6 +18,7 @@ "quotes_required": [ 'theapikey: ""', # Nothing in the quotes 'theapikey: "somefakekey"', # 'fake' in the secret + 'token: "somefaketoken"', # 'fake' in the secret ], "quotes_not_required": [ 'theapikeyforfoo:hopenobodyfindsthisone', # Characters between apikey and : @@ -30,11 +31,13 @@ '"theapikey": "{{h}o)p${e]nob(ody[finds>-_$#thisone}}"', 'apikey: "{{h}o)p${e]nob(ody[finds>-_$#thisone}}"', "apikey: '{{h}o)p${e]nob(ody[finds>-_$#thisone}}'", + "token: '{{h}o)p${e]nob(ody[finds>-_$#thisone}}'", ], "quotes_not_required": [ 'apikey: {{h}o)p${e]nob(ody[finds>-_$#thisone}}', 'apikey:{{h}o)p${e]nob(ody[finds>-_$#thisone}}', 'theapikey:{{h}o)p${e]nob(ody[finds>-_$#thisone}}', + 'token:{{h}o)p${e]nob(ody[finds>-_$#thisone}}', ], }, } @@ -60,6 +63,7 @@ 'some_dict["secret"] = "{{h}o)p${e]nob(ody[finds>-_$#thisone}}"', 'the_password= "{{h}o)p${e]nob(ody[finds>-_$#thisone}}"\n', 'the_password=\'{{h}o)p${e]nob(ody[finds>-_$#thisone}}\'\n', + 'apitoken=\'{{h}o)p${e]nob(ody[finds>-_$#thisone}}\'\n', ], "quotes_not_required": [ "some_dict['secret'] = {{h}o)p${e]nob(ody[finds>-_$#thisone}}", @@ -69,6 +73,7 @@ 'my_password = {{h}o)p${e]nob(ody[finds>-_$#thisone}}', 'my_password ={{h}o)p${e]nob(ody[finds>-_$#thisone}}', 'the_password={{h}o)p${e]nob(ody[finds>-_$#thisone}}\n', + 'my_token={{h}o)p${e]nob(ody[finds>-_$#thisone}}\n', ], }, } @@ -98,6 +103,7 @@ "quotes_required": [ 'theapikey := ""', # Nothing in the quotes 'theapikey := "somefakekey"', # 'fake' in the secret + 'token := "somefakekey"', # 'fake' in the secret ], "quotes_not_required": [ 'theapikeyforfoo := hopenobodyfindsthisone', # Characters between apikey and := @@ -115,12 +121,14 @@ "apikey:= '{{h}o)p${e]nob(ody[finds>-_$#thisone}}'", "apikey:='{{h}o)p${e]nob(ody[finds>-_$#thisone}}'", "apikey:= '{{h}o)p${e]nob(ody[finds>-_$#thisone}}'", + "token:= '{{h}o)p${e]nob(ody[finds>-_$#thisone}}'", ], "quotes_not_required": [ "apikey := {{h}o)p${e]nob(ody[finds>-_$#thisone}}", "apikey :={{h}o)p${e]nob(ody[finds>-_$#thisone}}", "apikey:= {{h}o)p${e]nob(ody[finds>-_$#thisone}}", "apikey:={{h}o)p${e]nob(ody[finds>-_$#thisone}}", + "thetoken:={{h}o)p${e]nob(ody[finds>-_$#thisone}}", ], }, }