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 0Output of version 1.3.2, lines wrapped. The wide Lambda permissions stay; ProofGate rejects the path, not wide permissions by themselves.
Findings
PG-IAM-004PG-IAM-005PG-IAM-003How it works
- ExtractRead the synthesized CloudFormation and keep the roles, statements, trusted services, and protected buckets. Unsupported syntax is rejected with its JSON path.
- ComputeWrite the model as a Lean 4 module. For the iam:PassRole path, Lean computes the findings itself.
- CompareLean's kernel checks that its list equals the TypeScript list. A difference, or a Lean failure, rejects the stack.
How it was checked
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.