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

Django XSS detection rule #294

Closed
ehooo opened this issue May 7, 2018 · 6 comments
Closed

Django XSS detection rule #294

ehooo opened this issue May 7, 2018 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@ehooo
Copy link
Contributor

ehooo commented May 7, 2018

Summary

The rule B308 only detect the function mark_safe ( According to Django security ), whoever, XSS you could "mark safe" a strings with SafeText, SafeUnicode, SafeString and SafeBytes.

Steps to reproduce the behavior

from django.utils import safestring

safestring.SafeText('<b>Hello World</b>')
safestring.SafeUnicode('<b>Hello World</b>')
safestring.SafeString('<b>Hello World</b>')
safestring.SafeBytes('<b>Hello World</b>')

Expected behavior

Detect the escape functions

Actual behavior

B308 do not detect this functions

@ehooo
Copy link
Contributor Author

ehooo commented May 9, 2018

Could someone tell me what thinking about removing the rule B308 ?

@lukehinds lukehinds added the enhancement New feature or request label Jun 14, 2018
@ehooo
Copy link
Contributor Author

ehooo commented Jun 14, 2018

@lukehinds @ericwb what do you think about remove B308?

@ehooo
Copy link
Contributor Author

ehooo commented Sep 5, 2018

Hi again @lukehinds and @ericwb any new about B308? if you don't want remove this rule this issue could be closed

@lukehinds
Copy link
Member

@ehooo let me verify I understand correctly, mark_safe is now covered in B703 (with more scope to capture other safe markers), and so we can remove B308? I think as B703 has merged, it makes sense, but we also need to make sure we don't break any jobs or scripts that users may have that specifically make calls to B308.

@ehooo
Copy link
Contributor Author

ehooo commented Sep 6, 2018

Hi @lukehinds yes B703 cover B308 and more, so now Bandit duplicated hits.
If you prefer I could remove the function cover by B308 on B703.

@ericwb
Copy link
Member

ericwb commented May 9, 2019

Fixed with #295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants