Skip to content

Commit 325d055

Browse files
committed
fix: use free security scanners for private repo
1 parent dcebab3 commit 325d055

File tree

1 file changed

+45
-54
lines changed

1 file changed

+45
-54
lines changed

.github/workflows/security.yml

Lines changed: 45 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,77 +8,61 @@ on:
88

99
permissions:
1010
contents: read
11-
security-events: write
1211
actions: read
1312

1413
jobs:
1514
# ============================================================================
16-
# CodeQL Security Analysis
15+
# Bandit Python Security Scanner
1716
# ============================================================================
18-
codeql:
19-
name: CodeQL Analysis
17+
bandit:
18+
name: Bandit Security Scan
2019
runs-on: ubuntu-latest
2120

22-
strategy:
23-
fail-fast: false
24-
matrix:
25-
language: ['python', 'javascript']
26-
2721
steps:
2822
- name: Checkout repository
2923
uses: actions/checkout@v6
3024

31-
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@v4
25+
- name: Set up Python
26+
uses: actions/setup-python@v6
3327
with:
34-
languages: ${{ matrix.language }}
35-
queries: +security-extended,security-and-quality
28+
python-version: "3.12"
29+
30+
- name: Install Bandit
31+
run: pip install bandit[toml]
3632

37-
- name: Autobuild
38-
uses: github/codeql-action/autobuild@v4
33+
- name: Run Bandit
34+
run: |
35+
bandit -r src/ -f json -o bandit-results.json || true
36+
bandit -r src/ -f txt -o bandit-results.txt || true
3937
40-
- name: Perform CodeQL Analysis
41-
uses: github/codeql-action/analyze@v4
38+
- name: Upload Bandit results
39+
uses: actions/upload-artifact@v4
4240
with:
43-
category: "/language:${{matrix.language}}"
44-
upload: true # Upload results to Security tab
41+
name: bandit-results
42+
path: |
43+
bandit-results.json
44+
bandit-results.txt
4545
4646
# ============================================================================
47-
# SonarCloud Quality Gate
47+
# Semgrep Security Scanner
4848
# ============================================================================
49-
sonarcloud:
50-
name: SonarCloud Analysis
49+
semgrep:
50+
name: Semgrep Security Scan
5151
runs-on: ubuntu-latest
5252

5353
steps:
54-
- uses: actions/checkout@v6
55-
with:
56-
fetch-depth: 0 # Shallow clones disabled for better analysis
54+
- name: Checkout repository
55+
uses: actions/checkout@v6
5756

58-
- name: Set up Python
59-
uses: actions/setup-python@v6
57+
- name: Run Semgrep
58+
uses: returntocorp/semgrep-action@v1
6059
with:
61-
python-version: "3.12"
62-
63-
- name: Install dependencies
64-
run: |
65-
python -m pip install --upgrade pip
66-
pip install -e .[dev]
67-
68-
- name: Run tests with coverage
69-
run: |
70-
pytest \
71-
--cov=src/arbitrium \
72-
--cov-report=xml \
73-
--cov-branch \
74-
--junitxml=test-results.xml \
75-
-n auto
76-
77-
- name: SonarCloud Scan
78-
uses: SonarSource/sonarqube-scan-action@v6
79-
env:
80-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
60+
config: >-
61+
p/python
62+
p/javascript
63+
p/typescript
64+
p/security-audit
65+
generateSarif: false
8266

8367
# ============================================================================
8468
# Trivy Container Scanning
@@ -110,12 +94,19 @@ jobs:
11094
uses: aquasecurity/[email protected]
11195
with:
11296
image-ref: 'arbitrium-backend:scan'
113-
format: 'sarif'
114-
output: 'trivy-results.sarif'
97+
format: 'table'
98+
severity: 'CRITICAL,HIGH,MEDIUM'
99+
100+
- name: Run Trivy (JSON output)
101+
uses: aquasecurity/[email protected]
102+
with:
103+
image-ref: 'arbitrium-backend:scan'
104+
format: 'json'
105+
output: 'trivy-results.json'
115106
severity: 'CRITICAL,HIGH,MEDIUM'
116107

117-
- name: Upload Trivy results to GitHub Security
118-
uses: github/codeql-action/upload-sarif@v4
108+
- name: Upload Trivy results
109+
uses: actions/upload-artifact@v4
119110
with:
120-
sarif_file: 'trivy-results.sarif'
121-
category: 'container-security'
111+
name: trivy-results
112+
path: trivy-results.json

0 commit comments

Comments
 (0)