complaining the feature that i am not using in the python library
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.3k
- Forks
- 836
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 1
Description
Describe the bug
I am using the below imports to construct the XML but I am not parsing the XML with the any of the below module or sub module but still bandit it complaining( CWE-20) that do not use those module or sub modules to parse the XML. I think it will be good to raise the warning if the feature is used.
import i am using
from xml.etree.ElementTree import Element, SubElement, tostring
Reproduction steps
Create test.py and add below code
import xml.etree.ElementTree as et
root = et.Element("user")
name = et.SubElement(root, "name")
name.text = "John Doe"
email = et.SubElement(root, "email")
email.text = "john@example.com"
tree = et.ElementTree(root)
a = et.tostring(root).decode("utf-8")
print(a)
Then run the bandit scan
Expected behavior
I think it will be good to raise the warning if the feature is used.
Bandit version
1.7.9 (Default)
Python version
3.9
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by creating the provided test.py reproduction and running Bandit 1.7.9 to confirm which warning is emitted for XML construction. Trace the XML-related check from that result and compare construction-only use with parsing use; done means construction code is not warned on while actual parsing remains covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- security, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100