Skip to content

Document how to use Bandit #603

@bittner

Description

@bittner

There are several issues open that suggest that it is unclear how Bandit is meant to be executed. In fact, there are no usage instructions at all in the Bandit docs.

Describe the solution you'd like

There should be simple, crisp, usage instructions in the Bandit docs, e.g.

Install Bandit:

pip install bandit

Run Bandit over your entire project:

bandit

(Obviously, the instructions above don't work for the current version 1.6.2.)

Apart from updating the docs, while this is likely the most important place to start, the problem domain may entail that the usage in general must be made simple:

  • Sensible defaults should prevail
  • Overriding defaults should be simple and intuitive
  • Common patterns of use (aka "developer behavior") should be taken into account

Describe alternatives you've considered

Setting default options in tox.ini and/or .bandit, and wrap it with Tox. See #396 (comment).

Not nice, with limited success, and not universally usable for everyone.

Additional context

Bandit doesn't current traverse the entire project tree, and it doesn't ignore (common) hidden folders by default, e.g. .git, .tox. It also reports security issues in tests that make little sense to report (e.g. "Use of assert detected", "Possible hardcoded password", "Starting a process with a partial executable path", etc. – that's just the natural way you implement tests).

Codacy also uses Bandit and reports all issues related to test implementations. It's unclear how they use the tool, but it's likely a rather custom way.

Long story short: There are a lot of things unclear when it comes to using Bandit. A tool that is – I would guess – meant to be simple to use. Not to say, trying to get out of your way.

Possibly related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions