DEV Community

CoreNova
CoreNova

Posted on Originally published at corenovacloud.com

Blocking AI-Generated IAM PassRole Escalation and EKS hostPath Mounts in GitHub Actions with SARIF 2.1.0

AI coding agents speed up Terraform and Kubernetes authoring, but under context pressure they frequently ship subtle security regressions or skip optional local linters altogether. Two patterns show up repeatedly in PR reviews:

  1. Indirect IAM privilege escalation across statements: Neither iam:PassRole nor lambda:CreateFunction looks like Action: "*" on its own, yet granting both on Resource: "*" lets any principal attach an admin role to a new Lambda function, EC2 instance, or ECS task.
  2. EKS Pod host escape defaults: Generated manifests omit automountServiceAccountToken: false, mount hostPath volumes into pods, or request CAP_SYS_ADMIN capabilities.

Running one set of heuristics inside the developer's MCP server and a completely different scanner in CI creates drift. The agent thinks the diff is clean; CI rejects the PR 10 minutes later.

1. One Deterministic Rule Engine for MCP and CI

CoreNova Cloud Audit v1.4.0 runs the exact same rule engine over both Streamable HTTP MCP (/mcp) and REST (POST /v1/scan/sarif, or ?format=sarif on /v1/scan/iam, /v1/scan/iac, and /v1/scan/k8s):

  • IAM_INDIRECT_PRIVILEGE_ESCALATION: Detects iam:PassRole combined with lambda:CreateFunction, ec2:RunInstances, or ecs:RegisterTaskDefinition across statements on Resource: "*".
  • K8S_HOST_PATH_MOUNT, K8S_DANGEROUS_CAPABILITIES, and K8S_AUTOMOUNT_SERVICE_ACCOUNT_TOKEN: Flags hostPath mounts, CAP_SYS_ADMIN / ALL capabilities, and missing automountServiceAccountToken: false.
  • IAC_IMDSV1_ENABLED and IAC_BEDROCK_PROVISIONED_THROUGHPUT: Blocks Terraform/CloudFormation deployments missing IMDSv2 http_tokens = "required" or introducing unapproved Bedrock Provisioned Throughput commitments.

You can test a combined IAM + Kubernetes payload against the zero-signup sandbox in under 15ms:

curl -s -X POST "https://audit.corenovacloud.com/v1/scan/k8s?format=sarif" \
  -H "Content-Type: application/json" \
  -d '{
    "filename": "k8s/worker-deploy.yaml",
    "content": "spec:\n  containers:\n  - name: worker\n    securityContext:\n      capabilities:\n        add: [\"CAP_SYS_ADMIN\"]\n    volumeMounts:\n    - name: host-root\n      mountPath: /host\n  volumes:\n  - name: host-root\n    hostPath:\n      path: /"
  }'
Enter fullscreen mode Exit fullscreen mode

2. Enforcing Inline PR Annotations with GitHub Actions SARIF

CoreNovaLabs/cloud-audit-mcp-starter includes a drop-in workflow (corenova-sarif-gate.yml) and runner (sarif_gate.py) that uploads SARIF 2.1.0 findings directly to GitHub Code Scanning so violations appear as inline PR line annotations:

- name: Run CoreNova Cloud Audit SARIF Gate
  run: python3 sarif_gate.py --paths infra/ k8s/ --out cloud-audit.sarif

- name: Upload SARIF to GitHub Code Scanning
  if: always()
  uses: github/codeql-action/upload-sarif@v3
  with:
    sarif_file: cloud-audit.sarif
Enter fullscreen mode Exit fullscreen mode

Because audit.corenovacloud.com emits exact line numbers and remediation text in SARIF 2.1.0, both human reviewers and automated coding agents get the exact same fix instruction.

Try Live or Subscribe on AWS Marketplace

Top comments (0)