Skip to content

hashlib_insecure_functions raising KeyError #832

@ericwb

Description

@ericwb

Describe the bug

[tester]	ERROR	Bandit internal error running: hashlib on file ../ansible/lib/ansible/plugins/inventory/__init__.py at line 317: 'name'Traceback (most recent call last):
  File "/Users/browne/workspace/bandit/bandit/core/tester.py", line 53, in run_tests
    result = test(context)
  File "/Users/browne/workspace/bandit/bandit/plugins/hashlib_insecure_functions.py", line 115, in hashlib
    return _hashlib_func(context)
  File "/Users/browne/workspace/bandit/bandit/plugins/hashlib_insecure_functions.py", line 57, in _hashlib_func
    name = args[0] if args else keywords["name"]
KeyError: 'name'

Reproduction steps

1. Clone the ansible repository
2. `bandit -r ../ansible/ -x ../ansible/test/`
3. Notice the traceback in the beginning of the Bandit output

Expected behavior

Shouldn't see any tracebacks from Bandit unless there are errors in the Bandit code itself.

Bandit version

1.7.3

Python version

3.9

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions