Skip to content
Projetos

spaceraccoon/vulnerability-spoiler-alert-action

Ver no GitHub

Sobre

GitHub Action to alert on security patches before the CVE drops.

Segurança e privacidade

Como estes números são medidos

O que você pode fazer

  • Multi-Provider AI — Works with Anthropic Claude, OpenAI, DeepSeek, or any OpenAI-compatible API
  • Proof of Concept Required — Only alerts when a concrete exploit can be demonstrated
  • PR Context Aware — Analyzes PR descriptions and labels for security indicators
  • Automatic Issue Creation — Creates detailed issues with vulnerability analysis

Crescimento medido de estrelas

em 24 h
0
em 7 dias
+3
em 15 dias
+3
em 1 mês
Coletando histórico

Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.

README.md

Original

Vulnerability Spoiler Alert Action

Know about security patches before the CVE drops.

GitHub Action TypeScript License: MIT

A reusable GitHub Action that monitors open-source repositories and uses AI to detect when commits are patching security vulnerabilities — often before a CVE is even assigned.

For the theory and research behind this action, see Discovering Negative Days: LLM Workflows for Vulnerability Intelligence.

Features

  • Multi-Provider AI — Works with Anthropic Claude, OpenAI, DeepSeek, or any OpenAI-compatible API
  • Proof of Concept Required — Only alerts when a concrete exploit can be demonstrated
  • PR Context Aware — Analyzes PR descriptions and labels for security indicators
  • Automatic Issue Creation — Creates detailed issues with vulnerability analysis
  • State Management — Tracks analyzed commits to avoid duplicates
  • Configurable — Choose which repositories to monitor, where to create issues, and more

Quick Start

name: Vulnerability Monitor

on:
  schedule:
    - cron: '0 */6 * * *'  # Every 6 hours
  workflow_dispatch:

permissions:
  contents: write
  issues: write

jobs:
  monitor:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: spaceraccoon/vulnerability-spoiler-alert-action@v1
        with:
          api-key: ${{ secrets.ANTHROPIC_API_KEY }}
          repositories: |
            [
              {"owner": "expressjs", "repo": "express"},
              {"owner": "lodash", "repo": "lodash"}
            ]

      - 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

Inputs

Input Required Default Description
api-key Yes* - API key for the model provider
anthropic-api-key Yes* - Anthropic API key (deprecated — use api-key)
provider No anthropic Model provider: anthropic, openai, deepseek, or openai-compatible
base-url No - Custom base URL for openai-compatible providers
github-token No ${{ github.token }} GitHub token for API access
repositories Yes - JSON array of repos to monitor
state-file No .vulnerability-spoiler-state.json Path to state file
create-issues No true Whether to create GitHub issues
issue-repo No Current repo Where to create issues (owner/repo)
model No claude-sonnet-4-6 Model to use for analysis — must match your provider and support structured output (e.g. claude-sonnet-4-6, claude-opus-4-5, gpt-4o, deepseek-chat)
max-commits No 50 Max commits to analyze per repo per run
enable-repo-context No false Fetch modified files for context (max 3 files, 3000 chars each)
enable-judge No false Use second model to review detections and reduce false positives
judge-model No Same as model Model for judge. Pair with judge-provider to run the judge on a different provider
judge-provider No Same as provider Provider for the judge: anthropic, openai, deepseek, or openai-compatible. Empty = same provider as the primary model
judge-api-key No Same as api-key API key for the judge provider. Empty = same key as the primary model
judge-base-url No Same as base-url Custom base URL for an openai-compatible judge provider. Empty = same base URL as the primary model
triage-model No - Cheap model for initial triage screen (empty = no triage). Commits not flagged by triage skip the primary model entirely. Uses the same provider as model
triage-diff-limit No 2000 Max characters of the diff prefix sent to the triage model (a short "... [diff truncated]" marker is appended when truncation occurs). When truncated, the complete changed-file list is appended so triage still sees every touched path. Set 0 to disable triage truncation (triage then receives the same diff as the primary analysis)

* One of api-key or anthropic-api-key is required.

Outputs

Output Description
vulnerabilities-found Number of vulnerabilities detected
issues-created Number of issues created
analyzed-commits Total commits analyzed
results JSON array of detected vulnerabilities

Usage Examples

Anthropic Claude (default)

- uses: spaceraccoon/vulnerability-spoiler-alert-action@v1
  with:
    api-key: ${{ secrets.ANTHROPIC_API_KEY }}
    model: claude-sonnet-4-6
    repositories: '[{"owner": "expressjs", "repo": "express"}]'

OpenAI

- uses: spaceraccoon/vulnerability-spoiler-alert-action@v1
  with:
    api-key: ${{ secrets.OPENAI_API_KEY }}
    provider: openai
    model: gpt-4o
    repositories: '[{"owner": "expressjs", "repo": "express"}]'

DeepSeek

- uses: spaceraccoon/vulnerability-spoiler-alert-action@v1
  with:
    api-key: ${{ secrets.DEEPSEEK_API_KEY }}
    provider: deepseek
    model: deepseek-chat
    repositories: '[{"owner": "expressjs", "repo": "express"}]'

Any OpenAI-Compatible API

Use provider: openai-compatible with base-url to point at any compatible endpoint — useful for self-hosted models (Ollama, vLLM, etc.) or third-party providers (Groq, Together AI, etc.):

- uses: spaceraccoon/vulnerability-spoiler-alert-action@v1
  with:
    api-key: ${{ secrets.GROQ_API_KEY }}
    provider: openai-compatible
    base-url: 'https://api.groq.com/openai/v1'
    model: llama-3.3-70b-versatile
    repositories: '[{"owner": "expressjs", "repo": "express"}]'

Monitor Multiple Repositories

- uses: spaceraccoon/vulnerability-spoiler-alert-action@v1
  with:
    api-key: ${{ secrets.ANTHROPIC_API_KEY }}
    repositories: |
      [
        {"owner": "expressjs", "repo": "express"},
        {"owner": "lodash", "repo": "lodash"},
        {"owner": "axios", "repo": "axios"},
        {"owner": "chalk", "repo": "chalk"}
      ]

Create Issues in a Different Repository

- uses: spaceraccoon/vulnerability-spoiler-alert-action@v1
  with:
    api-key: ${{ secrets.ANTHROPIC_API_KEY }}
    repositories: '[{"owner": "expressjs", "repo": "express"}]'
    issue-repo: 'my-org/security-alerts'

Detection Only (No Issues)

- uses: spaceraccoon/vulnerability-spoiler-alert-action@v1
  id: scan
  with:
    api-key: ${{ secrets.ANTHROPIC_API_KEY }}
    repositories: '[{"owner": "expressjs", "repo": "express"}]'
    create-issues: 'false'

- name: Process results
  if: steps.scan.outputs.vulnerabilities-found > 0
  run: |
    echo "Found ${{ steps.scan.outputs.vulnerabilities-found }} vulnerabilities!"
    echo "${{ steps.scan.outputs.results }}" | jq .

Enhanced Detection with Context & Judge

- uses: spaceraccoon/vulnerability-spoiler-alert-action@v1
  with:
    api-key: ${{ secrets.ANTHROPIC_API_KEY }}
    repositories: '[{"owner": "expressjs", "repo": "express"}]'
    enable-repo-context: true  # Fetch file contents for better analysis
    enable-judge: true          # Second review to reduce false positives
    judge-model: 'claude-sonnet-4-6'

Send to Slack

- uses: spaceraccoon/vulnerability-spoiler-alert-action@v1
  id: scan
  with:
    api-key: ${{ secrets.ANTHROPIC_API_KEY }}
    repositories: '[{"owner": "expressjs", "repo": "express"}]'
    create-issues: 'false'

- name: Notify Slack
  if: steps.scan.outputs.vulnerabilities-found > 0
  uses: slackapi/slack-github-action@v1
  with:
    payload: |
      {
        "text": "🚨 Detected ${{ steps.scan.outputs.vulnerabilities-found }} potential vulnerabilities!"
      }
  env:
    SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

How Detection Works

  1. Fetches new commits from each monitored repository since the last run
  2. Retrieves PR context including title, description, and labels
  3. Analyzes with AI using a carefully crafted prompt that:
    • Looks for security-relevant code patterns
    • Requires a concrete proof of concept exploit
    • Classifies severity based on impact
  4. Creates issues with full vulnerability details

What Gets Flagged

The action only flags commits where the model can demonstrate a concrete exploit:

  • Input validation/sanitization fixes
  • Authentication/authorization patches
  • Injection vulnerability fixes (SQL, XSS, Command, etc.)
  • Path traversal protections
  • Memory safety improvements

What Gets Ignored

  • General code quality improvements
  • Defensive coding without security impact
  • Performance optimizations
  • Refactoring

State Management

The action tracks which commits have been analyzed using a state file. This file should be committed back to your repository to persist across runs.

- 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

Permissions

The action requires these permissions:

permissions:
  contents: write  # To commit state file
  issues: write    # To create issues

Setup

  1. Get an API key from your chosen provider:
  2. Add it as a repository secret (e.g. ANTHROPIC_API_KEY)
  3. Create a workflow file as shown in the examples above
  4. Enable the workflow

Security Considerations

Prompt Injection Risk

This action sends commit diffs, commit messages, and pull request metadata from monitored repositories to an LLM for analysis. Because these inputs are controlled by the authors of the monitored repositories, they are inherently attacker-controllable. A malicious actor can craft commit messages, PR descriptions, or code diffs that contain adversarial instructions designed to manipulate the LLM's output. This is known as prompt injection and it cannot be fully prevented by the action itself.

Prompt injection could be used to:

  • Suppress real detections — instructing the model to always return isVulnerabilityPatch: false, causing the action to silently miss actual vulnerability patches.
  • Generate false positives — forcing the model to flag benign commits as vulnerabilities with fabricated descriptions and proof-of-concept exploits.
  • Influence issue content — since the model's output is used to create GitHub issues, a manipulated response could include misleading or socially-engineered content in your issue tracker.

Recommended Mitigations

  1. Treat all results as advisory. Never take automated action (e.g., blocking deployments, sending public notifications) based solely on this action's output without human review.
  2. Restrict the issue repository. Use a private or internal repository for created issues (issue-repo input) so that injected content is not publicly visible.
  3. Use create-issues: false for untrusted sources. When monitoring repositories you do not control, disable automatic issue creation and review the results output programmatically or manually instead.
  4. Apply least-privilege tokens. Use a GitHub token scoped to only the permissions the action needs. Do not use tokens with broad org-level access.
  5. Review issues before acting. Any vulnerability details, proof-of-concept exploits, or severity ratings in created issues originate from LLM analysis of external data and should be independently verified.

API Usage and Costs

Model Provider API

  • Primary analysis: 1 API call per commit analyzed
  • Judge model: +1 API call per detected vulnerability (when enable-judge: true)
  • Triage model: 1 cheap API call per commit (when triage-model is set). Commits not flagged by triage skip the primary model, so a cheap triage model can significantly reduce primary-model spend on repos with many non-security commits.
  • Triage diff size: triage calls send at most triage-diff-limit characters of the diff prefix (plus a short truncation marker and, when truncated, a changed-file list capped at 50 paths). Default 2000 vs. up to 15000 for the primary analysis. Since triage runs on every commit, this cap drives most of the triage token cost — lower it for cheaper runs, raise it (or set 0) if you want triage decisions based on more of the diff.
  • With judge enabled, costs can double for repositories with frequent vulnerability detections

GitHub API

  • Repository context: Up to 4 API calls per commit (1 for parent SHA + up to 3 for files, when enable-repo-context: true)
  • For default max-commits: 50, this could be 200+ API calls per run per repository
  • Monitor your rate limits when watching multiple repositories

Tip: Start with lower max-commits values and monitor costs before scaling up.

Limitations

  • Only analyzes public repositories (or private repos your token can access)
  • Large diffs are truncated to fit API limits
  • AI analysis may have false positives/negatives — all results should be treated as advisory and verified by a human (see Security Considerations)
  • Rate limited by GitHub and provider APIs

Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

License

MIT License — see LICENSE for details.

Disclaimer

This tool is for defensive security research only. Always follow responsible disclosure practices.

Explore projetos relacionados

Carregando…