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

Properly handle nosec strings in code #388

Merged
merged 3 commits into from Dec 19, 2018
Merged

Properly handle nosec strings in code #388

merged 3 commits into from Dec 19, 2018

Conversation

ericwb
Copy link
Member

@ericwb ericwb commented Sep 21, 2018

The string "# nosec" has a chance (albeit remote) that it can be
part of the code on the line not just within the comment. Bandit
currently checks the entire line for that string.

This patch tokenizes the line of input to figure out what piece
is a comment, then compares whether that comment contains "# nosec".

Fixes #383

Signed-off-by: Eric Brown browne@vmware.com

The string "# nosec" has a chance (albeit remote) that it can be
part of the code on the line not just within the comment. Bandit
currently checks the entire line for that string.

This patch tokenizes the line of input to figure out what piece
is a comment, then compares whether that comment contains "# nosec".

Fixes #383

Signed-off-by: Eric Brown <browne@vmware.com>
@lukehinds
Copy link
Member

LGTM, happy to merge once CI passes, unless @sigmavirus24 or @ghugo have concerns?

Copy link
Member

@lukehinds lukehinds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shipit

@lukehinds lukehinds merged commit ed79150 into PyCQA:master Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants