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

Remove lxml (B320 & B410) from blacklist #1212

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

djbrown
Copy link

@djbrown djbrown commented Dec 19, 2024

removes B320 (xml_bad_etree) and B410 (import_lxml)

fixes #767

@djbrown djbrown marked this pull request as ready for review December 19, 2024 02:45
Copy link
Member

@sigmavirus24 sigmavirus24 left a comment

Choose a reason for hiding this comment

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

In my opinion:

  • We should do this
  • We should add very clear notes to our changelog
  • We should start pointing people away from defused XML as it's maintenance status means lxml is likely to be safer going forward

@djbrown
Copy link
Author

djbrown commented Dec 26, 2024

I couldn't find any changelog files. @ericwb do you know what Ian meant?

@sigmavirus24
Copy link
Member

My mistake. I thought we had one but I guess not

@djbrown djbrown changed the title remove lxml from blacklist Remove lxml (B320 & B410) from blacklist Dec 27, 2024
@djbrown
Copy link
Author

djbrown commented Dec 27, 2024

@sigmavirus24 thank you for your reply! :)
I saw this project actually does have a nice changelog via GitHub release descriptions generated from PRs:
https://github.com/PyCQA/bandit/releases
I updated this PRs title to be more suitable for the changelog.
And I guess this change would require a minor version bump (currently 1.8.0 -> 1.9.0)
@ericwb @lukehinds is there anything else I may help with to get this merged?

Copy link
Member

@ericwb ericwb left a comment

Choose a reason for hiding this comment

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

So when removing a rule, we should keep the documentation for historical reasons and denote that the plugin or test was removed. This is to prevent someone in the future accidentally reusing the same Bandit ID number, thus leading to a conflict.

As for the code for the test, we can disable is functionality but keep it in order to reserve the Bandit ID associated with it.

For example, see the following. Notice how we kept the docs and denoted that the plugin was removed in what version. Please follow this example.

https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b309-httpsconnection

https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b322-input

https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b322-input

@djbrown djbrown requested a review from ericwb December 28, 2024 02:28
@djbrown
Copy link
Author

djbrown commented Dec 28, 2024

thank you @ericwb for the review!
I made another commit, restoring the documentation and denoting the removal

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.

lxml guidance is not useful
3 participants