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

Make Bandit suspicious import rules into a single configurable rule #11501

Open
inoa-jboliveira opened this issue May 23, 2024 · 2 comments
Open
Labels
question Asking for support or clarification

Comments

@inoa-jboliveira
Copy link

inoa-jboliveira commented May 23, 2024

Remove all rules from S401 to S415 (suspicious imports) and create a single S400 rule that says

"Possibly insecure import {import_name}: {reason}"

Allow the imports being configured via command line

[tool.ruff.lint.flake8_bandit]
suspicious_import = {"marshal" = "Deserialization is possibly dangerous"}

suspicious_import_include = {foobar = "I dont like this one"}

suspicious_import_exclude = [
  subprocess
]

To be honest, I just dont think these rules should exist since we have the TID253 configurable via banned-module-level-imports.

My issue is with these rules existing and not being in a good range that they can be ignored in bulk. I don't know if on next version we will get S416 or S420 (another range -- maybe I need to ignore the whole S4?) with more of these "unsafe" modules. In theory there could be thousands of unsafe modules and having multiple rules is just bad IMO.

@inoa-jboliveira inoa-jboliveira changed the title Make Bandit import rules into a single configurable rule Make Bandit suspicious import rules into a single configurable rule May 23, 2024
@augustelalande
Copy link
Contributor

If your goal is just to ignore them, you should be good to just ignore S4

@charliermarsh
Copy link
Member

Yeah, S4 is exactly the "suspicious" import rules.

@charliermarsh charliermarsh added the question Asking for support or clarification label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for support or clarification
Projects
None yet
Development

No branches or pull requests

3 participants