Skip to content

Commit 49a06a7

Browse files
committed
security: isolate dependency SARIF publication
1 parent 0644706 commit 49a06a7

6 files changed

Lines changed: 42 additions & 17 deletions

File tree

.github/workflows/ecosystem-baseline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
permissions:
4242
actions: read
4343
contents: read
44-
uses: filecoin-project/ff-sec-actions/.github/workflows/sec-dependencies.yml@5b2da0e0fda3e9268b69a35451ca016f1b4d24ba
44+
uses: filecoin-project/ff-sec-actions/.github/workflows/sec-dependencies.yml@0644706f2dee239fe569d32219c1bba8c1069a0c
4545
with:
4646
blocking: ${{ inputs.dependency-blocking }}
4747
skip-dirs: ${{ inputs.skip-dirs }}

.github/workflows/evaluation-pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
dependencies:
1919
permissions:
2020
contents: read
21-
uses: filecoin-project/ff-sec-actions/.github/workflows/sec-dependencies.yml@5b2da0e0fda3e9268b69a35451ca016f1b4d24ba
21+
uses: filecoin-project/ff-sec-actions/.github/workflows/sec-dependencies.yml@0644706f2dee239fe569d32219c1bba8c1069a0c
2222
with:
2323
blocking: ${{ inputs.dependency-blocking }}
2424

.github/workflows/security-pipeline.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,33 @@ jobs:
181181
permissions:
182182
actions: read
183183
contents: read
184-
security-events: write
185-
uses: filecoin-project/ff-sec-actions/.github/workflows/sec-dependencies.yml@5b2da0e0fda3e9268b69a35451ca016f1b4d24ba
184+
uses: filecoin-project/ff-sec-actions/.github/workflows/sec-dependencies.yml@0644706f2dee239fe569d32219c1bba8c1069a0c
186185
with:
187186
skip-dirs: ${{ inputs.skip-dirs }}
188187
blocking: ${{ inputs.dependency-blocking }}
189188
severity: ${{ inputs.dependency-severity }}
190-
publish-sarif: ${{ inputs.publish-sarif }}
189+
190+
publish-dependency-sarif:
191+
name: Publish Dependency SARIF
192+
if: always() && inputs.enable-dependencies && inputs.publish-sarif
193+
needs: dependencies
194+
runs-on: ubuntu-latest
195+
permissions:
196+
actions: read
197+
contents: read
198+
security-events: write
199+
steps:
200+
- name: Download Trivy dependency results
201+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
202+
with:
203+
name: trivy-deps-results
204+
path: trivy-deps-results
205+
206+
- name: Upload SARIF to GitHub Security tab
207+
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
208+
with:
209+
sarif_file: trivy-deps-results/trivy-deps.sarif
210+
category: trivy-dependencies
191211

192212
secrets-scan:
193213
if: inputs.enable-secrets

docs/reference/current-contracts.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Evidence Bundle and `Profile Conclusion`. Its inputs are
119119
| `dependency-review-fail-on-severity` | `high` | Dependency-review threshold |
120120
| `dependency-blocking` | `false` | Fail on dependency findings; tool failure always fails |
121121
| `dependency-severity` | `CRITICAL,HIGH,MEDIUM` | Dependency findings included in the gate |
122-
| `publish-sarif` | `false` | Publish dependency SARIF using a separate write-authorized job |
122+
| `publish-sarif` | `false` | Privileged umbrella only: publish dependency SARIF in a separate write-authorized job |
123123
| `iac-blocking` | `false` | Fail on IaC findings; tool failure always fails |
124124
| `iac-severity` | `CRITICAL,HIGH,MEDIUM` | IaC findings included in the gate |
125125
| `license-blocking` | `false` | Fail on license findings; tool failure always fails |
@@ -174,7 +174,8 @@ The Ecosystem Baseline never reads `ENABLE_GHAS` and never requests
174174
`security-events: write`. The privileged full-suite example converts
175175
`ENABLE_GHAS='true'` into the explicit `publish-sarif` input; private repository
176176
product availability still applies. Dependency SARIF publication runs in a
177-
separate job so the inspection job remains read-only.
177+
separate privileged-umbrella job, outside the reusable inspection workflow, so
178+
the inspection permission envelope remains read-only.
178179

179180
Possible permissions across the current workflows:
180181

scripts/test-ecosystem-baseline.sh

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,15 @@ grep -Fq "blocking: \${{ inputs.actions-security-blocking }}" "$workflow" \
4646
grep -Fq "blocking: \${{ inputs.actions-security-blocking }}" "$privileged_pipeline" \
4747
|| fail "the privileged pipeline does not forward its workflow-definition gate"
4848

49-
grep -Eq '^[[:space:]]+publish-sarif:[[:space:]]*$' "$dependencies_workflow" \
50-
|| fail "dependency evaluation does not expose explicit SARIF publication"
51-
grep -Eq '^ publish-sarif:[[:space:]]*$' "$dependencies_workflow" \
52-
|| fail "dependency SARIF publication is not isolated in its own job"
53-
grep -Fq "if: always() && inputs.publish-sarif" "$dependencies_workflow" \
54-
|| fail "dependency SARIF publication does not run after a finding gate fails"
55-
if grep -Fq "vars.ENABLE_GHAS" "$dependencies_workflow"; then
56-
fail "dependency evaluation still inherits consumer repository publication state implicitly"
49+
if grep -Eq 'security-events:[[:space:]]+write|publish-sarif:' "$dependencies_workflow"; then
50+
fail "dependency evaluation still mixes read-only inspection with SARIF publication"
5751
fi
58-
grep -Fq "publish-sarif: \${{ inputs.publish-sarif }}" "$privileged_pipeline" \
59-
|| fail "the privileged pipeline does not deliberately forward SARIF publication policy"
52+
grep -Eq '^ publish-dependency-sarif:[[:space:]]*$' "$privileged_pipeline" \
53+
|| fail "dependency SARIF publication is not isolated in the privileged pipeline"
54+
grep -Fq "if: always() && inputs.enable-dependencies && inputs.publish-sarif" "$privileged_pipeline" \
55+
|| fail "privileged dependency publication does not honor explicit consumer policy"
56+
grep -Fq "needs: dependencies" "$privileged_pipeline" \
57+
|| fail "privileged dependency publication is not ordered after inspection"
6058
if grep -Eq 'security-events:[[:space:]]+write|publish-sarif:' "$workflow" "$consumer_example"; then
6159
fail "the Ecosystem Baseline requests privileged SARIF publication"
6260
fi

security/workflow-policy.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@
159159
}
160160
},
161161
"dependencies": {
162+
"permissions": {
163+
"actions": "read",
164+
"contents": "read"
165+
}
166+
},
167+
"publish-dependency-sarif": {
162168
"permissions": {
163169
"actions": "read",
164170
"contents": "read",

0 commit comments

Comments
 (0)