Skip to content

Commit 63f5966

Browse files
added security scan on pre-merge
Signed-off-by: Barabanov <[email protected]>
1 parent a2774dc commit 63f5966

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

.github/workflows/pre_commit.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Pre-Commit Checks
2-
permissions: { } # No permissions by default on workflow level
2+
permissions: {} # No permissions by default on workflow level
33

44
on:
55
push:
@@ -50,3 +50,36 @@ jobs:
5050
run: pip install 'src/python/.[tests,ovms]'
5151
- name: Run python unit tests
5252
run: pytest tests/python/unit
53+
Zizmor-Scan-PR:
54+
runs-on: ubuntu-latest
55+
permissions:
56+
contents: read
57+
steps:
58+
- name: Checkout code
59+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
60+
with:
61+
persist-credentials: false
62+
- name: Run Zizmor scan
63+
uses: open-edge-platform/anomalib/.github/actions/security/zizmor@f60dd31a53407496508aa2db3165c8e8cd121a14
64+
with:
65+
scan-scope: "changed"
66+
severity-level: "MEDIUM"
67+
confidence-level: "HIGH"
68+
fail-on-findings: true
69+
Bandit-Scan-PR:
70+
runs-on: ubuntu-latest
71+
permissions:
72+
contents: read
73+
steps:
74+
- name: Checkout code
75+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
76+
with:
77+
persist-credentials: false
78+
- name: Run Bandit scan
79+
uses: open-edge-platform/anomalib/.github/actions/security/bandit@f60dd31a53407496508aa2db3165c8e8cd121a14
80+
with:
81+
scan-scope: "changed"
82+
severity-level: "LOW"
83+
confidence-level: "LOW"
84+
config_file: ".github/bandit_config.yml"
85+
fail-on-findings: true

.pre-commit-config.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,20 @@ repos:
5252
rev: v1.9.0
5353
hooks:
5454
- id: zizmor
55-
args: ["--min-severity", "medium", "--min-confidence", "high"]
55+
args: ["--min-severity", "medium", "--min-confidence", "high"]
56+
57+
# add bandit for security checks
58+
- repo: https://github.com/PyCQA/bandit
59+
rev: 1.8.3
60+
hooks:
61+
- id: bandit
62+
args:
63+
[
64+
"-c",
65+
"pyproject.toml",
66+
"--severity-level",
67+
"all",
68+
"--confidence-level",
69+
"all",
70+
]
71+
additional_dependencies: ["bandit[toml]"]

0 commit comments

Comments
 (0)