Skip to content

Commit f8cf05e

Browse files
Pull useful improvements from Community (#7)
# Pull useful improvements from community ## Pull new configuration input feature from related work in community * Incorporate the feature to optionally include a `config_path` input to allow further configuration of `bandit` ## Partial version bumps for action dependancies * Updating to `github/code-action/upload-sarif@v3` presents no significant changes since `v2` besides the underlying node version. Details in [relevant project README](https://github.com/github/codeql-action?tab=readme-ov-file#supported-versions-of-the-codeql-action) * Updating to `actions/upload-artifact@v4` brings significant changes we should be aware of. The maintainers have noted that version 4 introduces breaking changes: * **GitHub Enterprise Server (GHES) Compatibility**: Support for GHES versions prior to 3.5 has been discontinued. If you're using an older GHES version, this update might not be compatible. * **Default Behavior Adjustments**: There may be changes to default configurations, such as the default value for retention-days. Deprecated inputs or features might have been removed as well. For a comprehensive understanding of these impacts and to ensure seamless integration, please review the maintainers' notes in the [upload-artifact project README](https://github.com/actions/upload-artifact#actionsupload-artifact) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced an optional `config_path` parameter for the Bandit Scan action, allowing users to specify a configuration file for command line arguments. - **Improvements** - Updated artifact upload steps to use the latest versions of the actions, enhancing reliability and functionality. - Added an option to overwrite existing artifacts during upload. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents 637c5c4 + 3ab8218 commit f8cf05e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

action.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ inputs:
3232
description: 'path to a .bandit file that supplies command line arguments'
3333
required: false
3434
default: 'DEFAULT'
35+
config_path:
36+
description: 'path to a YAML or TOML file that supplies command line arguments'
37+
required: false
38+
default: 'DEFAULT'
3539
GITHUB_TOKEN:
3640
description: 'Github token of the repository (automatically created by Github)'
3741
required: true
@@ -102,21 +106,29 @@ runs:
102106
else
103107
INI_PATH="--ini $INPUT_INI_PATH"
104108
fi
105-
bandit -f sarif -o results.sarif -r $INPUT_PATH $LEVEL $CONFIDENCE $EXCLUDED_PATHS $EXIT_ZERO $SKIPS $INI_PATH
109+
110+
if [ "$INPUT_CONFIG_PATH" == "DEFAULT" ]; then
111+
CONFIG_PATH=""
112+
else
113+
CONFIG_PATH="-c $INPUT_CONFIG_PATH"
114+
fi
115+
bandit -f sarif -o results.sarif -r $INPUT_PATH $LEVEL $CONFIDENCE $EXCLUDED_PATHS $EXIT_ZERO $SKIPS $INI_PATH $CONFIG_PATH
106116
env:
107117
INPUT_PATH: ${{ inputs.path }}
108118
INPUT_LEVEL: ${{ inputs.level }}
109119
INPUT_CONFIDENCE: ${{ inputs.confidence }}
110120
INPUT_EXCLUDED_PATHS: ${{ inputs.excluded_paths }}
111121
INPUT_EXIT_ZERO: ${{ inputs.exit_zero }}
112122
INPUT_SKIPS: ${{ inputs.skips }}
113-
INPUT_INI_PATH: ${{ inputs.ini_path }}
123+
INPUT_INI_PATH: ${{ inputs.ini_path }}
124+
INPUT_CONFIG_PATH: ${{ inputs.config_path }}
114125

115126
- name: Upload artifact
116127
uses: actions/upload-artifact@v4
117128
with:
118129
name: results.sarif
119130
path: results.sarif
131+
overwrite: true
120132

121133
- name: Upload SARIF file
122134
uses: github/codeql-action/upload-sarif@v3

0 commit comments

Comments
 (0)