Repository navigation
Description
What
Every REST-JSON/REST-XML service reaches the request pipeline named after its
HTTP method rather than its API operation, so serviceToAction builds
lambda:POST instead of lambda:Invoke. With #411's evaluator now reachable
(#571), a policy that correctly grants the real action is denied.
Measured on 87a966f with a throwaway probe (ParseAWSRequest → req.Operation):
BARE lambda -> operation=POST BARE quicksight -> operation=POST
BARE apigateway -> operation=POST BARE ram -> operation=POST
BARE apigatewayv2 -> operation=POST BARE scheduler -> operation=POST
BARE appsync -> operation=POST BARE emrserverless -> operation=POST
BARE efs -> operation=POST BARE bedrock-runtime-> operation=POST
BARE route53 -> operation=POST BARE batch -> operation=POST
BARE sesv2 -> operation=POST BARE backup -> operation=PUT
BARE cloudfront -> operation=POST BARE msk -> operation=POST
BARE omics -> operation=POST
ok s3 -> operation=CreateBucket
17 of 18 REST services affected. S3 is the only one that resolves, because
#480 wired parseS3Operation into ParseAWSRequest for exactly this class of
bug — "every S3 request entered the pipeline named PUT/GET/POST/DELETE/HEAD".
That fix was made service-specific; the same defect remains in the other 17.
Why it matters now
Before #411 the evaluator was unreachable, so the wrong action string was
inert. It is no longer inert. A user with a correct policy is refused:
policy: Allow lambda:InvokeFunction, lambda:CreateFunction, apigateway:*, s3:*, sqs:*
lambda Invoke (wire name POST) -> DENIED: not authorized to perform: lambda:POST
apigateway CreateRestApi (POST) -> ALLOWED (only because the policy said apigateway:*)
s3 CreateBucket (resolved) -> ALLOWED
sqs ListQueues (resolved) -> ALLOWED
A wildcard masks it; a scoped policy — the thing #411 exists to let a consumer
test — gets a false AccessDeniedException. That inverts the release's claim:
instead of catching "policy too narrow", substrate would report a denial for a
policy that is correct.
Three further consequences, all pre-existing but now visible:
- Fault injection: exactly Fault injection: S3 rules can't name an operation, can't be bounded to N fires, and drop ErrorCode on the wire #480's complaint, unfixed for 17 services. A rule
namingInvokematches nothing; a rule namingPOSTtakes out every Lambda
call at once. - Recorded events carry
POSTas the operation, so an event log is not
greppable by operation and cost/consistency layers keyed on operation cannot
distinguish two calls to the same service. - CloudFormation's IaC path builds synthetic requests with HTTP-method
operations too (40 sites acrossemulator/cfn_*.go), so a stack's resource
calls hit the same wall.
The shape of the fix
Not new resolvers — 14 already exist and are already pure (method, path) → op:
parseAPIGatewayOperation, parseAppSyncOperation, parseBackupOperation,
parseBatchOperation, parseBedrockRuntimeOperation, parseCloudFrontOperation,
parseEFSOperation, parseEMRServerlessOperation, parseLambdaOperation,
parseKafkaOperation, parseOmicsOperation, parseQuickSightOperation,
parseRAMOperation, parseSchedulerOperation, plus parseAPIGatewayV2Operation,
parseRoute53Operation, parseSESv2Operation. Each plugin calls its own at the
top of HandleRequest — one step after authorization, fault injection, cost
and consistency have already read req.Operation.
So the work is to resolve the canonical name once, in ParseAWSRequest,
generalising what #480 did for S3 instead of repeating it 17 times: a
service → resolver table consulted only when req.Operation is still a bare
HTTP verb. That keeps the resolvers idempotent (parseS3Operation's existing
contract: "a resolved name is returned unchanged, so calling this twice on the
same request is safe"), so each plugin's own call becomes a no-op and no plugin
routing changes.
CFN's synthetic requests then need the same treatment, since they never pass
through ParseAWSRequest.
Acceptance criteria
- A representative request for each of the 17 services enters the pipeline
with its semantic operation name; a table-driven test asserts the name,
and fails onmain. - A scoped policy granting
lambda:InvokeFunctionallows an Invoke, and one
granting onlylambda:GetFunctiondenies it withlambda:InvokeFunction
named in the message. - Resolution is idempotent: every wired resolver returns an already-resolved
name unchanged, asserted directly. - A CloudFormation stack's resource calls are evaluated against real action
names, nots3:PUT. - No plugin's routing behaviour changes — the existing suite stays green
with no test edits. - A fault rule naming a semantic operation matches for a non-S3 REST service
(closes the Fault injection: S3 rules can't name an operation, can't be bounded to N fires, and drop ErrorCode on the wire #480 gap for the other 17).
Provenance
The operation names and affected-service list are observed, measured with
throwaway probes against 87a966f, not read off a reference. The false-denial
transcript above is likewise measured. Related: #480 (the S3-only precedent),
#411/#571 (what made this reachable).
Activity
feat(cloudformation): authorize a stack's resource calls and model it…