Skip to content

Commit d1fd78a

Browse files
added bandit config
Signed-off-by: Barabanov <[email protected]>
1 parent 08154af commit d1fd78a

File tree

3 files changed

+88
-1
lines changed

3 files changed

+88
-1
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Security Scans
2+
3+
on:
4+
schedule:
5+
# Run security checks every day at 2 AM UTC
6+
- cron: "0 2 * * *"
7+
workflow_dispatch:
8+
push:
9+
branches:
10+
- master
11+
- release**
12+
13+
permissions: {}
14+
15+
jobs:
16+
zizmor-scan:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
security-events: write # Needed to upload the results to code-scanning dashboard
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
with:
25+
persist-credentials: false
26+
- name: Run Zizmor scan
27+
uses: open-edge-platform/anomalib/.github/actions/security/zizmor@f60dd31a53407496508aa2db3165c8e8cd121a14
28+
with:
29+
scan-scope: "all"
30+
severity-level: "LOW"
31+
confidence-level: "LOW"
32+
fail-on-findings: false # reports only
33+
34+
bandit-scan:
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: read
38+
security-events: write # Needed to upload the results to code-scanning dashboard
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
42+
with:
43+
persist-credentials: false
44+
- name: Run Bandit scan
45+
uses: open-edge-platform/anomalib/.github/actions/security/bandit@f60dd31a53407496508aa2db3165c8e8cd121a14
46+
with:
47+
scan-scope: "all"
48+
severity-level: "LOW"
49+
confidence-level: "LOW"
50+
config_file: "src/python/pyproject.toml"
51+
fail-on-findings: false # reports only
52+
53+
trivy-scan:
54+
runs-on: ubuntu-latest
55+
permissions:
56+
contents: read
57+
security-events: write # Needed to upload the results to code-scanning dashboard
58+
steps:
59+
- name: Checkout code
60+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
61+
with:
62+
persist-credentials: false
63+
- name: Set up Python
64+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
65+
with:
66+
python-version: "3.10"
67+
- name: Install pip-tools
68+
run: python -m pip install pip-tools
69+
70+
- name: Freeze dependencies
71+
run: pip-compile --extra=full -o requirements.txt src/python/pyproject.toml
72+
73+
- name: Run Trivy scan
74+
id: trivy
75+
uses: open-edge-platform/anomalib/.github/actions/security/trivy@f60dd31a53407496508aa2db3165c8e8cd121a14
76+
with:
77+
scan_type: "fs"
78+
scan-scope: all
79+
severity: LOW
80+
scanners: "vuln,secret,config"
81+
format: "sarif"
82+
timeout: "15m"
83+
ignore_unfixed: "false"

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ repos:
5252
rev: v1.9.0
5353
hooks:
5454
- id: zizmor
55-
args: ["--min-severity", "low", "--min-confidence", "low"]
55+
args: ["--min-severity", "medium", "--min-confidence", "high"]

src/python/pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,7 @@ notice-rgx = """
248248
# Copyright \\(C\\) (\\d{4}(-\\d{4})?) Intel Corporation
249249
# SPDX-License-Identifier: Apache-2\\.0
250250
"""
251+
[tool.bandit]
252+
exclude_dirs = ["tests"]
253+
tests = ["B301","B302","B303","B304","B305","B306","B308","B310","B311","B312","B313","B314","B315","B316","B317","B318","B319","B321","B323","B324","B401","B402","B403","B404","B405","B406","B407","B408","B409","B411","B412","B413"]
254+
skips = ["B101","B102","B103","B104","B105","B106","B107","B108","B110","B112","B201","B501","B502","B503","B504","B505","B506","B507","B601","B602","B603","B604","B605","B606","B607","B608","B609","B610","B611","B701","B702","B703"]

0 commit comments

Comments
 (0)