-
-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document how to use Bandit #603
Comments
Hi, I think this may be helpful here. Here is my current approach to configure
If you are using VSCode, you can include the following in your
// settings.json
{
"python.linting.enabled": true,
"python.linting.lintOnSave": true,
"python.linting.banditEnabled": true,
// https://code.visualstudio.com/docs/editor/variables-reference
"python.linting.banditArgs": [
// "-ll",
// "-ii",
"--configfile=${workspaceFolder}/bandit.yml",
"--ini=${workspaceFolder}/.bandit",
],
"files.associations": {
".bandit": "ini",
},
} |
Bandit UX is seriously broken, only <1.6 works predictably. Exclude/ignore of files is currently broken in Bandit: - PyCQA/bandit#693 - PyCQA/bandit#490 - PyCQA/bandit#438 (comment) Reading settings from configuration files is broken: - PyCQA/bandit#753 - PyCQA/bandit#595 Reading from pyproject.toml not yet functional: - Must install "toml" package and use "-c pyproject.toml". - PyCQA/bandit#758 INI file configuration and CLI usage is unclear: - PyCQA/bandit#603 - PyCQA/bandit#467 - PyCQA/bandit#396
Bandit UX is seriously broken, only <1.6 works predictably. Exclude/ignore of files is currently broken in Bandit: - PyCQA/bandit#693 - PyCQA/bandit#490 - PyCQA/bandit#438 (comment) Reading settings from configuration files is broken: - PyCQA/bandit#753 - PyCQA/bandit#595 Reading from pyproject.toml not yet functional: Must install "toml" package and use "-c pyproject.toml". - PyCQA/bandit#758 INI file configuration and CLI usage is unclear: - PyCQA/bandit#603 - PyCQA/bandit#467 - PyCQA/bandit#396
Bandit UX is seriously broken, only <1.6 works predictably. Exclude/ignore of files is currently broken in Bandit: - PyCQA/bandit#693 - PyCQA/bandit#490 - PyCQA/bandit#438 (comment) Reading settings from configuration files is broken: - PyCQA/bandit#753 - PyCQA/bandit#595 Reading from pyproject.toml not yet functional: Must install "toml" package and use "-c pyproject.toml". - PyCQA/bandit#758 INI file configuration and CLI usage is unclear: - PyCQA/bandit#603 - PyCQA/bandit#467 - PyCQA/bandit#396
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.
(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:
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
bandit -rf custom
only shows up to 3 warnings #459 (bandit -rf custom
only shows up to 3 warnings)exclude
vsexclude_dirs
#528 (Documentation of configuration is confusing / misleading regardingexclude
vsexclude_dirs
)The text was updated successfully, but these errors were encountered: