Skip to content

Commit 3c3540b

Browse files
[CICD] Slamm Improvements to CI/CD
1 parent f0485d1 commit 3c3540b

File tree

2 files changed

+80
-26
lines changed

2 files changed

+80
-26
lines changed

.github/workflows/bandit.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# Bandit is a security linter designed to find common security issues in Python code.
7+
# This action will run Bandit on your codebase.
8+
# The results of the scan will be found under the Security tab of your repository.
9+
10+
# https://github.com/marketplace/actions/python-bandit-scan is ISC licensed
11+
# https://pypi.org/project/bandit/ is Apache v2.0 licensed, by PyCQA
12+
---
13+
name: Bandit
14+
on: # yamllint disable-line rule:truthy
15+
push:
16+
branches: ["main", "master", "stable"]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: ["main", "master", "stable", "feature-*", "patch-*", "HOTFIX-*"]
20+
21+
permissions: {}
22+
23+
jobs:
24+
bandit:
25+
permissions:
26+
contents: read # for actions/checkout to fetch code
27+
statuses: write
28+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33+
with:
34+
persist-credentials: false
35+
- name: Bandit Scan
36+
uses: reactive-firewall/python-bandit-scan@c56ff8d84b6e111989d803bbd884a7969363332c # v2.3
37+
with: # optional arguments
38+
# exit with 0, even with results found
39+
exit_zero: true # optional, default is DEFAULT
40+
# Github token of the repository (automatically created by Github)
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information.
42+
# File or directory to run bandit on
43+
path: "." # optional, default is .
44+
# Report only issues of a given severity level or higher. Can be LOW, MEDIUM or HIGH.
45+
# Default is UNDEFINED (everything)
46+
# level: MEDIUM # optional, default is UNDEFINED
47+
# Report only issues of a given confidence level or higher. Can be LOW, MEDIUM or HIGH.
48+
# Default is UNDEFINED (everything)
49+
# confidence: # optional, default is UNDEFINED
50+
# comma-separated list of paths (glob patterns supported) to exclude from scan
51+
# (note that these are in addition to the excluded paths provided in the config file)
52+
# (default: .svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg)
53+
# excluded_paths: # optional, default is DEFAULT
54+
# comma-separated list of test IDs to skip
55+
# skips: # optional, default is DEFAULT
56+
# path to a .bandit file that supplies command line arguments
57+
# ini_path: # optional, default is DEFAULT

.github/workflows/scorecards.yml

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
# This workflow uses actions that are not certified by GitHub. They are provided
2-
# by a third-party and are governed by separate terms of service, privacy
3-
# policy, and support documentation.
4-
1+
# .github/workflows/scorecard.yml
2+
# Reference: https://github.com/ossf/scorecard/blob/main/.github/workflows/scorecard-analysis.yml
3+
---
54
name: Scorecard supply-chain security
65
on:
76
# For Branch-Protection check. Only the default branch is supported. See
87
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
9-
branch_protection_rule:
8+
# branch_protection_rule:
9+
push:
10+
# Only the default branch is supported.
11+
branches: ["main", "master"]
1012
# To guarantee Maintained check is occasionally updated. See
1113
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
1214
schedule:
15+
# Weekly on Fridays.
1316
- cron: '18 9 * * 5'
14-
push:
15-
branches: [ master ]
1617

1718
# Declare default permissions as read only.
18-
permissions: read-all
19+
permissions: {}
1920

2021
jobs:
2122
analysis:
@@ -32,34 +33,30 @@ jobs:
3233

3334
steps:
3435
- name: "Checkout code"
35-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
36+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3637
with:
3738
submodules: true
3839
persist-credentials: false
3940

4041
- name: "Run analysis"
41-
uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
42+
uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
4243
with:
4344
results_file: results.sarif
4445
results_format: sarif
45-
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
46-
# - you want to enable the Branch-Protection check on a *public* repository, or
47-
# - you are installing Scorecard on a *private* repository
48-
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional.
46+
# Read-only PAT token. To create it,
47+
# follow the steps in https://github.com/ossf/scorecard-action#pat-token-creation.
4948
repo_token: ${{ secrets.SCORECARD_TOKEN }}
50-
# Public repositories:
51-
# - Publish results to OpenSSF REST API for easy access by consumers
52-
# - Allows the repository to include the Scorecard badge.
53-
# - See https://github.com/ossf/scorecard-action#publishing-results.
54-
# For private repositories:
55-
# - `publish_results` will always be set to `false`, regardless
56-
# of the value entered here.
57-
publish_results: false
49+
# Publish the results to enable scorecard badges. For more details, see
50+
# https://github.com/ossf/scorecard-action#publishing-results.
51+
# If you are installing the action on a private repo, set it to `publish_results: false`
52+
# or comment out the following line.
53+
publish_results: true
5854

59-
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
60-
# format to the repository Actions tab.
55+
# Upload the results as artifacts (optional). Commenting out will disable
56+
# uploads of run results in SARIF format to the repository Actions tab.
57+
# https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts
6158
- name: "Upload artifact"
62-
uses: actions/upload-artifact@97a0fba1372883ab732affbe8f94b823f91727db # v3.pre.node20
59+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
6360
with:
6461
name: SARIF file
6562
path: results.sarif
@@ -68,6 +65,6 @@ jobs:
6865
# Upload the results to GitHub's code scanning dashboard (optional).
6966
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
7067
- name: "Upload to code-scanning"
71-
uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
68+
uses: github/codeql-action/upload-sarif@d6bbdef45e766d081b84a2def353b0055f728d3e # v3.29.3
7269
with:
7370
sarif_file: results.sarif

0 commit comments

Comments
 (0)