Skip to content

Commit cfd2caa

Browse files
Merge pull request #46 from joshrotenberg/fix/security-workflow-yaml
fix: remove complex SARIF generation from security workflow
2 parents 7e59f0e + c02c37d commit cfd2caa

File tree

1 file changed

+2
-58
lines changed

1 file changed

+2
-58
lines changed

.github/workflows/security.yml

Lines changed: 2 additions & 58 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,64 +44,8 @@ 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
81-
82-
cargo-deny:
83-
name: Dependency Check
84-
runs-on: ubuntu-latest
85-
steps:
86-
- name: Checkout code
87-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
88-
89-
- name: Run cargo-deny
90-
uses: EmbarkStudios/cargo-deny-action@8371184bd11e21dcf8ac82ebf8c9c9f74ebf7268 # v2.0.3
91-
with:
92-
command: check
93-
arguments: --all-features
9451

95-
dependency-review:
96-
name: Dependency Review
97-
runs-on: ubuntu-latest
98-
if: github.event_name == 'pull_request'
99-
steps:
100-
- name: Checkout code
101-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
102-
103-
- name: Dependency Review
104-
uses: actions/dependency-review-action@a6993e2c61fd5dc440b409aa1d6904921c5e1894 # v5.0.0
105-
with:
106-
fail-on-severity: high
107-
deny-licenses: GPL-3.0, AGPL-3.0

0 commit comments

Comments
 (0)