Vulnerability Monitor #1099
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Vulnerability Monitor | |
| on: | |
| schedule: | |
| - cron: '0 * * * *' # Every hour | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| issues: write | |
| jobs: | |
| monitor: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: scan | |
| uses: spaceraccoon/vulnerability-spoiler-alert-action@b16483310fbd153dd8a4ece5fa1a29a8fcc004de | |
| with: | |
| api-key: ${{ secrets.ANTHROPIC_API_KEY }} | |
| repositories: | | |
| [ | |
| {"owner": "cure53", "repo": "DOMPurify"} | |
| ] | |
| max-commits: 25 | |
| triage-model: claude-haiku-4-5-20251001 | |
| enable-judge: true | |
| create-issues: true | |
| - name: Analyze fix bypass potential | |
| if: steps.scan.outputs.vulnerabilities-found > 0 | |
| continue-on-error: true | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| RESULTS: ${{ steps.scan.outputs.results }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: python3 scripts/bypass_analyzer.py | |
| - name: Notify Discord | |
| if: steps.scan.outputs.vulnerabilities-found > 0 | |
| env: | |
| DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
| RESULTS: ${{ steps.scan.outputs.results }} | |
| run: | | |
| [ -f /tmp/enriched-results.json ] || echo "$RESULTS" > /tmp/enriched-results.json | |
| jq -c '.[:5][]' /tmp/enriched-results.json | while read -r vuln; do | |
| severity=$(echo "$vuln" | jq -r '.analysis.severity // "unknown"') | |
| repo=$(echo "$vuln" | jq -r '"\(.repo.owner)/\(.repo.repo)"') | |
| vuln_type=$(echo "$vuln" | jq -r '.analysis.vulnerabilityType // "Unknown"') | |
| commit_sha=$(echo "$vuln" | jq -r '.commit.sha // ""') | |
| commit_short=$(echo "$commit_sha" | cut -c1-7) | |
| commit_url=$(echo "$vuln" | jq -r '.commit.url // ""') | |
| commit_msg=$(echo "$vuln" | jq -r '.commit.message // "No message"' | cut -c1-200) | |
| author=$(echo "$vuln" | jq -r '.commit.author // "unknown"') | |
| issue_url=$(echo "$vuln" | jq -r '.issueUrl // ""') | |
| commit_date=$(echo "$vuln" | jq -r '.commit.date // ""') | |
| bypass_risk=$(echo "$vuln" | jq -r '.bypassAnalysis.bypassRisk // "unknown"' | tr '[:upper:]' '[:lower:]') | |
| bypass_reasoning=$(echo "$vuln" | jq -r '.bypassAnalysis.reasoning // ""') | |
| bypass_example=$(echo "$vuln" | jq -r '.bypassAnalysis.example // ""') | |
| case "$bypass_risk" in | |
| none) bypass_display="✅ Fix looks complete" ;; | |
| low) bypass_display="⚠️ ${bypass_reasoning:-Fix may be incomplete}" ;; | |
| medium) bypass_display="🟡 ${bypass_reasoning:-Possible bypass} — ${bypass_example:-see diff}" ;; | |
| high) bypass_display="🔴 ${bypass_reasoning:-Bypass likely} — ${bypass_example:-see diff}" ;; | |
| *) bypass_display="❓ Analysis unavailable${bypass_reasoning:+ — $bypass_reasoning}" ;; | |
| esac | |
| case "${severity,,}" in | |
| critical) color=15158332 ;; | |
| high) color=16744272 ;; | |
| medium) color=16776960 ;; | |
| *) color=65280 ;; | |
| esac | |
| payload=$(jq -n \ | |
| --arg title "[${severity^^}] Possible silent patch — $repo" \ | |
| --arg url "$issue_url" \ | |
| --argjson color "$color" \ | |
| --arg vuln_type "$vuln_type" \ | |
| --arg commit_link "[$commit_short]($commit_url)" \ | |
| --arg author "$author" \ | |
| --arg commit_msg "$commit_msg" \ | |
| --arg ts "$commit_date" \ | |
| --arg bypass_display "$bypass_display" \ | |
| '{embeds:[{title:$title,url:$url,color:$color,timestamp:$ts, | |
| fields:[ | |
| {name:"Type",value:$vuln_type,inline:true}, | |
| {name:"Commit",value:$commit_link,inline:true}, | |
| {name:"Author",value:$author,inline:true}, | |
| {name:"Message",value:$commit_msg,inline:false}, | |
| {name:"Fix Quality",value:$bypass_display,inline:false} | |
| ], | |
| footer:{text:"videt vulnerability monitor"}}]}') | |
| curl -s -o /dev/null -w "%{http_code}" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$payload" \ | |
| "$DISCORD_WEBHOOK_URL" | |
| done | |
| - name: Commit state changes | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add .vulnerability-spoiler-state.json | |
| git diff --staged --quiet || git commit -m "Update vulnerability monitor state" | |
| git push |