Skip to content

Commit 301b93c

Browse files
Security pipeline update (#1781)
<!-- Contributing guide: https://github.com/open-edge-platform/datumaro/blob/develop/CONTRIBUTING.md --> ### Summary This PR updates security pipeline, in particular: - security checks is implemented based on reusable actions from Anomalib repo (later we will move it to more appropriate repo like `reusable-workflows`) - this will simplify maintenance and support across Geti repos. - bandit configuration moved to `pyproject.toml` - `.pre-commit-config.yaml` - added zizmor and bandit pre-commit checks - removed unnecessary files Tested on local fork. <!-- Resolves #111 and #222. Depends on #1000 (for series of dependent commits). This PR introduces this capability to make the project better in this and that. - Added this feature - Removed that feature - Fixed the problem #1234 --> ### How to test Tested in fork https://github.com/AlexanderBarabanov/datumaro/actions ### Checklist <!-- Put an 'x' in all the boxes that apply --> - [ ] I have added unit tests to cover my changes.​ - [ ] I have added integration tests to cover my changes.​ - [ ] I have added the description of my changes into [CHANGELOG](https://github.com/open-edge-platform/datumaro/blob/develop/CHANGELOG.md).​ - [ ] I have updated the [documentation](https://github.com/open-edge-platform/datumaro/tree/develop/docs) accordingly ### License - [ ] I submit _my code changes_ under the same [MIT License](https://github.com/open-edge-platform/datumaro/blob/develop/LICENSE) that covers the project. Feel free to contact the maintainers if that's a concern. - [ ] I have updated the license header for each file (see an example below). ```python # Copyright (C) 2025 Intel Corporation # # SPDX-License-Identifier: MIT ```
2 parents 0f10fc3 + 0cdc632 commit 301b93c

File tree

12 files changed

+153
-729
lines changed

12 files changed

+153
-729
lines changed

.ci/ipas_default.config

Lines changed: 0 additions & 407 deletions
This file was deleted.

.ci/trivy-csv.tmpl

Lines changed: 0 additions & 10 deletions
This file was deleted.

.ci/trivy-csv.yaml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.ci/trivy-json.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/bandit.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/codeql.yml

Lines changed: 20 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,34 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
6-
#
7-
# ******** NOTE ********
8-
# We have attempted to detect the languages in your repository. Please check
9-
# the `language` matrix defined below to confirm you have the correct set of
10-
# supported CodeQL languages.
11-
#
12-
name: "CodeQL scan"
1+
name: "CodeQL Scan"
132

143
on:
15-
schedule:
16-
- cron: "0 0 * * *"
174
push:
185
branches: ["develop", "releases/*"]
196
pull_request:
207
branches: ["develop", "releases/*"]
21-
# No permissions by default
22-
permissions: {}
8+
schedule:
9+
- cron: "0 0 * * *"
10+
11+
permissions: {} # No permissions by default on workflow level
2312

2413
jobs:
2514
analyze:
2615
name: Analyze (${{ matrix.language }})
27-
runs-on: ubuntu-24.04
16+
runs-on: ubuntu-latest
2817
permissions:
29-
# required for all workflows
30-
security-events: write
18+
security-events: write # required to publish sarif
3119

3220
strategy:
3321
fail-fast: false
3422
matrix:
35-
language: ["c-cpp", "python", "actions"]
23+
include:
24+
- language: actions
25+
build-mode: none
26+
- language: python
27+
build-mode: none
28+
- language: c-cpp
29+
build-mode: none
30+
- language: rust
31+
build-mode: none
3632

3733
steps:
3834
- name: Checkout repository
@@ -42,35 +38,13 @@ jobs:
4238

4339
# Initializes the CodeQL tools for scanning.
4440
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1
41+
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
4642
with:
4743
languages: ${{ matrix.language }}
48-
49-
- name: Setup Python
50-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
51-
with:
52-
python-version: "3.11"
53-
54-
- name: Build
55-
run: |
56-
pip install build
57-
python -m build
44+
build-mode: ${{ matrix.build-mode }}
45+
queries: security-extended
5846

5947
- name: Perform CodeQL Analysis
60-
uses: github/codeql-action/analyze@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1
48+
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
6149
with:
6250
category: "/language:${{matrix.language}}"
63-
64-
- name: Generate CodeQL Report
65-
uses: rsdmike/github-security-report-action@a149b24539044c92786ec39af8ba38c93496495d # v3.0.4
66-
with:
67-
token: ${{ secrets.GITHUB_TOKEN }}
68-
template: report
69-
outputDir: ${{matrix.language}}
70-
71-
- name: Upload Report
72-
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
73-
with:
74-
name: codeql-report-${{matrix.language}}
75-
path: "./${{matrix.language}}/report.pdf"
76-
retention-days: 7

.github/workflows/linter.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,37 @@ jobs:
2424
- name: Run pre-commit checks
2525
shell: bash
2626
run: pre-commit run --all-files
27+
28+
Zizmor-Scan-PR:
29+
runs-on: ubuntu-latest
30+
permissions:
31+
contents: read
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35+
with:
36+
persist-credentials: false
37+
- name: Run Zizmor scan
38+
uses: open-edge-platform/anomalib/.github/actions/security/zizmor@fadfedd5150eb8cd39dfb659ae9bd0eb1c06720d
39+
with:
40+
scan-scope: "changed"
41+
severity-level: "MEDIUM"
42+
confidence-level: "HIGH"
43+
fail-on-findings: true
44+
Bandit-Scan-PR:
45+
runs-on: ubuntu-latest
46+
permissions:
47+
contents: read
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
51+
with:
52+
persist-credentials: false
53+
- name: Run Bandit scan
54+
uses: open-edge-platform/anomalib/.github/actions/security/bandit@fadfedd5150eb8cd39dfb659ae9bd0eb1c06720d
55+
with:
56+
scan-scope: "changed"
57+
severity-level: "LOW"
58+
confidence-level: "LOW"
59+
config_file: "pyproject.toml"
60+
fail-on-findings: true

0 commit comments

Comments
 (0)