-
-
Notifications
You must be signed in to change notification settings - Fork 626
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
More specific nosec options #418
Labels
enhancement
New feature or request
Milestone
Comments
Would love to see this. Similar to how flake8 handles |
And please use the english identifiers, e.g., |
I would like to see it as well, but I prefer the short-cuts e.g.: |
Duplicate of #211. |
Thanks @stephen-dexda . Closing as Duplicate of #211 |
mikespallino
added a commit
to mikespallino/bandit
that referenced
this issue
Apr 7, 2020
- allow disabling tests by id and by name (e.g. B602,assert_used) - update nosec_lines to be a dict keyed on line number to a set of tests to ignore - use an empty set to indicate a blanket nosec (i.e. just #nosec, no individual tests) - use None to indicate that there was no nosec comment on the line in question - track and report metrics on the number of tests skipped by specific tests and the number of tests that fail because they were not included in the list of specific tests to ignore Resolves PyCQA#211 See also PyCQA#418
mikespallino
added a commit
to mikespallino/bandit
that referenced
this issue
Aug 4, 2020
- allow disabling tests by id and by name (e.g. B602,assert_used) - update nosec_lines to be a dict keyed on line number to a set of tests to ignore - use an empty set to indicate a blanket nosec (i.e. just #nosec, no individual tests) - use None to indicate that there was no nosec comment on the line in question - track and report metrics on the number of tests skipped by specific tests and the number of tests that fail because they were not included in the list of specific tests to ignore Resolves PyCQA#211 See also PyCQA#418
mikespallino
added a commit
to mikespallino/bandit
that referenced
this issue
Mar 4, 2021
- allow disabling tests by id and by name (e.g. B602,assert_used) - update nosec_lines to be a dict keyed on line number to a set of tests to ignore - use an empty set to indicate a blanket nosec (i.e. just #nosec, no individual tests) - use None to indicate that there was no nosec comment on the line in question - track and report metrics on the number of tests skipped by specific tests and the number of tests that fail because they were not included in the list of specific tests to ignore Resolves PyCQA#211 See also PyCQA#418
mikespallino
added a commit
to mikespallino/bandit
that referenced
this issue
Aug 25, 2021
- allow disabling tests by id and by name (e.g. B602,assert_used) - update nosec_lines to be a dict keyed on line number to a set of tests to ignore - use an empty set to indicate a blanket nosec (i.e. just #nosec, no individual tests) - use None to indicate that there was no nosec comment on the line in question - track and report metrics on the number of tests skipped by specific tests and the number of tests that fail because they were not included in the list of specific tests to ignore Resolves PyCQA#211 See also PyCQA#418
mikespallino
added a commit
to mikespallino/bandit
that referenced
this issue
Aug 25, 2021
- allow disabling tests by id and by name (e.g. B602,assert_used) - update nosec_lines to be a dict keyed on line number to a set of tests to ignore - use an empty set to indicate a blanket nosec (i.e. just #nosec, no individual tests) - use None to indicate that there was no nosec comment on the line in question - track and report metrics on the number of tests skipped by specific tests and the number of tests that fail because they were not included in the list of specific tests to ignore Resolves PyCQA#211 See also PyCQA#418
mikespallino
added a commit
to mikespallino/bandit
that referenced
this issue
Jan 7, 2022
- allow disabling tests by id and by name (e.g. B602,assert_used) - update nosec_lines to be a dict keyed on line number to a set of tests to ignore - use an empty set to indicate a blanket nosec (i.e. just #nosec, no individual tests) - use None to indicate that there was no nosec comment on the line in question - track and report metrics on the number of tests skipped by specific tests and the number of tests that fail because they were not included in the list of specific tests to ignore Resolves PyCQA#211 See also PyCQA#418
mikespallino
added a commit
to mikespallino/bandit
that referenced
this issue
Jan 7, 2022
- allow disabling tests by id and by name (e.g. B602,assert_used) - update nosec_lines to be a dict keyed on line number to a set of tests to ignore - use an empty set to indicate a blanket nosec (i.e. just #nosec, no individual tests) - use None to indicate that there was no nosec comment on the line in question - track and report metrics on the number of tests skipped by specific tests and the number of tests that fail because they were not included in the list of specific tests to ignore Resolves PyCQA#211 See also PyCQA#418
mikespallino
added a commit
to mikespallino/bandit
that referenced
this issue
Jan 7, 2022
- allow disabling tests by id and by name (e.g. B602,assert_used) - update nosec_lines to be a dict keyed on line number to a set of tests to ignore - use an empty set to indicate a blanket nosec (i.e. just #nosec, no individual tests) - use None to indicate that there was no nosec comment on the line in question - track and report metrics on the number of tests skipped by specific tests and the number of tests that fail because they were not included in the list of specific tests to ignore Resolves PyCQA#211 See also PyCQA#418
mikespallino
added a commit
to mikespallino/bandit
that referenced
this issue
Jan 7, 2022
- allow disabling tests by id and by name (e.g. B602,assert_used) - update nosec_lines to be a dict keyed on line number to a set of tests to ignore - use an empty set to indicate a blanket nosec (i.e. just #nosec, no individual tests) - use None to indicate that there was no nosec comment on the line in question - track and report metrics on the number of tests skipped by specific tests and the number of tests that fail because they were not included in the list of specific tests to ignore Resolves PyCQA#211 See also PyCQA#418
mikespallino
added a commit
to mikespallino/bandit
that referenced
this issue
Jan 26, 2022
- allow disabling tests by id and by name (e.g. B602,assert_used) - update nosec_lines to be a dict keyed on line number to a set of tests to ignore - use an empty set to indicate a blanket nosec (i.e. just #nosec, no individual tests) - use None to indicate that there was no nosec comment on the line in question - track and report metrics on the number of tests skipped by specific tests and the number of tests that fail because they were not included in the list of specific tests to ignore Resolves PyCQA#211 See also PyCQA#418
mikespallino
added a commit
to mikespallino/bandit
that referenced
this issue
Jan 28, 2022
- allow disabling tests by id and by name (e.g. B602,assert_used) - update nosec_lines to be a dict keyed on line number to a set of tests to ignore - use an empty set to indicate a blanket nosec (i.e. just #nosec, no individual tests) - use None to indicate that there was no nosec comment on the line in question - track and report metrics on the number of tests skipped by specific tests and the number of tests that fail because they were not included in the list of specific tests to ignore Resolves PyCQA#211 See also PyCQA#418
mikespallino
added a commit
to mikespallino/bandit
that referenced
this issue
Jan 28, 2022
- allow disabling tests by id and by name (e.g. B602,assert_used) - update nosec_lines to be a dict keyed on line number to a set of tests to ignore - use an empty set to indicate a blanket nosec (i.e. just #nosec, no individual tests) - use None to indicate that there was no nosec comment on the line in question - track and report metrics on the number of tests skipped by specific tests and the number of tests that fail because they were not included in the list of specific tests to ignore Resolves PyCQA#211 See also PyCQA#418
mikespallino
added a commit
to mikespallino/bandit
that referenced
this issue
Feb 2, 2022
- allow disabling tests by id and by name (e.g. B602,assert_used) - update nosec_lines to be a dict keyed on line number to a set of tests to ignore - use an empty set to indicate a blanket nosec (i.e. just #nosec, no individual tests) - use None to indicate that there was no nosec comment on the line in question - track and report metrics on the number of tests skipped by specific tests and the number of tests that fail because they were not included in the list of specific tests to ignore Resolves PyCQA#211 See also PyCQA#418
mikespallino
added a commit
to mikespallino/bandit
that referenced
this issue
Feb 2, 2022
- allow disabling tests by id and by name (e.g. B602,assert_used) - update nosec_lines to be a dict keyed on line number to a set of tests to ignore - use an empty set to indicate a blanket nosec (i.e. just #nosec, no individual tests) - use None to indicate that there was no nosec comment on the line in question - track and report metrics on the number of tests skipped by specific tests and the number of tests that fail because they were not included in the list of specific tests to ignore Resolves PyCQA#211 See also PyCQA#418
sigmavirus24
pushed a commit
that referenced
this issue
Feb 4, 2022
This adds support to the `# nosec` comment to specify specific tests to disable. - allow disabling tests by id and by name (e.g. B602,assert_used) - update nosec_lines to be a dict keyed on line number to a set of tests to ignore - use an empty set to indicate a blanket nosec (i.e. just #nosec, no individual tests) - use None to indicate that there was no nosec comment on the line in question - track and report metrics on the number of tests skipped by specific tests and the number of tests that fail because they were not included in the list of specific tests to ignore Resolves #211 See also #418
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
I couldn't find any way to specify
# nosec
for a particular bandit issue, which means# nosec
could accidentally mask multiple issues. I have a contrived example:This results in
B101:assert_used
andB506:yaml_load
. Obviously, it could trivially be split up over several lines, but illustrates the issue how# nosec
can mask more than one issue. This may have happened over time, for example the assert may have beenassert foo = []
previously, and the load vulnerability was introduced later.TL;DR: I'd like to be able to suppress just one issue.
Additionally, it would be nice to be able to suppress some issues on a per file/module basis. For most use-cases,
exclude
probably works fine, but again it's either all or nothing. Happy to submit a different feature request for this.Describe the solution you'd like
I think pylint does this well. As stated in their FAQ:
flake8 also offers fine-grained ignores via e.g.
# noqa: E731
.For bandit then, it could be something like:
or
Describe alternatives you've considered
nosec
and hope it doesn't mask any issues down the lineAdditional context
The text was updated successfully, but these errors were encountered: