hardcoded_password_string is not triggerend when using python typing
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 8.3k
- Forks
- 835
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 1
Description
Describe the bug
When using python typing the hardcoded_password_string issue is not produced
To Reproduce
class MyConfig:
my_password: str = 'password'
Expected behavior
The code above should produce a [B105:hardcoded_password_string] issue
Bandit version
bandit 1.6.2
python version = 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)]
Additional context
Add any other context about the problem here.
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 reproducing the shown annotated assignment with Bandit 1.6.2, then trace how the hardcoded_password_string check handles typed assignments. The work is done when the example produces a B105:hardcoded_password_string issue without breaking existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100