|
| 1 | +GitHub Actions Workflow for Bandit |
| 2 | +================================== |
| 3 | + |
| 4 | +This document provides a minimal complete example workflow for |
| 5 | +setting up a Code Scanning action using Bandit through GitHub |
| 6 | +Actions. It leverages PyCQA's `bandit-action |
| 7 | +<https://github.com/PyCQA/bandit-action>`_ for seamless |
| 8 | +integration. |
| 9 | + |
| 10 | +Example YAML Code for GitHub Actions Pipeline |
| 11 | +--------------------------------------------- |
| 12 | + |
| 13 | +Below is an example configuration for the GitHub Actions pipeline: |
| 14 | + |
| 15 | +.. code-block:: yaml |
| 16 | +
|
| 17 | + name: Bandit |
| 18 | +
|
| 19 | + on: |
| 20 | + workflow_dispatch: |
| 21 | +
|
| 22 | + jobs: |
| 23 | + analyze: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + permissions: |
| 26 | + # Required for all workflows |
| 27 | + security-events: write |
| 28 | + # Only required for workflows in private repositories |
| 29 | + actions: read |
| 30 | + contents: read |
| 31 | + steps: |
| 32 | + - name: Perform Bandit Analysis |
| 33 | + uses: PyCQA/bandit-action@v1 |
| 34 | +
|
| 35 | +Inputs |
| 36 | +====== |
| 37 | + |
| 38 | +Below is a list of available inputs for the `bandit-action` and |
| 39 | +their descriptions: |
| 40 | + |
| 41 | +.. list-table:: |
| 42 | + :header-rows: 1 |
| 43 | + :widths: 20 50 10 20 |
| 44 | + |
| 45 | + * - Name |
| 46 | + - Description |
| 47 | + - Required |
| 48 | + - Default Value |
| 49 | + * - ``configfile`` |
| 50 | + - Config file to use for selecting plugins and overriding defaults. |
| 51 | + - False |
| 52 | + - ``DEFAULT`` |
| 53 | + * - ``profile`` |
| 54 | + - Profile to use (defaults to executing all tests). |
| 55 | + - False |
| 56 | + - ``DEFAULT`` |
| 57 | + * - ``tests`` |
| 58 | + - Comma-separated list of test IDs to run. |
| 59 | + - False |
| 60 | + - ``DEFAULT`` |
| 61 | + * - ``skips`` |
| 62 | + - Comma-separated list of test IDs to skip. |
| 63 | + - False |
| 64 | + - ``DEFAULT`` |
| 65 | + * - ``severity`` |
| 66 | + - Report only issues of a given severity level or higher. Options include ``all``, ``high``, ``medium``, ``low``. |
| 67 | + Note: ``all`` and ``low`` may produce similar results, but undefined rules will not be listed under ``low``. |
| 68 | + - False |
| 69 | + - ``DEFAULT`` |
| 70 | + * - ``confidence`` |
| 71 | + - Report only issues of a given confidence level or higher. Options include ``all``, ``high``, ``medium``, ``low``. |
| 72 | + Note: ``all`` and ``low`` may produce similar results, but undefined rules will not be listed under ``low``. |
| 73 | + - False |
| 74 | + - ``DEFAULT`` |
| 75 | + * - ``exclude`` |
| 76 | + - Comma-separated list of paths (glob patterns supported) to exclude from the scan. These are in addition to excluded paths provided in the config file. |
| 77 | + - False |
| 78 | + - ``.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg`` |
| 79 | + * - ``baseline`` |
| 80 | + - Path of a baseline report to compare against (only JSON-formatted files are accepted). |
| 81 | + - False |
| 82 | + - ``DEFAULT`` |
| 83 | + * - ``ini`` |
| 84 | + - Path to a ``.bandit`` file that supplies command-line arguments. |
| 85 | + - False |
| 86 | + - ``DEFAULT`` |
| 87 | + * - ``targets`` |
| 88 | + - Source file(s) or directory(s) to be tested. |
| 89 | + - False |
| 90 | + - ``.`` |
0 commit comments