Commit Graph
1495 Commits
Author SHA1 Message Date
Priamo Germosen 94b09ff46b feat(iam): dispatch UpdateRoleDescription, the description half of UpdateRole (#6029)
UpdateRoleDescription answered UnsupportedOperation 400, where the reference
publishes it as a role operation of its own: "Use UpdateRole instead", and
"modifies only the description of a role. This operation performs the same
function as the Description parameter in the UpdateRole operation". So it is
that path rather than a second one. updateRole now answers the role it wrote,
updateRoleDescription is that call with the session duration left alone, and
the roleNameType check comes along rather than being restated. The handler
renders the Role the operation answers through the same roleXml fragment
GetRole and CreateRole use, detailed, there being no documented exclusion to
honour: the page's Response Elements section lists one Role object and says
only that it "contains details about the modified role".

Both members are required here, where UpdateRole's are optional, and that is
the one place this does not simply delegate. Description is read off the
request rather than through requireParam, which reads a blank value as an
absent member: roleDescriptionType carries a maximum of 1000 and no minimum, so
an empty description is a value that clears the description and only a missing
one is a refusal. It is rendered the way the handler renders every other
missing required member, "Value null at 'description' failed to satisfy
constraint: Member must not be null". RoleName is answered for by
validateRoleName, which reads a null as "Member must not be null" and a bad
shape before any lookup, as the other 21 roleNameType operations have since
#5391.

A service-linked role takes a description edit, through either action. The user
guide says so plainly, "You can edit the description of any role from the IAM
console, API, or CLI", its own procedure for editing one is update-role with
--description or the UpdateRoleDescription API, and it publishes a policy
granting iam:UpdateRoleDescription over arn:aws:iam::*:role/aws-service-role/*
for that. Both actions model UnmodifiableEntity, and a modelled error is not a
list of what triggers it: the guard now stands on MaxSessionDuration, the only
other member UpdateRole takes. So a description-only UpdateRole goes through
where it was refused before, a request carrying both is refused whole with
neither field written, and the other ten protected role actions are untouched.

Authorization needed nothing. AWS gives the action the role resource type in
the vendored authorization metadata, NAME_PARAMETERS already maps role to
RoleName, and ResourceArnBuilder mints the ARN from the stored role, so the
action is authorized against that role rather than against the wildcard. The
routing table has carried the name since routing became generated from the
model, so what changed there is only that it stops falling through to the
unsupported-action arm.

A role Description is held to the shape AWS publishes for it, and on every
action that takes one rather than only the new one: at most 1000 characters of
[\u0009\u000A\u000D -~¡-ÿ], which admits tab, newline and
carriage return and no other control character. CreateRole, UpdateRole,
UpdateRoleDescription and CreateServiceLinkedRole share one
validateRoleDescription, run before the role is looked up or created, so a
refused description never reaches a stored role.

That is more than strictness. XmlBuilder escapes the five XML entities and
passes everything else through, so a control character stored in a description
would make the Role these actions and GetRole answer unparsable, which
CreateRole could already produce before this. The rendering names neither the
offending value nor the set, following the one IAM constraint message a
recording covers, which also keeps the refused bytes out of the error body they
would otherwise break. Reverting the three call sites fails the maximum, the
control character and the sibling cases and nothing else.

Sixteen tests. Ten over the wire in IamRoleDescriptionIntegrationTest: the
description applied and answered, an empty description clearing it, the session
duration and the trust policy untouched, the maximum taken and one character
past it refused with the stored description intact, a control character refused
while tab and newline are taken, CreateRole and UpdateRole answering the same
way with nothing stored, an absent Description refused with the role left as it
was, an absent RoleName, a name outside the shape refused ahead of the lookup,
and an unknown role answering NoSuchEntity. Four on the service: the role that
comes back, the shape across the create and update paths, the name read before
the lookup, and a service-linked role taking the edit while refusing the
duration. Two in IamServiceLinkedRoleIntegrationTest: that allowance over the
wire, and CreateServiceLinkedRole answering ValidationError for a description
outside the shape rather than its own InvalidInput. The protected-actions test
pins UpdateRole on MaxSessionDuration, which is what AWS protects there.

Docs carry the table row, the three ways this differs from UpdateRole, the
description constraint and why it matters for the answer, the carve-out in the
service-linked section, and the matrix row at 176, which check_service_matrix
reads off the handler's own switch rather than taking the number on trust.
2026-10-20 17:17:59 -05:00
Priamo Germosen 77c5d74a7d fix(iam): check the EventBridge Scheduler and Pipes routes (#6044)
Under IAM enforcement no Scheduler or Pipes route was mapped to an IAM
action, so every call to either went unchecked, and the roles they take
with it.

- Every Scheduler and Pipes route is mapped, tagging at /tags as well as
  /tags/<arn>, and IamRestRouteCoverageTest now checks every operation
  of both models. Each request is checked against the resource the
  Service Reference gives: schedule/<group>/<name>, the group read where
  Scheduler reads it (the body's GroupName on a create or an update,
  groupName otherwise, else default), schedule-group/<name>,
  pipe/<name>, the ARN a tagging route names, and * where the request
  names none. Scheduler and Pipes ARNs are minted in the request's
  partition, as those services mint theirs.
- SchedulerController joins the Scheduler descriptor, so a schedule
  request is checked as Scheduler whatever scope signs it. Otherwise one
  signed for another service was checked by that service's rules.
- The shared tagging routes, /tags and /v1/tags, hand a request to the
  service its ARN names, so it is checked as that service, against the
  ARN the controller acts on: the body's resourceArn on POST /tags, the
  query's on the other bare routes. Otherwise a Pipes grant could tag a
  schedule group, a scope with no tagging rule went unchecked, and a
  query ARN could stand in for the body's.
- iam:PassRole: CreateSchedule and UpdateSchedule pass the target's
  RoleArn to scheduler.amazonaws.com, and CreatePipe and UpdatePipe
  their RoleArn to pipes.amazonaws.com, as the Scheduler user guide's
  example policies and the EventBridge user guide say.
2026-10-20 17:17:48 -05:00
Suja Shaj 50e515f17a fix(ec2): give RunInstances the private address it asks for (#6099)
RunInstances ignored the private address it was given, so every instance
got the subnet's next free address. It now reads PrivateIpAddress,
NetworkInterface.1.PrivateIpAddress (Terraform), the primary
NetworkInterface.1.PrivateIpAddresses entry (AWS CLI) and a launch
template's primary interface address. The address is validated (inside
the subnet, not reserved, not in use, including by another account's
instance, interface or NAT gateway on a shared default VPC network,
single instance with its own interface, no instance-level address with
network interfaces), leased on the VPC's Docker network, and assigned to
the instance and its primary interface. A CloudFormation
AWS::EC2::Instance now launches at its declared PrivateIpAddress too.

Closes #5830
2026-10-20 17:20:51 -04:00
Jackson Price 61a42591a9 fix(elbv2): answer a single-subnet ALB with ValidationError (#6098)
* test(elbv2): expect ValidationError for a single-subnet ALB

AWS answers a CreateLoadBalancer for an Application Load Balancer with
one subnet with ValidationError (400) "At least two subnets in two
different Availability Zones must be specified", the answer it gives
one with none, and it counts the subnets before it looks them up.
Floci answers InvalidConfigurationRequest with a message of its own.

- ElbV2ServiceTest, ElbV2IntegrationTest (Query protocol),
  CloudFormationElbV2SubnetMappingsIntegrationTest and the
  compatibility suite's ElbV2Test expect that error, and no balancer,
  for one subnet in Subnets or SubnetMappings, with or without Type,
  and for one subnet that does not exist. A Network or Gateway Load
  Balancer on one subnet is still created.
- The tests that sent an Application Load Balancer one missing subnet
  to get SubnetNotFound now send it an existing subnet as well, or ask
  for a Network Load Balancer, so they still reach the subnet lookup.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(elbv2): answer a single-subnet ALB with ValidationError

CreateLoadBalancer for an Application Load Balancer with one subnet
now answers ValidationError (400) "At least two subnets in two
different Availability Zones must be specified", as AWS does, instead
of InvalidConfigurationRequest with a message of Floci's own.
requireSubnets, which already refused a balancer with no subnets this
way, now refuses an Application Load Balancer with fewer than two. It
runs before any subnet is looked up, so one subnet that does not exist
gets the same answer, as on AWS. One SubnetMappings entry goes through
the same check, following the rule the API reference states for both
fields. CloudFormation creates and replacements go through it too.

A Network or Gateway Load Balancer on one subnet is still created.
SetSubnets with one subnet and two subnets in one Availability Zone
keep their InvalidConfigurationRequest answers.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(elbv2): cover a one-subnet ALB replacement

Review follow-ups:
- CloudFormationElbV2ReplacementIntegrationTest renames an Application
  Load Balancer onto one subnet: the update rolls back with
  CreateLoadBalancer's ValidationError, no balancer gets the new name,
  and the one it was to replace keeps both subnets.
- ElbV2CfnProvisioner's Javadoc no longer says a blank SubnetId is
  refused as an unknown subnet, since an Application Load Balancer
  with only that mapping now gets the subnet count error first.
- ElbV2ServiceTest says why its one-subnet test stubs a lookup that it
  then expects never to happen.
- Ec2DescribeSubnetsNotFoundTest says the missing subnet is sent
  alongside an existing one, rather than that its position matters.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(elbv2): give the one-subnet NLB and GWLB test its own order

Review follow-up: the test
createLoadBalancerOnOneSubnetIsAllowedForNetworkAndGatewayLoadBalancers
shared @Order(12) with
createLoadBalancerWithOneSubnetIsAValidationError, so JUnit ran the two
in no defined order. It now runs at @Order(78), after the other load
balancer subnet tests. Neither test depends on the other: each uses
its own load balancer names, and the network and gateway one deletes
the balancers it creates.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(elbv2): move the one-subnet NLB and GWLB test to order 79

The draft #6100 adds
setSubnetsWithNeitherSubnetsNorSubnetMappingsIsRefused at @Order(78)
in the same class, and the two branches merge without a conflict, so
whichever lands second would bring back a shared order. 79 is unused
on main and on both branches; no other order changes.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-20 17:19:07 -04:00
Niels Kootstra 73e890dbc7 fix(logs): require the policy type's read permission for DescribeAccountPolicies (#6097) 2026-10-20 17:15:13 -04:00
Alessandro Lattao 5fa67625c1 fix(cloudformation): refuse a template that holds a null value (#6071)
* fix(cloudformation): refuse a template that holds a null value

CloudFormation refuses a template with a null anywhere in it when
ValidateTemplate, CreateStack, UpdateStack or CreateChangeSet is
requested, before anything is created: 400 ValidationError
"[<path>] 'null' values are not allowed in templates". Floci accepted
such a template and provisioned it, so a template AWS rejects deployed
locally, and ValidateTemplate answered success without reading it.

The check runs where a change set is created, which CreateStack,
UpdateStack and CreateChangeSet share, and in ValidateTemplate. The
path is the one AWS names, measured on eu-west-1 on 2026-10-20: the
first null in document order, Type in place of a resource's Properties
below them, a null Properties named as is, list entries by index and
an intrinsic's arguments included. JSON null, YAML ~ and a YAML key
with no value are all null there.

A template that does not parse is left to the parser's error where it
is processed, as the other request-time checks do.

CognitoResourceServerCfnIntegrationTest's null Scopes cases sent such
a template and expected the resource to fail. They now expect the
request refused, as on AWS, and keep what they checked: no server is
created, and a refused update leaves the server as it was.

* fix(cloudformation): refuse null templates in stack sets and answer missing template objects

A review of the null-value check found four gaps, each measured on
CloudFormation (eu-west-1, 2026-10-20) before the fix.

- A template that is null as a whole ("null", "~", "---", a comment
  alone) parsed to no root
  and the check failed with a 500. AWS answers "Template format error:
  At least one Resources member must be defined.", which it does now.
- CreateStackSet and UpdateStackSet stored a null-valued template and
  only each instance's deployment refused it. AWS refuses the request
  and keeps the previous template, with CloudFormation's message
  followed by the service exception's details. Both now check the
  template they would keep before storing it or reserving an operation.
- ValidateTemplate reading TemplateURL reached the shared S3 fetch,
  whose failures were a 500, as they already were for CreateStack and
  GetTemplateSummary. A missing object or bucket now answers AWS's
  ValidationError texts for all three. AWS also refuses a URL that is
  not an S3 one; Floci keeps reading any host as S3, so a local URL can
  name Floci by whatever host reaches it.
- The compatibility test's cleanup swallowed every exception; DeleteStack
  of a stack that does not exist succeeds, so it no longer catches any.

CloudFormationS3VectorsTest and CloudFormationCognitoResourceServerTest
in sdk-test-java sent null values and expected them to reach the
resource. AWS refuses those templates when the operation is requested,
so the S3 Vectors cases that cannot be deployed there are dropped and
the Cognito update case now expects the request refused, with the
server left as it was.

* refactor(cloudformation): build the stack-set null refusal with sdkErrorMessage

A review pointed out that the suffix StackSets adds to CloudFormation's
message was built by hand while CloudFormationTemplateEngine.sdkErrorMessage
already builds it for this package, and that updateStackSet wrote the
template it would keep twice. The refusal now uses sdkErrorMessage, and
the kept template is one local both checks read; the answers are the
same.
2026-10-20 17:13:31 -04:00
Andre Kurait 2c6f2118e8 fix(stepfunctions): reject reserved API headers in definitions (#6082)
Reject the live-AWS-verified reserved names and hyphenated prefixes before state-machine creation or update, including JSONata and nested workflows. Share the existing exact-name policy with the invoker, preserve nearby accepted header names and keep the current response parser behavior.

Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-20 17:01:22 -04:00
Jimmy Liu Jia a578bb0811 fix(emr): release instance capacity when clusters terminate (#6095)
* fix(emr): release instance capacity when clusters terminate

I mark instance groups and fleets TERMINATED and clear their active capacity on automatic and manual cluster termination. I preserve requested and target capacity and cover both paths through HTTP regressions.

* fix(emr): retain terminated instances and reject capacity changes
2026-10-20 16:59:10 -04:00
Alessandro Lattao 95bf6df474 feat(dsql): add Aurora DSQL's control plane and AWS::DSQL::Cluster (#6048)
* feat(dsql): add Aurora DSQL's control plane and AWS::DSQL::Cluster

The first half of #6014. Aurora DSQL's REST JSON control plane, with
the answers measured on AWS (eu-west-1): CreateCluster, GetCluster,
ListClusters, UpdateCluster, DeleteCluster, GetVpcEndpointServiceName,
the cluster policy calls and tagging on cluster ARNs. Identifiers are 26
characters of lowercase base32 as DSQL's are, and malformed or unknown
ones are refused with DSQL's messages; a cluster created without
deletionProtectionEnabled is protected, and deleting a protected one is
refused. CreateCluster answers CREATING and the cluster is ACTIVE right
after.

AWS::DSQL::Cluster waits for ACTIVE, returns the identifier from Ref
and Identifier, ResourceArn, Status, CreationTime, Endpoint, VpcEndpoint
and VpcEndpointServiceName through Fn::GetAtt, and a protected cluster
makes the stack's deletion fail, as on AWS.

A cluster has no database behind it here: its endpoint is named as on
AWS, <id>.dsql.<region>.localhost.floci.io, but not served. Serving it
is the second half of #6014, its own pull request.

* fix(dsql): answer the control plane's edge cases as DSQL does

Review of #6048, each answer measured on DSQL (eu-west-1) first:
- ListClusters carries on from a page token whose cluster was deleted
  in between, as AWS does: the token now holds the sort position of the
  next page's first cluster rather than its identifier.
- deletionProtectionEnabled is read as DSQL reads it: text is false
  when it spells false in any case and true otherwise; empty text, a
  number, an object and a list fail with SerializationException.
- The tag calls refuse another account's cluster ARN with 403
  AccessDeniedException instead of reading it in the caller's account.
- A client token reused with other parameters answers 409
  ConflictException; with the same ones, the earlier cluster.
- AWS_OWNED_KMS_KEY names AWS's own key on create and update.

AWS::DSQL::Cluster reads DeletionProtectionEnabled and PolicyDocument
with AWS::NoValue as left out, and an update that drops the
multi-Region properties clears them, as it already reset the key and
deletion protection. ListTagsForResource copies the tags under the
cluster's lock, and a cluster's lock goes with the cluster.

* fix(dsql): answer errors, policies, updates and multi-Region clusters as DSQL does

A review asked for the attribute coverage, the reason ValidationException
carries, a real untag assertion and tests of the stack-update path.
Measuring them on DSQL (eu-west-1, 2026-10-20) found more that did not
match, fixed here too.

- Attributes are written with resource.getAttributes().put, which the
  schema coverage test reads; EncryptionDetails, an object an output
  refuses on AWS, is recorded as a gap.
- DSQL leaves reason out of its model-validation errors. Only the page
  token's refusal carries it, with fieldList naming next-token and its
  own text. maxResults no longer quotes the value.
- Tag calls answer what DSQL answers: 403 for an ARN that is not a
  cluster ARN, 400 BadRequestException for another Region's, 404
  NotFoundException for no cluster. The 403s name the caller.
- Policy versions are epoch milliseconds, DeleteClusterPolicy answers
  the deleted version, and the missing-policy and stale-version errors
  carry DSQL's texts and resourceType.
- Policies are checked and kept as DSQL does: its three refusal texts,
  a service principal, a principal that names no one, a public grant,
  and the lockout check when both policy actions are denied to the
  caller, unless bypassPolicyLockoutSafetyCheck. The kept form is
  Jackson's pretty printer in DSQL's element order, with condition
  operators and keys in HashMap order, as measured.
- The public check shares its condition keys with Lambda web functions
  through PublicAccessConditions, and S3 now takes its fixed-value and
  SourceIp range tests from there. Sharing the whole rule was tried and
  dropped: DSQL was measured to treat some operators otherwise than
  LambdaWeb's and S3's rules do (ForAnyValue:, ArnLike "*",
  StringEquals "*"), so the operator rules stay per service. The
  lockout check is IamPolicyEvaluator's.
- A multi-Region cluster is PENDING_SETUP and lists itself until it and
  each peer name one another, then ACTIVE; its deletion answers
  PENDING_DELETE.
- AWS::DSQL::Cluster reads its properties through CfnPropertyTypes, so
  a PolicyDocument object or DeletionProtectionEnabled "yes" fails as
  on AWS, where Boolean.valueOf made "yes" false. An update leaves a
  property the template no longer sets as it was, deletion protection,
  KMS key and multi-Region alike, and removes only the tags and the
  policy; an earlier change put them back to their defaults, which was
  not measured and is not what CloudFormation does. A policy the
  template does not change keeps its version, and create settles on
  PENDING_SETUP too.

DsqlServiceTest, DsqlClusterPoliciesTest and DsqlCfnProvisionerTest
cover these in isolation, the integration tests over the wire.

* fix(dsql): keep the public access rule to DSQL and forget a deleted policy's version

A review asked to leave S3 and Lambda web functions out of this change,
and pointed at DSQL's own block public access page. The shared helper
is dropped and S3 and Lambda web functions are as on main; folding
their copies into one helper belongs to a separate change.

DSQL now has its own keys: the trusted ones its page lists, and
aws:SourceIp, aws:SourceVpcArn and the three aws:Vpce* keys, which the
page leaves out but DSQL accepts (measured, eu-west-1, 2026-10-20). As
the page says, a policy variable never restricts: StringEquals with
${aws:PrincipalArn}, ${aws:SourceVpc} or a role/${aws:username} ARN is
public on DSQL. ArnEquals reads like ArnLike, as IAM matches both the
same way, so a value that is no ARN, ${aws:SourceArn} among them,
matches nothing and restricts, as measured.

DeleteClusterPolicy left the deleted version on the cluster, so a put
naming it went through; it is now cleared, and a put that names a
version on a cluster with no policy is refused as not found.
2026-10-20 15:34:39 -04:00
Jimmy Liu Jia 67e4bfec1c fix(emr): terminate transient clusters after steps (#6085)
* fix(emr): terminate transient clusters after steps

* fix(emr): I preserve terminal state on later requests
2026-10-20 13:21:02 -04:00
TATSUNO “Taz” Yasuhiro 5aaa37284c feat(lambdaweb): refuse a long request head as AWS does (#6083)
A head past 128 KiB gets the AWS edge page 431 Platform.HeaderTooLarge before every other check. A URI of 65,535 bytes or more gets an empty 414.

The HTTP server now reads heads up to 256 KiB so the data plane can answer them. Every other host keeps the Quarkus defaults of 4096 bytes for the request line and 20 KiB for the headers.
2026-10-20 13:12:33 -04:00
Jackson Price a434e52892 fix(elbv2): refuse CreateLoadBalancer with neither Subnets nor SubnetMappings (#6087)
* test(elbv2): give the tests' subnetless load balancers subnets

CreateLoadBalancer takes Subnets or SubnetMappings for every load
balancer type, and AWS refuses a request with neither. Tests that
created a balancer with neither, to exercise listeners, the data plane,
CodeDeploy, API Gateway or CloudFormation, now give it two default
subnets: the src/test classes through Ec2Service.defaultSubnetId, the
Java compatibility suite through a new TestFixtures.defaultVpcSubnets.

setSubnetsAfterSubnetlessCreateCanAdoptCustomVpc becomes
setSubnetsInAnotherVpcIsRefused, since a balancer created with subnets
keeps its VPC. The adoption it covered still applies to a balancer an
earlier version saved without subnets, and ElbV2ServiceTest now covers
that.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(elbv2): refuse CreateLoadBalancer with neither Subnets nor SubnetMappings

A CreateLoadBalancer that named neither Subnets nor SubnetMappings made
a load balancer with no Availability Zone and no VPC, where the API
reference says every type takes one or the other. It now answers
ValidationError and creates nothing, with the message AWS gives for the
type: "At least two subnets in two different Availability Zones must be
specified" for an Application Load Balancer, "At least one subnet must
be specified" for a Network or Gateway Load Balancer. A CloudFormation
load balancer with neither fails its stack the same way.

The check runs after the duplicate-name check, because a stack update
finds the balancer it keeps through DuplicateLoadBalancerName whatever
subnets its template names. A balancer an earlier version saved without
subnets still works, and its first SetSubnets still gives it a VPC.

Follow-up to the review of #5881.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* refactor(elbv2): take a request's Subnets or SubnetMappings from ElbV2Service

The rule that Subnets and SubnetMappings are alternatives, and its
ValidationError, was written out three times: in the Query handler's
CreateLoadBalancer and SetSubnets, and in the CloudFormation
provisioner. ElbV2Service.requestedSubnets now holds it, and all three
take the request's subnets from there. Valid requests resolve the same
subnets as before, and both together are still refused with the same
error.

A new test pins the SetSubnets path, which had none.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(elbv2): say when CloudFormation refuses a load balancer without subnets

The behaviour note said a CloudFormation load balancer with neither
Subnets nor SubnetMappings fails its stack the same way as the API
does. That holds when the stack creates or replaces the balancer. An
update that keeps the balancer finds it by its taken name before the
subnet check, so it leaves the balancer on its subnets, as before.
The note now says so.

The requireSubnets Javadoc no longer presents the Gateway Load
Balancer message as AWS's own. No public record of it was found; it
is the Network Load Balancer one, since a Gateway Load Balancer takes
subnets the same way.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(elbv2): give the remaining subnetless test requests subnets

Review follow-ups:
- The two duplicate-name tests, ElbV2IntegrationTest and the
  compatibility suite's ElbV2Test, sent a create with no subnets, so
  they passed only because the name is checked first. They now name
  subnets. The compatibility one also changes the scheme, because AWS
  answers a create that repeats a balancer's settings with success.
- ElbV2CfnProvisionerTest's successful creates and replacements now
  provision templates with two subnets and match them, rather than a
  subnetless create the real service refuses. The kept-balancer
  updates keep their subnetless templates.
- The CloudFormation case that leaves both properties out checks that
  its template really has no SubnetMappings, so a reformatted template
  cannot quietly turn it into the empty-list case.
- TestFixtures.defaultVpcSubnets() fails with a message when the
  region has no default VPC or fewer than two default subnets.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(elbv2): say which subnet messages are AWS's in the test docs

Second-round review follow-ups, wording only:
- The ELBv2 unit and Query-protocol tests of a create with neither
  Subnets nor SubnetMappings now say the messages are the ones AWS
  gives an Application or a Network Load Balancer, and that a Gateway
  Load Balancer gets the Network one, as the service's Javadoc does.
- The provisioner test's onTwoSubnets builds its list from TWO_SUBNETS,
  the list its stubs match, and its Javadoc no longer reads as two
  subnets for every type.
- TestFixtures.defaultVpcSubnets() says an Application Load Balancer
  needs two zones, not every load balancer.
- The ELBv2 docs say a CloudFormation update moves a balancer when it
  names other subnets, since one that names none leaves it in place.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-20 13:08:31 -04:00
Vũ Thế Huy 484255871e feat(firehose): accept a Redshift destination on create, update and describe (#6004)
* feat(firehose): accept a Redshift destination on create, update and describe

Adds RedshiftDestinationConfiguration to CreateDeliveryStream and RedshiftDestinationUpdate to UpdateDestination, validated against the Firehose API model. DescribeDeliveryStream returns RedshiftDestinationDescription without Password. A batch is staged in the intermediate S3 location like an S3 destination; the COPY delivery follows in a separate change.

* fix(firehose): close review gaps in the Redshift destination API

Require BucketARN and RoleARN on the intermediate and backup S3 configurations, validate the Secrets Manager RoleARN, apply the paired buffering-hints rule to the backup location, recognise dollar-quote tags with digits or non-ASCII letters in CopyOptions, and take the update lock in DeleteDeliveryStream so a concurrent update cannot revive a deleted stream. Rejected requests are now asserted to leave the stream unchanged.

* fix(firehose): refuse any dollar sign outside a quoted CopyOptions literal

A dollar-quote tag can hold any non-ASCII character, including code points outside the basic plane that a Java character-class range does not cover, so a tag pattern could hide a second statement. CopyOptions never need dollar quoting, so the separator check now refuses a dollar sign outside a quoted literal instead of parsing the tag.

* docs(firehose): list every refused CopyOptions token in the docs and validation message
2026-10-20 13:05:31 -04:00
Mohith 645c97c803 fix(cognito): return USER_ID_FOR_SRP in the SOFTWARE_TOKEN_MFA challenge (#6086)
* fix(cognito): return USER_ID_FOR_SRP in the SOFTWARE_TOKEN_MFA challenge

The SOFTWARE_TOKEN_MFA challenge carried the canonical username under
USERNAME. AWS returns it as USER_ID_FOR_SRP, the key clients read to
build USERNAME and SECRET_HASH for the challenge response, so they could
not answer the challenge.

The challenge now carries USER_ID_FOR_SRP (the sub in a pool with
UsernameAttributes) and FRIENDLY_DEVICE_NAME when one was set, matching
the InitiateAuth API reference example. VerifySoftwareToken keeps the
FriendlyDeviceName on the user and replaces it with each newly verified
authenticator. Every flow that ends in SOFTWARE_TOKEN_MFA shares the
same builder, so password, admin password, SRP, USER_AUTH,
NEW_PASSWORD_REQUIRED and SELECT_MFA_TYPE all get the new parameters.
MFA_SETUP is unchanged.

Fixes #6074

* fix(cognito): reject an over-long FriendlyDeviceName in VerifySoftwareToken

VerifySoftwareToken stored a FriendlyDeviceName of any length and later
returned it in the SOFTWARE_TOKEN_MFA challenge. The service model caps
the member at 131072 characters, and AWS rejects a longer value during
request validation, before the code is checked.

A longer name now fails with InvalidParameterException and the Smithy
length-constraint message, before any session, token or code is looked
at, so the user's authenticator, pending association and remaining
attempts are left as they were. The length counts Unicode code points,
as Smithy's length trait does, so a name of supplementary characters
such as emoji is measured in characters rather than UTF-16 units. An
absent or empty name is unchanged.
2026-10-20 13:02:17 -04:00
Aniket Shukla 17f32c9d04 fix(ecs): retry FireLens configuration uploads (#6075)
* fix(ecs): retry FireLens configuration archive uploads

* test(ecs): cover FireLens upload failure boundaries

* perf(ecs): avoid streaming pipes for prebuilt FireLens archives

Reuse byte-backed archive retries without the 16 MiB pipe and writer thread per attempt. Preserve exact archive bytes and the shared retry policy. Warmed launch measurements dropped from 17.3 MB to 0.5-0.6 MB on the caller thread, with zero new writer threads. Add regression coverage for allocation path, consumed streams and failure boundaries.

* test(ecs): make FireLens retry regressions sleep-free

Add a package-private task-launch overload for the FireLens upload delay. The public entry point retains six attempts and the shared 500 ms initial backoff. Preserve real replay and cleanup assertions, and verify default, zero and nonzero delay selection. The expanded 32-case class runs in 0.54-0.68 seconds instead of 22.19 seconds.
2026-10-20 12:12:47 -04:00
Jackson Price d09b3215d5 fix(cloudformation): carry EC2 MetadataOptions from templates and instances (#6050)
* fix(cloudformation): carry EC2 MetadataOptions from templates and instances

AWS::EC2::LaunchTemplate dropped LaunchTemplateData.MetadataOptions,
and AWS::EC2::Instance read only the image, type and key from its
launch template and ignored its own MetadataOptions. A CDK instance with
requireImdsv2 therefore launched with HttpTokens=optional, and
DescribeInstances reported that whatever the template declared.

The template now stores the block, the instance launches with its own
options over its template's, and an update that changes them applies
them in place with ModifyInstanceMetadataOptions, as the property's
"No interruption" update behavior allows. A hop limit that is not an
integer fails the resource.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): check MetadataOptions first and reset dropped ones

An update that keeps an AWS::EC2::Instance applied its MetadataOptions
last, after resizing it and rewriting its security groups, user data
and profile, so a bad value failed the update with the instance half
changed while the stack reported a rollback. The options are now
checked with EC2's own rules before anything changes, which needs
Ec2Service.validateMetadataOptions to be public.

An update that stopped declaring an option, its own or through its
launch template (CDK's requireImdsv2 turned off), left the instance
with it. The provisioner now records what it declared and returns an
option it no longer declares to the launch default, as it already does
for an instance profile it stops declaring.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): replace an instance whose launch template changes

LaunchTemplate is a replacement property of AWS::EC2::Instance, and
Floci's change-set preview already says so, but an update kept the
instance whatever happened to it: removing the template (CDK's
requireImdsv2 turned off) reset the instance's options in place where
AWS launches a new instance. The provisioner now records which template
it declared and replaces the instance when the update names another
one, adds one or drops it. A new version of the same template is still
applied in place, because Floci's AWS::EC2::LaunchTemplate publishes a
version on every stack update.

The record of declared MetadataOptions now keeps only the member names,
which is all the reset needs, instead of a serialized model object.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): track template versions and roll records back

The previous commit left a new version of the same launch template in
place, on the grounds that the template's provisioner publishes a
version on every stack update. It publishes one only when the template
itself changes, so an instance naming Fn::GetAtt LatestVersionNumber
sees its LaunchTemplate change exactly when AWS replaces it. The
recorded spec now includes the version, and the change-set preview and
the update agree: another template or version, or none, replaces the
instance; one added to an instance launched without one keeps it, and
an instance launched without one now carries no record at all.

When a later resource failed a replacing update, the rollback restored
the prior instance but kept the attempt's __FlociDeclared records, so a
retry compared against the wrong declaration (a retried template drop
kept the instance requiring tokens). The records as they stood before
the replacement are saved and put back by rollbackUpdate, and cleared
when the update completes.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): keep an instance whose launch template changes

Replacing an instance on another launch template, version or none could
not be made to agree with the change-set preview: a Version given by
Fn::GetAtt LatestVersionNumber previews no replacement, and the template
publishes a new, identical version for a Metadata-only change. Keep the
instance in place, as upstream does, and reconcile what the template
declares; the docs state this as a deviation from AWS.

A rollback whose delete of the replacement throws has already named the
prior instance again, and a rollback that then skips the resource never
calls back, so put the prior instance's declared records back before
rethrowing. A saved copy that cannot be read now fails the rollback.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): keep a rollback's delete failure over a bad record

When the replacement's delete fails and the saved declarations cannot
be read, report the delete failure with the read failure suppressed,
rather than replacing it.

The docs and the provisioner comment said every launch template change
keeps the instance; an ImageId or KeyName the template supplies still
replaces it, and a change set still previews a literal LaunchTemplate
change as a replacement. Tests pin the replacement and a retried
rollback.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* chore(cloudformation): vendor EC2 instance and launch template property types

AWS::EC2::Instance and AWS::EC2::LaunchTemplate are to read their
MetadataOptions through CfnPropertyTypes, so the generator lists them
and checks the MetadataOptions members they rely on. Only their entries
are added to the vendored file: a fresh generation also carries new
AWS::ECS::TaskDefinition members AWS has published since, which belong
to their own sync.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): refuse EC2 MetadataOptions of the wrong type

AWS::EC2::Instance and AWS::EC2::LaunchTemplate read a MetadataOptions
member given as a list or an object, such as HttpTokens: [required], as
absent, so the instance launched with HttpTokens=optional; a block that
was not an object was dropped the same way. Read the block through
CfnPropertyTypes against the shape each resource schema declares, as
AWS::AutoScaling::LaunchConfiguration is: a block or member of the
wrong type now fails the resource with CloudFormation's template
validation error, and a hop limit that is not a whole number says what
it is ("found: Float") rather than a message Floci made up.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): let AWS::NoValue omit launch template metadata options

The launch template read its MetadataOptions from LaunchTemplateData
after resolving it, which turns AWS::NoValue into an empty string, so
since the previous commit a block or hop limit left out with Fn::If and
AWS::NoValue failed the template as the wrong type. Read the block as
the template writes it, with AWS::NoValue already left out, as the
instance does.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* refactor(cloudformation): drop the launch template's unreachable options fallback

When LaunchTemplateData is absent or an intrinsic call, its resolved
form has no MetadataOptions member either, so the fallback to it always
gave null. Say so and use null. A test row also covers a launch template
whose MetadataOptions is a string.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): put back metadata options a stack rollback undoes

An update that kept the instance and changed its MetadataOptions left
them changed when a later resource failed and the stack rolled back:
rollbackUpdate undid replacements only, so the instance kept options
the stack no longer declared, and the stack reported that the update
could not be rolled back.

The update now saves the options it replaces, with their region and the
instance's __FlociDeclared records, and changes them last, after the
tags, so nothing else in the step can fail after them. rollbackUpdate
puts both back. The rollback counts as done only when the update changed
nothing else on the instance; the instance type, groups, user data,
profile and tags still have no rollback, so the stack keeps saying so
for them, with the options put back all the same. Ec2Tags.reconcile now
reports whether it changed anything, so a tag change counts. A committed
or cleared update drops the saved copy.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): describe CloudFormation MetadataOptions and launch template updates

The EC2 notes now say that AWS::EC2::LaunchTemplate stores
MetadataOptions and AWS::EC2::Instance launches with its own over its
template's, what a wrong type and AWS::NoValue do, that an update
applies and resets options in place and a rollback puts them back, and
that a changed or dropped LaunchTemplate keeps the instance where AWS
replaces it, unless the ImageId or KeyName it supplies changed.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): pin the tag change and order in an options rollback

A tag change in the same in-place update makes a rollback put the
MetadataOptions back but report the update undone, and a tag failure
leaves the options unchanged, since they are the update's last change.
The validation comment now lists tags among what runs before them.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): roll back declaration-only updates and refuse blank options

An update that kept the instance saved a rollback record only when it
changed the instance's MetadataOptions. One that changed only what was
declared, such as declaring a default the instance already had, left
rollbackUpdate nothing to restore, so a later resource's failure ended
the stack with "Rollback is not implemented". Every update that keeps
the instance now saves its __FlociDeclared records, with the prior
options only when it changes them, and a rollback restores what was
saved and counts as done when nothing else on the instance changed.

A MetadataOptions member given as an empty or padded string read as
absent, so HttpTokens: "" launched with the default. The text is now
kept as written and EC2's checks refuse it, as EC2 does; AWS::NoValue
still leaves a member out.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* chore(cloudformation): sync the vendored property types with AWS

The vendored file lacked the AWS::ECS::TaskDefinition SharingStrategy
and NvidiaMpsAllocation members AWS has published since it was last
generated, so the drift check, which runs when a change touches the
file, failed. This is make cfn-property-types-sync, and the file now
matches AWS's schemas.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): cover tag-only and declaration-only rollbacks

A rolled-back update that changed only tags puts the declarations back
and reports that it could not undo the update, without touching the
options. A stack whose update only declares the default HttpTokens the
instance already has ends UPDATE_ROLLBACK_COMPLETE when a later
resource fails, and a string member left out with Fn::If and
AWS::NoValue keeps its default. The ec2 notes say that a blank member
is refused and that an update that changed no EC2 setting rolls back in
full, which covers any property Floci does not apply, not only
MetadataOptions. A stale test name and comment are corrected.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* revert(cloudformation): leave AWS's ECS schema change to its own sync

The drift check fails on main as well: AWS has added SharingStrategy and
NvidiaMpsAllocation to AWS::ECS::TaskDefinition since main vendored the
file, and a fresh generation from main's own tree shows the same three
ECS shapes. The AWS::EC2::Instance and AWS::EC2::LaunchTemplate entries
this PR vendors already match AWS. The resync is an unrelated change, so
the vendored file goes back to this PR's EC2-only addition; the check
stays red until main syncs.

This reverts commit 092eb432f.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): say a launch template stores a blank metadata option unchecked

The ec2 notes said a blank MetadataOptions member is refused, in a
sentence about both resources, but AWS::EC2::LaunchTemplate stores it
unchecked, as CreateLaunchTemplate does, and only the instances launched
from it fail. The declaration-only rollback test also says that its
stack status, not the options, is what it checks.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* chore(cloudformation): sync the vendored ECS task definition types with AWS

The vendored property types check has to pass before this change can
merge, and AWS::ECS::TaskDefinition's SharingStrategy and
NvidiaMpsAllocation members are the only drift left: the
AWS::EC2::Instance and AWS::EC2::LaunchTemplate types this change adds
already match AWS. This brings back the sync from 092eb432f, which
51dca7d0f had left out of this change.

This reverts commit 51dca7d0f.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-20 11:55:39 -04:00
Jimmy Liu Jia e14e5433ab fix(emr-serverless): isolate applications by request region (#6078) 2026-10-20 11:50:02 -04:00
jwoa95 d1a2708634 fix(cognito): keep the sign-in's auth_time across managed login sessions and refresh (#5157)
The tokens an authorization code redeems for were stamped with the time of
the redemption, so an authorize that a managed login session let skip the
form reported a fresh sign-in, and so did every refresh of those tokens.

The managed login session now records when the user signed in, the
authorization code carries that time (or the identity provider callback's
for federated sign-in), and the token endpoint mints with it. Refresh tokens
carry it too, so REFRESH_TOKEN_AUTH, GetTokensFromRefreshToken and the token
endpoint's refresh_token grant keep the original auth_time, as AWS
documents: "Refreshing a token doesn't reset the auth_time claim."

The sign-in time is a tagged auth_time= field after the family id, ahead of
the scope field. Refresh tokens minted before keep working and fall back to
the time they were issued.

A pre token generation trigger can no longer suppress or override auth_time,
which AWS lists among the claims a trigger cannot add, modify or suppress.
2026-10-20 11:48:02 -04:00
Allen Sanborn 0ebcf84653 fix(config): store PutConfigRule tags and drop them on DeleteConfigRule (#6080)
* fix(config): store PutConfigRule tags and drop them on DeleteConfigRule

PutConfigRule accepted a top-level Tags list but never stored it, so
ListTagsForResource on the new rule's ARN returned an empty list and a
tagged aws_config_config_rule drifted on every plan. DeleteConfigRule
also left any tags behind under the removed rule's ARN.

Tags are now applied when PutConfigRule creates the rule, and ignored
when it updates an existing one, as the PutConfigRule model documents
("Tags are added at creation and cannot be updated with this
operation"). The get-then-put now runs under the lock DeleteConfigRule
takes, and DeleteConfigRule removes the rule's tags inside that lock,
matching conformance packs and aggregation authorizations.

* fix(config): validate creation tags and write them before the rule

PutConfigRule and PutAggregationAuthorization now check their TagsList
against the config/2014-11-12 model (at most 50 tags, Key 1-128
characters, optional Value of at most 256) and reject with the modelled
InvalidParameterValueException before anything is stored. A tag with no
Value stays accepted, as the model makes Value optional.

PutConfigRule writes the creation tags before the rule. Tags are applied
only when the Put creates the rule, so a rule stored ahead of a failed
tag write could never get its tags back from a retry; now the failed
write leaves no rule and the retry creates both.
2026-10-20 11:43:26 -04:00
Andre Kurait a899318862 feat(stepfunctions): invoke regional API Gateway tasks with IAM (#6043)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-20 10:17:47 -04:00
David 1f96bf42f1 feat(ecr): registry policy, replication and scanning configuration (#5817)
* feat(ecr): registry policy, replication and scanning configuration

PutRegistryPolicy, GetRegistryPolicy, DeleteRegistryPolicy, PutReplicationConfiguration,
DescribeRegistry, PutRegistryScanningConfiguration and GetRegistryScanningConfiguration store
the registry's own settings per account and Region and return them as written. Floci does not
replicate or scan images or evaluate the policy, as with repository policies.

- The policy must be a JSON object; a missing one is RegistryPolicyNotFoundException.
- Replication destinations, filters and rule counts are checked against the service model, and
  an empty rules list clears the configuration.
- Scanning defaults to BASIC with no rules, and CONTINUOUS_SCAN is refused with BASIC.

Closes #5803

* fix(ecr): put the registry setting writes under one lock

PutRegistryPolicy, DeleteRegistryPolicy, PutReplicationConfiguration and
PutRegistryScanningConfiguration read the registry's one settings record, change a
field and write it back. Terraform applies the three resources in parallel, so two
writers could start from the same record and the later write dropped the other's
setting. The read, change and write now happen under a lock per account and Region.

* refactor(ecr): check registry setting requests against the vendored model

The Resource Groups request walker moves to core.common as RequestConstraintCheck, so
a service can check a JSON request against botocore's constraints: member types,
required members, lengths and counts, number ranges, patterns and enums, each
answered in the service's own words. Resource Groups keeps its BadRequestException
messages.

- tools/aws/request_shapes.py gains build_constraints, which
  regen_resource_groups_shapes.py now calls; its vendored file is unchanged.
- tools/aws/regen_ecr_shapes.py vendors ecr-request-shapes.json for the seven
  registry setting actions, and aws-data-sync and aws-data-check run it.
- EcrJsonHandler checks those requests first, answering InvalidParameterException in
  ECR's form. The hand-written checks the model states are gone; a policy that is
  not a JSON object and CONTINUOUS_SCAN with BASIC stay, as the model cannot say
  them.
2026-10-20 10:03:30 -04:00
David Phillips c4a2c0a4f6 docs(ec2): clarify opt-in vCPU quota checks (#6076) 2026-10-20 09:59:40 -04:00
Jackson Price 9f9c16a181 fix(ec2): honor IncludePublicKey when describing key pairs (#6055)
* fix(ec2): honor IncludePublicKey when describing key pairs

DescribeKeyPairs ignored IncludePublicKey. With IncludePublicKey=true each
key pair now carries its OpenSSH public key, with the key-pair name as the
comment in place of any comment an imported key had; omitted or false
leaves it out. Imported material that is not a whole OpenSSH key, such as
PEM or RFC 4716 text, a blob missing a field its type needs, a line that
names another type than its blob, or a key type other than RSA, ED25519,
ECDSA and their security-key forms, is kept as given and described without
a public key. SshPublicKeys.carriesAKey checks the fields each type needs.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): describe a key pair's key only when it is exactly one key

DescribeKeyPairs with IncludePublicKey=true still described a blob with
bytes after its key, which OpenSSH and Go's ssh package refuse, and the
first of several key lines, although an instance launched with the key
pair trusts every line. Both are now described without a public key. A
key pair stored before KeyName was required gets no comment instead of
"null". carriesAKey reads the RSA fields once through the reader.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): leave a key-pair name that cannot be a comment off the key

ImportKeyPair accepts a key-pair name with a line break, and as the comment
of the described key such a name split it into lines that authorized_keys
reads as further keys. A name holding a control character is now left
off. carriesAKey names each ECDSA curve's coordinate size and reads a
security key's application field directly, and its docs say it checks
the format only.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): name the key types and formats a described key pair needs

The Key Pairs section now names DER beside PEM and RFC 4716, and the two
security-key types OpenSSH has, instead of a security-key form for every
type. The SshPublicKeys class comment covers the whole-key check, and a
test comment no longer says a tab would split the described key.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): list the described key types by their wire names

The Key Pairs section lists the key types a key pair is described with by
their OpenSSH names, which reads one way only, and the SshPublicKeys
comments name the two security-key types instead of implying a
security-key form for every key type.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-20 09:54:54 -04:00
David Phillips 689201122f fix(ec2): add opt-in Standard On-Demand vCPU admission (#6058)
* feat(ec2): enforce Standard On-Demand vCPU limits

Keep EC2 launches and restarts within regional account limits.

* fix(ec2): preserve quota lifecycle and launch semantics

Keep Spot launches independent and pending restarts recoverable.
Report incomplete CloudFormation restoration accurately.

* fix(ec2): make vCPU admission opt-in and running-only
2026-10-20 08:38:21 -04:00
TATSUNO “Taz” Yasuhiro 8bff1ba0f3 feat(cloudfront): sign requests to a Lambda Web Function origin under OAC (#6037)
* feat(cloudfront): sign requests to a Lambda Web Function origin under OAC

CreateOriginAccessControl now takes always-amz-auth for the lambda origin
type and sigv4a for s3 and lambda, with the AWS validation messages.
Distributions check the origin access control of a Lambda origin as AWS
does, and refuse a Lambda@Edge origin trigger in front of an origin signed
with always-amz-auth or sigv4a.

Under always-amz-auth, CloudFront signs its requests to a Web Function
endpoint of this Floci for the distribution. An IamAuth endpoint lets them
through, or under IAM enforcement evaluates the function policy for
cloudfront.amazonaws.com with aws:SourceArn and aws:SourceAccount.

* fix(cloudfront): refuse unknown and in-use OAC changes as AWS does

A distribution naming an origin access control that does not exist is
InvalidOriginAccessControl. A control an origin uses can no longer change
its origin type, its signing protocol, or whether it is always-amz-auth,
which AWS answers with IllegalUpdate.

* fix(cloudfront): match a Lambda origin by the end of its hostname

CloudFront takes a Lambda origin only from a hostname under on.aws, and it matches the fixed labels case sensitively. Floci also takes one under its own host.

The CloudFront check and the caller check now share the endpoint condition keys. The docs say when CloudFront forwards the viewer Authorization.

* fix(cloudfront): read the Floci host for Lambda origins from the authority

URI.getHost is null for a host with an underscore, such as a Compose service name, which broke CloudFront at startup. The Web Function endpoints are named from the authority, so the match reads it the same way.
2026-10-20 08:26:11 -04:00
Aniket Shukla 1a598b7f0c fix(rds): retry grant and snapshot archive uploads (#6069)
* fix(rds): retry master grant archive uploads

* fix(rds): retry snapshot restore archive uploads
2026-10-20 08:25:52 -04:00
David Phillips 08d5a9c742 fix(rds): retain requested storage types (#6057)
* fix(rds): retain requested storage types

Keep database storage settings across updates, copies and restarts.

* fix(rds): retain Provisioned IOPS storage types
2026-10-20 08:22:19 -04:00
Jimmy Liu Jia ae53c4b352 fix(emr): preserve request-level step execution role (#6061)
* fix(emr): preserve request-level step execution role

* test(emr): keep integration test order unique

* fix(emr): align step roles with AWS response shapes
2026-10-20 08:15:09 -04:00
David c6551a47bc feat(ecr): PutImage and the layer API (#5784)
* feat(ecr): PutImage and the layer API

PutImage, BatchCheckLayerAvailability, GetDownloadUrlForLayer, InitiateLayerUpload,
UploadLayerPart and CompleteLayerUpload now go through the registry:2 container that
docker push already writes to, so an image written through the API is the image
docker pull and BatchGetImage return.

- PutImage writes the manifest under its tag, or under its digest. It answers
  ImageDigestDoesNotMatchException, ImageAlreadyExistsException,
  ImageTagAlreadyExistsException and LayersNotFoundException as the model lists them.
- Layer uploads map onto registry upload sessions, held in memory. Parts must follow
  each other, be at most 20 MiB, and all but the last at least 5 MiB.
- GetDownloadUrlForLayer returns the blob's address on Floci's registry endpoint.
- The immutable-tag guard moves into EcrService, so a docker push and a PutImage of
  one tag cannot both succeed.

Closes #5735

* fix(ecr): refuse mixed layer digests, keep push time on retag, expire idle uploads

CompleteLayerUpload refuses a second, different layer digest instead of
ignoring it. PutImage keeps an image's first push time when it retags it.
A layer upload idle for a day is refused even when no other upload opens,
and dropping one cancels its registry upload session.

* fix(ecr): check PutImage tags, require a manifest media type, share registry error handling

- PutImage checks imageTag against the OCI tag grammar and answers
  InvalidParameterException otherwise. The tag goes into the registry's manifest URL,
  so v1?x wrote v1 and a slash wrote into another repository.
- A manifest with no mediaType needs imageManifestMediaType, as on AWS, instead of
  Floci guessing one from the manifest's shape.
- PutImage and the layer API reach the registry through one helper, callRegistry,
  in place of five copies of the same failure handling.

* fix(ecr): answer ECR's own message for a tag outside its rule

PutImage refuses a tag outside ECR's rule, [a-zA-Z0-9-_.]+ up to 300 characters,
with ECR's message. A tag ECR takes but the backing registry cannot hold, one
starting with '.' or '-' or longer than 128 characters, is refused with a message
naming that limit, which docs/services/ecr.md now notes.
2026-10-20 07:29:43 -04:00
Aymen JAMAAOUI d0dac9814f fix(redshift): check the extra IAM actions GetClusterCredentials needs (#6067) 2026-10-20 07:29:25 -04:00
Aniket Shukla fa4bacd0d1 fix(timestream-influxdb): retry restore archive uploads (#6064)
Reopen each backup tar for transient Docker upload retries without wrapping or buffering it. Keep restore commands outside the retry boundary and preserve cleanup on failure.

Refs #5096.
2026-10-20 07:27:05 -04:00
TATSUNO “Taz” Yasuhiro 9b59b8997e feat(dynamodb): add on-demand backups (#6052)
* feat(dynamodb): add on-demand backups

Add CreateBackup, DescribeBackup, ListBackups, DeleteBackup and
RestoreTableFromBackup. A backup keeps a copy of the table settings and
items from the time of the call, and it outlives the table.

The restored table keeps the keys, indexes, billing mode, throughput and
encryption. It drops the stream, TTL, point-in-time recovery, tags,
deletion protection and table class, as on AWS. A GSI or LSI override
must match a source index by key schema and projection, and a vector
index override must match one by name. Error wording and check order
follow AWS.

A restore finishes before the response is sent. The response still says
CREATING with RestoreInProgress true, as on AWS.

Part of #4521.

* feat(dynamodb): check the throughput members of a restore override

* test(dynamodb): tolerate only missing resources in the backup test cleanup

* feat(dynamodb): follow the AWS rules for on-demand restore overrides
2026-10-20 07:18:23 -04:00
Aniket Shukla 35ddd5c59d fix(redshift): retry snapshot and catalog uploads (#6065)
Rebuild host-resource uploads and catalog tar streams for transient Docker I/O retries. Keep SQL outside the retry boundary and preserve snapshot failure and optional bootstrap behavior.

Refs #5096.
2026-10-20 07:14:28 -04:00
Jackson Price 9f99c7c2c2 fix(ec2): report image creation provenance and its three filters (#6059)
* fix(ec2): report image creation provenance and its three filters

DescribeImages never returned SourceImageId, SourceImageRegion or
SourceInstanceId, and the source-image-id, source-image-region and
source-instance-id filters matched every image.

- A CreateImage AMI reports the instance it captured, and the AMI that
  instance was launched from with its region.
- A CopyImage AMI reports the AMI it copied and its SourceRegion, and no
  instance.
- Both name the source by its AMI id, also when the request used a
  catalog alias, and keep naming it after the source is deregistered.
- Registered and catalog AMIs report none. The filters match only
  images that carry the field, so the image DescribeImages makes up for
  a CDK lookup or an unknown launchable id no longer passes them.

The fields are stored apart from the flattened ancestor Floci launches
from, so a copy of a copy names its immediate source and still boots
the right base image. Images saved before this change load without
provenance.

Split out of #5663 at review.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): accept a catalog alias in the source-image-id filter

An instance launched by a catalog alias such as ami-amazonlinux2 keeps
the alias as its ImageId, while the AMI captured from it records the
AMI id the alias names. Filtering on the instance's ImageId therefore
found nothing, where on AWS the two are always the same id.
source-image-id now matches the recorded id or any alias of it, as
image-id already does for catalog images.

Review follow-ups in the same area:
- a test pins the catalog branch of source-image-region, and the
  restart test names the flattened ancestor it expects;
- the detached-storage test double copies the provenance fields;
- the provenance test cleans up each resource independently, and the
  compatibility test deletes the copy's snapshot;
- the AMI docs list CopyImage and DeregisterImage and say the filter
  takes an alias.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(ec2): pin wildcard alias matching in source-image-id

The provenance test now checks that a wildcard on a catalog alias finds
a capture, as it does for image-id, and reads the source-image-region
result once. The DeregisterImage row in the AMI docs says a snapshot
another AMI still uses is kept even with DeleteAssociatedSnapshots.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-20 07:12:21 -04:00
Alessandro Lattaoandoutof-place 47f570a821 feat(cognito): hand email codes to the CustomEmailSender trigger (#6031)
* feat(cognito): hand email codes to the CustomEmailSender trigger

* test(cognito): decrypt CustomEmailSender codes with the AWS Encryption SDK

* docs(cognito): document the CustomEmailSender trigger

* fix(cognito): fail a CustomEmailSender delivery as Cognito does

Measured on Cognito (eu-west-1, 2026-10-16), with the events a real sender
received:
- CreateUserPool and UpdateUserPool refuse a custom sender trigger without
  a KMSKeyID ("KMSKeyId parameter is required when Custom SMS/Email Lambda
  trigger is used."), and CreateUserPool a key that does not exist
  ("Encountered error when CreateGrant was attempted on the input KMS key -
  Key '<id>' does not exist"), both InvalidParameterException.
- A disabled key fails the request with CodeDeliveryFailureException
  "Caller needs to enable the configured KMS Key", a key pending deletion
  with "Unable to encrypt CustomEmailSender/CustomSMSSender code using the
  configured KMS Key". The sign-up is kept, unlike a failed SES delivery,
  and InitiateAuth answers the same error rather than InternalErrorException.
- A function that is gone, or that Cognito may not invoke, answers
  UnexpectedLambdaException "CustomEmailSender invocation failed due to
  error AccessDeniedException."
- request.clientMetadata is null for every source, InitiateAuth's
  ClientMetadata included, so the parameter that carried it is gone.

The branch also follows main since it was written: CognitoService takes
enforceTokenValidityLimits, and signUp ValidationData and ClientMetadata.

* fix(cognito): withdraw a code the CustomEmailSender could not take

Review of #6031: when the handover failed, the code issued for it stayed
live in SignUp, ForgotPassword and both attribute flows, so asking for a
code again within 30 seconds answered LimitExceededException. Measured
on Cognito (eu-west-1): it hands out a code again at once, on a healthy
pool and once a key that could not encrypt is enabled again, for
ResendConfirmationCode and ForgotPassword alike.

sendThroughCustomEmailSender now withdraws the code before it fails, for
every flow, and the two catches that withdrew it by hand (resend and the
sign-in OTP) leave that to it.

* fix(cognito): hand the CustomEmailSender the request's ClientMetadata

Review of #6031: the developer guide lists ClientMetadata for the
sign-up, forgot-password and sign-in sources, and the branch passed null
for every one on the strength of InitiateAuth alone. Measured on Cognito
(eu-west-1): SignUp, ResendConfirmationCode, ForgotPassword,
GetUserAttributeVerificationCode and UpdateUserAttributes each hand the
function the request's ClientMetadata; only the sign-in code's event has
none, even when InitiateAuth sends one. A request without ClientMetadata
gives null, as measured before.

ResendConfirmationCode, ForgotPassword and the two attribute calls now
take the request's ClientMetadata through the service, with overloads
that keep their previous signatures. resolveTriggerArn's custom sender
branch gets its braces.

---------

Co-authored-by: outof-place <contact@outofplace.space>
2026-10-20 06:44:20 -04:00
Andre Kurait 0e6db1f2b3 fix(route53): serve stored public TXT and delegation records (#6034)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-20 00:05:29 -04:00
Andre Kurait be2cb677d0 feat(resourcegroups): support EC2 capacity reservation pools (#6011)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-20 00:04:50 -04:00
lex00 691499d335 feat(sqs): opt-in AWS QueueUrl form via endpoint strategy (#5517)
* feat(sqs): opt-in AWS QueueUrl form via endpoint strategy

FLOCI_SERVICES_SQS_ENDPOINT_STRATEGY=standard returns queue URLs in the AWS
form, https://sqs.<region>.<dnsSuffix>/<account>/<name>. The default, path,
keeps the current form. Every input form resolves under either setting.

* fix(sqs): endpoint strategy accepts path or standard

* refactor(sqs): queue URL forms are floci and aws, with shared round-trip tests

* test(sqs): strategy names in tests and config comments read floci and aws

* docs(sqs): list endpoint-strategy on the application.yml page

The yml block and the env var table both list the setting, and the base-url comment names the aws strategy.
2026-10-19 23:51:18 -04:00
Allen Sanborn 88b0522168 fix(config): answer ResourceNotFoundException for tags on a missing resource (#6047)
TagResource, UntagResource and ListTagsForResource were plain map
operations keyed by ARN. Tagging a deleted conformance pack's ARN
returned 200 and re-created an orphan tag entry, and listing it
returned an empty list. The Config model lists ResourceNotFoundException
for all three operations.

For the kinds Floci stores (config rules, conformance packs, aggregation
authorizations) the ARN must now match an existing resource in the
caller's account and request Region, so a deleted resource, or an ARN
from another account, Region or partition, is not found. The check and
the write run under the lock the resource's delete takes, so a delete
cannot land between them and leave tags for a resource that is gone.
ARNs of kinds Floci does not model are still accepted unchecked.
2026-10-19 23:42:17 -04:00
David Phillips 0da0c80824 feat(elbv2): terminate HTTPS with ACM and IAM certificates (#5959)
* feat(elbv2): serve HTTPS listeners with ACM and IAM certificates

Route HTTPS traffic with SNI and refresh certificates when they change.

* fix(elbv2): preserve attached ACM certificates

Refuse revocation while a listener uses the certificate and keep
certificate listings responsive when many listeners are configured.
2026-10-19 23:40:17 -04:00
Hector Ventura 73da37b90e fix(ec2): reject tag writes on missing, malformed or absent resources (#5996)
* fix(ec2): reject tag writes on missing, malformed or absent resources

CreateTags and DeleteTags stored tags for any id. Both now answer
MissingParameter when no resource is named and InvalidID for an id that is
not a known EC2 prefix followed by hex digits. CreateTags also checks each
resource exists in the request region and answers with that type's own
NotFound error, as moto does; a well-formed id of a type Floci does not
model is still tagged.

CreateTags enforces the documented limits: at most 50 user tags per
resource (aws: tags do not count) with TagLimitExceeded, and keys up to 128
and values up to 256 Unicode characters with InvalidParameterValue. Every
resource and limit is checked before any tag is written.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* fix(ec2): match tag targets in full and resolve them by their prefix

A tag target id is now matched in full with an 8 or 17 hex suffix, and an id Floci seeds without hex digits (a default VPC resource, a catalog AMI alias) passes only when the region holds it. The resource type comes from the matched prefix, so eni-attach-, vpce-svc- and the cidr-assoc ids reach the unmodelled arm, and an AMI is checked against the catalog and the region's registered images instead of DescribeImages, which answers an unknown id with a launchable fallback.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* fix(ec2): accept fleet and IPAM tag targets and check the tag limit under the write's locks

EC2 Fleet and Spot Fleet request ids are UUIDs and an IPAM pool allocation id has 33 hex digits, so a tag target id now takes 8 or more hex digits or a UUID, and the ipam, ipam-scope, ipam-pool and ipam-pool-alloc prefixes are known. The 50-tag check ran before the write took its resource locks, so concurrent CreateTags requests at 49 tags could all pass it; the check and the write now run holding every named resource's lock, taken in stripe order after the topology lock.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-19 23:39:29 -04:00
Jackson Price 7504d71e76 fix(ec2): require IMDSv2 tokens when HttpTokens is required (#5966)
* fix(ec2): probe IMDS proxy readiness with an IMDSv2 token

The proxy start script checked readiness with a tokenless read of the
instance ID. Once IMDS enforces HttpTokens=required, that read gets 401
and the proxy reports a failed start after twelve attempts. The probe
now fetches a 60-second token and reads with it; a refused or empty
token fails the attempt rather than falling back to a tokenless read.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): refuse tokenless metadata reads when HttpTokens is required

IMDS answered every request without a token through IMDSv1, whatever
the instance's HttpTokens said. On AWS, when token usage is required,
requests without a valid token get 401 Unauthorized. Floci now does the
same for every metadata endpoint, before it looks up the data, using
the options the instance was launched with or last modified to.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): clear application library paths in IMDS helper shells

docker exec gives the proxy's install and start shells the image's
environment. An application image that sets LD_LIBRARY_PATH, PYTHONPATH
or PYTHONHOME can then make the package manager, socat and curl load
its libraries or Python instead of the system's. Both shells now unset
those three first; only the helper shell changes, so the container's
configuration and the application's processes keep them.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): refuse metadata option changes on EKS cluster nodes

IMDS serves a cluster node from the instance its EKS cluster registered,
while EC2 hands out a copy of it. ModifyInstanceMetadataOptions changed
and stored that copy, so DescribeInstances reported HttpTokens=required
while the node's IMDS kept answering tokenless reads, and the stored
copy no longer counted as a cluster node. The action now answers
OperationNotPermitted for cluster nodes, as their stop, start, reboot
and terminate actions do.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): publish metadata option changes to the IMDS event loop

IMDS now reads an instance's metadata options on its Vert.x event loop,
while ModifyInstanceMetadataOptions replaces them from a request thread.
Without a happens-before edge the event loop could keep serving the old
options, or see the new object before its fields. The field is now
volatile, as the instance's state already is.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): keep the IMDS readiness probe off HTTP proxies

The probe's curl calls honored an image's http_proxy or ALL_PROXY, so a
proxy configured for the application received the link-local requests,
every attempt failed and the start reported a failure although socat
was running. Both calls now pass --noproxy '*'.

The helper-shell test support moves to a shared HelperShellFixture, and
a new test runs the real token probe inside the generated start script,
whose set -eu loop must retry after a refused token.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): clear application library paths in the sshd install probe

The sshd install probe runs dnf, yum or apt-get through docker exec with
the image's environment, the failure the IMDS helper shells now avoid:
with an application's PYTHONHOME or LD_LIBRARY_PATH, dnf could not
start, so sshd was never installed. The probe now unsets the same three
variables first, through the IMDS proxy's shared constant.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): keep refusing cluster nodes once EC2 has stored a copy

The cluster-node check counted an instance as a node only while EC2's
own store had no record of it, but ModifyInstanceAttribute, monitoring
and other actions store EC2's copy of a node. After one of them,
ModifyInstanceMetadataOptions was accepted without reaching the node's
IMDS, and TerminateInstances and StopInstances were no longer refused.
A node is now recognized by its cluster's provider alone.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): keep the pod identity relay probe off HTTP proxies

The EKS pod identity relay's readiness probe shares the IMDS proxy's
start script and environment, but its curl still honored the image's
http_proxy: a proxy that answered passed the probe whether or not socat
relayed, and an unreachable one failed the start. It now passes
--noproxy '*' like the IMDS probe, from a podIdentityProbeCommand the
test runs. The shared unset's Javadoc now names the shells that run it.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): refuse tokenless reads of every path when tokens are required

The HttpTokens=required check ran inside the handlers of the paths IMDS
serves, so a tokenless read of any other path, such as the
/latest/meta-data/ listing that IMDSv1 detection probes, answered 404
where AWS answers 401. The check now runs ahead of every GET route;
with a token, or on an instance that allows IMDSv1, such a path is
still 404.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): keep IMDS answers for methods it does not serve

The required-token check was registered as a GET route for every path,
and Vert.x answers 405 to any other method on a path some route matches,
so POST /latest/meta-data/ began to answer 405 instead of 404, and a
tokenless HEAD on a required-token instance got 405 instead of 401. The
check is now a route for every method that acts on GET and HEAD only.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(ec2): check that the pod identity probe reaches its relay

The probe treats any answer but 000 as ready, so the test passed even
when curl was missing and nothing reached the relay. It now counts the
relay's requests, and both stand-in servers start inside its try.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): say that IMDS refuses a tokenless HEAD but serves none

The required-token check's Javadoc called HEAD a read, but no IMDS route
serves HEAD, so one with a token still gets the router's 405.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): say what IMDS answers a HEAD that has a token

No route serves HEAD, so the router answers 405 on a path a GET route
serves and 404 elsewhere. A test pins both.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(ec2): check IMDS refuses tokenless reads on Fleet and Auto Scaling launches

Since #5964, Auto Scaling launches carry a launch template's
MetadataOptions and CreateFleet forwards them. The test of template
options on Fleet and Auto Scaling launches now also checks that IMDS
refuses the launched instance a tokenless read and serves it with a
token.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): say where HttpTokens comes from and what IMDS refuses

The IMDS notes said HttpTokens could be set "at launch". They now name
its sources: RunInstances, directly or through a launch template, EC2
Fleet and Auto Scaling launches, and ModifyInstanceMetadataOptions.
They say that a tokenless GET or HEAD is refused on every path, and
that EKS cluster nodes refuse the change, in the notes, the EKS
lifecycle-protection list and the action table. They also say that the
readiness probe bypasses the image's HTTP proxy, that the helper shells
keep an application's library search path and Python installation from
the system tools rather than promising more, and that the sshd install
shell clears them too.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-19 22:50:50 -04:00
Allen Sanborn 2f6f3a8f86 feat(route53resolver): add TagResource, UntagResource and ListTagsForResource (#6035)
* feat(route53resolver): add TagResource, UntagResource and ListTagsForResource

The Terraform provider lists tags after creating any aws_route53_resolver_*
resource, and Route 53 Resolver had no tagging operations, so the apply failed
right after the create succeeded.

Tags are kept per ARN in their own store, because none of the modelled
resource shapes carries a Tags member. Resolver endpoints, resolver rules and
custom firewall domain lists are taggable; tags passed to their Create calls
are stored, and validated before anything is allocated. Lookup resolves the id
in the caller's account and requires the stored ARN to match exactly, so an
ARN naming another account, region or partition is ResourceNotFoundException.
ListTagsForResource pages with MaxResults (1-100, default 100) and NextToken.

* fix(route53resolver): scope tagging lookups to the caller and type-check tag input

TagResource, UntagResource and ListTagsForResource now require the ARN to
name the caller's own partition, region and account before reading any
store, and fetch the resource with getForAccountMigratingLegacy, so an
unprefixed pre-multi-account entry is migrated only into the account its
stored ARN names. Before, a plain get() moved such an entry into whichever
account looked it up first, and that account could then tag it by naming
its original ARN.

Tag Key and Value, and each UntagResource TagKeys entry, must be JSON
strings (TagKey/TagValue are string shapes) instead of being coerced with
asText(). MaxResults must be an integral number before its 1-100 range is
checked, so 1.5 or true is InvalidParameterException rather than 1.

ListTagsForResource copies the stored tag node under the monitor that
TagResource and UntagResource mutate it under, so a concurrent tag change
can no longer break the iteration or show a half-applied page.

* fix(route53resolver): page tags through Pagination and cap tag lists at 200

ListTagsForResource now pages through the shared Pagination.paginate with
an opaque, namespaced cursor on the tag key instead of a raw offset, so a
forged or stale offset token is InvalidNextTokenException. MaxResults stays
type-checked against the JSON value (integer 1-100, InvalidParameterException).

TagResource Tags, UntagResource TagKeys and the Tags on CreateResolverEndpoint,
CreateResolverRule and CreateFirewallDomainList are capped at the modelled 200
entries per request (TagList/TagKeyList max 200). Over the cap is the
operation's parameter error: InvalidParameterException, or ValidationException
on CreateFirewallDomainList. No per-resource total is enforced; the model does
not state one.
2026-10-19 22:45:48 -04:00
Priamo Germosen 37717537a4 fix(iam): record a denied browser PostObject in CloudTrail (#6030)
Under IAM enforcement a denied S3 request is recorded in CloudTrail as
the operation that was refused, but a browser POST upload left no
record. Its credential is only in the form fields, so S3Controller
authorizes it through IamEnforcementFilter.authorizeAdditionalResource,
which threw AccessDenied without going through the denial emitter.

The POST path now calls a new authorizePostObject, which checks
s3:PutObject as before and, when IAM refuses it, records the denial as
PostObject before refusing. AWS's S3 developer guide lists PostObject
among the object-level API actions logged as CloudTrail events; the
current user guide's data events table no longer names it. The
emitter's recording half is split out so both paths share it, and a
record it cannot write is logged as a warning.

The denial is recorded in the Region the form's credential names, as a
presigned URL's is in the one its query credential names, so a trail
that logs only that Region gets it.
2026-10-19 21:32:47 -05:00
Priamo Germosen 24a960a599 fix(iam): check the API Gateway and Lambda routes the action map names, and test them (#6036)
Under IAM enforcement a REST request is checked as the action its route
maps to, and a route no rule maps is let through unchecked. On #5604 the
S3 and API Gateway entries of iam-authorized-actions.json were noted as
never read, since those requests are authorized by route, with a test
comparing them with the route table asked for. This adds that test,
against each operation's real route, and fixes what it found.

- IamRestRouteCoverageTest builds a request on each operation's route,
  as botocore's model gives it, and checks that the registry resolves
  every S3, API Gateway and Lambda entry of iam-authorized-actions.json
  to the action the entry names. The routes are vendored, one operation
  to a line, in src/test/resources/aws/rest-routes.json by the new
  tools/aws/regen_rest_routes.py, which make aws-data-sync and
  aws-data-check now run.
- API Gateway: only /account and /restapis were mapped, so API keys,
  usage plans, client certificates, base path mappings, domain names
  and all of the v2 API went unchecked. The management API is now
  checked as apigateway:<method> on any route, as AWS authorizes it,
  and RejectDomainNameAccessAssociation and PutRoutingRule as their own
  actions. The v2 operations AWS checks only as actions of their own
  names, routing rules and portals, are not served by Floci.
- Lambda: InvokeWithResponseStream went unchecked; it is now checked as
  lambda:InvokeFunction, against the qualified function as an invoke
  is. GetLayerVersionByArn is checked as lambda:GetLayerVersion. It
  shares its path with ListLayers, so a rule can now require a query
  parameter.
- S3: the two bucket metadata configuration entries are not applied.
  Floci serves no metadata configuration, and such a request falls
  through to ListObjects or DeleteBucket, so it stays checked as the
  operation that runs.
2026-10-19 21:32:37 -05:00
Alessandro Lattao e38ec02d44 fix(cloudformation): register an ECS task definition's containers with their LinuxParameters (#6027)
* fix(cloudformation): register an ECS task definition's containers with their LinuxParameters

An AWS::ECS::TaskDefinition dropped its containers' LinuxParameters, so
a container CloudFormation registered ran without the init process,
capabilities, devices, shared memory, swap or tmpfs mounts the template
asked for, and the Fargate rules on them never applied.

They are now read from the task definition as the ECS handler converts
it and kept where RegisterTaskDefinition keeps them, among the
container's unparsed members under linuxParameters, so
DescribeTaskDefinition returns them in the API's shape and the same
validation, normalisation and Fargate checks apply as for a definition
registered through the API. As CloudFormation's handler does
(measured), the devices and tmpfs lists are sent empty when the
template has none.

* test(compat): wait for the LinuxParameters stacks through TestFixtures

Review of #6027: the test's private waitForTerminal and waitForDeleted
repeated TestFixtures.awaitStackTerminal. It now waits through that, and
deletes its two stacks with a plain DeleteStack after the class, as
CloudFormationEcsTaskDefinitionModelTest does.

* test(compat): give the ECS CloudFormation stacks Floci's and AWS's own timeouts

Review of #6027: DEPLOY_TIMEOUT was 30 seconds against both targets.
These stacks finish in milliseconds on Floci, so it is now 10 seconds
there and 10 minutes on real AWS, as CloudFormationEventsRuleTargetTest
splits it. CloudFormationEcsTaskDefinitionModelTest, from #6018, had the
same single 60 seconds and splits the same way.
2026-10-19 22:32:16 -04:00
Andre Kurait 0517a7a936 fix(cloudformation): enforce SAM REST authorization defaults (#6021)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-19 21:32:03 -04:00
Jackson Price e520166170 fix(ec2): protect subnets and VPCs that load balancers use (#5663)
* fix(elbv2): protect subnets and VPCs that load balancers use

DeleteSubnet and DeleteVpc returned success while an Application or
Network Load Balancer still used the subnet, and DescribeLoadBalancers
went on listing a subnet that no longer existed. EC2 now asks each
VpcDependencyProvider, implemented by ELBv2, before deleting a subnet or
VPC, under the lock CreateLoadBalancer and SetSubnets hold while they
record their subnets, and refuses with DependencyViolation. Covered end to
end through CloudFormation, including updates, rollbacks and stack
deletes that move or delete load balancers, subnets and VPCs.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): record the subnets a load balancer is on

A load balancer's attributes named none of its subnets, so once a
template stopped naming it, the stack walks had nothing to order it by
and deleted it after them, which EC2 now refuses. The provisioner keeps
one hidden uses attribute per subnet, refreshed when an update moves the
balancer and when a rollback moves it back.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): delete removed resources dependents first

The update cleanup deleted removed and condition-disabled resources in
reverse map order, before the replacement cleanup. A subnet an earlier
update added sits after the load balancer it moved onto it, so removing
both deleted the subnet first, and a renamed balancer's old entity still
used a subnet the same update dropped. Both now end DELETE_FAILED, since
EC2 refuses to delete a subnet a load balancer uses.

The removed resources are now walked in dependency order, and a failed
delete is tried once more after the replacement cleanup before it is
reported.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): name every ELBv2 load balancer type as a subnet dependency

The DeleteSubnet and DeleteVpc rows named only Application and Network
Load Balancers, while the check counts every ELBv2 type. The SDK
lifecycle test now deletes its subnets and VPC even when an assertion
fails.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): pin the order of the removed-resource deletes

The removal test passed through the retry alone, so it now checks that
the load balancer is deleted before its subnet is tried, and that the
replaced balancer's old entity goes before the dropped subnet. The
provisioner attribute test reads only what Fn::GetAtt can see, with the
balancer on subnets.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-19 21:13:00 -04:00
David Phillips 0f4f59bbbb fix(elbv2): require an HTTPS default certificate (#5989)
* fix(elbv2): require an HTTPS default certificate

Refuse HTTPS listener changes until a default certificate is supplied.

* docs(elbv2): keep certificate checks documented correctly
2026-10-19 21:12:16 -04:00
TATSUNO “Taz” Yasuhiro 7fb649715c fix(cloudfront): serve a Lambda Web Function endpoint origin from Floci itself (#6022)
* fix(cloudfront): serve a Lambda Web Function endpoint origin from Floci itself

A custom origin whose domain is an endpoint this Floci minted now goes to
the listener the viewer reached, with the endpoint domain as Host. Before,
the endpoint host did not resolve, and loopback failed the private address
check.

As on AWS, a forwarded viewer Host is a 502, because the endpoint's
certificate does not name it.

* fix(cloudfront): fetch the endpoint origin over plain HTTP for TLS viewers

A viewer over TLS reached the HTTPS port, and Floci sent plain HTTP to it.
The request now goes to the plain HTTP port at the same address.

The endpoint domains are also indexed by the host a CloudFront origin
names, so a base URL host with upper case or a trailing dot still matches.
2026-10-19 21:06:57 -04:00