PyCQA / bandit

Bandit is a tool designed to find common security issues in Python code.
https://bandit.readthedocs.io
Apache License 2.0
6.5k stars 610 forks source link

Add a new playground to the docs #1184

Open ericwb opened 1 month ago

ericwb commented 1 month ago

This change introduces a new playground in the docs where a user can test out Bandit right within their browser. This code uses PyScript (and sphinx-pyscript) to generate an editor window on a sphinx page in our docs. When the user clicks the play button, it runs Bandit against the example code they have provided.

If Bandit finds issues it renders them in a box on the same page under the editable code.

The editor windows by default includes an example of correct and incorrect usage of ssl context.

ericwb commented 1 month ago
Screenshot 2024-10-04 at 3 30 45 PM
ericwb commented 1 month ago

Note, this PR is a draft because its utilizing a few hacks to enable it to work properly. Once https://github.com/sphinx-extensions2/sphinx-pyscript/pull/6 has merged and a release issued to PyPI, then this change could be more appropriately merged.