#!/bin/bash
# scan-and-notify.sh
RESULT=$(zenveil scan repo . --json /tmp/scan.json)
EXIT_CODE=$?
if [ $EXIT_CODE -eq 1 ]; then
CRITICAL=$(python3 -c "import json; d=json.load(open('/tmp/scan.json')); print(sum(1 for f in d['findings'] if f['severity']=='CRITICAL'))")
HIGH=$(python3 -c "import json; d=json.load(open('/tmp/scan.json')); print(sum(1 for f in d['findings'] if f['severity']=='HIGH'))")
curl -X POST $SLACK_WEBHOOK_URL \
-H 'Content-type: application/json' \
-d "{
\"text\": \"🚨 ZenVeil Security Alert\",
\"blocks\": [
{
\"type\": \"section\",
\"text\": {
\"type\": \"mrkdwn\",
\"text\": \"*Security scan found critical issues*\nCRITICAL: ${CRITICAL} · HIGH: ${HIGH}\n<https://app.zenveil.dev|View dashboard>\"
}
}
]
}"
fi