Skip to content

Rebase and reorganize files & folders #1395

Rebase and reorganize files & folders

Rebase and reorganize files & folders #1395

Workflow file for this run

name: Security scan

Check failure on line 1 in .github/workflows/code_scan.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/code_scan.yaml

Invalid workflow file

(Line: 34, Col: 9): Unexpected value 'uses', (Line: 35, Col: 9): Unexpected value 'with', (Line: 32, Col: 9): Required property is missing: run, (Line: 45, Col: 9): Unexpected value 'uses', (Line: 46, Col: 9): Unexpected value 'with', (Line: 42, Col: 9): Required property is missing: run, (Line: 51, Col: 9): Unexpected value 'uses', (Line: 52, Col: 9): Unexpected value 'with', (Line: 49, Col: 9): Required property is missing: run, (Line: 61, Col: 9): Unexpected value 'uses'
on:
workflow_dispatch: # run on request (no need for PR)
push:
branches:
- "develop"
- "releases/*"
schedule:
# every UTC 6PM from Mon to Fri
- cron: "0 18 * * 1-5"
permissions: {}
jobs:
Trivy-Scan-Vuln:
runs-on: ubuntu-24.04
permissions:
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.12"
- name: Freeze dependencies
working-directory: lib
run: |
pip install '.[docs]'
pip freeze > requirements.txt
- name: Run Trivy Scan (vuln)
working-directory: lib
uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # v0.32.0
with:
scan-type: fs
format: "sarif"
scan-ref: requirements.txt
scanners: vuln
output: trivy-results-vuln.sarif
- name: Upload SARIF file
working-directory: lib
if: ${{ always() }}
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.28.8
with:
sarif_file: "trivy-results-vuln.sarif"
- name: Run Trivy Scan (spdx)
working-directory: lib
uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # v0.32.0
with:
scan-type: fs
format: "spdx-json"
scan-ref: requirements.txt
output: trivy-results-spdx.json
- name: Upload Trivy results artifact
working-directory: lib
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: trivy-vuln-results
path: "${{ github.workspace }}/trivy-results-*"
retention-days: 7
- name: Upload deps list
working-directory: lib
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: always()
with:
name: python-deps-list
path: "${{ github.workspace }}/requirements.txt"
retention-days: 7
Trivy-Scan-Misconfig:
runs-on: ubuntu-24.04
permissions:
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run Trivy Scan (dockerfile and secrets)
working-directory: lib
uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # v0.32.0
with:
scan-type: fs
format: "sarif"
scan-ref: .
scanners: misconfig,secret
output: trivy-results-misconfig.sarif
- name: Upload SARIF file
working-directory: lib
if: ${{ always() }}
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.28.8
with:
sarif_file: "trivy-results-misconfig.sarif"
- name: Upload Trivy results artifact
working-directory: lib
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: trivy-misconfig-results
path: "${{ github.workspace }}/trivy-results-misconfig.sarif"
retention-days: 7
Bandit:
runs-on: ubuntu-24.04
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.12"
- name: Install tox
working-directory: lib
run: |
pip install '.[dev]'
- name: Bandit Scanning
working-directory: lib
run: tox -e bandit-scan
- name: Upload SARIF file
working-directory: lib
if: ${{ always() }}
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.28.8
with:
sarif_file: .tox/bandit-results.sarif
- name: Upload Bandit artifact
working-directory: lib
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: bandit-results
path: .tox/bandit-results.sarif
retention-days: 7
Summarize:
needs: [Trivy-Scan-Vuln, Trivy-Scan-Misconfig, Bandit]
if: always()
runs-on: ubuntu-24.04
steps:
# Create directory first
- name: Create results directory
run: mkdir -p all-results
# Download artifacts with error handling
- name: Download all results
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
continue-on-error: true # Don't fail if some tools didn't generate results
with:
pattern: "*-results"
merge-multiple: true
path: all-results
# Only upload if there are files
- name: Upload combined results
if: hashFiles('all-results/**/*') != ''
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: security-scan-results
path: all-results
retention-days: 7