Skip to content

fix(lambda): discover permissions on published versions and aliases - #182

Merged
JeroenSoeters merged 1 commit into
mainfrom
jeroensoeters/lambda-permission-qualified-discovery
Aug 22, 2026
Merged

fix(lambda): discover permissions on published versions and aliases#182
JeroenSoeters merged 1 commit into
mainfrom
jeroensoeters/lambda-permission-qualified-discovery

Conversation

@JeroenSoeters

Copy link
Copy Markdown
Contributor

Summary

  • AWS::Lambda::Permission discovery only found statements on the bare function's resource policy. Lambda keeps a separate policy per qualifier, and the CloudControl list handler returns just the unqualified one, so a permission granted against a published version's or alias's ARN (the shape API Gateway and Lambda@Edge wiring uses) was invisible to discovery. This surfaced as soon as discovery for the type was enabled: the conformance suite that attaches a permission to a published version's qualified ARN fails its discovery phase because the awaited id can never appear in the list.
  • List now goes through a custom provisioner that walks every policy scope via the Lambda control plane: GetPolicy on the function, on each published version (ListVersionsByFunction, paginated, $LATEST skipped since it shares the unqualified policy), and on each alias (ListAliases). Each statement emits the same ARN|Sid composite id the CloudControl CRUD path produces, so discovered and managed permissions resolve to identical ids. A deleted function yields an empty list, a scope with no policy is skipped, and the client carries the discovery-grade retry budget that registry dispatch bypasses.

Verification

  • Six unit tests cover the multi-scope enumeration, version pagination, missing-filter and deleted-function handling, and error propagation; make test-unit, make lint, make verify-schema, make build all pass.
  • Targeted conformance for lambda-version-ref (the failing qualified case) and lambda-permission (unqualified regression guard) dispatched from this branch; results will be linked in a comment.

A Lambda function keeps a separate resource policy per qualifier:
statements added against the bare function name live on the unqualified
policy, while statements added against a version's or alias's ARN live
on that qualifier's policy. The CloudControl list handler only returns
the unqualified policy's statements, so a permission granted against a
qualified ARN, the shape API Gateway and Lambda@Edge wiring uses, was
invisible to discovery. List now goes through a custom provisioner that
walks every policy scope via the Lambda control plane (GetPolicy on the
function, each published version, and each alias) and emits the same
statement-ARN|Sid composite id the CloudControl CRUD path produces. The
client carries the discovery-grade retry budget registry dispatch
bypasses.
@JeroenSoeters

Copy link
Copy Markdown
Contributor Author

Conformance evidence: lambda-version-ref and lambda-permission, CRUD and discovery suites, all phases passing. The version-ref discovery phase, structurally unable to pass before this change, completes in 2m12s with the qualified permission found; the unqualified case stays green.

@JeroenSoeters
JeroenSoeters merged commit cc7bf04 into main Aug 22, 2026
13 checks passed
@JeroenSoeters
JeroenSoeters deleted the jeroensoeters/lambda-permission-qualified-discovery branch August 22, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant