Blocking AI-Generated IAM PassRole Escalation and EKS hostPath Mounts in GitHub Actions with SARIF 2.1.0
How to enforce identical deterministic checks in your coding agent's MCP loop and GitHub Actions PR gate so wildcard iam:PassRole chains, EKS hostPath mounts, and IMDSv1 never reach main.
Tags AWS IAM · Amazon EKS · Terraform · GitHub Actions · SARIF · AWS Marketplace
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:
- Indirect IAM privilege escalation across statements: Neither
iam:PassRolenorlambda:CreateFunctionlooks likeAction: "*"on its own, yet granting both onResource: "*"lets any principal attach an admin role to a new Lambda function, EC2 instance, or ECS task. - EKS Pod host escape defaults: Generated manifests omit
automountServiceAccountToken: false, mounthostPathvolumes into pods, or requestCAP_SYS_ADMINcapabilities.
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: Detectsiam:PassRolecombined withlambda:CreateFunction,ec2:RunInstances, orecs:RegisterTaskDefinitionacross statements onResource: "*".K8S_HOST_PATH_MOUNT,K8S_DANGEROUS_CAPABILITIES, andK8S_AUTOMOUNT_SERVICE_ACCOUNT_TOKEN: FlagshostPathmounts,CAP_SYS_ADMIN/ALLcapabilities, and missingautomountServiceAccountToken: false.IAC_IMDSV1_ENABLEDandIAC_BEDROCK_PROVISIONED_THROUGHPUT: Blocks Terraform/CloudFormation deployments missing IMDSv2http_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: /"
}'
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
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
- 3-second zero-signup sandbox: Paste IAM JSON, Terraform, CloudFormation, Kubernetes YAML, or Dockerfiles at audit.corenovacloud.com.
- Cloud Audit Serverless SaaS ($29 / $99 / $299 per month, 3% SaaS): Subscribe to Cloud IAM & IaC Security Audit API + MCP on AWS Marketplace on your consolidated AWS invoice.
- Zero-SSH EKS Administration: Pair CI policy gates with CoreNova EKS Admin Bastion AMI (x86_64) or ARM64 using AWS SSM Session Manager and EKS Access Entries.