Skip to content

Commit 2fd3279

Browse files
authored
Merge branch 'main' into chore/remove-bundled-z3
2 parents ba19bea + d99f12a commit 2fd3279

15 files changed

Lines changed: 457 additions & 37 deletions

File tree

‎.agents/skills/watch-github-actions/SKILL.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ gh run list --json databaseId,status,headBranch,url --jq '.[] | {id: .databaseId
125125

126126
## View Job Logs
127127

128+
For `Trivy Changes`, inspect the `Resolve PR baseline` step for the base and head
129+
SHAs. PR runs compare the tested merge commit with its
130+
first parent; change detection and scans must use the same pair. On reruns, do
131+
not substitute the current `main` tip or the event's older PR base SHA. Merge
132+
groups and manual runs use their explicit baseline. Findings are reported by
133+
`Reject new high or critical findings`; distinguish those from scanner failures.
134+
128135
View logs for a specific run:
129136

130137
```bash

‎.github/workflows/cargo-deny.yml‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ on:
77
schedule:
88
- cron: "23 7 * * *"
99
workflow_dispatch:
10+
workflow_call:
11+
inputs:
12+
candidate_ref:
13+
description: Optional pre-release tag to scan instead of the triggering revision
14+
default: ""
15+
type: string
16+
advisories-only:
17+
description: Run only the dependency advisory check
18+
default: false
19+
type: boolean
1020

1121
env:
1222
CARGO_TERM_COLOR: always
@@ -17,7 +27,7 @@ permissions:
1727
packages: read
1828

1929
concurrency:
20-
group: ${{ github.workflow }}-${{ github.ref }}
30+
group: cargo-deny-${{ github.workflow }}-${{ inputs.candidate_ref || github.ref }}
2131
cancel-in-progress: true
2232

2333
jobs:
@@ -31,9 +41,16 @@ jobs:
3141
password: ${{ secrets.GITHUB_TOKEN }}
3242
steps:
3343
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
44+
with:
45+
ref: ${{ inputs.candidate_ref && format('refs/tags/{0}', inputs.candidate_ref) || '' }}
3446

3547
- name: Install tools
3648
run: mise install --locked
3749

3850
- name: Check dependencies
51+
if: ${{ !inputs.advisories-only }}
3952
run: mise run rust:deny
53+
54+
- name: Check dependency advisories
55+
if: inputs.advisories-only
56+
run: cargo deny check advisories

‎.github/workflows/codeql.yml‎

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,23 @@ on:
77
schedule:
88
- cron: "29 5 * * *"
99
workflow_dispatch:
10+
workflow_call:
11+
inputs:
12+
candidate_ref:
13+
description: Optional pre-release tag to scan instead of the triggering revision
14+
default: ""
15+
type: string
16+
fail-on-findings:
17+
description: Fail on HIGH/CRITICAL security findings (score at least 7.0)
18+
default: false
19+
type: boolean
1020

1121
permissions:
1222
contents: read
1323
security-events: write
1424

1525
concurrency:
16-
group: ${{ github.workflow }}-${{ github.ref }}
26+
group: codeql-${{ github.workflow }}-${{ inputs.candidate_ref || github.ref }}
1727
cancel-in-progress: true
1828

1929
jobs:
@@ -38,7 +48,9 @@ jobs:
3848
build-mode: none
3949
steps:
4050
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
51+
id: checkout
4152
with:
53+
ref: ${{ inputs.candidate_ref && format('refs/tags/{0}', inputs.candidate_ref) || '' }}
4254
persist-credentials: false
4355

4456
- name: Set up Go
@@ -69,9 +81,11 @@ jobs:
6981
upload: never
7082

7183
- name: Summarize findings
84+
id: findings
7285
if: always()
7386
env:
7487
LANGUAGE: ${{ matrix.language }}
88+
FAIL_ON_FINDINGS: ${{ inputs.fail-on-findings || false }}
7589
shell: bash
7690
run: |
7791
set -euo pipefail
@@ -83,11 +97,23 @@ jobs:
8397
echo
8498
if [ "${#sarif_files[@]}" -eq 0 ]; then
8599
echo "No SARIF report was produced."
100+
exit 1
86101
else
87-
finding_count=$(jq -s '[.[].runs[]?.results[]?] | length' "${sarif_files[@]}")
102+
finding_count=$(jq -s '[.[].runs[].results[]] | length' "${sarif_files[@]}")
103+
high_count=$(jq -s '
104+
[ .[].runs[] | . as $run | .results[]
105+
| select(all(.suppressions[]?; .status != "accepted"))
106+
| .ruleId as $id
107+
| ($run.tool.driver, $run.tool.extensions[]?) | .rules[]?
108+
| select(.id == $id)
109+
| select((.properties["security-severity"] // "0" | tonumber) >= 7)
110+
] | length
111+
' "${sarif_files[@]}")
112+
echo "high_count=$high_count" >> "$GITHUB_OUTPUT"
88113
echo "Findings: $finding_count"
114+
echo "HIGH/CRITICAL: $high_count"
89115
echo
90-
echo "Findings are informational and do not fail CI."
116+
echo "Fail on HIGH/CRITICAL: $FAIL_ON_FINDINGS"
91117
fi
92118
} >> "$GITHUB_STEP_SUMMARY"
93119
@@ -96,6 +122,8 @@ jobs:
96122
uses: github/codeql-action/upload-sarif@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7
97123
with:
98124
sarif_file: codeql-results
125+
ref: ${{ inputs.candidate_ref && format('refs/tags/{0}', inputs.candidate_ref) || '' }}
126+
sha: ${{ inputs.candidate_ref && steps.checkout.outputs.commit || '' }}
99127
category: /language:${{ matrix.language }}
100128

101129
- name: Upload SARIF
@@ -107,8 +135,22 @@ jobs:
107135
if-no-files-found: ignore
108136
retention-days: 14
109137

138+
- name: Enforce HIGH/CRITICAL threshold
139+
if: ${{ !cancelled() && steps.findings.outcome == 'success' }}
140+
env:
141+
HIGH_COUNT: ${{ steps.findings.outputs.high_count }}
142+
FAIL_ON_FINDINGS: ${{ inputs.fail-on-findings || false }}
143+
run: |
144+
if [ "$HIGH_COUNT" -gt 0 ]; then
145+
if [ "$FAIL_ON_FINDINGS" = "true" ]; then
146+
echo "::error::CodeQL reported $HIGH_COUNT HIGH/CRITICAL findings."
147+
exit 1
148+
fi
149+
echo "::warning::CodeQL reported $HIGH_COUNT HIGH/CRITICAL findings; enforcement is disabled."
150+
fi
151+
110152
result:
111-
name: OpenShell / CodeQL (informational)
153+
name: ${{ inputs.fail-on-findings && 'OpenShell / CodeQL' || 'OpenShell / CodeQL (informational)' }}
112154
if: always()
113155
needs: analyze
114156
runs-on: ubuntu-latest
@@ -120,7 +162,7 @@ jobs:
120162
shell: bash
121163
run: |
122164
if [ "$ANALYZE_RESULT" != "success" ]; then
123-
echo "::error::One or more CodeQL analyzers did not complete successfully."
165+
echo "::error::CodeQL execution or the configured finding threshold failed."
124166
exit 1
125167
fi
126-
echo "All CodeQL analyzers completed; findings remain informational."
168+
echo "All CodeQL analyzers completed and the configured finding threshold passed."

‎.github/workflows/codex-security.yml‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ on:
2323
required: false
2424
default: false
2525
type: boolean
26+
fail-on-findings:
27+
description: Fail on HIGH/CRITICAL security findings
28+
default: false
29+
type: boolean
30+
upload_sarif:
31+
description: Upload results to Code Scanning when called from a manual workflow
32+
default: true
33+
type: boolean
2634
outputs:
2735
base_sha:
2836
description: Previous stable commit, empty for a full bootstrap scan
@@ -230,16 +238,25 @@ jobs:
230238
--output "$SARIF_FILE"
231239
232240
- name: Summarize findings
241+
id: findings
233242
env:
234243
BASE_TAG: ${{ steps.range.outputs.base_tag }}
235244
CANDIDATE_TAG: ${{ steps.range.outputs.candidate_tag }}
236245
COMMIT_COUNT: ${{ steps.range.outputs.commit_count }}
237246
SARIF_FILE: ${{ runner.temp }}/codex-security.sarif
238247
SCAN_SCOPE: ${{ steps.range.outputs.scan_scope }}
239248
TRAIN: ${{ steps.range.outputs.train }}
249+
FAIL_ON_FINDINGS: ${{ inputs.fail-on-findings || false }}
240250
run: |
241251
set -euo pipefail
242-
finding_count=$(jq '[.runs[]?.results[]?] | length' "$SARIF_FILE")
252+
finding_count=$(jq '[.runs[].results[]] | length' "$SARIF_FILE")
253+
high_count=$(jq '
254+
[ .runs[].results[]
255+
| select(all(.suppressions[]?; .status != "accepted"))
256+
| select(.properties.severity | ascii_downcase | IN("high", "critical"))
257+
] | length
258+
' "$SARIF_FILE")
259+
echo "high_count=$high_count" >> "$GITHUB_OUTPUT"
243260
{
244261
echo "### Codex Security release qualification"
245262
echo
@@ -254,8 +271,9 @@ jobs:
254271
fi
255272
echo "- Coverage: complete"
256273
echo "- Findings: $finding_count"
274+
echo "- HIGH/CRITICAL: $high_count"
257275
echo
258-
echo "Findings are informational during the observation phase."
276+
echo "Fail on HIGH/CRITICAL: $FAIL_ON_FINDINGS"
259277
} >> "$GITHUB_STEP_SUMMARY"
260278
261279
- name: Upload SARIF to Code Scanning
@@ -267,8 +285,22 @@ jobs:
267285
sha: ${{ steps.range.outputs.candidate_sha }}
268286
category: ${{ steps.range.outputs.category }}
269287

288+
- name: Enforce HIGH/CRITICAL threshold
289+
if: ${{ !cancelled() && steps.findings.outcome == 'success' }}
290+
env:
291+
HIGH_COUNT: ${{ steps.findings.outputs.high_count }}
292+
FAIL_ON_FINDINGS: ${{ inputs.fail-on-findings || false }}
293+
run: |
294+
if [ "$HIGH_COUNT" -gt 0 ]; then
295+
if [ "$FAIL_ON_FINDINGS" = "true" ]; then
296+
echo "::error::Codex reported $HIGH_COUNT HIGH/CRITICAL findings."
297+
exit 1
298+
fi
299+
echo "::warning::Codex reported $HIGH_COUNT HIGH/CRITICAL findings; enforcement is disabled."
300+
fi
301+
270302
result:
271-
name: OpenShell / Codex Security (informational)
303+
name: ${{ inputs.fail-on-findings && 'OpenShell / Codex Security' || 'OpenShell / Codex Security (informational)' }}
272304
if: ${{ always() }}
273305
needs: analyze
274306
runs-on: ubuntu-latest
@@ -283,4 +315,4 @@ jobs:
283315
echo "::error::Codex Security release qualification did not complete successfully."
284316
exit 1
285317
fi
286-
echo "Codex Security completed; findings remain informational."
318+
echo "Codex Security completed and the configured finding threshold passed."
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Security Scan
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
candidate_ref:
10+
description: Pre-release tag to scan (vMAJOR.MINOR.PATCH-pre.N)
11+
required: true
12+
type: string
13+
stable_ref:
14+
description: Optional previous stable tag override for Codex
15+
default: ""
16+
type: string
17+
allow_full_bootstrap:
18+
description: Allow a full Codex scan when no previous stable tag exists
19+
default: false
20+
type: boolean
21+
allow-high-critical:
22+
description: Report HIGH/CRITICAL findings without failing; scanner errors still fail
23+
default: false
24+
type: boolean
25+
images:
26+
description: Newline-separated image references for Trivy
27+
default: ""
28+
type: string
29+
charts:
30+
description: Newline-separated packaged Helm chart OCI references for Trivy
31+
default: ""
32+
type: string
33+
workflow_call:
34+
inputs:
35+
candidate_ref:
36+
description: Pre-release tag to scan (vMAJOR.MINOR.PATCH-pre.N)
37+
required: true
38+
type: string
39+
stable_ref:
40+
description: Optional previous stable tag override for Codex
41+
default: ""
42+
type: string
43+
allow_full_bootstrap:
44+
description: Allow a full Codex scan when no previous stable tag exists
45+
default: false
46+
type: boolean
47+
allow-high-critical:
48+
description: Report HIGH/CRITICAL findings without failing; scanner errors still fail
49+
default: false
50+
type: boolean
51+
images:
52+
description: Newline-separated image references for Trivy
53+
default: ""
54+
type: string
55+
charts:
56+
description: Newline-separated packaged Helm chart OCI references for Trivy
57+
default: ""
58+
type: string
59+
secrets:
60+
CODEX_SECURITY_API_KEY:
61+
required: true
62+
CACHIX_AUTH_TOKEN:
63+
required: false
64+
65+
permissions:
66+
contents: read
67+
68+
# Only the finding threshold is overridable; execution failures remain fatal.
69+
jobs:
70+
codex:
71+
name: Codex Security
72+
uses: ./.github/workflows/codex-security.yml
73+
permissions:
74+
actions: read
75+
contents: read
76+
security-events: write
77+
with:
78+
candidate_ref: ${{ inputs.candidate_ref }}
79+
stable_ref: ${{ inputs.stable_ref }}
80+
allow_full_bootstrap: ${{ inputs.allow_full_bootstrap }}
81+
fail-on-findings: ${{ !inputs.allow-high-critical }}
82+
upload_sarif: true
83+
secrets:
84+
CODEX_SECURITY_API_KEY: ${{ secrets.CODEX_SECURITY_API_KEY }}
85+
86+
codeql:
87+
name: CodeQL
88+
uses: ./.github/workflows/codeql.yml
89+
permissions:
90+
contents: read
91+
security-events: write
92+
with:
93+
candidate_ref: ${{ inputs.candidate_ref }}
94+
fail-on-findings: ${{ !inputs.allow-high-critical }}
95+
96+
trivy:
97+
name: Trivy
98+
uses: ./.github/workflows/trivy-scan.yml
99+
permissions:
100+
contents: read
101+
packages: read
102+
security-events: write
103+
with:
104+
candidate_ref: ${{ inputs.candidate_ref }}
105+
fail-on-findings: ${{ !inputs.allow-high-critical }}
106+
severity: HIGH,CRITICAL
107+
ignore-unfixed: false
108+
images: ${{ inputs.images }}
109+
charts: ${{ inputs.charts }}
110+
secrets:
111+
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
112+
113+
cargo-deny:
114+
name: Cargo Deny
115+
uses: ./.github/workflows/cargo-deny.yml
116+
permissions:
117+
contents: read
118+
packages: read
119+
with:
120+
candidate_ref: ${{ inputs.candidate_ref }}
121+
advisories-only: true
122+
123+
workflow-security:
124+
name: Actionlint and Zizmor
125+
uses: ./.github/workflows/workflow-security.yml
126+
permissions:
127+
contents: read
128+
security-events: write
129+
with:
130+
candidate_ref: ${{ inputs.candidate_ref }}
131+
fail-on-findings: ${{ !inputs.allow-high-critical }}
132+
secrets:
133+
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}

0 commit comments

Comments
 (0)