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 BXXX does not contribute to Total lines skipped (#nosec) #1205

Open
Cabalist opened this issue Nov 21, 2024 · 1 comment · May be fixed by #1206
Open

#nosec BXXX does not contribute to Total lines skipped (#nosec) #1205

Cabalist opened this issue Nov 21, 2024 · 1 comment · May be fixed by #1206
Labels
bug Something isn't working

Comments

@Cabalist
Copy link

Cabalist commented Nov 21, 2024

Describe the bug

When running code that has a nosec line that specifes a test these lines are not counted in the "Total lines skipped" metric in the summary

Reproduction steps

1. Create foo.py with this content:


table = "my_table"
query = "SELECT * FROM {} WHERE True".format(table)  # nosec B608


2. Run `bandit foo.py` from the shell
3. At the end of the run observe the summary and notice the `Total lines skipped` is 0

❯ bandit blah.py
[main]  INFO    profile include tests: None
[main]  INFO    profile exclude tests: None
[main]  INFO    cli include tests: None
[main]  INFO    cli exclude tests: None
[main]  INFO    running on Python 3.12.7
Run started:2024-11-21 17:22:51.993562

Test results:
        No issues identified.

Code scanned:
        Total lines of code: 2
        Total lines skipped (#nosec): 0

Run metrics:
        Total issues (by severity):
                Undefined: 0
                Low: 0
                Medium: 0
                High: 0
        Total issues (by confidence):
                Undefined: 0
                Low: 0
                Medium: 0
                High: 0
Files skipped (0):

Expected behavior

The Total lines skipped should be 1 just like when you use a bare #nosec

Bandit version

1.7.10 (Default)

Python version

3.12

Additional context

No response

@Cabalist Cabalist added the bug Something isn't working label Nov 21, 2024
@Cabalist Cabalist linked a pull request Nov 21, 2024 that will close this issue
@Cabalist
Copy link
Author

It looks like this was an issue with duplicate code not being updated. PR is here: #1206

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

Successfully merging a pull request may close this issue.

1 participant