Commit Graph
2834 Commits
Author SHA1 Message Date
lex00 991bf3ab9e fix(autoscaling): round-trip InstanceMaintenancePolicy, AvailabilityZoneDistribution, CapacityReservationSpecification, ServiceLinkedRoleARN, WeightedCapacity and EnabledMetrics (#5513)
* fix(autoscaling): round-trip InstanceMaintenancePolicy, AvailabilityZoneDistribution, CapacityReservationSpecification, ServiceLinkedRoleARN, WeightedCapacity and EnabledMetrics

DescribeAutoScalingGroups dropped several members of the AutoScalingGroup shape
that CreateAutoScalingGroup and UpdateAutoScalingGroup accept, so a client that
set them read them back as absent and saw a permanent diff.

- AsgOptionalFields gains ServiceLinkedRoleARN, InstanceMaintenancePolicy,
  AvailabilityZoneDistribution and CapacityReservationSpecification with its
  CapacityReservationTarget. The four-argument constructor stays, so existing
  call sites are unchanged.
- MixedInstancesPolicy launch template overrides carry WeightedCapacity.
- EnableMetricsCollection and DisableMetricsCollection are implemented, and
  DescribeAutoScalingGroups reports EnabledMetrics.
- Validation follows the botocore model. MinHealthyPercentage 0 to 100 and
  MaxHealthyPercentage 100 to 200, both required, at most 100 apart, and -1
  on both clears the policy. CapacityDistributionStrategy and
  CapacityReservationPreference enums. No target with preference none.
  CapacityReservationIds 1 to 255 characters matching [A-Za-z0-9-_/] and
  resource group ARNs 1 to 1600. ServiceLinkedRoleARN 1 to 1600 characters.
  WeightedCapacity 1 to 999 in at most 32 characters, set on every override
  or none. Granularity required and 1Minute. Known metric names only.
- The AWS::AutoScaling::AutoScalingGroup provisioner passes the new properties
  and MetricsCollection through, and its update rollback snapshot restores
  them. It requires CapacityReservationPreference and each entry's
  Granularity as the resource schema does, and rejects an unknown metric
  before creating the group.
- The Java SDK compatibility suite gains a round-trip case that sets every
  new member, reads it back through DescribeAutoScalingGroups, then clears
  the maintenance policy and the enabled metrics.

* fix(autoscaling): route the metrics collection actions and close the review gaps

EnableMetricsCollection and DisableMetricsCollection now route to Auto
Scaling when a request carries no credential scope. Both hold the group
lock, so concurrent calls keep each other's changes and a call racing a
delete cannot write the group back.

A failed stack update now clears the service-linked role, AZ
distribution and capacity reservation when the group had none before.
A blank ServiceLinkedRoleARN or WeightedCapacity in a template reaches
the service's validation instead of reading as unset. The provisioner
reuses the service's granularity rule and message.
2026-10-12 16:26:44 -04:00
lex00 72a4cc5515 fix(iam): page ListRoles and ListPolicies through MaxItems and Marker (#5515)
Both actions returned every match in one response with IsTruncated false.
They now use the existing paginate helper, so an omitted MaxItems returns
100 items, a MaxItems outside 1 to 1000 is a ValidationError, and Marker
appears only on a truncated page. PathPrefix and Scope filter first.

Roles and customer managed policies are listed in name order so a marker
keeps pointing at the same place between calls.
2026-10-12 15:40:59 -04:00
Anders Wasen c5feab635a fix(cloudformation): honour the DescribeStackResources filters (#5455)
* fix(cloudformation): honour the DescribeStackResources filters

Closes #5451

DescribeStackResources read only StackName, so LogicalResourceId and
PhysicalResourceId were accepted and ignored and every call answered with the
whole stack. That is quiet rather than loud: a caller that filters and reads the
first member gets whichever resource the stack happens to list first, with
nothing in the response saying the filter was dropped. Serverless Framework
resolves an AppSync API id that way after a deploy, so it ended up asking
AppSync for an API whose id was a Lambda function name.

Both filters now apply. Naming a LogicalResourceId the stack does not have is a
ValidationError rather than an empty list, so the miss cannot be read as "the
stack has no resources". A PhysicalResourceId with no StackName resolves the
stack that owns the resource, which is the other form AWS accepts, and a call
with neither is the ValidationError AWS answers.

The response also stamps the resolved stack's own name on each member rather
than echoing what the caller passed, which was an ARN when the caller used one
and null for the PhysicalResourceId-only form.

* fix(cloudformation): correct the DescribeStackResources physical-id form

Review on #5455, all against the API reference.

A PhysicalResourceId names the stack rather than narrowing it: "the associated
resources of the stack that the resource belongs to are returned". It no longer
filters the result down to the one resource.

Specifying both StackName and PhysicalResourceId is a ValidationError, which the
reference states outright and this did not enforce.

stackContaining walked listStacks directly, which answers oldest first and keeps
deleted stacks for their retention window, so a resource whose stack had been
redeployed resolved to the stack that used to own it. Live stacks now come
first, newest first within each group.

An unmatched LogicalResourceId is an empty result rather than a ValidationError.
The reference calls it a filter on the result and documents no error for a miss;
DescribeStackResource, the singular action where the resource is required rather
than optional, is the one that raises. The error here was my inference, not an
observed AWS response.

* docs(cloudformation): correct the DescribeStackResources Javadoc and pin the redeploy test

Review on #5455.

The four-argument describeStackResources still documented an unmatched
LogicalResourceId as a ValidationError, which is what the previous commit
removed. It now says what the code does: a physical id answers with the whole
stack, a logical id is only a filter, and DescribeStackResource is the singular
action that raises for a miss.

aRedeployedPhysicalIdResolvesToTheLiveStackNotTheDeletedOne created the second
stack straight after DeleteStack, which answers before the deletion runs. The
old stack could still be DELETE_IN_PROGRESS, sorting it with the live stacks, so
the test could pass on creation time alone without ever reaching the deleted
branch it is named for. Awaiting the deletion makes it compare against a
DELETE_COMPLETE stack every time, and it still fails on a straight walk of
listStacks.
2026-10-12 15:28:40 -04:00
outofplaceandPriamo 5092713a6e feat(cognito): support passkeys (WebAuthn) registration and sign-in (#5102)
* feat(cognito): register passkeys and sign in with WEB_AUTHN

* test(cognito): cover passkeys with the Java SDK

* docs(cognito): document passkey registration and sign-in

* fix(cognito): check passkey counters under the user lock and tighten passkey origins

* fix(cognito): turn passkey MFA on per user and page passkeys with a cursor

* fix(cognito): verify passkeys without webauthn4j and gate passkey MFA on tier

Drops the webauthn4j dependency and its native-image entries. Cognito
recognizes only ES256 and RS256 passkeys and does not enforce
attestation, so jackson-dataformat-cbor decodes the attestation object,
the authenticator data and the COSE key, and java.security checks the
signature. The attestation statement is no longer verified.

The helpers the verifier needs live in core.common, and the existing
copies across main and test code now call them:
- PublicKeys builds a public key from its raw components, for the JWT
  verifiers of API Gateway and Verified Permissions, SshPublicKeys, and
  the CloudFront and SES curve lookups.
- Digests.sha256 and Digests.sha256Hex replace every one-shot SHA-256
  digest and the private hex helpers built on one, including the two
  public sha256Hex methods on SigV4RequestValidator; incremental and
  streaming digests keep MessageDigest.
- Base64Url.encode, for bytes or the UTF-8 bytes of a string, replaces
  every unpadded base64url encode and the private helpers wrapping it.
- DomainNames.isWithin replaces the same-domain-or-subdomain check in
  SES, ACM, Route 53, the embedded DNS server, the TLS certificate
  manager and the Cognito message dispatcher.
Every replacement produces the same bytes as the code it replaces.

Turning passkey MFA on now also needs a pool in the Essentials tier or
higher, and in an optional-MFA pool a user with software-token MFA keeps
WEB_AUTHN when passkey MFA is on, as the AWS MFA table describes.

---------

Co-authored-by: Priamo <pgermosen@gmail.com>
2026-10-12 15:27:36 -04:00
Bharat Kaurav 162ac6dea7 fix(ec2): reject VPC IPv4 prefixes outside /16 to /28 (#5495)
* fix(ec2): reject VPC IPv4 prefixes outside /16 to /28

CreateVpc and AssociateVpcCidrBlock took any IPv4 prefix, while the VPC
User Guide allows only /16 to /28 for VPC blocks and AWS answers anything
else with InvalidVpc.Range. The EKS test that needs a VPC block covering
both default service CIDRs now widens a valid VPC in the store instead.

* refactor(ec2): share one prefix check, seed /8 VPC in subnet tests
2026-10-12 15:15:09 -04:00
Andre Kurait 255ad96168 fix(dynamodb): validate legacy Expected operands without rejecting Value (#5508)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-12 15:08:18 -04:00
Aniket Shukla 4c7f1bb9e1 refactor(cognito): share ClientMetadata parsing (#5507) 2026-10-12 14:53:12 -04:00
Matheus Oliveira 9cd97f13f4 fix(ec2): honor ZoneName, ZoneId and filters in DescribeAvailabilityZones (#5475)
DescribeAvailabilityZones ignored the ZoneName, ZoneId and Filter
parameters and always returned every zone of the region. It now reads and
applies all three:

- ZoneName and ZoneId are mutually exclusive (InvalidParameterCombination).
- A name or id the region does not publish is refused with
  InvalidParameterValue rather than silently dropped, so a wrong id cannot
  pass as an empty result.
- Filters: zone-name, zone-id, zone-type, state, region-name, message,
  opt-in-status, group-name, group-long-name, parent-zone-id and
  parent-zone-name, with repeated same-name filters preserved for AND
  semantics.
- group-name and group-long-name are modelled from the region (its id and
  display name) so those filters match instead of being compared against
  zone-type, and opt-in-status is read from the zone.

CreateSubnet now refuses a zone name outside the published zones too, so a
subnet can always be paired with a zone DescribeAvailabilityZones lists. The
published zones stay a/b/c per region, matching the seeded default subnets
and the compatibility suite.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-10-12 14:40:08 -04:00
Vũ Thế Huy 86b32584f3 feat(cloudformation): provision ElastiCache users and user groups (#5422)
* feat(cloudformation): provision ElastiCache users and user groups

Add AWS::ElastiCache::User and AWS::ElastiCache::UserGroup provisioners with authentication mode handling, create-only UserName, membership deltas, engine changes and replacement on rename.

* fix(cloudformation): address review findings for ElastiCache users and user groups

- Require Engine property when provisioning AWS::ElastiCache::User

- Reject invalid and conflicting AuthenticationMode combinations

- Add setUserGroupMembers to atomically update group membership under lock

- Require UserIds property when provisioning AWS::ElastiCache::UserGroup

- Snapshot and restore User and UserGroup on stack update rollback

- Tighten replaced subnet group deletion assertion in integration test

* refactor(elasticache): share user authentication and user group update logic

Move the AuthenticationMode / Passwords / NoPasswordRequired decision into
UserAuthentication so the query handler and the CloudFormation provisioner
no longer duplicate it. Make modifyUserGroup and setUserGroupMembers share
one locked update path, and drop the concurrency test that passed without
the lock.
2026-10-12 14:28:27 -04:00
Jay 669548277f fix(cloudformation): apply an S3 bucket's NotificationConfiguration (#5493)
* fix(cloudformation): apply an S3 bucket's NotificationConfiguration

AWS::S3::Bucket dropped NotificationConfiguration silently, so a stack wiring a
bucket to a queue, topic or function reported CREATE_COMPLETE and never
delivered an event. The property now goes through the same service method as
PutBucketNotificationConfiguration, destination validation included.

An update that removes the property clears the bucket's configuration, and one
the stack never declared is left alone, as on AWS. ProvisionContext gains the
previous template's properties, evaluated under that deployment's conditions,
so a provisioner can tell the two apart.

* test(cloudformation): share the stack status wait as CfnStackWaits.awaitStatus

The notification integration test polled DescribeStacks with a private helper
that waits out the CREATE_FAILED or UPDATE_FAILED a stack shows on its way to a
rollback, which awaitTerminal returns on. It is now CfnStackWaits.awaitStatus,
so other suites can wait for a rollback the same way.
2026-10-12 14:22:51 -04:00
Samarth Tikotkar e3c2096aec fix(eventbridge): reject malformed Detail JSON for PutEvents (#5465)
* fix(eventbridge): reject malformed Detail JSON for PutEvents

* fix(eventbridge): PutEvent handles multiple JSONs in detail

* fix(eventbridge): PipesTargetInvoker throws exception for failed PutEvent result

* fix(eventbridge): add explicit types instead of var

* fix(eventbridge): throw invalid argument when Detail json is missing

* fix(eventbridge): add correct ErrorMessage when Detail is missing

* fix(eventbridge): add checks for required entires

* fix(eventbridge): add explicit types
2026-10-12 14:07:10 -04:00
TATSUNO “Taz” Yasuhiro c047da882e fix(dynamodb): use the current AWS wording for Scan validation errors (#5504) 2026-10-12 13:40:28 -04:00
david lee 3bdb07deac fix(bedrock-runtime): preserve images sent through the proxy (#4681)
* fix(bedrock-runtime): preserve inline images in proxy requests

* fix(bedrock-runtime): bound image validation allocations
2026-10-12 13:32:54 -04:00
danielxoi 2cade5cd21 fix(cloudformation): apply Tags, DNS attributes and InstanceTenancy on AWS::EC2::VPC (#5224)
* fix(cloudformation): apply Tags, DNS attributes and InstanceTenancy on AWS::EC2::VPC

Ec2VpcCfnProvisioner read only CidrBlock, so a VPC from a template had no tags
and DescribeVpcs with a tag:Name filter (CDK Vpc.from_lookup) never found it.
EnableDnsSupport, EnableDnsHostnames and InstanceTenancy were dropped as well.

Tags are now reconciled through Ec2Tags on create and on update (keys removed
from the template are deleted), the DNS attributes are applied with the AWS
defaults when omitted, and InstanceTenancy is passed to CreateVpc, with the
dedicated-to-default change applied in place through a new modifyVpcTenancy and
any other change treated as a replacement. CreateVpc on the EC2 Query API now
honours InstanceTenancy too so the two paths agree. Fn::GetAtt gains
CidrBlockAssociations, DefaultNetworkAcl and Ipv6CidrBlocks.

* fix(cloudformation): validate VPC tenancy and treat blank DNS properties as omitted

EnableDnsSupport/EnableDnsHostnames resolving blank (Fn::If with AWS::NoValue)
now take the AWS default instead of false. CreateVpc rejects an InstanceTenancy
outside default/dedicated/host with InvalidParameterValue, and ModifyVpcTenancy
requires the VPC to be dedicated, as on AWS; the provisioner replaces on any
other tenancy change. The integration test reads outputs with XmlPath, and the
query-handler test stub follows the new createVpc overload.

* style(cloudformation): no final on the VPC local; compare tag sets unordered in the test

* fix(ec2): CreateVpc accepts default or dedicated tenancy only

* fix(ec2): share the enumerated-parameter check for VPC tenancy and cover it on the Query API

requireMetadataOptionValue becomes requireParameterValue and requireVpcTenancy
uses it, so the InvalidParameterValue wording lives in one place. A Query API
test sends InstanceTenancy to CreateVpc and reads it back from DescribeVpcs,
the provisioner test no longer turns DNS hostnames on with DNS support off,
and the CreateVpc docs row names the accepted tenancies.

* fix(ec2): only an absent InstanceTenancy defaults; order the test static imports
2026-10-12 12:17:35 -04:00
Som Samantray 34c11b8981 fix(cognito): include domains in user pool responses (#5448)
* fix(cognito): include domains in user pool responses

* test(cognito): cover UpdateUserPool domain fields

* fix(cognito): scope user pool domain lookups by account

* fix(cognito): avoid stale domain responses after reset

* fix(cognito): drop redundant domain delete lock
2026-10-12 12:09:33 -04:00
Mario Toffia e8a300f4d5 fix(cloudformation): roll back a changed custom resource (#4941)
When a stack update sent a custom resource's handler an Update and the
update then failed, Floci never told the handler. If a later resource
failed, the rollback recorded "Rollback is not implemented for
Custom::..." and the stack ended UPDATE_ROLLBACK_FAILED with the
handler's change still applied. If the handler failed its own Update,
Floci put the previous resource back in silence. In both cases
CloudFormation sends the handler a second Update with the previous
properties so it can undo the change.

CustomResourceCfnProvisioner now snapshots the resource before an
Update reaches its handler: the prior physical id, the old and the
attempted properties, the region and the Data attributes, under the new
CUSTOM_RESOURCE_UPDATE_SNAPSHOT_ATTR. A stale snapshot from an earlier
update is dropped first, so an update that sends nothing needs no
rollback. The ServiceToken is checked as Lambda's Invoke checks it
before the snapshot is written, so an Update rejected before it reaches
any handler is restored as before and sends no rollback request. While
the snapshot is held, retainsFailedUpdateState answers
true, so an Update the handler failed keeps its copy for the rollback
walker instead of being restored over. Its rollbackUpdate spends the
snapshot:

- the physical id was kept: report UPDATE_IN_PROGRESS and send Update
  with the old properties as ResourceProperties and the attempted ones
  as OldResourceProperties, under the same physical id and stack id. On
  SUCCESS the Data attributes are replaced by the response's. A
  response naming another id is taken, and the id that was sent gets a
  best effort Delete with the attempted properties at once, since Floci
  has no rollback cleanup phase.
- the handler replaced the resource: send a best effort Delete for the
  new id with the attempted properties and point the resource back at
  the old id and attributes, with no Update. CloudFormation sends this
  Delete in its cleanup phase; Floci sends it during the rollback.

The old properties become the resource's own before the handler is
called, as on AWS, which treats the rollback target as the resource's
properties even when the handler fails it: a later DeleteStack sends
them in its Delete and the next update sends them as
OldResourceProperties. A FAILED answer throws with the handler's
Reason, so the resource is UPDATE_FAILED and the stack
UPDATE_ROLLBACK_FAILED, as on AWS, and the snapshot stays so a retry
sends the same Update again.
2026-10-12 11:34:24 -04:00
Alessandro Lattao 85e0061a6f feat(cloudformation): provision AWS::ApiGatewayV2::DomainName and ApiMapping (#5038)
* refactor(apigateway): move the v2 domain and API mapping rules into the service

CreateDomainName and CreateApiMapping on /v2/domainnames kept their rules in
ApiGatewayController: the one-configuration check, the refusal of inputs Floci
does not emulate, the flattening onto the shared custom-domain store, the API
and stage existence check, the mapping key conflict check, the API type the
mapping is routed as, and the mapping id. A CloudFormation provisioner cannot
reach a controller, so it would have had to copy them.

They now live in ApiGatewayService. createV2DomainName validates the body and
creates the domain; createApiMapping checks the API and stage, refuses a key
that is taken and routes the mapping as the API's protocol type; getApiMapping,
deleteApiMapping and apiMappingId follow. ApiGatewayService takes
ApiGatewayV2Service for the API and stage lookup, so the whole rule sits in one
place and a caller needs one service. Nothing on the v2 side depends on the v1
service, so this adds no cycle. Leaving the lookup in ApiGatewayV2Service was
tried first, but then every caller had to resolve the API before calling into
ApiGatewayService, and the rule was split across two classes again.

The code is moved, not rewritten: messages, error codes, the order of the
checks and the id scheme are unchanged, and the controller delegates.

* feat(cloudformation): provision AWS::ApiGatewayV2::DomainName and ApiMapping

Both types were left to the stub arm. A stack reported CREATE_COMPLETE, but no
domain or mapping existed, Fn::GetAtt on the domain resolved to literals such
as DomainResource.RegionalDomainName (so a Route 53 alias built from it pointed
nowhere), and with allow-stub-unsupported-resource-types off the stack rolled
back.

ApiGatewayV2DomainCfnProvisioner creates them through the v2 rules in
ApiGatewayService and injects only that service. Ref on a domain is its name
and Fn::GetAtt returns DomainNameArn, RegionalDomainName and
RegionalHostedZoneId as GetDomainName reports them. Ref on a mapping is its
ApiMappingId, which is also its only attribute.

Updates follow AWS. DomainName is the only createOnly property of either type,
and everything else changes in place: the domain's configuration is replaced as
a whole, as DomainNameConfigurations is on AWS, and a mapping's ApiId, Stage and
ApiMappingKey change without a new id. To keep the id across a key change, a
mapping now stores the apiMappingId it was given instead of deriving it from
its key on every read. A record persisted before is still read under the
derived id, and a new mapping gets the id it always had unless another mapping
holds it. Deriving the id and documenting the difference was the first version;
it was dropped because Ref changed where AWS keeps it, and the change set
already reported the key change as an update.

A replacement creates the new entity and leaves the displaced one to
ReplacementCleanup, so it is deleted in UPDATE_COMPLETE_CLEANUP_IN_PROGRESS,
kept under UpdateReplacePolicy: Retain, and put back when a later resource
fails the update. The first version deleted the old domain inside provision, as
the v1 provisioner does, and a failed rename then ended in
UPDATE_ROLLBACK_FAILED with the original domain and its mappings already gone.
A mapping moved to another domain gets an id the displaced mapping does not
hold, since two mappings under one physical id cannot be told apart, and the
domain of each displaced id is recorded beside the cleanup. An in-place update
snapshots what it changes, so a failed stack update restores it instead of
ending in UPDATE_ROLLBACK_FAILED.

CDK templates needed the v2 rules to match AWS in two more places.
apigateway.DomainName with a multi-level basePath maps a REST API through
AWS::ApiGatewayV2::ApiMapping, so a mapping now accepts a REST API stage. And
the restrictions AWS documents for API mappings are enforced, in the API and in
templates alike: no v2 call on an edge-optimized domain, with AWS's message;
TLS_1_2 for an HTTP API or a multi-level key, which also keeps such a domain on
TLS_1_2; no WebSocket API beside an HTTP or REST API; and AWS's key characters
and length.

The id-only delete accepts <ApiMappingId>|<DomainName>, the type's primary
identifier, which is how Cloud Control names a mapping; a bare id still answers
NotFoundException, so Cloud Control cannot report a delete that did not happen.
The integration test deploys two templates aws-cdk-lib 2.272.0 synthesized,
checked in with the app that produced them, and compat-cdk deploys the same
shapes.

* fix(apigateway): answer v2 domain and API mapping calls as API Gateway does

The review of this PR found four places where Floci answered differently
from API Gateway. Each was measured against API Gateway in eu-west-1 on
2026-10-04, with an imported certificate on a throwaway domain.

An HTTP API custom domain is regional. CreateDomainName and
UpdateDomainName with an endpoint type of PRIVATE, or one API Gateway does
not know, give a REGIONAL domain, where Floci refused the first and stored
the type on an update. EDGE is refused with "EDGE endpoint type is not
supported for APIGatewayV2 domainName", not the message for v2 calls on an
existing edge-optimized domain.

API mapping keys are checked as API Gateway checks them, with its messages:
a key does not end with '/', does not start with '/' or hold '//', holds
letters, digits and $-_.+!*'(), between its levels, and is at most 300
characters. No key, an empty one, or on a create one of whitespace only, is
the root; an update refuses whitespace only. Floci took "/" for the root and
had its own message for the characters, without the comma.

UpdateApiMapping and UpdateDomainName answer over the v2 HTTP API, not only
from CloudFormation. What an UpdateApiMapping leaves out keeps its value.

Cloud Control identifies an AWS::ApiGatewayV2::ApiMapping by the type's
primary identifier, <ApiMappingId>|<DomainName>, while CloudFormation's Ref
stays the bare id: CloudControlService derives the identifier from the
desired state, as it already names primary identifier fields by type, and
the provisioner deletes by it with the create-time attributes too.

* fix(apigateway): refuse a v2 update of an edge domain, and recover a compound identifier whole

The second review pass found three gaps in the previous commit.

UpdateDomainName through the v2 API converted a v1-created edge-optimized
domain to REGIONAL. The v2 API does not manage an edge-optimized domain, so
the update is refused with the message every other v2 call on one gets, and
the CloudFormation in-place update goes through the same check.

A v2 UpdateDomainName without a configuration returned the domain unchanged
without looking at the rest of the body, so a mutual TLS request was
silently dropped. ApiGatewayService.updateV2DomainName now refuses what
Floci does not emulate, and the edge-optimized domain, either way.

Cloud Control's recovery of a create that finished just before a restart
took the identifier after the last '|' of its key, which for an API
mapping's <ApiMappingId>|<DomainName> left only the domain. It now takes
everything after the key's third separator.

A later review pass found four more points.
UpdateApiMapping fills in what its body leaves out under the lock the update
takes, so two partial updates of one mapping cannot write back each other's
old values. A v2 domain's certificate is stored as the v1 API's regional
certificate, which is what a regional domain reports through both APIs; a
domain the v2 API wrote before still reports the one it holds until its
configuration is replaced. The domain ARN both APIs and both CloudFormation
provisioners build comes from ApiGatewayService.domainNameArn, the Cloud
Control test waits with the awaitSuccess helper main has since gained, and
requireMappingAllowed's javadoc is back on it.
2026-10-12 11:28:04 -04:00
Bharat Kaurav b1bb016b6e fix(ec2): reject subnet IPv4 prefixes outside /16 to /28 (#5439)
* fix(ec2): reject subnet IPv4 prefixes outside /16 to /28

* test(ec2): store the /30 endpoint subnet directly and quote the guide's subnet wording

CreateSubnet now refuses prefixes outside /16 to /28, so the interface
endpoint test seeds its /30 subnet through the subnet store, as the
stored-endpoint test does. Quote the VPC guide's subnet sentence rather
than its VPC block sentence.
2026-10-12 10:39:44 -04:00
Aniket Shukla 22c4c32e3a fix(apigatewayv2): include stage variables in Lambda events (#5416)
* fix(apigatewayv2): include stage variables in Lambda events

* fix(apigatewayv2): tolerate missing stages during variable lookup
2026-10-12 10:32:46 -04:00
David Wooldridge e61b66fb22 fix(rds): load the token role's ALTER ROLE defaults into IAM sessions (#5344)
* fix(rds): load the token role's ALTER ROLE defaults into IAM sessions

* fix(rds): open IAM sessions with the role's defaults as startup options so RESET keeps them
2026-10-12 10:28:06 -04:00
Kenshin Okinaka 1230aec424 fix(ses): check a v2 raw From header only in place of a missing sender (#5490)
* fix(ses): check a v2 raw From header only in place of a missing sender

A v2 SendEmail with Content.Raw reads the MIME From header only when
FromEmailAddress is omitted. AWS then answers "Invalid From address
provided." for an empty domain or a non-ASCII local part or domain, and
keeps "Missing final '@domain'" for a missing @. With FromEmailAddress
given, the header is not checked at all. v1 SendRawEmail is unchanged.

* fix(ses): skip the v2 raw From header length check when a sender is given

A v2 SendEmail with Content.Raw and FromEmailAddress ignores the From
header's 320-character limit as well as its syntax. The From-header
decision now uses the sender-omitted flag SendRawEmail already computes,
and the v2 wording keys on the kind of syntax violation, not its message.

* refactor(ses): read a raw send's sender presence from the request

SendEmailRequest gains hasSource(), alongside hasRecipients(), so
sendRawEmail and the raw From-header checks no longer pass a
sender-omitted flag around.

* fix(ses): report a v2 raw From header's missing @ after the destination check

AWS reports a missing @ in a v2 raw From header, read in place of
FromEmailAddress, only after the configuration set and the
missing-destination checks and before the length check, so a message
with no recipient anywhere gets "Missing required header 'To'." The
missing-destination check now precedes the length check on both APIs.

* refactor(ses): compare the missing @ by its message constant

The v2 raw From-header checks only need to tell a missing @ from the
other violations, which the message constant already does, so the
violation enum goes and violation() returns its messages directly again.

* fix(ses): resolve a raw sender's default configuration set before the destination check

A raw send whose sender comes from the MIME From header re-resolves the
identity's default configuration set; that check now runs before the
missing-destination check again, so a deleted default is still reported
instead of "Missing required header 'To'."

* test(ses): pin the unknown configuration set ahead of a raw send's missing destination

* test(ses): save the stale-default identity through the identity service
2026-10-12 08:56:12 -04:00
jwoa95andPriamo 58bad471f3 fix(s3): report EntityTooSmall for a presigned POST below the content-length-range minimum (#5154)
* fix(s3): report EntityTooSmall for a presigned POST below the content-length-range minimum

A browser POST whose body is shorter than the policy's content-length-range
minimum was refused with EntityTooLarge, "Your proposed upload exceeds the
maximum allowed size". Refuse it with EntityTooSmall, "Your proposed upload
is smaller than the minimum allowed object size", S3's documented error for
an upload below the minimum. A body above the maximum still gets
EntityTooLarge.

* fix(s3): match the real S3 wording for an undersized POST

* ci: retrigger

* fix(s3): name the proposed and allowed sizes on a presigned POST size error

S3 answers a presigned POST outside its content-length-range with the
proposed size and the bound it broke: ProposedSize and MinSizeAllowed on
EntityTooSmall, ProposedSize and MaxSizeAllowed on EntityTooLarge, as
LocalStack's AWS-validated test_post_object_policy_validation_size
capture records (tests/aws/services/s3/test_s3.snapshot.json, recorded
2026-02-21). Both errors now carry them, and the S3 error XML renders
MinSizeAllowed next to the two size fields it already did.

The too-large branch now uses the shared EntityTooLarge error from
#5469, whose message has no trailing full stop, as the same capture
shows; the POST path was the one place still sending "...allowed
size.". The too-small error is built next to it.

* fix(s3): fail a presigned POST policy whose content-length-range is not a number

A content-length-range bound that is a string but not a number, such as
["content-length-range", "test", "10"], was read as 0, so the upload was
accepted whenever its size fit the other bound. S3 fails the condition
instead: 403 AccessDenied, "Invalid according to Policy: Policy
Condition failed: ["content-length-range", "test", "10"]", while bounds
written as strings holding numbers, ["content-length-range", "5", "10"],
are accepted (LocalStack's AWS-validated
test_post_object_policy_validation_size capture, recorded 2026-02-21).

Both bounds are now read before any size is compared, and a bound that
is neither a number nor a string holding one fails the condition, quoted
back as JSON. A number too large for a long fails the same way, as the
same digits written as a string already did, instead of wrapping:
18446744073709551615 read as -1 and refused every upload as too large.
The policy-failure message is now built in one place for the eq,
starts-with and exact-match conditions too, their wording unchanged.

The size tests post through one helper instead of repeating the form.

---------

Co-authored-by: Priamo <pgermosen@gmail.com>
2026-10-12 08:48:32 -04:00
Som Samantray 77113c7f85 fix(apigateway): require API keys for imported methods (#5450)
* fix(apigateway): require API keys for imported methods

* test(apigateway): cover API-key PutRestApi imports

* fix(apigateway): honor OpenAPI security alternatives

Keep imported methods public when an empty security alternative exists, reject API-key versus authorizer alternatives that a single API Gateway method cannot express, and verify imported API-key enforcement through deployed calls.

* fix(apigateway): honor optional security alternatives

* fix(apigateway): restrict imported API key schemes
2026-10-12 08:13:44 -04:00
Aniket Shukla 4ff263271c fix(appconfig): accept names in management APIs (#5417)
* fix(appconfig): accept names in management APIs

* fix(appconfig): handle profile identifier collisions

* test(appconfig): clean up identifier precedence fixtures
2026-10-12 08:03:02 -04:00
David Phillips ea8da22226 fix(iam): match absent context keys with ForAllValues (#5482)
* fix(iam): match absent context keys with ForAllValues

* fix(iam): preserve condition guards for missing keys

* fix(iam): reject unsupported condition shortcuts

* docs(iam): clarify supported IfExists conditions

* fix(iam): enforce requested keys in set conditions

* docs(iam): clarify unresolved attribute conditions

* fix(iam): enforce requested S3 object tag keys

* fix(iam): scope object tag keys to the authorized action
2026-10-12 06:54:16 -04:00
TATSUNO “Taz” Yasuhiro 6e38c080fb fix(dynamodb): reject a too deep transact value before the transaction runs (#5483)
* fix(dynamodb): reject a too deep transact value before the transaction runs

* fix(dynamodb): report a too deep transact result on every member
2026-10-12 06:51:47 -04:00
Hector Ventura 1aabc8b4fe fix(ec2): give availability-zone ids AWS's shape, shared by EC2, flow logs and EFS (#5486)
* fix(efs): report the zone id EC2 reports for the same zone

EFS derived its own availability-zone id (use1-az1) by splitting the region
on hyphens, while EC2 publishes <region>-az<n> for subnets and zones, so a
mount target and its subnet disagreed. The abbreviation also only worked
for three-part regions: us-gov-west-1a and eusc-de-east-1a kept the whole
region. EFS now takes the id from the helper EC2 and VPC flow logs use.

Also drops an allowlist pattern for flow-log region abbreviations that
matches no source line since flow logs moved to the same helper.

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

* fix(ec2): give availability-zone ids AWS's shape, shared by EC2, flow logs and EFS

EC2 published <region>-az<n> as a zone id and EFS its own abbreviation, so
a mount target and its subnet disagreed and neither matched AWS in every
region. AvailabilityZoneIds in core.common now derives the id for all
three: AWS's short region prefix and -az<n> (use1-az1, apne1-az1,
usgw1-az1, cnn1-az1). The prefix rule is attested for the commercial, China
and GovCloud regions; AWS publishes no zone id for an ISO or EUSC region,
so those keep the whole region as the prefix instead of a guessed one.

Zone a is still az1, b az2, and so on: AWS maps names to ids per account,
which Floci does not model. CreateSubnet resolves AvailabilityZoneId in the
new shape and refuses the old one.

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

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-12 06:47:02 -04:00
Hector Ventura 78377921e3 fix(partition): accept EFS access points in ISO-E and ISO-F and list the execution's regions in Step Functions (#5485)
* fix(partition): accept EFS access points in ISO-E and ISO-F and list the execution's regions in Step Functions

Lambda validated a FileSystemConfigs ARN with a region pattern whose ISO
branch was -iso(b)?, so an access point in eu-isoe-west-1, us-isof-south-1
or us-isof-east-1 was refused. The branch is now -iso[a-z]?, as in the
Lambda model's FileSystemArn pattern.

The Step Functions aws-sdk:ec2:describeRegions integration listed the
regions of the deployment's partition. It now lists those of the partition
the state machine runs in, as a direct DescribeRegions call does.

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

* fix(stepfunctions): read the describeRegions partition from the state machine ARN and reuse the test helpers

The partition now comes from the state machine's ARN, so a state machine
in a region no partition publishes (floci.partitions.allow-unknown-regions)
lists the regions of the partition its ARN was minted in, not the
commercial ones. A published region resolves as before.

The new test built its own create, start and describe loop to send a
cn-north-1 Authorization header. The class's helpers take the header
instead, and a run that never finishes now fails through
waitForExecution's own message.

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

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-12 06:46:45 -04:00
Hector Ventura 32cb4b7b8b fix(lambda): quote the model's FunctionName pattern in the validation error (#5487)
The ValidationException for a bad function name quoted a region pattern
without the (eusc-)? and -iso([a-z]?) branches the Lambda model's
FunctionName pattern has. The text is only quoted, never enforced, so no
name is accepted or refused differently.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-12 06:45:50 -04:00
David Phillips 03a0dfefdd fix(rds): honor restore IAM flags and reject malformed booleans (#5473)
* fix(rds): reject malformed restore flags

* fix(rds): disable IAM authentication by default on restore

* fix(rds): honor IAM settings on instance snapshot restore
2026-10-11 23:25:34 -04:00
Aymen JAMAAOUI dd6bf4cfcb fix(docker): do not retry a call when the Docker socket does not exist (#5424)
* fix(docker): do not retry a call when the Docker socket does not exist

Without a mounted Docker socket, every Docker call failed with
"No such file or directory" and was retried six times, about 15
seconds. The ECS check for leftover containers runs at startup, so
Floci opened port 4566 only after all the retries.

A missing socket file does not come back on a retry, so DockerRetry no
longer treats this error as transient.

Closes #5342

* fix(docker): do not retry a call when access to the Docker socket is denied

When the Docker socket exists but Floci may not open it, every Docker
call failed with "Permission denied" and was retried six times, about
15 seconds. This also held each Docker call of the shutdown cleanup.

A retry cannot change the permissions of the process, so DockerRetry no
longer treats this error as transient, like a missing socket file.
2026-10-11 22:16:40 -05:00
Priamo Germosen 4e769484df feat(iam): generate and read the Organizations access report (#5467)
GenerateOrganizationsAccessReport and GetOrganizationsAccessReport answered
UnsupportedOperation, which is not a reply any SDK models. They are the Access
Advisor job shape over a different question, and everything the question needs
was already here: an Organizations tree with roots, OUs, accounts and SCPs, a
policy evaluator, and a job model whose report is fixed at generation time.

The report is the services the service control policies along an entity path
leave reachable. The path names the organization, its root, and the OUs or
account below it, and the SCPs attached to each of those are read from
Organizations and evaluated. Only SCP logic applies, which the reference is
explicit about: identity policies, resource policies, ACLs, permissions
boundaries and trust policies play no part in this data.

Attached SCPs are a union within one level and the levels are intersected, so a
service survives only where every level allows it. That cannot be answered a
namespace at a time, because a service is reachable only while some action in it
survives the whole chain: two levels allowing single disjoint actions,
s3:GetObject under s3:PutObject, leave no S3 action at all, and a Deny on the one
action a level allows leaves none either. What a namespace-wide reading got right
stays right. An SCP denying s3:DeleteBucket alone keeps S3 on the list, because
every other S3 action is still reachable, and a Deny carrying a Condition or
naming particular resources closes nothing: the region guardrail on * that most
organizations carry, and a deny scoped to one bucket, both leave the service
reachable by every request they do not cover, and reading them as total denials
would report an organization that reaches nothing.

This is still not the existing scpAllows asked once per namespace. That question
needs a concrete action, and a request action of s3:* would not match a statement
naming s3:GetObject, a pattern globbing against a request value and never the
other way round. The survivors are found by probing instead, with the actions the
policies themselves name and one stand-in action per wildcard, which decides the
patterns policies are written with exactly: a deny on s3:GetObject leaves the
service reachable where a deny on s3:Get* does not. A wildcard that is not a
trailing one is the limit of it, since the stand-in for s3:*Object misses the
s3:GetObject that s3:Get* would allow; such a pattern leaves the service on the
list rather than off it, which is the side the namespace reading was already on.

The management account is not limited by SCPs, so its report lists every service
and an OrganizationsPolicyId passed with it is ignored, both as documented.
Passing that ID otherwise narrows the report to the one SCP named, and it has to
name one: Organizations keeps tag, backup, chatbot and opt-out policies in the
same ID space, none of them carries statements, and evaluating one as a ceiling
would read as a level that constrains nothing and report every service there is.

The entity path has to be a path the organization actually has. The segments
below the root name a chain of parent and child, so the path is held to the one
Organizations reports for its last node rather than each segment being resolved
on its own. Resolving them one at a time accepts a path assembled from two
branches, or one that skips an OU, and reports the policies of a chain the
organization does not have; it also lets a path whose last segment is the
management account take the unlimited answer with an OU above it that does not
exist.

Floci records no service access, so every service in a report is one principals
are allowed but never reached. The reference's own example gives such a service
as a namespace and a zero count with no region, entity path or last-authenticated
time, so that is the shape here and NumberOfServicesNotAccessed equals
NumberOfServicesAccessible. ServiceName carries a display name Floci has no
mapping for, so the namespace stands in for it as it does on the last-accessed
reader. SortKey is validated against its four values: the namespace keys sort
the list and the time keys leave it in namespace order, since ordering on a
timestamp no entry carries would be ordering on nothing.

A caller who is not the management account gets AccessDenied 403. Neither
operation models a code for that, but a per-action error list is additive: the
reference's common error types "that this AWS service may return" apply to every
action and include the 403 permission denial, and the user guide names the code
for a denied IAM action outright in its AddRoleToInstanceProfile entry. That page
spells it AccessDeniedException where the user guide and the rest of this
service's surface spell it AccessDenied; the latter is used, so a caller sees one
spelling across IAM and STS.

Three things are inferences, and they are the same inference three times. The
docs say so. The generator models no error for an entity path that is well-formed
but resolves to nothing, nor for the prerequisite the reference states, that SCPs
be enabled for the organization root, nor for an OrganizationsPolicyId naming a
policy of some other type, so each produces a FAILED job carrying ErrorDetails:
InvalidEntityPath or the Organizations code for the entity in the first case,
PolicyTypeNotEnabled in the second, Organizations' InvalidInputException in the
third. That is read off the shape of the API rather than off a sentence: AWS
publishes both fields on this reader for failures the generator does not report
synchronously. The alternatives are worse. Letting Organizations' own error
escape unchanged puts another service's code on an IAM operation, a COMPLETED job
with an empty list cannot be told apart from an organization that reaches no
services, and ValidationError is for a shape violation, which a well-formed path,
a disabled policy type and an existing policy of the wrong type are not.

ReportGenerationLimitExceeded, the generator's only modeled error, reports
concurrent generations and stays unreachable: a job completes the moment it is
created, so two never overlap.

The generator also carries the access-report resource type, so it leaves
UNRESOLVED_TYPES and resolves from the request. The reference spells the type as
access-report/${EntityPath}, so the entity path goes into the ARN whole: its
slashes are the organization's tree, not an IAM path, which is why it does not
go through the minting the creates use.

Both actions join AwsQueryController.IAM_ACTIONS as well as the handler, without
which inferService would never route them. That list and the handler now hold
166 each, still exactly in step.

Validation runs before the lookup, as AWS rejects a request shape whether or not
the job exists: a SortKey outside the enum answers ValidationError even for a
job ID nothing holds, where validating it afterwards would answer NoSuchEntity.
A member the request carries is held to its shape whatever it carries, an empty
value included, since SortKey= and OrganizationsPolicyId= are a malformed enum
and a malformed id rather than a way of leaving an optional member out. The
entity path reports the constraint that failed rather than the regular
expression for every case, so a path over the maximum length reads as a length
violation, which is what every other validated IAM member does.

Only the one Organizations answer that means something about the caller becomes
AccessDenied. A read that fails for any other reason keeps its own error, rather
than reaching the caller as a permission problem they do not have.

Two things are shared rather than copied. The job registry both report
generators keep, an account-scoped store keyed by job ID that answers
NoSuchEntity for an ID it does not hold, moves into IamJobStore and
ServiceLastAccessedService reads it from there; the two had the same three
methods and the same message. The report's timestamps come from the injected
Clock, which IamService already takes, rather than from Instant.now(), so they
agree with every other time IAM decides. IamQueryHandlerTest builds the handler
itself rather than through injection, so it passes the new service along with
the dependencies it already does not use.

Fourteen unit tests cover the chain semantics, including the allow-list idiom of
allowing everything and denying all but one namespace, levels allowing disjoint
single actions, a deny on the only action allowed and on a pattern wider than it,
a conditional deny, a deny scoped to one bucket, a level with an unreadable
document, and a level with none. Twenty-one integration tests drive the pair over
an organization built through the Organizations API, on a management account of
their own so they never contend with the existing Organizations suites for one.
Two of them are the ones that hold the walk honest: the OU path, where the root
leaves S3 and DynamoDB and the OU leaves DynamoDB and IAM, so only a report
reading both levels answers DynamoDB alone, and the management account path,
which reports every service and ignores the policy ID passed with it even with a
ceiling attached to the root above it. With the tree read deliberately broken the
first SCP test returns all 456 namespaces instead of the one, and it is the only
test that notices. Two more tests mock the Organizations read, which is the one
failure a real organization cannot be made to produce.
2026-10-11 21:47:58 -05:00
Priamo Germosen 6d2aaba6a6 fix(s3): reject a PutObject or UploadPart over 5 GiB (#5469)
S3 takes at most 5 GB in one PutObject and 5 GiB in one part (User
Guide, "Uploading objects" and the multipart upload limits table), but
Floci only enforced that for UploadPartCopy. Since PutObject and
UploadPart stream to disk, the only cap was
FLOCI_PROTOCOLS_MAX_REQUEST_SIZE, so raising it past 5120 MB, as
docs/services/s3.md says to for 5 GiB uploads, let a single request
store any size up to the new limit.

A request that declares more than 5 GiB of data, in Content-Length or,
for an aws-chunked body, x-amz-decoded-content-length (its
Content-Length also counts the framing), now fails with EntityTooLarge
before any of its body is read. A body that declares no size, or less
than it sends, fails the same way once it passes 5 GiB: the stream that
digests a body on its way to disk counts it against the limit, while
memory mode already stops at about 2 GiB. PutObject's "5 GB" is taken
as 5 GiB, as CopyObject's is.

The error is now the one S3 sends, as S3's answer to an oversized
UploadPart logged in aws/aws-cli#5420 and an AWS-validated LocalStack
capture record it: the message "Your proposed upload exceeds the maximum
allowed size", not the error table's description, and the ProposedSize
and MaxSizeAllowed fields, ProposedSize left out when a body passes the
limit as it is read, since its whole size is then not known. It is built
in one place and shared with UploadPartCopy and the memory-mode cap,
which sent the table's wording and named neither size; the memory-mode
cap names the most memory mode can hold.

A client that sent Expect: 100-continue never sends a body it was not
told to continue with, so answering it before reading the body left the
connection waiting for that body and reading the client's next request
as it (#5291). Such an answer now says Connection: close and the
connection is closed after it, which covers this rejection as well as
NoSuchBucket or a failed precondition.

An aws-chunked body sent without a streaming x-amz-content-sha256 or an
x-amz-trailer is read whole to be decoded. That read now fails with
EntityTooLarge once it passes what one array holds, through the bounded
read memory mode uses, instead of running the heap out of memory.

Telling an aws-chunked body from its Content-Encoding is now one helper,
which the four places that repeated the check use too.
2026-10-11 21:47:48 -05:00
Priamo Germosen 233253334d fix(elbv2): reject a listener certificate the account does not have (#5474)
A listener stored whatever certificate ARN it was given. CreateListener,
ModifyListener and AddListenerCertificates each model CertificateNotFound,
and all three took an ARN naming nothing and answered 200, so a listener
could be left serving a certificate that was never uploaded. Only the other
direction worked: ELBv2 reports its references to IAM, so
DeleteServerCertificate already refused with DeleteConflict while a listener
held one.

The error is the one AWS publishes on those three operations and no others:
botocore gives CertificateNotFoundException the code CertificateNotFound,
400, senderFault, and the API reference lists it under
AddListenerCertificates, CreateListener and ModifyListener with one
sentence, "The specified certificate does not exist." That sentence is the
message rather than one naming the ARN, because it is the one the reference
publishes.

The check covers the listener types the member belongs to and no more. The
reference marks Certificates "[HTTPS and TLS listeners]" on CreateListener
and ModifyListener, and describes AddListenerCertificates as adding to the
list "for the specified HTTPS or TLS listener", so a certificate on a
listener of any other protocol is a configuration it does not describe. What
AWS answers there is not CertificateNotFound on any evidence to hand, so
such a request keeps the behaviour it had rather than being refused with a
code read off the wrong case. A test pins each side of that line. The line
follows the protocol the listener ends the call with, not the one it started
with: ModifyListener takes a protocol without taking certificates, so when
none arrive the certificates checked are the ones already on file. An HTTP
listener holding an ARN that resolves to nothing is left alone, and the
request that turns it into an HTTPS one, which is where those certificates
start being served, is refused.

A blank entry is refused the same way, rather than skipped. Certificates is
the list of certificates the listener serves, an empty value in it names one
no better than a value that is no ARN at all, and the Query parser turns an
empty CertificateArn parameter into exactly that entry, so skipping it
stored a certificate the listener cannot serve.

ELB Classic already answered this question in full, resolving an ARN to an
IAM server certificate or an ACM one and holding IAM's certificate lock
across the write. This is the second caller, so the three private methods it
kept, certificateExists, iamServerCertificate and acmCertificateExists, move
to CertificateReferenceResolver in core.common and Classic reads them from
there. Neither referrer owns the lookup: IAM holds server certificates, ACM
holds the rest, and a listener carries only the ARN. Classic's public
constructors are untouched, so its unit tests still build it the same way.

The check alone is not enough, which is why the lock moves with it. A
certificate can be deleted between the check and the write, and the delete
walks the reference providers under IAM's own lock, so every write that
records an IAM certificate runs inside that lock and re-checks there, while
the fail-fast check outside it keeps the error precedence. That covers
CreateListener as much as the two writes to a listener already published:
until the new listener is in the map, nothing the delete walks can see that
it holds the certificate. A race test drives each of them against
DeleteServerCertificate over the wire, and with the lock removed they leave
a listener holding a deleted certificate in 1 of 30 trials for
AddListenerCertificates and 4 of 30 for CreateListener, so the guarantee is
measured rather than asserted.

Where the check sits in ModifyListener is part of the fix. The listener it
modifies is the stored object, and the port, protocol and SSL policy were
set before anything could refuse the request, so a refusal answered 400 over
a listener already moved to the new port: no later read put it back, and the
data plane was never restarted to match. Every refusal now lands before the
first setter.

An absent resolver leaves the old behaviour in place. ElbV2Service is wired
by hand in its unit tests, with no IAM and no ACM, and a listener write
there is the write it was before any certificate existed to check. The
dependency is a field rather than a constructor parameter because that is
how this class takes all six of its others, and converting it would be a
refactor this change does not need.

docs/services/elb.md said listener certificate ARNs are not validated when
they are added, which was true and is the behaviour this removes, so it now
documents the three operations, the protocols they cover, the empty value,
the protocol change, the error and the lock, as the Classic page already
does.

Sixteen integration tests cover a missing IAM certificate, a missing ACM
one, a blank entry, a value that is no ARN at all and an ARN of a service
that serves no certificates, an uploaded certificate and an ACM certificate
being accepted, a listener carrying no certificate, a TLS listener held to
the same check as an HTTPS one and a listener of a protocol with no
certificates left alone, a protocol change refused over the certificate it
already held and allowed over one that exists, a second certificate being
added, a refused change leaving the port and protocol as they were, and the
two writes that must refuse without changing what the listener already
serves. Every certificate and load balancer they make is registered for
cleanup: the account's certificate quota is 20 and the Quarkus instance is
shared, so one left behind fails an unrelated class's upload instead of
anything here.

Three things the reference states about these operations stay open, each
wanting an error code no source here gives: CreateListener and
ModifyListener take "exactly one certificate" and AddListenerCertificates
"one certificate per call", where Floci accepts a list; TooManyCertificates
is modeled on all three and no quota is enforced; and
DescribeListenerCertificates is documented to report the default certificate
alongside the list, with IsDefault telling them apart, which Floci does not
model.

Driven through the standard hashicorp/aws provider against a local instance
as well, which is how the change was checked against a real client rather
than only against the suite: an aws_iam_server_certificate and an
aws_lb_listener serving it apply clean, and a listener naming a certificate
nobody uploaded fails with CertificateNotFound and the reference's sentence.
That failure arrives at the end of the provider's create timeout rather than
at once, because the provider retries this error on all three calls, the
AddListenerCertificates one against a constant named iamPropagationTimeout:
real AWS is eventually consistent about a certificate just imported, so a
client waits it out. Floci's storage is immediately consistent and nothing
here models a propagation delay, so the retry simply ends in the refusal.

The same contract is pinned at the SDK boundary too, as eight boto3 tests in
compatibility-tests: the refusal on each of the three operations, the
accepted cases, and both protocol edges. They run in under a second, where
driving the same thing through Terraform in CI costs about a minute for the
accepted case and nearly two for the refusal, almost all of it the
provider's waiter and the retry above rather than anything Floci does. The
suite had no ELB coverage at all before this. Each test takes its load
balancer back out before its certificates, which is the order that frees
them, and test_acm.py's private certificate builder moves to a conftest
fixture taking the common name rather than being copied, since the new file
needs the same pair.
2026-10-11 21:47:38 -05:00
Priamo Germosen 6d7d85f0f8 fix(lambda): enforce function policies on cross-account calls (#5476)
Under IAM enforcement, a caller whose own policy allowed lambda:InvokeFunction could invoke
another account's function by ARN even when that function's policy granted nothing, and
RotateSecret could be pointed at another account's function the same way. Three things combined:
there was no resource-policy provider for Lambda, so the call was judged as same-account; the
function name was cut at its first colon, so an ARN was evaluated as function:arn in the caller's
account, where no Allow or Deny written for the function could match; and the invoke followed the
account in the ARN.

- LambdaResourcePolicyProvider supplies a function's policy statements and the account its ARN
  names, also when the function has no policy, so a call to another account's function needs that
  function's policy to allow the caller as well as the caller's own policy. It is keyed on the
  ARN, so RotateSecret's check on its rotation function, made under the secretsmanager scope,
  sees it too.
- ResourceArnBuilder evaluates each call against the function it acts on. An invoke runs in the
  account and Region a full or partial ARN names, as the version or alias it names in the function
  name or in Qualifier, since Lambda authorizes a qualified call against the qualified ARN.
  GetFunction, GetFunctionConfiguration and ListDurableExecutionsByFunction read a qualified full
  ARN in the account it names, so they are evaluated there too, and a read of another account's
  function needs its policy as on AWS. Every other route acts on the caller's own function of that
  name, so it is evaluated against that function, unqualified because not all of their handlers
  act on the qualifier.
- An invoke by partial ARN runs in the account it names, as one by full ARN already did.
- RotateSecret looks its function up where the rotation runs it: in the ARN's account, and as the
  version or alias the ARN names.
2026-10-11 21:47:27 -05:00
TiM 23c6666a51 fix(s3): evaluate identity policies per key in DeleteObjects (#5471)
* fix(s3): evaluate identity policies per key in DeleteObjects

Under IAM enforcement a batch DeleteObjects now honours the caller's
identity policies for every key it names, so a user allowed to delete
under one prefix can no longer empty the rest of the bucket in one
request. As in S3, the request still answers 200 and each denied key
comes back as an AccessDenied error with the message "Access Denied",
while the allowed keys are deleted.

IamEnforcementFilter cannot do this on its own: S3 has no
s3:DeleteObjects action, the keys arrive only in the request body, and
the outcome is per key rather than per request. S3Controller therefore
authorizes each entry through authorizeAdditionalResource before the
existing bucket-policy checks, the way CopyObject authorizes its source:
s3:DeleteObject, or s3:DeleteObjectVersion for an entry naming a
version, plus s3:GetObject for an ETag-conditioned entry, matching the
single-key conditional delete. The credential comes from the header or
the presigned query string, and no resource-policy decision is passed,
so the bucket policy is resolved with the same global condition keys
the filter uses for a single-key delete.

authorizeAdditionalResource now canonicalises the credential scope as
filter() does, so an s3express-signed request finds the S3 bucket
policy instead of none.

* fix(s3): close the remaining DeleteObjects identity-check gaps

A batch DeleteObjects now applies the caller's IAM policies to every key
however the request is signed and whichever service it was signed for,
and a governance-retention bypass now needs the bypass permission from
those policies too.

A presigned request that also sends an empty Authorization header is
evaluated with its query credential. IamEnforcementFilter.filter()
already treats a blank header as absent; the handler passed it through,
found no access key in it and skipped every per-key check.

When an entry is under active GOVERNANCE retention and the request asks
to bypass it, s3:BypassGovernanceRetention is evaluated through the same
per-key IAM path as the delete, with the same "Access Denied" error,
before the existing bucket-policy check. The single-key DeleteObject
path is unchanged.

authorizeAdditionalResource now picks resource-policy providers by the
service of the action being authorized, as filter() picks them by the
route's serving service, instead of by the caller's signing scope. A
request signed for another service, or for the s3express alias, now
sees the bucket policy. The canonicalised signing scope still selects
the error codes for an inactive key or expired session.

S3ResourcePolicyProvider is the only registered ResourcePolicyProvider,
so the other callers of the helper see no change: CopyObject's source
read passes its own resource-policy decision and never resolves
providers, and SecretsManager rotation (lambda:InvokeFunction) and SSM
secret references (secretsmanager:GetSecretValue) find no provider
under either scope. A presigned POST's s3:PutObject check changes only
for a form credential not scoped to s3, which now sees the bucket
policy like any other S3 request.

* fix(s3): check governance bypass for the null version in DeleteObjects

A DeleteObjects entry naming VersionId "null" under active GOVERNANCE
retention now needs s3:BypassGovernanceRetention before the bypass
header lets it through, as an entry naming any other version does.

isGovernanceRetentionActive looked the literal "null" up as a versioned
key, found nothing and reported the entry as unprotected, so the batch
path skipped both bypass checks (IAM and bucket policy). Deletion
treats "null" as the unversioned object at the plain key, the object
written before versioning was enabled. The helper now resolves it the
same way. DeleteObjects is its only caller.

The batch path evaluates identity policies for every key of a request
whose credential IAM knows. An unknown or unreadable credential with S3
request authentication off is handled as an unsigned request, as
filter() handles it; with S3 authentication on, S3 refuses an unknown
key. The comments in IamEnforcementFilter now say that DeleteObjects
reaches authorizeAdditionalResource with a key filter() has not
checked, since filter() returns before its key checks on a route no
action maps.

Tests: the null-version bypass, a mixed batch where only the retained
entry needs the bypass permission, and an inactive key and an expired
session signed for s3express answered with S3's InvalidAccessKeyId and
ExpiredToken rather than the other services' codes.

* test(s3): pin the null-version lookup to the pre-versioning object

A DeleteObjects entry naming VersionId null resolves to the object at the
plain key only when that object has no version id. On a versioning-enabled
bucket whose current version is GOVERNANCE-retained and versioned, a null
entry names a version that does not exist, so it must not demand
s3:BypassGovernanceRetention: S3 reports it deleted and the retained version
stays. The test fails if the version-id filter in isGovernanceRetentionActive
is dropped.

* fix(s3): name the version in each DeleteObjects error

An entry that names a VersionId now reports it in its <Error>, as S3 does,
so a batch naming several versions of one key says which of them failed.
This covers both the per-key authorization errors and the errors from the
delete itself (retention, precondition). An entry naming no version still
reports none.

* test(s3): pin the VersionId on a DeleteObjects error from the delete itself

A retained version deleted without the bypass header is refused by the
retention, not the authorization check, and that error names the version too.

* test(s3): create DeleteObjects test users through EnforcementFixtures

The two DeleteObjects enforcement classes carried their own copies of the
createUser and auth helpers that several S3 and IAM enforcement tests already
repeat. EnforcementFixtures now provides both: createUser registers removeUser
with PartitionCleanup before it creates the user, so the users and access keys
these classes make no longer outlive them in the shared application.
2026-10-11 22:18:53 -04:00
Nazimuddin Tajuddin Basha da063a82f8 fix(ec2): apply EBS encryption by default to new volumes and root volumes (#5371)
* fix(ec2): apply EBS encryption by default to new volumes and root volumes

EnableEbsEncryptionByDefault stored the flag but nothing on the volume
creation path read it, so CreateVolume and the RunInstances root volume
came back Encrypted=false even with the default on.

CreateVolume now encrypts when the region default is on, and an explicit
Encrypted=false cannot opt out, as on AWS. The RunInstances root volume
follows the same rule. The setting is per region.

Fixes #5370

* test(ec2): use an explicit RequestSpecification type instead of var

* refactor(ec2): take Ec2EbsEncryptionService on the CDI constructor

Constructor injection per AGENTS.md: Ec2EbsEncryptionService joins the
other CDI-only dependencies on Ec2Service's @Inject constructor instead
of being a field. The test uses a static import for assertEquals in
place of the private wrapper.
2026-10-11 22:13:26 -04:00
David Phillips eb3c14d414 fix(rds): reject malformed event subscription flags (#5481) 2026-10-11 20:44:26 -04:00
Kenshin Okinaka a96cc04fab fix(ses): reject non-array v2 reply-to and bulk destination members (#5477)
ReplyToAddresses in SendEmail and SendBulkEmail, and the To/Cc/Bcc of
each SendBulkEmail entry, read a value of the wrong JSON type as an empty
list. They are rejected with SerializationException, as the SendEmail
Destination members already are.
2026-10-11 20:38:55 -04:00
David Phillips 1e92b7e17b fix(rds): reject malformed cluster snapshot copy flags (#5472) 2026-10-11 19:44:08 -04:00
Mario Toffia 1a0afce7ec feat(cognito): serve the OAuth token revocation endpoint (#4936)
POST /cognito-idp/oauth2/revoke, and /oauth2/revoke on a custom domain,
revoke a refresh token through RevokeToken and answer as AWS's revocation
endpoint does, as measured: 200 with no body for a revoked, already
revoked or invalid token; 400 invalid_request for a missing token or a
client with revocation disabled; 400 unsupported_token_type for an access
or ID token; and 401 invalid_client with WWW-Authenticate: Basic for
missing or bad client credentials, a client of another pool, or a token
issued to another client. Unlike the token endpoint, a client secret is
taken only from the Basic header.

On a custom domain, the Cognito filter now answers a path under /oauth2/
that Cognito does not serve with AWS's JSON 404, and a served path called
with another method with an empty 405, so neither reaches S3 as a key of a
bucket named cognito-idp.
2026-10-11 19:38:32 -04:00
Daniël van Ziel 20bc835b6f fix(ec2): reject subnet CIDRs outside the VPC address space (#5461)
* fix(ec2): reject subnet CIDRs outside the VPC address space

* fix(ec2): serialize CIDR edits with subnet validation

* test(ec2): request native IPv6 subnets in endpoint fixtures
2026-10-11 18:52:30 -04:00
Matheus Oliveira 9698c216c5 fix(s3): limit CORS credentials header to S3-routed requests (#5375)
Add S3SignatureFilterScope.routedToS3 check to S3CorsFilter so
Access-Control-Allow-Credentials is only applied to requests routed
to S3Controller, not to other services like API Gateway's
/execute-api/ paths.

Add regression tests for:
- non-S3 routes with matching bucket names (API Gateway /execute-api/... paths)
- S3 bucket named 'execute-api' still receives correct CORS headers

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-10-11 18:47:28 -04:00
Bharat Kaurav a8374ee2ad fix(ec2): allocate endpoint IPv4 addresses within the subnet prefix (#5385)
* fix(ec2): allocate endpoint IPv4 addresses within the subnet prefix

Interface endpoint ENIs kept the subnet CIDR's first three octets and
picked a host of 200..249 from the endpoint id, ignoring the prefix
length. Two /25s inside one /24 got the same address, and the lower one
landed outside its own subnet; smaller subnets could also get reserved
or out-of-range addresses.

Derive the address from the subnet's parsed network and prefix: only
offsets AWS lets a resource hold (skipping the first four and the last
address) are candidates, the preferred one stays 200..249 for blocks of
256 addresses or more and moves to the top of the usable range for
smaller ones, and the range is probed in subnet order past addresses the
endpoint already holds (pinned ones first). Interface endpoints are
refused with InsufficientFreeAddressesInSubnet in a subnet with no
assignable address.

Fixes #5384

* fix(ec2): keep endpoint reads working for undersized subnets and avoid instance IP collisions

Deriving an interface endpoint's address threw InsufficientFreeAddressesInSubnet
when its subnet had no usable address, which an endpoint stored before
CreateVpcEndpoint refused such subnets can still hit. The derivation runs on
every read, so one such endpoint broke DescribeNetworkInterfaces for the whole
region. A subnet with nothing left for the interface now degrades it to the
synthetic fallback address instead; create and modify still refuse new ones.

Endpoint interfaces are derived rather than stored, so the instance allocator
never saw them and, in a /28, both could land on the same address. The
derivation now also skips addresses persisted ENIs, instances and NAT gateways
hold in the subnet (the allocator's own in-use scan), and the allocator treats
derived endpoint addresses as taken. The derivation reads only persisted state,
so the two cannot recurse, and the regional enumeration scans each subnet once.
2026-10-11 18:36:46 -04:00
David Phillips b86268e459 fix(ec2): preserve original Spot instance user data (#5468)
* fix(ec2): preserve original Spot instance user data

* fix(ec2): omit whitespace-only Spot user data

* docs(ec2): clarify Spot user-data encoding

* refactor(ec2): simplify Spot user-data handling
2026-10-11 18:27:48 -04:00
David Phillips 4fd8df2b00 fix(rds): reject malformed parameter reset flags (#5454) 2026-10-11 16:32:15 -04:00
Mario Toffia 8c61aa441d fix(cloudformation): report CREATE events for a resource an update adds (#4932)
A logical id the stack did not hold before an UpdateStack is created, so AWS
reports CREATE_IN_PROGRESS and CREATE_COMPLETE (or CREATE_FAILED) for it and
DescribeStackResource shows CREATE_COMPLETE. Floci used the stack-wide update
flag and reported UPDATE_* instead. The resource loop now decides per resource
from whether the stack held it; stack-level statuses and the rollback of an
added resource are unchanged.
2026-10-11 15:12:12 -04:00
Sam Fakhreddine e28c58cc8a fix(lambda): keep every AddPermission condition and store account principals as root ARNs (#5123)
AddPermission kept only one condition and stored an account principal as
the bare ID. It now writes every condition member in one statement, laid
out the way AWS writes it: SourceArn under ArnLike, SourceAccount,
FunctionUrlAuthType, PrincipalOrgID and EventSourceToken under
StringEquals, and InvokedViaFunctionUrl under Bool as the string "true".

A 12-digit account principal is stored as that account's root ARN in the
function's partition, and an ARN is recognised before the dot test, so an
IAM role, user or session name with a dot is no longer taken for a service.

The condition members are checked against the model's enum and patterns
before the function is looked up, and AWS::Lambda::Permission passes all
of them through from a template.

Fixes #4627
2026-10-11 15:10:53 -04:00
Aymen JAMAAOUI 8deac0a424 fix(cloudfront): reject a function runtime that CloudFront does not support (#5445)
Closes #5425
2026-10-11 14:52:01 -04:00
Niels Kootstra d6f93abb18 fix(eventbridge): stop a scheduled rule's timer when its rule is gone (#5462)
* fix(eventbridge): stop a scheduled rule's timer when its rule is gone

* fix(eventbridge): stop only the timer whose tick found its rule gone
2026-10-11 14:45:14 -04:00