Comments (4)
ok to close now @ericwb ?
from bandit.
ok to close now @ericwb ?
No, it's still an issue. The example I gave, still shows the warning in the logs.
from bandit.
I have the same issue. My code looks approximately like this:
205 parameter = { # nosec B108
206 "certificate": "/tmp/certificates/tls.crt",
207 "privateKey": "/tmp/certificates/tls.key",
208 "trustedCertificates": "/tmp/certificates/ca.crt",
209 "alias": "alias",
210 }
Regardless of which of these lines I put the # nosec on (any of lines 205-210), or how many of them I have (used to have one each on lines 206-208), I get the following warnings:
[tester] WARNING nosec encountered (B108), but no failed test on line 206
[tester] WARNING nosec encountered (B108), but no failed test on line 207
[tester] WARNING nosec encountered (B108), but no failed test on line 208
[tester] WARNING nosec encountered (B108), but no failed test on line 209
[tester] WARNING nosec encountered (B108), but no failed test on line 209
Also note the double entry for line 209, which in fact doesn't even have the issue.
If I remove the # nosec, then Bandit fails with B108.
from bandit.
In the example I gave, it actually is functioning as you'd expect. The line:
return {"tmp_dirs": ["/tmp", "/var/tmp", "/dev/shm"]} # nosec: B108
The plugin hardcoded_tmp_directory
will be called 4 times. One time for each str object as this plugin is designed to check string literals for a strings ["/tmp", "/var/tmp", "/dev/shm"]
in them. However the first string encountered "tmp_dirs"
is not found to have one of those and it is label with a nosec
(for the entire line). So the warning is output to the logs as a result.
A more ideal solution would be do nosec processing by line, not by test result encounter since you can have multiple strings per line obviously.
from bandit.
Related Issues (20)
- dependabot.yml should be in .github/workflows
- Add support for `httpx` in `B113` (`request_without_timeout`)
- Issue: [B113:request_without_timeout]
- Flag `markupsafe.Markup` on non-literal content HOT 5
- Mark use of `PKCS1v15` for encryption and decryption a vulnerability HOT 3
- B314 since Python 3.6 is not valid HOT 5
- ssh_no_host_key_verification is failing on Python 3.12
- OSSFuzz Integration HOT 1
- B411 error can't be resolved by the suggested change
- One test fails HOT 1
- Bandit container image.
- More Info hyperlink is broken HOT 3
- Official GitHub Action
- Can we add a json schema to complete pyproject.toml's [tool.bandit]? HOT 1
- Publish to Test PyPI fails
- assert_used skips change in 1.7.7 HOT 2
- SARIF docs are not rendered HOT 2
- Do performance benchmark testing as part of build
- IndexError: list index out of range while scanning cpython
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bandit.