Skip to content

Commit 0d01e13

Browse files
committed
fix: update security workflow - Rust 1.89 and cargo-audit 0.21.2
- Updates Rust version to 1.89 to support edition 2024 - Updates cargo-audit to 0.21.2 (0.20.5 doesn't exist) - Removes complex Python script for SARIF generation - Keeps simple cargo audit check which is sufficient
1 parent 97e61e1 commit 0d01e13

File tree

1 file changed

+2
-32
lines changed

1 file changed

+2
-32
lines changed

.github/workflows/security.yml

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Install Rust
3535
uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable
3636
with:
37-
toolchain: stable
37+
toolchain: 1.89
3838

3939
- name: Cache cargo registry
4040
uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5
@@ -44,40 +44,10 @@ jobs:
4444
- name: Install cargo-audit
4545
uses: taiki-e/install-action@v2
4646
with:
47-
tool: cargo-audit@0.20.5
47+
tool: cargo-audit@0.21.2
4848

4949
- name: Run security audit
5050
run: cargo audit --deny warnings
51-
52-
- name: Run audit and generate SARIF
53-
run: cargo audit --json | python3 -c "
54-
import sys, json
55-
sarif = {
56-
'version': '2.1.0',
57-
'runs': [{
58-
'tool': {'driver': {'name': 'cargo-audit', 'informationUri': 'https://rustsec.org/'}},
59-
'results': []
60-
}]
61-
}
62-
try:
63-
data = json.load(sys.stdin)
64-
for vuln in data.get('vulnerabilities', {}).get('list', []):
65-
sarif['runs'][0]['results'].append({
66-
'ruleId': vuln['advisory']['id'],
67-
'level': 'error' if vuln['advisory'].get('cvss') and float(vuln['advisory']['cvss'].split('/')[0].split(':')[-1]) >= 7 else 'warning',
68-
'message': {'text': vuln['advisory']['title']},
69-
'locations': [{'physicalLocation': {'artifactLocation': {'uri': 'Cargo.lock'}}}]
70-
})
71-
except: pass
72-
print(json.dumps(sarif))
73-
" > audit.sarif || echo '{"version":"2.1.0","runs":[{"tool":{"driver":{"name":"cargo-audit"}},"results":[]}]}' > audit.sarif
74-
75-
- name: Upload audit results to GitHub Security
76-
if: always()
77-
uses: github/codeql-action/upload-sarif@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f2 # v3.27.4
78-
with:
79-
sarif_file: audit.sarif
80-
category: dependency-audit
8151

8252
cargo-deny:
8353
name: Dependency Check

0 commit comments

Comments
 (0)