diff --git a/tests/zxcvbn_test.py b/tests/zxcvbn_test.py index 6752c1f..a33c8dd 100644 --- a/tests/zxcvbn_test.py +++ b/tests/zxcvbn_test.py @@ -46,3 +46,13 @@ def test_empty_password(): zxcvbn(password, user_inputs=[input_]) except IndexError as ie: assert False, "Empty password raised IndexError" + + +def test_user_inputs_side_effects(): + password = '7r3iz3|)0uz3' + input_ = [password] + + guess1 = zxcvbn(password)['guesses_log10'] + zxcvbn('somepassword', user_inputs=input_) + guess2 = zxcvbn(password)['guesses_log10'] + assert abs(guess1 - guess2) < 1 diff --git a/zxcvbn/matching.py b/zxcvbn/matching.py index e211ab3..7845aaa 100644 --- a/zxcvbn/matching.py +++ b/zxcvbn/matching.py @@ -100,6 +100,8 @@ def wrapper(*args, **kwargs): def omnimatch(password, _ranked_dictionaries=None, user_inputs=[]): if len(user_inputs): _ranked_dictionaries['user_inputs'] = build_ranked_dict(user_inputs) + elif 'user_inputs' in _ranked_dictionaries: + del(_ranked_dictionaries['user_inputs']) matches = [] for matcher in [