Skip to main content

ProofGate

A check that runs inside cdk synth. It stops the synthesis when a principal can reach a protected S3 bucket through another role, and names the principal, the role, and the bucket.

npm install @proofgate-cdk/cdk-plugin

Version 1.3.2. Needs Node.js 26 or later and Lean 4 (elan). No AWS account is used.

The demo stack

One role may pass another role to Lambda, and may create Lambda functions. The passed role can read the protected bucket. Each permission looks ordinary alone. Together they let the first role run code with the second role's access.

$ cdk synth
exit 0

$ PROOFGATE=1 cdk synth
ProofGate: Lean certificate for VulnerableAppStack.template.json
           checked by the Lean kernel (decide +kernel)
ERROR DeveloperRole58EC5A58 can pass role ProtectedDataRoleCDFF69BA
      to lambda.amazonaws.com and launch it (lambda:CreateFunction);
      ProtectedDataRoleCDFF69BA trusts lambda.amazonaws.com
      and can access protected bucket
exit 1

# remove the iam:PassRole statement (8 lines)

$ PROOFGATE=1 cdk synth
exit 0

Output of version 1.3.2, lines wrapped. The wide Lambda permissions stay; ProofGate rejects the path, not wide permissions by themselves.

Findings

PG-IAM-004
A principal can reach a protected S3 bucket through another rolePass a role to a service, or change a function that already runs as that role
PG-IAM-005
A role can change IAM itselfAttach a policy to its own role, rewrite a trust policy, create a role
PG-IAM-003
ProofGate cannot read the input, or its two implementations disagreeRejected, never assumed safe

How to answer each finding

How it works

  1. ExtractRead the synthesized CloudFormation and keep the roles, statements, trusted services, and protected buckets. Unsupported syntax is rejected with its JSON path.
  2. ComputeWrite the model as a Lean 4 module. For the iam:PassRole path, Lean computes the findings itself.
  3. CompareLean's kernel checks that its list equals the TypeScript list. A difference, or a Lean failure, rejects the stack.

What Lean checks, and what is trusted

How it was checked

58decisions of the real IAM engine compared with the rule
2,000generated cases per run: independent oracle, TypeScript, and Lean
84realistic CDK stacks, with the expected result committed before each run
60 of 91pathfinding.cloud escalation paths reported (preconditions, not working attacks)
14 of 15dangerous variants of a 27-variant shop application found, with no false alarm

Checks like these found three bugs in our own releases. They are fixed in 1.2.1, 1.3.1, and 1.3.2.

Limits

Not modeled: service control policies, permissions boundaries, resource policies, explicit deny, conditions, role chains, IAM users and groups, and paths across stacks. Lean checks a model that TypeScript builds from the template; it does not prove CloudFormation or IAM semantics.

All limits