Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions scan/trustabl-scan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,17 @@ BASE_ARGS=(scan "$TARGET")
[ "$STRICT" = "true" ] && BASE_ARGS+=(--strict)
[ -n "$RULES_REF" ] && BASE_ARGS+=(--rules-ref "$RULES_REF")

# Run 1: SARIF (file emit).
trustabl "${BASE_ARGS[@]}" --format sarif > "$SARIF_FILE"
# One scan, both machine artifacts. --json-out/--sarif-out write their documents
# independently of --format, so --format human additionally puts trustabl's own
# summary in the build log rather than having a redirect swallow it.
#
# This used to be two full scans. That cost twice the time on every build, and
# because rules are fetched at scan time the two runs could resolve different
# rulesets — leaving the SARIF that gets uploaded and the JSON that decides the
# gate describing two separate scans.
trustabl "${BASE_ARGS[@]}" --format human \
--json-out "$JSON_FILE" --sarif-out "$SARIF_FILE"
NATIVE_CODE=$?

# Run 2: JSON (drives thresholds, log summary, dotenv).
trustabl "${BASE_ARGS[@]}" --format json > "$JSON_FILE" || true
SCAN_END=$(date -u +%Y-%m-%dT%H:%M:%S)

# trustabl's overall_score is a float in [0.0, 1.0]; scale to [0,100] ints.
Expand Down