Skip to content
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

#nosec string outside of a comment is treated as a comment #383

Closed
posita opened this issue Sep 12, 2018 · 1 comment
Closed

#nosec string outside of a comment is treated as a comment #383

posita opened this issue Sep 12, 2018 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@posita
Copy link

posita commented Sep 12, 2018

From @ehooo in #211 (comment):

Hi I found a bug related with the way that "nosec " comment is checked.
For example vulnerable_call(param="#nosec") this line will be scaped

When fixing this, please do not introduce a regression that prevents use of in-line # nosec comments alongside other source code analyzers' line comment directives? Consider someone who uses Mypy notations, pyflakes, pylint, and bandit:

… # type: … # nosec # noqa: E501 ; pylint: disable=line-too-long

@ericwb
Copy link
Member

ericwb commented Sep 18, 2018

Here is the culprit:
https://github.com/PyCQA/bandit/blob/master/bandit/core/manager.py#L277

To fix this might require use of Python's tokenize module since the AST doesn't provide info on comments. But using tokenize could result in a performance penalty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants