scan: report .vex/ files and print VEX re-checks; vex: action for the central VEX repo
dtrack-panel now applies OpenVEX / CycloneDX VEX files as well as osv-scanner.toml [[IgnoredVulns]], and sends a statement's findings back to IN_TRIAGE when its review date passes, the package version moves on, or the CVE turns KEV. scan sends .vex/**/*.json with the report and turns the panel's answer into job annotations (re-check due, review date within 14 days, skipped statements). vex/ posts a whole repo's VEX files to /panel-ci/vex for statements about third-party images.
This commit is contained in:
1 parent
f9e42005ba
commit
2b4b140200
3 files changed
+107
-12
No files matched your search
+23
-10
@@ -15,12 +15,16 @@ author: 'janhouse'
|
||||
# dtrack-url: ${{ secrets.DEPENDENCY_TRACK_URL }}
|
||||
# dtrack-api-key: ${{ secrets.DEPENDENCY_TRACK_API_KEY }}
|
||||
#
|
||||
# osv-scanner.toml [[IgnoredVulns]] are NOT_AFFECTED decisions: dtrack-panel
|
||||
# writes them to Dependency-Track for this repo's own dependencies (the CI
|
||||
# project, and the app's dependency tree in the images). A reason may start
|
||||
# with a CycloneDX justification: "code_not_reachable: we never parse XML".
|
||||
# They don't expire unless ignoreUntil says so — re-check them when the code
|
||||
# that uses the package changes (see the repo's AGENTS.md).
|
||||
# osv-scanner.toml [[IgnoredVulns]] and VEX files under .vex/ (OpenVEX or
|
||||
# CycloneDX VEX, *.json) are NOT_AFFECTED decisions: dtrack-panel writes them
|
||||
# to Dependency-Track for this repo's own dependencies (the CI project, and
|
||||
# the app's dependency tree in the images), or for the images a VEX statement
|
||||
# names. A reason may start with a CycloneDX justification:
|
||||
# "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:
|
||||
project:
|
||||
@@ -141,7 +145,7 @@ runs:
|
||||
# analysis runs when the Go toolchain is on the runner.
|
||||
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
|
||||
continue-on-error: true
|
||||
env:
|
||||
@@ -161,11 +165,20 @@ runs:
|
||||
while IFS= read -r f; do
|
||||
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)
|
||||
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" \
|
||||
--argjson images "$images" --argjson tomls "$tomls" \
|
||||
'{repo: $repo, commit: $commit, project: $project, images: $images, osvScannerToml: $tomls}' > report.json
|
||||
echo "Reporting $(jq '.images | length' report.json) image(s), $(jq '.osvScannerToml | length' report.json) osv-scanner.toml file(s) to ${url}"
|
||||
--argjson images "$images" --argjson tomls "$tomls" --argjson vex "$vex" \
|
||||
'{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), $(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" \
|
||||
--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):"
|
||||
jq -r '.open[] | " \(.project): \(.n) \(.severity)"' response.json || true
|
||||
Reference in new issue
Block a user