Skip to content

Commit

Permalink
Use unverified by default, only report false for true neg (Yelp#289)
Browse files Browse the repository at this point in the history
* Use unverified by default, only report false for true neg

* Still use 5s as timeout
  • Loading branch information
XIANJUN ZHU authored and justineyster committed Sep 9, 2020
1 parent fa39922 commit 6fb2100
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions detect_secrets/plugins/db2.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,11 @@ def verify_db2_credentials(
else:
return VerifiedResult.VERIFIED_FALSE
except Exception as e:
if 'Timeout' in str(e):
return VerifiedResult.UNVERIFIED
else:
if 'invalid' in str(e).lower():
# Only return for true negative
return VerifiedResult.VERIFIED_FALSE
else:
return VerifiedResult.UNVERIFIED


def find_other_factor(content, factor_keyword_regex, factor_regex):
Expand Down
2 changes: 1 addition & 1 deletion tests/plugins/db2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_verify_invalid_connect_throws_exception(self, mock_db2_connect):
host={},
port={}'''.format(DB2_USER, DB2_PASSWORD, DB2_DATABASE, DB2_HOSTNAME, DB2_PORT),
potential_secret,
) == VerifiedResult.VERIFIED_FALSE
) == VerifiedResult.UNVERIFIED

mock_db2_connect.assert_called_with(DB2_CONN_STRING, '', '')

Expand Down

0 comments on commit 6fb2100

Please sign in to comment.