DEV Community

CoreNova
CoreNova

Posted on

GitHub Code Scanning with SARIF 2.1.0 + Remote MCP: Catching AI-Generated Wildcard AWS IAM & Privileged EKS Pods on Every PR

AI coding agents (Claude Code, Cursor, Amazon Bedrock coding agents) are great at shipping Terraform, CloudFormation, IAM policies, and Kubernetes manifests fast. They are also great at optimizing for "make it work on the first try"—which is why Action: "*", 0.0.0.0/0 SSH/DB security groups, IMDSv1 (http_tokens = "optional"), and privileged: true pods keep sneaking into pull requests.

Earlier this week, a reader here on DEV pointed out the exact production failure mode of agent-only guardrails:

Under context pressure, coding agents occasionally skip optional MCP tool calls. To make security guardrails stick, your fast local MCP loop and your hard GitHub Actions PR merge gate must run the exact same deterministic rule engine with exact line-level remediation.

We took that feedback straight into production and shipped v1.1.0 of CoreNova Cloud IAM & IaC Security Audit (https://audit.corenovacloud.com) with exact 1-based line numbers and native OASIS SARIF 2.1.0 output for GitHub Code Scanning.


Why Two-Layer Parity Beats CI-Only or Agent-Only Checks

Layer Latency Role What happens on violation
1. Local Remote MCP (/mcp) <15ms Developer / Agent fast feedback loop Agent sees exact rule_id, line, and remediation before even proposing the diff
2. GitHub Actions SARIF Gate (/v1/scan/sarif) <15ms per batch Hard merge enforcement Uploads OASIS SARIF 2.1.0 to GitHub Code Scanning (inline PR diff annotations + Security tab) and blocks merge

Because both layers hit the exact same zero-data-retention deterministic engine, there is zero rule drift between what the AI agent checks locally and what CI enforces on pull_request.


Step 1: Test the Multi-File SARIF 2.1.0 Endpoint (curl)

You can test the live zero-data-retention sandbox right now (no signup required):

curl -sS -i -X POST https://audit.corenovacloud.com/v1/scan/sarif \
  -H "Content-Type: application/json" \
  -d '{
    "files": [
      {
        "filename": "infra/rds.tf",
        "content": "resource \"aws_db_instance\" \"prod\" {\n  storage_encrypted   = false\n  publicly_accessible = true\n}\n"
      },
      {
        "filename": "k8s/worker-pod.yaml",
        "content": "apiVersion: v1\nkind: Pod\nspec:\n  containers:\n    - name: worker\n      securityContext:\n        privileged: true\n"
      }
    ]
  }'
Enter fullscreen mode Exit fullscreen mode

The response includes machine-readable headers (x-corenova-action: block, x-corenova-findings-count: 2, x-corenova-risk-score: 75) and a valid SARIF 2.1.0 payload with exact startLine, security-severity, and remediation guidance ready for github/codeql-action/upload-sarif@v3.


Step 2: Drop-In GitHub Actions SARIF PR Gate

Add .github/workflows/corenova-sarif-gate.yml to your repository (full MIT starter at CoreNovaLabs/cloud-audit-mcp-starter):

name: CoreNova Cloud Security SARIF Gate

on:
  pull_request:
    paths:
      - "**/*.tf"
      - "**/*.yaml"
      - "**/*.yml"
      - "**/iam/*.json"
      - "**/Dockerfile*"

permissions:
  contents: read
  security-events: write

jobs:
  sarif-audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - name: Run CoreNova deterministic audit (SARIF 2.1.0)
        id: audit
        continue-on-error: true
        env:
          CORENOVA_AUDIT_API_KEY: ${{ secrets.CORENOVA_AUDIT_API_KEY }}
          CORENOVA_SARIF_OUT: corenova-audit.sarif
        run: |
          FILES=$(git diff --name-only --diff-filter=AM origin/${{ github.base_ref }}...HEAD -- '*.tf' '*.yaml' '*.yml' '*iam*.json' '*Dockerfile*' || true)
          if [ -n "$FILES" ]; then
            python3 examples/python/sarif_gate.py $FILES
          fi
      - name: Upload SARIF to GitHub Code Scanning
        if: always() && hashFiles('corenova-audit.sarif') != ''
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: corenova-audit.sarif
      - name: Enforce merge gate on block
        if: steps.audit.outcome == 'failure'
        run: exit 1
Enter fullscreen mode Exit fullscreen mode

Step 3: Wire the Same Engine Into Your AI Coding Agent (MCP)

Add corenova-cloud-audit to Claude Code, Cursor, or any Streamable HTTP MCP client:

{
  "mcpServers": {
    "corenova-cloud-audit": {
      "type": "http",
      "url": "https://audit.corenovacloud.com/mcp"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Available MCP tools in v1.1.0:

  • audit_aws_iam_policy
  • audit_iac_template
  • audit_k8s_or_dockerfile
  • audit_to_sarif

Open-Source Starter & AWS Marketplace

What AWS IAM escalation paths or Kubernetes admission rules would you want added next in v1.2.0? Drop a comment below—we ship community-requested rules fast.

Top comments (0)