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

add jsonpickle deserialization blacklist #707

Merged
merged 5 commits into from
Jul 7, 2022
Merged

Conversation

SugarP1g
Copy link
Contributor

add jsonpickle deserialization blacklist

add jsonpickle deserialization blacklist
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.

@JeremyVriens
Copy link

Good addition, but this triggered me to look a bit further ahead. What's the requirement/flow for other 3rd party libraries to be added to this static blacklist?
As an example: Pandas, another pretty big 3rd party lib, also has a pandas.read_pickle (https://github.com/pandas-dev/pandas/blob/9d0517a2f9c17377e8a7823e0af7776d3d9a0679/pandas/io/pickle.py#L217) which uses pickle.load. Currently when using pandas.read_pickle inside your code, Bandit won't complain. Should it be also added to the blacklist?

@SugarP1g
Copy link
Contributor Author

SugarP1g commented May 4, 2021

Good addition, but this triggered me to look a bit further ahead. What's the requirement/flow for other 3rd party libraries to be added to this static blacklist?
As an example: Pandas, another pretty big 3rd party lib, also has a pandas.read_pickle (https://github.com/pandas-dev/pandas/blob/9d0517a2f9c17377e8a7823e0af7776d3d9a0679/pandas/io/pickle.py#L217) which uses pickle.load. Currently when using pandas.read_pickle inside your code, Bandit won't complain. Should it be also added to the blacklist?

It's a question about the purpose of bandit. If bandit is desired to find more vulnerability, this check rule should be added.

@sigmavirus24
Copy link
Member

Good addition, but this triggered me to look a bit further ahead. What's the requirement/flow for other 3rd party libraries to be added to this static blacklist?

I don't know, but I'm pretty sure 3rd party libraries are already covered (I think we have checks for PyYAML). I think what's already covered is based upon what folks using it have needed thus far.

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.

Please add jsonpickle to a file in the examples, possibly pickle_deserialize.py or a new file. Then update test_functional.py to run bandit on that example to ensure the black listed call is correctly detected. Thanks!

@ericwb ericwb removed the request for review from ghugo July 7, 2022 17:44
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.

LGTM

@ericwb ericwb merged commit 9832461 into PyCQA:main Jul 7, 2022
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.

4 participants