Skip to content

Does bandit support scanning Jupyter Notebook .ipynb file? #990

Answered by SamMorrowDrums
muaz-jasman asked this question in Q&A
Discussion options

You must be logged in to vote

No is the answer.

I have experimented with this, and even though technically it does "scan" the files, and reports lines of code scanned - it does not in fact interpret the (escaped) python code contained and so does not report any issues where it should.

I tried this by pasting some examples of known errors from this repo in both a python file, and an iPython notebook file, the python file gave results as expected, while the notebook did not.

I believe to support this would require bandit knowing about how to extract code cells from a notebook file, un-escaping them and then parsing the contents of that (while preserving the source line numbers) into the AST, so it can actually process t…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ericwb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants