Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b4b140200 |
No files matched your search
@@ -38,6 +38,22 @@ reports to dtrack-panel which images the repo builds and its
|
|||||||
`osv-scanner.toml` `[[IgnoredVulns]]`. The panel's auto-triage then marks
|
`osv-scanner.toml` `[[IgnoredVulns]]`. The panel's auto-triage then marks
|
||||||
those NOT_AFFECTED in Dependency-Track — for the CI project and for the app's
|
those NOT_AFFECTED in Dependency-Track — for the CI project and for the app's
|
||||||
own dependency tree in the running images — and closes CI-project findings for
|
own dependency tree in the running images — and closes CI-project findings for
|
||||||
dependencies that never reach the image (dev/build-time). Inputs and an example
|
dependencies that never reach the image (dev/build-time). VEX files under
|
||||||
are in `scan/action.yml`. Authenticates with the same
|
`.vex/` (OpenVEX or CycloneDX VEX, `*.json`) are reported too. Inputs and an
|
||||||
|
example are in `scan/action.yml`. Authenticates with the same
|
||||||
`DEPENDENCY_TRACK_API_KEY` the upload uses; no extra secret.
|
`DEPENDENCY_TRACK_API_KEY` the upload uses; no extra secret.
|
||||||
|
|
||||||
|
Every decision holds for the package versions present when it was written,
|
||||||
|
until its `ignoreUntil` / `review_by` (default 90 days after it was added or
|
||||||
|
last changed), and while the CVE is not known-exploited (CISA KEV). Then the
|
||||||
|
panel reopens the findings (IN_TRIAGE) and the job log warns "VEX re-check
|
||||||
|
due". Re-check; editing the entry (e.g. a new `ignoreUntil`) re-confirms it.
|
||||||
|
|
||||||
|
## `vex` — the central VEX repo
|
||||||
|
|
||||||
|
`uses: https://git.janhouse.lv/janhouse/sbom-tools-action/[email protected]` posts every
|
||||||
|
`*.json` under `vex/` (OpenVEX or CycloneDX VEX) to dtrack-panel
|
||||||
|
(`/panel-ci/vex`): statements about third-party images and packages, applied
|
||||||
|
to the images they name, or wherever the package appears. The repo's complete
|
||||||
|
set each run; a removed statement withdraws its decisions. A rejected file
|
||||||
|
(invalid JSON, `not_affected` without justification or reason) fails the job.
|
||||||
+23
-10
@@ -15,12 +15,16 @@ author: 'janhouse'
|
|||||||
# dtrack-url: ${{ secrets.DEPENDENCY_TRACK_URL }}
|
# dtrack-url: ${{ secrets.DEPENDENCY_TRACK_URL }}
|
||||||
# dtrack-api-key: ${{ secrets.DEPENDENCY_TRACK_API_KEY }}
|
# dtrack-api-key: ${{ secrets.DEPENDENCY_TRACK_API_KEY }}
|
||||||
#
|
#
|
||||||
# osv-scanner.toml [[IgnoredVulns]] are NOT_AFFECTED decisions: dtrack-panel
|
# osv-scanner.toml [[IgnoredVulns]] and VEX files under .vex/ (OpenVEX or
|
||||||
# writes them to Dependency-Track for this repo's own dependencies (the CI
|
# CycloneDX VEX, *.json) are NOT_AFFECTED decisions: dtrack-panel writes them
|
||||||
# project, and the app's dependency tree in the images). A reason may start
|
# to Dependency-Track for this repo's own dependencies (the CI project, and
|
||||||
# with a CycloneDX justification: "code_not_reachable: we never parse XML".
|
# the app's dependency tree in the images), or for the images a VEX statement
|
||||||
# They don't expire unless ignoreUntil says so — re-check them when the code
|
# names. A reason may start with a CycloneDX justification:
|
||||||
# that uses the package changes (see the repo's AGENTS.md).
|
# "code_not_reachable: we never parse XML". Each holds for the package
|
||||||
|
# versions present when it was written, until ignoreUntil / review_by
|
||||||
|
# (default 90 days after it was added or last changed), and while the CVE is
|
||||||
|
# not known-exploited; then the panel reopens the findings for a re-check —
|
||||||
|
# editing the entry re-confirms it (see the repo's AGENTS.md / CLAUDE.md).
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
project:
|
project:
|
||||||
@@ -141,7 +145,7 @@ runs:
|
|||||||
# analysis runs when the Go toolchain is on the runner.
|
# analysis runs when the Go toolchain is on the runner.
|
||||||
osv-scanner scan source -r "$SCAN_PATH" --format table || true
|
osv-scanner scan source -r "$SCAN_PATH" --format table || true
|
||||||
|
|
||||||
- name: Report to dtrack-panel (images + osv-scanner.toml)
|
- name: Report to dtrack-panel (images + osv-scanner.toml + .vex/)
|
||||||
shell: bash
|
shell: bash
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
env:
|
env:
|
||||||
@@ -161,11 +165,20 @@ runs:
|
|||||||
while IFS= read -r f; do
|
while IFS= read -r f; do
|
||||||
tomls=$(jq --arg p "$f" --rawfile c "$f" '. + [{path: $p, content: $c}]' <<<"$tomls")
|
tomls=$(jq --arg p "$f" --rawfile c "$f" '. + [{path: $p, content: $c}]' <<<"$tomls")
|
||||||
done < <(find "$SCAN_PATH" -name osv-scanner.toml -not -path '*/node_modules/*' -not -path '*/.git/*' | head -20)
|
done < <(find "$SCAN_PATH" -name osv-scanner.toml -not -path '*/node_modules/*' -not -path '*/.git/*' | head -20)
|
||||||
|
vex='[]'
|
||||||
|
while IFS= read -r f; do
|
||||||
|
vex=$(jq --arg p "$f" --rawfile c "$f" '. + [{path: $p, content: $c}]' <<<"$vex")
|
||||||
|
done < <(find "$SCAN_PATH" -path '*/.vex/*' -name '*.json' -not -path '*/node_modules/*' -not -path '*/.git/*' | sort | head -200)
|
||||||
jq -n --arg repo "$REPO" --arg commit "$COMMIT" --arg project "$PROJECT" \
|
jq -n --arg repo "$REPO" --arg commit "$COMMIT" --arg project "$PROJECT" \
|
||||||
--argjson images "$images" --argjson tomls "$tomls" \
|
--argjson images "$images" --argjson tomls "$tomls" --argjson vex "$vex" \
|
||||||
'{repo: $repo, commit: $commit, project: $project, images: $images, osvScannerToml: $tomls}' > report.json
|
'{repo: $repo, commit: $commit, project: $project, images: $images, osvScannerToml: $tomls, vexFiles: $vex}' > report.json
|
||||||
echo "Reporting $(jq '.images | length' report.json) image(s), $(jq '.osvScannerToml | length' report.json) osv-scanner.toml file(s) to ${url}"
|
echo "Reporting $(jq '.images | length' report.json) image(s), $(jq '.osvScannerToml | length' report.json) osv-scanner.toml file(s), $(jq '.vexFiles | length' report.json) VEX file(s) to ${url}"
|
||||||
curl -fsS -X POST "$url" -H "X-Api-Key: ${DTRACK_API_KEY}" -H "Content-Type: application/json" \
|
curl -fsS -X POST "$url" -H "X-Api-Key: ${DTRACK_API_KEY}" -H "Content-Type: application/json" \
|
||||||
--data-binary @report.json -o response.json
|
--data-binary @report.json -o response.json
|
||||||
|
jq -r '.vex // empty | "VEX statements: \(.statements) (\(.added) new, \(.changed) changed, \(.removed) removed)"' response.json || true
|
||||||
|
jq -r '.vex.skipped[]? | "::notice file=\(.path)::\(.id) skipped: \(.why)"' response.json || true
|
||||||
|
# Statements that need a re-check: their findings are back IN_TRIAGE.
|
||||||
|
jq -r '.reviewDue[]? | "::warning::VEX re-check due — \(.vulnId) in \(.package) (\(.image)): \(.detail)"' response.json || true
|
||||||
|
jq -r '.expiringSoon[]? | "::notice file=\(.path)::\(.vulnId): review date \(.reviewBy[0:10]) is within 14 days"' response.json || true
|
||||||
echo "Applied on the panel's next sync. Still open (not triaged):"
|
echo "Applied on the panel's next sync. Still open (not triaged):"
|
||||||
jq -r '.open[] | " \(.project): \(.n) \(.severity)"' response.json || true
|
jq -r '.open[] | " \(.project): \(.n) \(.severity)"' response.json || true
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
name: 'VEX statements to dtrack-panel'
|
||||||
|
description: >
|
||||||
|
Post every OpenVEX / CycloneDX VEX file of a repo (the central VEX repo) to
|
||||||
|
dtrack-panel, which applies them as NOT_AFFECTED decisions in
|
||||||
|
Dependency-Track: to the images a statement names, or wherever the package
|
||||||
|
appears. The repo's complete set each time — a removed file or statement
|
||||||
|
withdraws its decisions.
|
||||||
|
author: 'janhouse'
|
||||||
|
|
||||||
|
# Usage (janhouse/vex .gitea/workflows/vex.yml, on push to main + weekly):
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# - uses: https://git.janhouse.lv/janhouse/sbom-tools-action/[email protected]
|
||||||
|
# with:
|
||||||
|
# dtrack-url: ${{ secrets.DEPENDENCY_TRACK_URL }}
|
||||||
|
# dtrack-api-key: ${{ secrets.DEPENDENCY_TRACK_API_KEY }}
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
dtrack-url:
|
||||||
|
description: 'Dependency-Track base URL (the panel answers on <dtrack-url>/panel-ci/)'
|
||||||
|
required: true
|
||||||
|
dtrack-api-key:
|
||||||
|
description: 'Dependency-Track API key that may upload BOMs (authenticates the report)'
|
||||||
|
required: true
|
||||||
|
panel-url:
|
||||||
|
description: 'dtrack-panel VEX URL (default: <dtrack-url>/panel-ci/vex)'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
path:
|
||||||
|
description: 'Directory to collect *.json VEX files from'
|
||||||
|
required: false
|
||||||
|
default: 'vex'
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: 'composite'
|
||||||
|
steps:
|
||||||
|
- name: Post VEX statements
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
DTRACK_URL: ${{ inputs.dtrack-url }}
|
||||||
|
DTRACK_API_KEY: ${{ inputs.dtrack-api-key }}
|
||||||
|
PANEL_URL: ${{ inputs.panel-url }}
|
||||||
|
VEX_PATH: ${{ inputs.path }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
COMMIT: ${{ github.sha }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
url=${PANEL_URL:-${DTRACK_URL%/}/panel-ci/vex}
|
||||||
|
files='[]'
|
||||||
|
while IFS= read -r f; do
|
||||||
|
files=$(jq --arg p "$f" --rawfile c "$f" '. + [{path: $p, content: $c}]' <<<"$files")
|
||||||
|
done < <(find "$VEX_PATH" -name '*.json' -not -path '*/.git/*' | sort | head -500)
|
||||||
|
jq -n --arg repo "$REPO" --arg commit "$COMMIT" --argjson files "$files" \
|
||||||
|
'{repo: $repo, commit: $commit, files: $files}' > vex-report.json
|
||||||
|
echo "Posting $(jq '.files | length' vex-report.json) VEX file(s) to ${url}"
|
||||||
|
# -f: a rejected file (bad JSON, no justification) fails the job.
|
||||||
|
code=$(curl -sS -o response.json -w '%{http_code}' -X POST "$url" \
|
||||||
|
-H "X-Api-Key: ${DTRACK_API_KEY}" -H "Content-Type: application/json" \
|
||||||
|
--data-binary @vex-report.json)
|
||||||
|
if [ "$code" != 200 ]; then
|
||||||
|
echo "::error::dtrack-panel answered HTTP $code: $(jq -r '.message // .' response.json 2>/dev/null || cat response.json)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
jq -r '.vex | "VEX statements: \(.statements) (\(.added) new, \(.changed) changed, \(.removed) removed)"' response.json
|
||||||
|
jq -r '.vex.skipped[]? | "::notice file=\(.path)::\(.id) skipped: \(.why)"' response.json || true
|
||||||
|
jq -r '.reviewDue[]? | "::warning::VEX re-check due — \(.vulnId) in \(.package) (\(.image)): \(.detail)"' response.json || true
|
||||||
|
jq -r '.expiringSoon[]? | "::notice file=\(.path)::\(.vulnId): review date \(.reviewBy[0:10]) is within 14 days"' response.json || true
|
||||||
Reference in new issue
Block a user