Skip to content
Draft
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
29 changes: 28 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ inputs:
description: "GitHub token to use for authenticating with this instance of GitHub. The token needs the `security-events: write` permission."
required: false
default: ${{ github.token }}
enrich-sarif:
description: "Enrich cabal-audit SARIF with dependency paths from Cabal plan.json using cabal-plan-submit."
required: false
default: "true"

outputs:
sarif-id:
Expand All @@ -29,17 +33,40 @@ runs:
shell: bash
env:
CHECKOUT_PATH: ${{ inputs.checkout_path }}
ENRICH_SARIF: ${{ inputs.enrich-sarif }}
run: |
set -euo pipefail
cd "$CHECKOUT_PATH"
wget https://github.com/MangoIV/cabal-audit/releases/download/nightly/cabal-audit
chmod +x cabal-audit
if [[ "$ENRICH_SARIF" == "true" ]]; then
cabal update
cabal install cabal-plan-submit \
--installdir "$RUNNER_TEMP/bin" \
--overwrite-policy=always
fi
- name: Run Haskell Security Action
shell: bash
env:
CHECKOUT_PATH: ${{ inputs.checkout_path }}
ENRICH_SARIF: ${{ inputs.enrich-sarif }}
run: |
set -euo pipefail
cd "$CHECKOUT_PATH"
./cabal-audit --sarif --to-file results.sarif
./cabal-audit --sarif --to-file cabal-audit.sarif
if [[ "$ENRICH_SARIF" == "true" ]]; then
cabal build all --dry-run
if [[ ! -f dist-newstyle/cache/plan.json ]]; then
echo "Expected dist-newstyle/cache/plan.json after cabal build all --dry-run"
exit 1
fi
"$RUNNER_TEMP/bin/cabal-plan-submit" enrich-sarif \
dist-newstyle/cache/plan.json \
cabal-audit.sarif \
> results.sarif
else
cp cabal-audit.sarif results.sarif
fi
cat results.sarif
- name: Upload SARIF file
id: upload-sarif
Expand Down