Bug fix for hardcoded passwords test

This commit is contained in:
Travis McPeak 2014-09-16 16:02:20 -07:00
parent 6b1211b561
commit db1a78d4de
3 changed files with 11 additions and 2 deletions

View File

@ -5,3 +5,11 @@ def someFunction2(password):
if password == "root":
print "OK, logged in"
def noMatch(password):
if password == '':
print "No password!"
def NoMatch2(password):
if password == "ajklawejrkl42348swfgkg":
print "Nice password!"

View File

@ -1,3 +1,4 @@
f = open('/tmp/abc', 'w')
f.write('def')
f.close()
f.close()

View File

@ -42,5 +42,5 @@ def hardcoded_password(context, config):
# for every password in the list, check against the current string
for word in word_list:
if context.string_val == word:
if context.string_val and context.string_val == word:
return bandit.WARN, "Possible hardcoded password '(%s)'" % word