-
-
Notifications
You must be signed in to change notification settings - Fork 711
Description
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 banditRun 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
- Make 'target' arg optional and let it be defined in the ini file #274 (Make 'target' arg optional and let it be defined in the ini file)
- default config file name #318 (default config file)
- INI file format is not obviously documented anywhere #396 (INI file format is not obviously documented anywhere)
- Skip configuration for certain paths only #457 (Skip configuration for certain paths only)
bandit -rf customonly shows up to 3 warnings #459 (bandit -rf customonly shows up to 3 warnings)- Use current directory unless explicitly specified #467 (Use current directory unless explicitly specified)
- Bandit 1.6.0 no longer respects excluded directories #488 (Bandit 1.6.0 no longer respects excluded directories) -- still a bug in 1.6.2
- degraded performance in 1.6.0 release #490 (degraded performance in 1.6.0 release) -- likely related to Bandit 1.6.0 no longer respects excluded directories #488
- Exclude paths in config file ignored if passing specific files to Bandit CLI #499 (Exclude paths in config file ignored if passing specific files to Bandit CLI)
- Doc - Usage with Code Climate #519 (Doc - Usage with Code Climate) -- note the "minimal configuration" hint
- Documentation of configuration is confusing / misleading regarding
excludevsexclude_dirs#528 (Documentation of configuration is confusing / misleading regardingexcludevsexclude_dirs) - cannot run bandit on codes in a folder using *.py #537 (cannot run bandit on codes in a folder using *.py)
- Ini file settings ignored #595 (Ini file settings ignored)