Commit Graph
683 Commits
Author SHA1 Message Date
Jackson Price ff813c6f34 fix(ec2): create the key type and format CreateKeyPair asks for (#6112)
* fix(ec2): create the key type and format CreateKeyPair asks for

CreateKeyPair ignored KeyType and KeyFormat, so asking for an ED25519
key or a PuTTY key file returned a 2048-bit RSA key as PEM, and any
value of either was accepted. Now, as AWS answers:

- KeyType=ed25519 creates an ED25519 key, returned in OpenSSH's own
  BEGIN OPENSSH PRIVATE KEY format and fingerprinted by the padded
  base64 SHA-256 of its public key blob.
- KeyFormat=ppk returns the key as an unencrypted PuTTY version 2 key
  file whose comment is the key pair's name. An RSA key keeps the SHA-1
  fingerprint of its DER private key, taken over the key with its
  larger prime first, the order PuTTY stores.
- Any other KeyType or KeyFormat is InvalidParameterValue with AWS's
  validation message, checked before the name is found taken, and
  nothing is created.

RunInstances injects the ED25519 public key of such a key pair, and
DescribeKeyPairs reports it.

Follow-up to the review of #6093.

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

* test(ec2): keep the CreateKeyPair test helpers in one place

The launch test and the key unit tests use the Query helpers and the
ED25519 readers of Ec2CreateKeyPairIntegrationTest instead of their own,
PuttyKeyFile reads fields and RSA public keys with SshPublicKeys, the
digests come from Digests, and the RSA prime-order test takes its keys
from Ec2KeyMaterial.generateRsa instead of building them itself.

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

* fix(ec2): answer a CreateKeyPair DryRun before its other checks

AWS answers CreateKeyPair with DryRun=true by DryRunOperation (412)
before it looks at the name or the key type, so a DryRun with an
unknown KeyType is DryRunOperation rather than InvalidParameterValue.
Floci ignored DryRun and created the key pair; it now answers it first
and creates nothing.

The CreateKeyPair tests share their requests and key readers through
Ec2CreateKeyPairFixtures rather than an integration test class, the
launch test shares the container-backed application of
Ec2CapturedImageReclaimIntegrationTest, a described public key is
compared without the line break AWS ends it with, a created ED25519
key imports with the same fingerprint, the PuTTY comment rule is
checked for CR, tab and DEL as well as LF, and the case of a key with
its smaller prime first is skipped rather than failed under a
generator that never makes one. The orders AWS documents nowhere are
described as Floci's.

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

* test(ec2): clean up after the CreateKeyPair tests

The launch test terminates its instance and deletes its key pair, since
it now shares an application with another class, and the import test
deletes what it made even when a step before its assertion fails. A
test comment and the DryRun comment no longer claim an order AWS does
not document.

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

* test(ec2): say what the launch test's cleanup leaves behind

With the container manager mocked, TerminateInstances releases the
instance's address and volume but leaves its record pending, so the
comment says so instead of claiming the instance goes.

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

* fix(ec2): record the key type CreateKeyPair created

With #6093 merged, CreateKeyPair stored every key pair's type as rsa,
so an ED25519 key pair was described as rsa and the key-type filter
found it under rsa. It now stores the type it created. The guard test
now requires the reported type and checks the key-type filter.

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

* test(ec2): share Ec2KeyPairFixtures and keep the type check to what AWS does

The CreateKeyPair tests now use the key pair fixture #6093 added, which
gains the type-and-format CreateKeyPair and the ED25519 key readers, and
their own fixture class goes. The described-type check no longer looks
the key pair up with the key-type filter, which AWS answers with
InvalidParameterValue. The createKeyPair Javadoc says the name is checked
as present and valid before the values.

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

* fix(ec2): read a stored key pair's type from its public key

A key pair saved before its type was recorded was described as rsa
whenever it held key material, which would misreport a created ED25519
key pair. Its type is now read from its stored public key, created or
imported; a created key pair saved before Floci kept its public key is
still rsa, the only type CreateKeyPair made then.

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

* refactor(ec2): generate ED25519 key pairs in Ec2KeyMaterial

Ec2KeyMaterial already reads imported ED25519 keys, so the created ones
move there too and share its base64 and fingerprint rule instead of a
class of their own. Ec2PuttyKeys uses its colon-hex fingerprint, and the
PuTTY test key moves into Ec2KeyPairFixtures with the other test keys.

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

* test(ec2): check the described key type through the SDK

The SDK test now checks DescribeKeyPairs returns the type each key pair
was created with, which the hardcoded rsa would have failed. The key pair
fixture exports the region it signs for, and the legacy keyType paragraph
in the EC2 docs is re-wrapped.

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

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-21 13:38:36 -04:00
Jackson Price ab0737798d fix(elbv2): answer SetSubnets with one ALB subnet with ValidationError (#6116)
* test(elbv2): expect ValidationError for SetSubnets with one ALB subnet

SetSubnets on an Application Load Balancer with one subnet answers
InvalidConfigurationRequest with a message of Floci's own, once the
subnet has been looked up. The SetSubnets API reference states the
rule CreateLoadBalancer states, subnets from at least two Availability
Zones, and since #6098 CreateLoadBalancer answers one subnet with
ValidationError "At least two subnets in two different Availability
Zones must be specified", counted before any subnet is looked up.

- ElbV2ServiceTest, ElbV2IntegrationTest (Query protocol) and the
  compatibility suite's ElbV2Test expect that error for SetSubnets
  with one subnet, in Subnets or in SubnetMappings, and for one subnet
  that does not exist, with the balancer left on its subnets.
- CloudFormationElbV2SubnetUpdateIntegrationTest: an update that keeps
  the balancer and names one subnet rolls back with that error.
- A Network or Gateway Load Balancer is still set onto one subnet, and
  a move onto no subnets, which a CloudFormation rollback makes for a
  balancer an earlier version saved without subnets, is still taken.
- setSubnetsWithMissingSubnetReturnsSubnetNotFound sends an existing
  subnet beside the missing one, so it still reaches the lookup.

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

* fix(elbv2): answer SetSubnets with one ALB subnet with ValidationError

SetSubnets on an Application Load Balancer with one subnet now answers
ValidationError (400) "At least two subnets in two different
Availability Zones must be specified", the answer CreateLoadBalancer
gives since #6098, instead of InvalidConfigurationRequest with a
message of Floci's own. setSubnets runs requireSubnets once it has
looked the balancer up for its type and before any subnet is looked
up, so one subnet that does not exist gets the same answer, as on
create. One SubnetMappings entry goes through the same check.

The answer follows the SetSubnets API reference, which states the
two-zone rule for an Application Load Balancer, and the answer AWS
gives CreateLoadBalancer; no public report shows what AWS answers
SetSubnets with one subnet. AWS does give a Network Load Balancer's
SetSubnets with no subnets CreateLoadBalancer's message.

A CloudFormation update that keeps an Application Load Balancer and
names one subnet moves it through setSubnets, so it now fails with
this error and rolls back. A move onto no subnets is not counted,
because a CloudFormation rollback moves a balancer an earlier version
saved without subnets back onto none. A Network or Gateway Load
Balancer can still be set onto one subnet.

resolveSubnetVpcId drops its own one-subnet refusal, which neither
caller reaches any more; its zone check still refuses an Application
Load Balancer whose subnets are all in one Availability Zone.

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

* docs(elbv2): say where SetSubnets' one-subnet answer comes from

Review follow-ups to the SetSubnets one-subnet fix:
- The requireSubnets Javadoc scopes what AWS is known to answer to
  CreateLoadBalancer, and says SetSubnets gets the create message and
  order because no public report shows what AWS answers there.
- The setSubnets comment says an empty list moves the balancer onto no
  subnets, rather than that the list is left alone.
- docs/services/elb.md says the same about the SetSubnets answer, and
  instead of saying a Gateway Load Balancer can be set onto one subnet,
  that Floci does not enforce AWS's rule that SetSubnets keeps every
  subnet a Gateway Load Balancer already has.

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

* test(elbv2): keep the SetSubnets tests to answers ELBv2 gives

Review follow-ups to the SetSubnets one-subnet fix:
- ElbV2CfnProvisionerTest: the update with a blank SubnetId keeps a
  Network Load Balancer, for which SubnetNotFound is still the answer
  ELBv2 gives; an Application Load Balancer now gets the subnet count
  error first. The move-and-move-back test moves the kept balancer
  onto two subnets, as ELBv2 refuses an Application Load Balancer on
  one.
- ElbV2ServiceTest: the move onto no subnets follows the rollback it
  stands for, a balancer saved without subnets moved onto subnets and
  back onto none. SetSubnets onto one subnet for a balancer that does
  not exist reports LoadBalancerNotFound before any subnet is looked
  up.

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

* docs(elbv2): word the SetSubnets count notes as the rules read

Second review round on the SetSubnets one-subnet fix:
- docs/services/elb.md no longer says Network and Gateway Load
  Balancers are not counted: they are, and a list that names a subnet
  cannot fail the count for them, while a SetSubnets with neither form
  is refused for every type once #6100 lands. It now says a Network
  Load Balancer can be set onto one subnet, and that AWS requires a
  Gateway Load Balancer's SetSubnets to list every subnet it is
  already on, which Floci does not enforce.
- The setSubnets comment says "an earlier Floci version", as the
  tests do.

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

* test(elbv2): give the blank SubnetId update a typed balancer

Second review round on the SetSubnets one-subnet fix: the update with
a blank SubnetId in ElbV2CfnProvisionerTest names a Network Load
Balancer in its template, and the balancer its describe stub returns
is now a network one too, so the template, the stub and the Javadoc
agree. The answer the stub gives, SubnetNotFound, is unchanged.

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

* docs(elbv2): scope the Gateway Load Balancer SetSubnets rule to Subnets

Third review round on the SetSubnets one-subnet fix: the SetSubnets API
reference states that a Gateway Load Balancer must include every
subnet it is already on under Subnets only, not under SubnetMappings,
so docs/services/elb.md now says the reference requires it of a
Gateway Load Balancer's Subnets, rather than of its SetSubnets as a
whole. Floci still does not enforce it.

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

* chore(elbv2): tidy what #6100 and the SetSubnets count both added

With #6100 merged, this branch and it each documented and tested the
same SetSubnets paths:
- ElbV2ServiceTest keeps aRollbackOntoNoSubnetsIsNotCounted, which
  models the CloudFormation rollback that needs setSubnets to take an
  empty list, and drops #6100's aMoveBackOntoNoSubnetsIsStillTaken,
  which tested the same call on a balancer that still had subnets. The
  two missing-balancer tests now say which path each pins: the
  SetSubnets action with neither form, or setSubnets with one subnet.
- The requireSubnets Javadoc names setSubnetsFromRequest beside
  setSubnets, and the setSubnets comment no longer repeats the
  empty-list reason its Javadoc gives.
- docs/services/elb.md has one SetSubnets bullet instead of two.

No behaviour changes.

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

* docs(elbv2): say what requireSubnets checks for SetSubnets

Review of the merge with #6100: the requireSubnets Javadoc gave the
two-zone rule as the reason setSubnetsFromRequest runs it, but that
call refuses a SetSubnets that names no subnets, for every type, and
requireSubnets only counts the list. It now says SetSubnets takes the
same subnets as CreateLoadBalancer, which of the two methods runs the
count on which list, and that the two-zone check comes after the
subnets are looked up. Javadoc only.

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

* docs(elbv2): say what the folded SetSubnets bullet counts like

Review of the tidy: once the two SetSubnets bullets in
docs/services/elb.md became one, "counted the same way" followed the
sentence about a SetSubnets with neither form, so it no longer read
as CreateLoadBalancer's count. It now says a SetSubnets that names
subnets is counted as CreateLoadBalancer counts them.

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

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-21 10:47:07 -04:00
Jackson Price fbf3bfff84 fix(ec2): refuse key pairs AWS refuses and describe their type, create time and filters (#6093)
* fix(ec2): refuse key pairs AWS refuses and describe their type, create time and filters

ImportKeyPair stored whatever material it was given. It now reads the key
as AWS documents: RSA or ED25519 as an OpenSSH line, RSA also as RFC 4716
or base64 DER, bare or in PEM armour, and RSA from 1024 to 16384 bits.
DSA, ECDSA, security-key and certificate keys, blobs that are incomplete,
carry trailing bytes or name another type, and material with more than one
key line are refused with InvalidKey.Format. The key is stored as one
OpenSSH line, which is what RunInstances writes to authorized_keys.
CreateKeyPair and ImportKeyPair take a KeyName of up to 255 ASCII
characters with no leading or trailing space, and answer any other with
InvalidParameterValue.

DescribeKeyPairs now returns keyType and createTime, and honours Filter.N
with key-pair-id, key-name, fingerprint, key-type, tag-key and tag:<key>,
refusing any other name. Key pairs persisted before this change load as
they are: they have no createTime, and their keyType is read from the
stored key.

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

* test(ec2): describe malformed key pairs from saved records, not imports

ImportKeyPair now refuses material that is not exactly one whole key and
converts RFC 4716, so the IncludePublicKey cases that imported partial
or mislabelled blobs, trailing bytes, two key lines or UTF-16 text could
no longer create their key pairs. Such material is now held only by key
pairs saved by an earlier version, so those cases describe a stored
record through the handler instead, and the RFC 4716 case checks that
the converted key is described as its OpenSSH line.

The handler test stubs the DescribeKeyPairs overload that takes filters,
which the handler now calls. The Key Pairs docs and the javadoc of the
public-key description say what is stored now and what an older record
may still hold.

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

* fix(ec2): refuse a DER key whose bit string declares pad bits

A SubjectPublicKeyInfo whose key BIT STRING declares unused bits made
Bouncy Castle throw an IllegalStateException, which the key reader did
not catch. ImportKeyPair answered such base64 DER or PEM with a 500
instead of InvalidKey.Format, and a key pair saved earlier with that
material failed every DescribeKeyPairs in its region, since the key type
of an older record is read from its material.

The reader now refuses a key bit string with pad bits, and treats Bouncy
Castle's IllegalStateException like its other parse errors. A new test
sets every byte of each binary form to values that matter to DER and SSH
framing and checks that nothing escapes.

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

* fix(ec2): refuse an IncludePublicKey that is neither true nor false

DescribeKeyPairs read IncludePublicKey with Boolean.parseBoolean, so a
value such as "invalid" or "yes" was taken as false and the key pairs
were described without their public keys instead of the request being
refused. It now goes through the handler's strict boolean reader, the
one the block device mapping and peering options use: true or false in
any case, and InvalidParameterValue for anything else. TRUE was already
read as true, and still is.

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

* test(ec2): send each describe filter once and allow clock skew in the SDK check

The DescribeKeyPairs integration helper always sent a key-name filter of
the test's prefix, so the cases that test key-name itself sent the name
twice and Floci kept only the second. A key-name filter under test is now
sent alone. The SDK compatibility check gives createTime a minute either
side, since Floci may run in a container with another clock.

The Key Pairs docs and the RSA length test now say what AWS lists and
what Floci takes beyond it, citing the 8192-bit key AWS was seen to
import.

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

* fix(ec2): refuse a DER key with no key in its bit string

An rsaEncryption SubjectPublicKeyInfo whose key bit string holds no bytes
parses to no structure at all, and the reader passed that null on to a
NullPointerException: ImportKeyPair answered such DER or PEM with a 500,
and a key pair saved earlier with it failed DescribeKeyPairs for every
listing that included it. The reader now reads the PKCS#1 sequence
itself and refuses anything that is not two integers.

It reads those integers signed, as an ssh-rsa blob's are, so a modulus
missing its sign byte is refused rather than imported as a different,
positive key. And the key type of an older record no longer depends on
the reader never failing: if it does, the type is left out and the
failure logged, instead of failing the whole description.

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

* docs(ec2): keep key pair comments and docs true to the new checks

SshPublicKeyException's javadoc said EC2 answers an unreadable imported
key with no fingerprint; ImportKeyPair now refuses it with
InvalidKey.Format. The Key Pairs docs say that an empty IncludePublicKey
reads as false. The RSA length test links the report of an 8192-bit
import in full, and the describe test says that sending one key-name
filter is a Floci limit, not an AWS rule.

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

* test(ec2): cover the stored key-type guard on its own

The stored-record test passed even with the reader broken, because the
guard in keyTypeOf turned the reader's exception into the expected
missing type. It now checks that the reader refuses each stored material
by itself, and a new test makes the reader fail, through an inline static
mock as other tests here do, and checks that the record is still
described, with no type, and that a key-type filter passes over it.

The keyTypeOf javadoc and the docs now mention that case, the docs say a
blank IncludePublicKey reads as false and a missing or blank KeyName is
MissingParameter, and a comment no longer says every imported key is
fingerprinted with MD5.

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

* test(ec2): make the stored key-type guard test depend on its failing reader

The guard test stored text the real reader already refuses without
throwing, so it passed even if the failing reader was never consulted.
It now stores a valid ed25519 key, whose type would be ed25519 without
the failure, checks that the stubbed reader was called, and describes the
record through the handler too, where each item's type is read. A
comment on the stored-record test no longer says the reader refuses the
records it accepts.

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

* fix(ec2): AND a repeated DescribeKeyPairs filter name

DescribeKeyPairs read Filter.N into a map keyed by name, so a second
filter of one name replaced the first: key-name=X-prod-* with
key-name=X-*-web returned X-dev-web too. AWS joins every filter with AND.
The handler now passes the filters in request order, as
DescribeAvailabilityZones already does, and a key pair has to match each
of them, with the values of one filter still ORed.

The other EC2 describe actions share the map reader and keep its
behaviour; that is for a separate change. The describe test's helper
goes back to ANDing a second key-name filter with its prefix filter.

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

* test(ec2): show the key-type guard covers only key pairs saved without a type

With the key reader made to fail, ImportKeyPair still fails with the
error, and a key pair whose type was recorded is described and filtered
by key-type without the reader being consulted. Only a record saved
before the type was recorded goes through the guard that leaves its type
out and logs the failure.

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

* test(ec2): check repeated key pair filters in the service, and route unfiltered calls through them

A service test now passes Filter.N with a repeated name to the ordered
DescribeKeyPairs overload and checks that the two filters are ANDed, and
that a later unknown name is still refused. The unfiltered overload goes
through the ordered one too, leaving the map form as a convenience for
filters of distinct names, and the docs sentence on filters is split in
two.

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

* test(ec2): pick repeated key pair filters that each match more alone

The service check of a repeated key-name filter used `*-rsa` then `g*`,
and `g*` alone gives the same answer, so it passed when only the last
filter was kept. Each filter now matches two key pairs alone and one
together, so keeping either one instead fails the test.

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

* test(ec2): share one fixture between the key pair tests

The import, describe and public-key integration tests each had their
own CreateKeyPair, ImportKeyPair and DeleteKeyPair calls, and the same
ED25519 key was pasted into five classes. Ec2KeyPairFixtures now holds
those calls and the one key, which the handler, service and persistence
tests use too. SshKeyBlobs builds the OpenSSH blobs and lines that
SshPublicKeysTest, Ec2KeyMaterialTest and Ec2QueryHandlerTest each built
and joined themselves, and the import test reads RSA keys with
SshPublicKeys.rsaKeyOf instead of its own copy.

Test-only: every class runs the same tests as before.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(ec2): build key blobs with the SshPublicKeysTest helpers main has

SshPublicKeysTest on main already builds OpenSSH blobs with blob and
joins bytes with withTrailing. The EC2 key pair tests now call those two,
made public for them, instead of the SshKeyBlobs class the previous
commit added, which is removed.

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

* test(ec2): keep the shared throwaway keys in Ec2KeyPairFixtures

The pinned RSA key and its fingerprint, the ED25519 fingerprint, the DSA
and ECDSA P-256 keys and the truncated ssh-rsa blob were each written
out in two to four of the key pair test classes. They now live beside
the ED25519 key in Ec2KeyPairFixtures; keys only Ec2KeyMaterialTest
uses stay there. The handler test loses a comment and an import the
earlier move left behind.

The earlier move also switched Ec2KeyPairPublicKeyIntegrationTest and
Ec2QueryHandlerTest from the ED25519 key #6055 added to the shared one;
no assertion in them depends on which valid key it is.

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

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-21 09:11:13 -04:00
Alessandro Lattao f2b62fbbec feat(dsql): serve each cluster's database on the DSQL endpoint (#6102)
* feat(dsql): serve each cluster's database on the DSQL endpoint

Each Aurora DSQL cluster gets a PostgreSQL 16 database in a Docker container,
set up as DSQL's (the role admin owning public, repeatable read), and every
cluster is served on one TLS endpoint where the server name picks the cluster.
A connection is admitted as DSQL admits it, measured on AWS: an IAM token for
the endpoint, DbConnectAdmin for admin, 5 seconds of grace past expiry, a
long-term key only in its own account, IAM enforcement with the account's SCPs,
and DSQL's SQLSTATE, text and hint for every refusal. A role other than admin
is refused as an unmapped one, since role mappings come with AWS IAM GRANT in
the next part. The startup is read as DSQL reads it: a dotted parameter is
refused, and of options only -c name=value counts, the first for a name.

The cluster is CREATING until its database answers; a multi-Region peer is
ACTIVE after peering only once its database answers. A start that fails after
the container exists removes it, a deletion Docker cannot finish leaves the
cluster DELETING for the next start, and whether a cluster is wanted and its
route change under one lock, so a deletion racing a start leaves no route.

The data plane was first one PR; it is split by layer at the maintainer's
request: this part (transport and admin), then AWS IAM GRANT and the other
roles, then DSQL's dialect and limits.

* refactor(postgres): speak PostgreSQL's wire protocol through one shared helper

The DSQL endpoint brought a third copy of the startup parsing, message framing
and ErrorResponse building that the RDS proxy's PostgresProtocolHandler and
Redshift's PostgresWireDecoder each carried. They now go through
core.common.PostgresWire: the startup packet and its parameters, reading and
writing a message with its checked length, and the fields of an ErrorResponse
or NoticeResponse. The length refusals keep the RDS proxy's wording, which its
tests assert; Redshift's oversized-message refusal now reads the same way.

Also from the review: the DSQL integration test makes its IAM users with
EnforcementFixtures.createUser, which removes them after the test; the service
test shares one ready-at-once provision stub; and every exception the endpoint
and session swallow is named ignored, with the reason it is safe.
2026-10-21 08:54:07 -04:00
Mario Toffia 89317831bb feat(ssm): publish parameter change events (#5262)
* feat(ssm): publish parameter change events

After a successful PutParameter, DeleteParameter, DeleteParameters,
LabelParameterVersion or UnlabelParameterVersion, SsmService publishes the
AWS-shaped aws.ssm "Parameter Store Change" event to the default EventBridge
bus, with the parameter ARN in resources. A label event carries the type and
description of the labelled version; an unlabel event lists the labels it
removed. Every event is published after the service lock is released. Failed
calls publish nothing, and a delivery failure is logged without failing or
undoing the write. CloudFormation managed parameters go through SsmService and
publish the same events.

* test(cloudformation): move CfnStackWaits into testing

CfnStackWaits was package-private in the CloudFormation tests, so the SSM
event integration test polled DescribeStacks for CREATE_COMPLETE itself.
It now lives in testing with a public API, and that test waits through
CfnStackWaits.awaitStatus and builds its CloudFormation requests with
CfnRequests.cfn instead of a private copy.

* refactor(eventbridge): build service event entries in one place

The ECS, Step Functions, Redshift Data, CodePipeline, SES and SSM publishers
each built the same Source, DetailType, Detail and Resources entry.
EventBridgeService.serviceEventEntry builds it, with Resources always
present and empty for a null or blank resource ARN. Each publisher still
calls putEvents with its own region and account. The explicit default
EventBusName and the Region that repeated putEvents' region argument are
gone; putEvents fills both the same way.
2026-10-21 07:07:39 -04:00
David 1108bc75dc feat(rds): DB proxy endpoints (#6062)
* feat(rds): DB proxy endpoints

CreateDBProxyEndpoint, DescribeDBProxyEndpoints, ModifyDBProxyEndpoint and
DeleteDBProxyEndpoint store endpoints per account and Region, checked against the
service model. Each endpoint reports its proxy's own host, so a client connects
through it as through the proxy. DescribeDBProxyEndpoints lists each proxy's
default endpoint first; it cannot be modified or deleted. Deleting a proxy
deletes its endpoints, and endpoint ARNs take tags.

Closes #5805

* fix(rds): report each proxy endpoint at the proxy's current host

A custom endpoint kept the proxy's host from when it was created, so after a
restore gave the proxy a new host, every custom endpoint still reported the
old one while default reported the new one. The host is no longer stored with
the endpoint: create, describe, modify and delete take it from the proxy when
they answer.

A missing DBProxyName, DBProxyEndpointName or VpcSubnetIds is now
MissingParameter, checked before the proxy is looked up.

* test(rds): import Executable and assertTrue instead of naming them inline
2026-10-21 06:47:06 -04:00
TATSUNO “Taz” Yasuhiro 1dce18e766 feat(dynamodb): add point-in-time recovery restores (#6110)
* feat(dynamodb): add point-in-time recovery restores

* feat(dynamodb): record a point-in-time change before the write

* feat(dynamodb): authorize RestoreTableToPointInTime on its source table

* perf(dynamodb): store each point-in-time change on its own

* feat(dynamodb): delete system backups that have expired

* chore(dynamodb): take point-in-time times from a clock in tests

* chore(dynamodb): share the duplicated test helpers and table name pattern
2026-10-21 01:09:06 -04:00
Jackson Price 883cd4f1c2 fix(elbv2): refuse SetSubnets with neither Subnets nor SubnetMappings (#6100)
* test(elbv2): cover SetSubnets with neither Subnets nor SubnetMappings

SetSubnets takes Subnets or SubnetMappings, and AWS refuses a request
with neither. These tests pin that answer, which Floci does not give
yet: a ValidationError with the CreateLoadBalancer message for the
balancer's type, with the balancer left on its subnets and in its VPC,
whether the two lists are left out or sent empty. They fail until the
fix that follows.

They also pin the paths that must keep working: a balancer that does
not exist is reported first, a CloudFormation update that names
neither leaves its kept balancer alone, and a rollback can still move
a balancer an earlier version saved without subnets back onto none.

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

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

A SetSubnets that named neither Subnets nor SubnetMappings answered
success and left the load balancer in no Availability Zone, still in
its VPC. The API reference says the request takes one or the other,
and AWS answers a Network Load Balancer's with "ValidationError: At
least one subnet must be specified", the message CreateLoadBalancer
gives it.

SetSubnets with neither now answers ValidationError and leaves the
balancer on its subnets, with the message CreateLoadBalancer gives the
balancer's 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 balancer that does not exist is still LoadBalancerNotFound, since
the message depends on its type, and a request that names subnets is
checked as before.

The check runs in the new ElbV2Service.setRequestedSubnets, which the
Query handler calls. ElbV2Service.setSubnets still takes an empty
list: CloudFormation moves a kept balancer through it, never onto none
on an update, and onto none on a rollback only for a balancer an
earlier version saved without subnets, which rolls back as before.

Follow-up to #6087.

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

* refactor(elbv2): keep the SetSubnets action check in the package

Review follow-ups, no change in behaviour:
- The action's entry point is now the package-private
  ElbV2Service.setSubnetsFromRequest, which only the Query handler
  calls; setRequestedSubnets read like a property setter. The
  CloudFormation provisioner, in another package, cannot reach it and
  keeps moving balancers through setSubnets.
- Its Javadoc says why only an empty list is refused there: a request
  that names subnets is checked by setSubnets. The setSubnets and test
  Javadocs speak of a balancer an earlier Floci version saved without
  subnets.
- The provisioner test of an update that names neither says the real
  reason the update must not call setSubnets: it would move the
  balancer onto none.
- The docs line for SetSubnets gives both messages.

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

* test(elbv2): give the SetSubnets neither test the class's last order

#6098 adds a test at @Order(79) earlier in ElbV2IntegrationTest, while
this one stays the last method in the file at @Order(78). Once both
land, whoever appends a test would read 78 and pick 79, so this one
takes 80 and the last method keeps the highest order. The two tests
are independent, so the order between them does not matter.

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

* test(elbv2): give the SetSubnets compat test its own order

setSubnetsWithoutSubnets and createLoadBalancerWithoutSubnets in the
compatibility suite's ElbV2Test both carried @Order(6), so JUnit's
order between them was left to its tie-break. The SetSubnets test now
has @Order(8), the first value not taken once #6098's @Order(7) test
is in the class, so every order in the class is unique. The test stays
where it is in the file: moving it below the create test would edit
the lines #6098 added on main. The two tests create and delete their
own balancers, so neither depends on running before the other.

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

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-21 00:07:32 -04:00
Hector Ventura e5591dda32 feat(ec2): page and filter DescribeTags as AWS does (#6109)
* feat(ec2): page and filter DescribeTags as AWS does

DescribeTags ignored MaxResults and NextToken, so SDK paginators got a
single page, and matched filter values exactly: tag:<key> was dropped,
the * and ? wildcards matched literally, and a filter name given twice
kept only the last one.

It now pages with MaxResults (5 to 1000, InvalidMaxResults otherwise)
and NextToken, takes tag:<key> as the documented alternate spelling of
a key filter plus a value filter, honours wildcards, ORs the values of
one filter and ANDs separate filters. Results are ordered by resource id
so a page boundary stays put while no tags change.

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

* fix(ec2): bound filter wildcards and refuse every out-of-range MaxResults

EC2 filter wildcards were translated to a regex, so a caller-supplied
pattern of many stars backtracked for seconds against a long value and
`*` skipped line terminators. They now use the two-pointer glob IAM and
S3 already share, which every EC2 Describe filter goes through.

DescribeTags treated MaxResults=0 and negative values as unpaged; any
value sent outside 5 to 1000 now answers InvalidMaxResults, and only a
missing MaxResults is unpaged. A NextToken whose offset is at or past the
end returns an empty last page instead of overflowing into a token that
fails on the next call. The compat case moves to its own @Order.

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

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-20 23:42:14 -04: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
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
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
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
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
Mohith b8d87df054 fix(cloudwatch): reject PutMetricData datums without a MetricName (#6072)
* fix(cloudwatch): reject PutMetricData datums without a MetricName

MetricName is the one required member of MetricDatum. The JSON handler
stored a nameless datum under an empty name, and the Query handler
treated a member without MetricName as the end of the list, silently
dropping it and every later datum while still storing the earlier ones.

Both handlers now reject a missing or empty MetricName in top-level
MetricData and in EntityMetricData[].MetricData with MissingParameter
(400), the error PutMetricData declares for a missing required input,
naming the offending member. A whitespace name is still accepted, since
AWS constrains MetricName only to 1 to 255 characters. Every datum is
validated before any is stored, so a rejected request leaves no state
behind. On Query, a member index with no keys at all still ends that
MetricData list.

* fix(cloudwatch): return MissingRequiredParameterException on JSON and CBOR

CloudWatch is awsQueryCompatible. MissingParameter is the awsQueryError
code of the MissingRequiredParameterException shape, so it belongs in the
Query <Code> and the x-amzn-query-error header, while a JSON 1.0 or CBOR
body's __type names the shape. With the code in __type the AWS SDK v2
raised a generic CloudWatchException instead of the modelled one.

A package-private CloudWatchMetricsException keeps the Query code as its
error code and overrides jsonType() with the shape name, the same split
SwfException makes. The shared query-code table in AwsException is left
alone because SQS reports MissingParameter as its JSON type.
2026-10-20 10:07:57 -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
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
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
Mohith 03f5730396 fix(cloudwatch): store datums sent in PutMetricData EntityMetricData (#6070)
The CloudWatch Agent sends PutMetricData with an empty top-level
MetricData and every datum nested under EntityMetricData[].MetricData.
Both the JSON 1.0 handler (also reached by Smithy RPC v2 CBOR) and the
Query handler read only the top-level list, so the agent's metrics were
silently dropped.

Both handlers now append each EntityMetricData entry's datums to the
top-level ones and store them under the request Namespace, with the same
parsing as top-level datums. Entity and StrictEntityValidation are
accepted and ignored. The per-request INFO logs of the raw request and
parsed datums are lowered to a DEBUG count.

Fixes #6066
2026-10-20 08:19:42 -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
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
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
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
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
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
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
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
Mario Toffia 34d904fde5 feat(iot): search fleet things by connectivity status (#6025)
* feat(iot): search fleet things by connectivity status

SearchIndex refused every connectivity field and its documents carried
no connectivity, so an application that finds its things by connection
state got InvalidQueryException.

With connectivity indexing on, a thing now reports the MQTT broker
session whose client id is its name, and connectivity.connected,
connectivity.clientId and connectivity.disconnectReason can be
searched. The other connectivity fields are still refused with
InvalidQueryException. A thing whose client id never connected reports
connected false and timestamp 0, as on AWS.

The broker now records the account, region, connect time, keep alive
and clean session of each session, and keeps in memory how the last
one of each client id ended in each account and region, until a state
reset. The reason is the one the session's disconnected lifecycle
event carries, recorded by the same single endSession under the
session lock, so the late end of a displaced session cannot overwrite
its successor's. A plaintext session counts in the default account and
region, a TLS session in its certificate's.

Closes #4912

* fix(iot): serialize connectivity reads and resets with session ends

A connectivity lookup read the live session without the session lock,
so a search racing DeleteConnection could see the session connected
after its disconnect was recorded. A state reset cleared the history
without the lock too. Both now run under the session lock; the lookup
tests the session's ended flag instead of the endpoint, as the lock is
never held across endpoint calls.

Tests cover the reset contract, a lookup and a reset racing a held
DeleteConnection, and a TLS session counting in its certificate's
account and region.
2026-10-19 19:45:53 -04:00
Hector Ventura 1eb402d623 fix(ec2): keep tags in the region of the resource they label (#5973)
* fix(ec2): keep tags in the region of the resource they label

DescribeTags listed every region's tags because the tag store was keyed by
the bare resource id. Tags are now stored per region, so DescribeTags,
DeleteTags, CreateTags and the aws:ResourceTag IAM condition only see the
request region's tags. Each side of a cross-region transit gateway or VPC
peering connection keeps its own tags in its own region.

Tags stored by bare id are moved under their resource's region at startup,
for every account; a tag whose resource no region holds is dropped.

DescribeTags now reports image, volume, snapshot, network-acl,
vpc-peering-connection and spot-instances-request instead of "unknown".
Tags given when a volume or peering connection is created reach the store,
and DescribeVolumes, DescribeSnapshots and DescribeSpotInstanceRequests show
later CreateTags and DeleteTags changes.

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

* fix(ec2): remove tags with their resource and keep node and catalog AMI tags on upgrade

Deleting a volume (directly or as a delete-on-termination volume of a
terminated instance), a snapshot with its image or a VPC peering connection,
and pruning a terminated instance, now removes the resource's tags, both
peering sides included.

The startup migration no longer drops tags it cannot place in a store: a
catalog AMI's tags move to the default region, and an instance's are kept
until its EKS node is found in a region, which then claims them.

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

* fix(ec2): file a cluster node's legacy tags under its own region

A region-less findInstanceById reaches the EKS provider, which answers from any region, so the claim moved the node's legacy tags under a null region where DescribeTags never finds them. The claim now uses the instance's own region, and with no region known it reads the legacy tags in place for a regional lookup to claim.

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

* fix(ec2): pass the region in the query GET resource-tag stub

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

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-19 19:13:38 -04:00
andrehoong-px 5774e7db8d feat(cloudformation): support S3 Vectors resources (#5853)
* feat(cloudformation): support S3 Vectors resources

* fix(cloudformation): validate S3 Vectors encryption settings

* fix(cloudformation): align S3 Vectors provisioning contracts

* fix(cloudformation): restore S3 Vectors properties on rollback
2026-10-19 18:16:10 -04:00
Allen Sanborn fb390968d5 feat(guardduty): support publishing destinations (#6016)
* feat(guardduty): support publishing destinations

Add CreatePublishingDestination, DescribePublishingDestination,
UpdatePublishingDestination, DeletePublishingDestination and
ListPublishingDestinations under /detector/{detectorId}/publishingDestination.
Previously these returned UnknownOperationException, which broke
Terraform's aws_guardduty_publishing_destination.

Destinations are stored per detector through StorageFactory, so they follow
the detector's account and region scoping, survive a persistent-storage
reload, and report PUBLISHING on create (the state Terraform's create waiter
targets). A missing destination returns BadRequestException with the message
the Terraform provider matches for not-found. Deleting a detector removes its
destinations.

clientToken makes create idempotent and is capped at the model's 64
characters, measured in code points as the model's length constraint is.
destinationArn stays optional on create: the GuardDuty model marks
DestinationProperties.DestinationArn and KmsKeyArn as not required
(botocore guardduty/2017-11-28 service-2.json).

The service gains a five-store constructor; the existing three- and
four-store (malware protection plan) constructors delegate to it.

Closes #4983

* docs(guardduty): update the service matrix operation count

* test(guardduty): cover the publishing destination lifecycle through the SDK

Create, describe, update, list and delete an S3 publishing destination
with the AWS SDK v2 GuardDuty client, asserting the shapes as the SDK
reads them, including the required publishingFailureStartTimestamp.
2026-10-19 16:45:15 -04:00
Alessandro Lattao 28799ed352 fix(apigatewayv2): answer an HTTP API's Lambda proxy body it cannot read with 500 (#6012)
* fix(apigatewayv2): answer an HTTP API's Lambda proxy body it cannot read with 500

Review of #5985: the catch at the end of buildProxyResponse still
answered an HTTP API with 502 and the function's output, for example
when isBase64Encoded is set on a body that is not base64.

Measured on HTTP APIs (eu-west-1), with payload formats 1.0 and 2.0:
API Gateway answers 500 with {"message":"Internal Server Error"} a body
that is an object or a list, an isBase64Encoded it cannot read as a
boolean, and a body said to be base64 that does not decode. It reads
isBase64Encoded's text as Go's strconv.ParseBool does: "True", "TRUE",
"t" and 1 are true, "F" and 0 false, and "tRuE", "yes", 2 and 1.5 are
not read. Floci read true, the text "true" and any integer but 0 as
true, so it relayed "True" and "t" bodies undecoded, "yes" ones as
plain text, decoded a body under 2, and answered an object body 200
with an empty body. A number or a boolean body is still its text.

The catch now answers an HTTP API with the same 500 for a result Floci
cannot parse at all; a REST API keeps its 502.

* refactor(apigatewayv2): decode an HTTP API's base64 body once

Review of #6012: the readability check decoded a base64 body that the
response then decoded again, a second decode and array for every
encoded reply. The catch at the end of buildProxyResponse already
answers an HTTP API with 500 and the generic message, so the check now
looks only at the body's shape, and a body said to be base64 that does
not decode fails where it is decoded and reaches that catch.
2026-10-19 16:40:26 -04:00
Allen Sanborn 65e35adf54 feat(backup): add CreateLogicallyAirGappedBackupVault (#6015)
* feat(backup): add CreateLogicallyAirGappedBackupVault

Route PUT /logically-air-gapped-backup-vaults/{name}. The vault shares the
standard vault namespace and ARN shape; DescribeBackupVault reports VaultType
LOGICALLY_AIR_GAPPED_BACKUP_VAULT, VaultState and the retention days. Both
retention values are required, MinRetentionDays >= 7, MaxRetentionDays >= Min.

The vault is locked at creation so the existing retention enforcement applies,
vault-lock put/delete are rejected on it, and ListBackupVaults honours the
vaultType filter.

Closes #4986

* docs(backup): correct the service matrix operation count

* fix(backup): fail a job whose vault was replaced before it completed

A backup job resolved its vault by name at completion. Deleting a
logically air-gapped (or locked) vault while a job was in flight is
allowed, since it holds no recovery point yet; recreating the name as a
standard vault then received the old job's recovery point, which the
unlocked replacement let be deleted inside the original vault's minimum
retention.

Completion now checks, under the vault-name monitor, that the vault
holding the name is the incarnation the job started in. If not, the job
ends FAILED with no recovery point, as it cannot land in a vault that no
longer exists.

* fix(backup): air-gapped vault LockDate at creation; standard vault VaultType BACKUP_VAULT

CreateLogicallyAirGappedBackupVault now sets LockDate to the creation
date, so the vault's lock reads as compliance mode (immutable) rather
than a governance lock with no LockDate. DescribeBackupVault and
ListBackupVaults report VaultType BACKUP_VAULT for standard vaults,
filled at read time so vaults stored with no VaultType are covered.
2026-10-19 16:24:05 -04:00
Mario Toffia 87aa6f38a1 feat(iot): publish connection lifecycle events (#5277)
* feat(iot): publish connection lifecycle events

The MQTT broker publishes $aws/events/presence/connected and disconnected
for every session, with its session identifier, certificate principal,
version number and disconnect reason, through topic rules and to
subscribers. Topic filters starting with a wildcard no longer match $ topics,
as on AWS.

Closes #5275

* fix(iot): keep lifecycle events within the reset guard

A lifecycle event admits its topic rules under the rule state at the time
of the event, so one queued before an emulator reset skips them. A
DeleteConnection that wins the session tolerates an endpoint the client's
DISCONNECT already closed.

* fix(iot): serialize session transitions and report keep-alive timeouts

Admission, takeover, DeleteConnection and session end now allocate the
versionNumber and change the session map under one lock, with endpoint
I/O kept outside it. A takeover of an endpoint that is already closed
still accepts the new connection.

A close after a full keep-alive period without a packet from the client
is reported as MQTT_KEEP_ALIVE_TIMEOUT, as AWS IoT does. The WebSocket
upgrade carries the client's port, and the wildcard-first exclusion is
limited to the lifecycle topics, which AWS does not deliver to such
filters while it does deliver shadow topics.

* fix(iot): keep ended sessions out of subscriptions and time keep-alive from CONNECT

* test(iot): drive keep-alive tests from an injected nano-time source

The broker takes a LongSupplier nano-time source, as ReloadingKeyManager
does, so the keep-alive unit tests move a fake clock forward instead of
sleeping. The race test uses ThreadStates.awaitBlockedOrDone.
2026-10-19 16:18:54 -04:00
Alessandro Lattao fcb41966a8 fix(cloudformation): read an ECS task definition's properties as the ECS handler does (#6018)
Measured on CloudFormation (eu-west-1): an AWS::ECS::TaskDefinition gets
no template validation. CloudFormation hands the ECS handler every
scalar as text, and the handler converts each to the type the resource
schema declares: an integer is a sign and digits once trimmed, within
32 bits ("+128", " 128", "0128"), and a boolean is true or false in
lower, upper or title case once trimmed. A value it cannot convert
("abc", 4.5 or true for an integer, "yes", "tRuE" or "1" for a
boolean), and an object, a list and a scalar standing for one another,
fail the resource with every violation of the unconverted model, where
every scalar is a String, so a Memory of 128 is listed beside the value
that failed. At each object its missing required members come first,
then its members in the schema's order. When every value converts, the
required members the model lacks fail it alone, grouped where their
paths meet as the schema validator groups them.

Floci read the properties as plain JSON: a Memory of "abc" and a
container without an image were registered, and an Essential of
"False" registered an essential container.

AWS::ECS::TaskDefinition joins the generated cfn-property-types.json,
whose structures now carry the members the schema requires, read into
RequestShapeModel's shapes. CfnPropertyTypes' walk over the shapes is
shared by the template validation Reader and the new HandlerReader,
which differ in how a scalar converts and in what a mismatch does.
2026-10-19 16:15:05 -04:00
Alessandro Lattao e5a206554f refactor(cloudformation): read property types from the vendored resource schemas (#5988)
* refactor(cloudformation): read property types from the vendored resource schemas

Follow-up asked on #5958: the types EventsCfnProvisioner checked a rule
target's members against were written by hand from describe-type, and
LambdaCfnProvisioner named the JSON type of each property it reads. They
now come from src/main/resources/aws/cfn-property-types.json, which
tools/aws/regen_cfn_property_types.py generates from the resource
schemas AWS publishes for us-east-1, in the request shapes' layout so
RequestShapeModel reads it: a structure, list, map or scalar per shape,
and "json" for what a schema leaves free.

The schemas come from AWS's live archive rather than a pinned package.
cfn-lint ships copies, but widens some types: a Lambda environment
variable's value takes any JSON type there and a string in the published
schema, where CloudFormation refuses an object or a list with "Property
[AB] expected type: String, found: JSONObject" (measured). The archive
keeps no older copy, so the generator follows the IAM data's split:
--check is offline and structural and runs on every pull request,
--verify compares a fresh generation with the vendored file and runs in
cfn-schema-drift.yml, weekly and on changes to the file or its generator.

CfnPropertyTypes.Reader walks the vendored shapes instead of type trees,
maps included: a map's values are read as its value shape, and a
mismatch names the key, as CloudFormation does ("Property [h] expected
type: String, found: JSONObject", measured). Every member of a rule
target is now read against its schema type, not only the four #5958
typed, and Lambda reads the properties it already typed through the same
reader, nested members included (VpcConfig.SubnetIds, EphemeralStorage.
Size, ImageConfig.Command, TracingConfig.Mode, Environment.Variables).
The messages for the newly checked members were measured on
CloudFormation (eu-west-1) and are in the tests.

* fix(cloudformation): keep a literal list's blank entries where the template put them

Review of #5988: the reader read every list of strings through the
engine's resolveStringList, which drops blank entries, so a rule
target's HttpParameters.PathParameterValues ["", "b"] became ["b"]
and moved "b" into the first wildcard. CloudFormation passes a literal
list on as written (measured: SecurityGroups ["", "sg-..."] reaches the
target as both). A literal list is now read through the engine's new
resolveLiteralList, which keeps blanks and still expands a list-valued
intrinsic in place; a list an intrinsic yields keeps the engine's
reading. Lambda's literal lists, read through the same reader, keep their
blanks too, for Lambda to judge as on AWS.

resolveLiteralList delegates to the private resolveListElements rather
than opening it: tests that mock the engine and call resolveStringList's
real code would otherwise get the mock's empty list from it, as
IamUserCfnProvisionerTest did.

* refactor(cloudformation): read a launch configuration's MetadataOptions by its schema shape

Review of #5988: #5964, merged after this branch opened, read
AWS::AutoScaling::LaunchConfiguration's MetadataOptions through the type
trees this PR removes. The generator now vendors that resource type too,
and AutoScalingGroupCfnProvisioner reads the block by the shape its
published schema declares (HttpTokens and HttpEndpoint strings,
HttpPutResponseHopLimit an integer, the same types #5964 wrote by hand),
so its tests pass unchanged. The hop limit's type is an anchor of the
generator's offline check.
2026-10-19 12:40:17 -04:00
TATSUNO “Taz” Yasuhiro 2bb69a030b fix(s3): keep a percent sign in a virtual-hosted object key (#6000)
* fix(s3): keep a percent sign in a virtual-hosted object key

A virtual-hosted request for a key such as a%/b failed with 400 or 500.
The same request in path style worked. S3 stores the key as sent in
both styles.

RESTEasy keeps the decoded path of a rewritten request URI and later
decodes it again. S3VirtualHostFilter now escapes the raw path once more,
so routing sees the same path as a path-style request. The request URI
then decodes to /<bucket> plus the raw path, so the virtual-hosted key
check compares against the decoded path.

Fixes #5997

* test(s3): keep only the percent-key cases that guard the fix
2026-10-19 10:57:03 -04:00
Mario Toffia c145fa104c fix(ssm): normalize parameter resource ARNs (#5261)
* fix(ssm): normalize parameter resource ARNs

A parameter's ARN is now arn:<partition>:ssm:<region>:<account>:parameter/<name
without leading slash> for both top-level names and paths, matching AWS. Before,
a top-level name such as foo got parameterfoo.

SsmService.parameterResource(name) is the single formula, used by PutParameter
and by the AWS::SSM::Parameter provisioner, so the CloudFormation Arn attribute
equals the GetParameter ARN.

Tag operations and the internal getParameter(nameOrArn, region) read resolve an
ARN to the stored name and, for parameter/x when only x is stored, fall back to x,
so a top-level parameter is found by its ARN, also with a :version or :label
selector. ECS task secrets pass valueFrom to
that read whole instead of stripping only ":parameter". Legacy parameterfoo ARNs
still resolve.

* test(cloudformation): share the CloudFormation Query request builder

Six CloudFormation integration tests each carried a private copy of the
same Query request builder, as cfn or request. CfnRequests.cfn in testing
replaces them, as RdsRequests.rds does for RDS. A null stack name leaves
StackName out, which the ContinueUpdateRollback validation test needs.
2026-10-19 09:46:50 -04:00
Jackson Price e75b15809f fix(autoscaling): honor launch configuration metadata options (#5964)
* fix(autoscaling): honor launch configuration metadata options

CreateLaunchConfiguration ignored MetadataOptions, so
DescribeLaunchConfigurations never returned them and every instance
launched from the configuration got EC2's defaults, HttpTokens=optional
included.

- The Query handler and the AWS::AutoScaling::LaunchConfiguration
  provisioner read the structure, validate it as EC2 does
  (ValidationError for a value outside the allowed set or range) and
  store it. CloudFormation resolves Fn::If and AWS::NoValue inside it.
- DescribeLaunchConfigurations returns the structure with defaults for
  the members left out, and omits it when it was never given.
- The reconciler passes it to every launch, instance refresh
  replacements included.
- Auto Scaling launches from a launch template, directly or through a
  mixed instances policy, and CreateFleet forward the template's
  metadata options, which they dropped before.

Split out of #5671 at review.

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

* test(autoscaling): clean up after the launch configuration metadata tests

The metadata tests now delete the groups, launch configurations and
stacks they create, so later reconcileAll calls in the shared test
application stop reconciling leaked groups. They build their
Authorization headers with EnforcementFixtures.auth, and the case that
expects no MetadataOptions first checks that the launch configuration
was found.

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

* fix(autoscaling): word metadata option errors as Auto Scaling does

CreateLaunchConfiguration refused bad MetadataOptions with EC2's
InvalidParameterValue text under a ValidationError code. It now answers
with Auto Scaling's model-validation text, for example "1 validation
error detected: Value '65' at 'metadataOptions.httpPutResponseHopLimit'
failed to satisfy constraint: Member must have value less than or equal
to 64", and reports every invalid member of the structure in one
error, "N validation errors detected: ...; ...". EC2's validator is no
longer shared.

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

* fix(cloudformation): refuse list or object launch configuration metadata members

A MetadataOptions member given as a list or an object, such as
HttpTokens: [required], read as an empty string and so as absent: the
launch configuration was created with that member at its default,
HttpTokens=optional included. Such a member now fails the resource with
ValidationError, as the whole structure already does when it is not an
object.

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

* test(autoscaling): cover every metadata member in the combined error

The test that sends several invalid MetadataOptions members now makes
all three invalid, so the position of HttpEndpoint in the combined
ValidationError is checked, and confirms that no launch configuration
was created.

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

* fix(cloudformation): report metadata type errors as CloudFormation does

A launch configuration MetadataOptions block or member of the wrong
JSON type failed with wording Floci made up, such as "HttpTokens must
be a string.". It now fails with CloudFormation's schema type error, as
the S3 and DynamoDB provisioners already report it, for example "Model
validation failed (#/MetadataOptions/HttpTokens: expected type: String,
found: JSONArray)". A value of the right type that Auto Scaling rejects
keeps Auto Scaling's ValidationError.

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

* fix(cloudformation): report an oversized metadata hop limit as out of range

A whole-number HttpPutResponseHopLimit too large for an int, such as
2147483648, failed with the contradictory "expected type: Integer,
found: Integer". It is an integer outside 1 to 64, so it now fails with
the same Auto Scaling ValidationError text as 65 or 0, with the value
as written.

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

* fix(cloudformation): count an oversized hop limit with the other metadata errors

An oversized CloudFormation HttpPutResponseHopLimit was refused before
the other MetadataOptions members were checked, so an invalid
HttpTokens beside it went unreported, and the value was echoed as
written, "+002147483648" included. Auto Scaling now builds the whole
error from the options and the hop limit as a BigInteger, so the
oversized value is counted with every other violation and printed as
a plain number.

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

* refactor(autoscaling): build metadata option errors through SmithyValidationErrors

The launch configuration MetadataOptions validator assembled its "N
validation errors detected" message by hand. It now uses
SmithyValidationErrors, which main adopted for Auto Scaling's other
checks. The error code and text are unchanged.

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

* fix(cloudformation): read launch configuration metadata through CfnPropertyTypes

The MetadataOptions reader had its own type check and answered every
wrongly typed value with the handler's "Model validation failed"
message. It now reads the block through CfnPropertyTypes, as the Events
and Lambda provisioners do:

- a value of the wrong type fails template validation first, for
  example "Property [HttpTokens] expected type: String, found:
  JSONArray", and a hop limit of 4.5 is "found: Float";
- a hop limit beyond 32 bits fails the handler's model validation,
  before Auto Scaling's own check runs;
- a number or a boolean given for a string member arrives at Auto
  Scaling as its text, as CloudFormation converts it, and fails its
  enum check there.

The hand-written type helpers go away.

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

* refactor(autoscaling): fold the metadata options error back into its validator

The public metadataOptionsError took the hop limit as a BigInteger so
that CloudFormation could report a value beyond 32 bits through it.
CloudFormation now refuses such a value in model validation, before
Auto Scaling, so the helper goes back to a private validator over the
Integer field. The error code and text are unchanged.

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

* test(ec2): delete the launch template the metadata test creates

Ec2LaunchTemplateMetadataOptionsIntegrationTest never deleted its
launch template, and its cleanup began only after the fleet or group
had launched, so an earlier failure left everything behind. Everything
after the template is created now runs in the try block, and the
finally block removes the group or the instance and then the template,
ignoring the status so a test's own failure is kept.

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

* fix(ec2): check template metadata options before a CreateFleet dry run

A launch template stores its metadata options unchecked, as AWS does,
so they fail at launch. CreateFleet forwards them to the launch since
this branch, but a dry run returned DryRunOperation before any launch
ran, saying a fleet would succeed that then fails with
InvalidParameterValue. CreateFleet now checks every launch's metadata
options with the rest of its pre-launch checks, as RunInstances does
before honoring DryRun.

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

* test(autoscaling): pin the Query answer for a hop limit beyond 32 bits

CreateLaunchConfiguration with MetadataOptions.HttpPutResponseHopLimit=
2147483648 answers MalformedInput, as for any value that is not a
32-bit integer: the awsQuery protocol binds the member before model
validation runs. A row now covers it beside the non-numeric case.

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 09:42:58 -04:00
Huan Jiang 3a913ca8d6 fix(s3): ignore hoisted upload checksum query parameters (#5977)
* fix(s3): ignore hoisted upload checksum query parameters

* fix(s3): ignore hoisted multipart checksum types
2026-10-19 09:30:12 -04:00
Alessandro Lattao 49d2d74f3f fix(apigatewayv2): answer the Lambda proxy results an HTTP API cannot read with 500 (#5985)
* fix(apigatewayv2): answer the Lambda proxy results an HTTP API cannot read with 500

Measured on HTTP APIs (eu-west-1), with payload formats 1.0 and 2.0:
a function that raises is answered 500 with {"message":"Internal Server
Error"}, not the 502 Floci sent. The same 500 answers what API Gateway
cannot read as a response: in format 1.0 a result that is not an object
with a statusCode (a result without one, a string, a number, null), and
in either format a statusCode that is not a whole number from 100 to 599
(99, 600, 201.5, "abc"); a statusCode given as text that spells one,
"201", is taken, and headers that are not an object are left out.
Format 2.0 keeps inferring a 200 for a result without a statusCode.

Floci answered a format 1.0 result without a statusCode with 200 and
its headers and body, as HttpApiLambdaProxyResponseInferenceIntegrationTest
pinned since #5153; AWS answers 500, and that test and the unit tests
that pinned 502 now expect what AWS answers. A REST API's Lambda proxy
keeps its own 502, untouched.

The HTTP API's generic error responses come from one helper, which the
invocation failures from #5935 (500, or 503 when Lambda throttles) use
too.

* test(compat): skip the HTTP API proxy cases unless the API reaches Lambda

Review of #5985: the test checked only that Lambda can be invoked, not
that API Gateway dispatches to it. It now sends a readable result through
the API first, as ApiGatewayV2ExecuteTest does, and skips the cases when
that does not come back.
2026-10-19 09:18:20 -04:00
David Phillips 84dfb77f99 fix(acm): reject mismatched certificate private keys (#5987)
Preserve existing certificates when an import supplies the wrong key.
2026-10-19 09:00:35 -04:00
Alessandro Lattao 98b2429e58 fix(ecs): launch a container with its linuxParameters, checked as RegisterTaskDefinition does (#5951)
* fix(ecs): launch a container with its linuxParameters, checked as RegisterTaskDefinition does

RegisterTaskDefinition kept a container's linuxParameters and
DescribeTaskDefinition returned them, but the container was launched
without any of them. A worker that set initProcessEnabled so its orphaned
browser processes would be reaped ran with its own command as PID 1, and
they stayed zombies until the container ended; capabilities, devices,
/dev/shm size, tmpfs mounts and swap limits were ignored the same way.

ECS documents each member as a docker run option, and the container is
now created with them: initProcessEnabled is --init (through
ContainerSpec.init, the flag main already has for it), capabilities are
--cap-add and --cap-drop, devices are --device (read, write and mknod when
no permissions are given, at the host path when no container path is),
sharedMemorySize is --shm-size in MiB, each tmpfs entry is a --tmpfs of
its size in MiB with its mount options, maxSwap is --memory-swap as the
container's hard limit plus that many MiB, and swappiness is
--memory-swappiness. ContainerSpec gains LinuxOptions for the rest,
applied in ContainerLifecycleManager's HostConfig; a constructor with the
former signature keeps every other caller unchanged.

A container behind a security group already had NET_ADMIN and NET_RAW
dropped, because the group is enforced by nftables in the namespace the
task's containers share. Docker applies a named --cap-add over a
--cap-drop, so those two are now also removed from what the container
asks to add; ALL can stay, since Docker grants every capability but the
dropped ones then (measured: docker run --cap-add ALL --cap-drop NET_ADMIN
--cap-drop NET_RAW reports CapEff 000001ffffffcfff, bits 12 and 13 clear).

Measured on RegisterTaskDefinition (eu-west-1, 2026-10-03 and 2026-10-16),
with the SDK's own validation off, and now checked the same way before
anything is stored:
- every capability must be one the KernelCapabilities reference lists, in
  any case and without a CAP_ prefix ("Unrecognized Linux capabilities in
  add: [CAP_NET_ADMIN]", likewise for drop);
- a device needs a hostPath ("Device cannot have empty hostPath") and only
  read, write and mknod as permissions, as written ("Invalid permission:
  READ for device /dev/null");
- a tmpfs mount needs a containerPath, a size above zero and options the
  Tmpfs reference lists, as written ("The NOEXEC tmpfs mount option
  specified is invalid.");
- sharedMemorySize must be above zero, maxSwap zero or more and needs a
  swappiness ("When a container has a swap memory, it must also specify a
  swappiness value."), from 0 to 100;
- the checks run capabilities, devices, tmpfs, then swap, all before the
  Fargate rules;
- on Fargate a non-empty devices list, sharedMemorySize, maxSwap and
  swappiness are refused in that order ("Fargate compatible task
  definitions do not support devices", with no trailing period, unlike
  AWS's other Fargate refusals), and any capability added but SYS_PTRACE
  as written ("NET_ADMIN is not allowed on Fargate.");
- a swappiness without maxSwap is accepted and dropped, and capabilities
  are stored with both an add and a drop list.

EcsLinuxParameters holds all of it, validation, the stored form and the
launch, and reads the members through one set of helpers, so EcsService
only calls it.

Not done: swap is not limited for a container with no hard memory limit,
since Docker cannot limit swap without one, and a daemon on cgroup v2
discards swappiness, as Amazon Linux 2023 does on ECS.

Tests: EcsLinuxParametersTest and ContainerLifecycleManagerLinuxOptionsTest
for what reaches Docker, EcsLinuxParametersDockerIntegrationTest for a
real container (PID 1, capabilities, device, /dev/shm, tmpfs),
EcsFargateEdgeCaseIntegrationTest for the measured refusals and the stored
form, and EcsLinuxParametersRegistrationTest in sdk-test-java for the
same through the SDK.

* fix(ecs): read linuxParameters as RegisterTaskDefinition does, and guard devices like host volumes

Review of #5951 (Qodo).

A device hands the container the host's hardware, and reached Docker with
no check, where a host volume at the same path is refused by default.
HostVolumePolicy now covers each device's hostPath too, naming the field
it checks: refused unless floci.services.ecs.host-volume-roots holds it or
allow-unsafe-host-volumes is set, at RegisterTaskDefinition after AWS's
own checks (so their messages still come first) and again at launch,
through EcsContainerManager.checkDeviceHostPaths. The registration check
sits in EcsService rather than beside the host volume one in
EcsJsonHandler, so a template's definition gets it too.

Measured with raw requests on RegisterTaskDefinition (eu-west-1,
2026-10-18):
- a member of the wrong JSON type is refused with an
  InvalidParameterException from the deserializer, before any rule on the
  values: "Unexpected field type" for a scalar where an object or a list
  is expected, "Unexpected value type in payload" for a device or a tmpfs
  mount that is not an object, "Start of structure or map found where not
  expected" for an object where a list or a scalar is expected,
  "NUMBER_VALUE cannot be converted to String", "STRING_VALUE cannot be
  converted to Integer", "TRUE_VALUE ...", "NUMBER_VALUE cannot be
  converted to Boolean", "Unexpected token received from parser" for text
  that is not true or false, and no message at all for a list where none
  is expected;
- numbers are read as integers, the fraction dropped (sharedMemorySize
  1.9 is stored as 1, 0.5 as 0 and refused) and the range capped
  (3000000000 is 2147483647); a boolean may come as text in any case; a
  null member or list entry is absent, and a null device is an empty one.

Floci kept such values as written and silently skipped what it could not
read, so a definition stored one size and launched another. The stored
form now holds what AWS stores.

Tests: EcsFargateEdgeCaseIntegrationTest for every measured shape, the
stored numbers, booleans and nulls, and a device refused by default; the
Docker test allows /dev/null through host-volume-roots. All fail on the
previous head.

* refactor(ecs): check linuxParameters' JSON types against the vendored ECS model

Review of #5951. EcsLinuxParameters hand-wrote the deserializer's type
check member by member, where Floci already drives that check from
botocore for DynamoDB and SES v2 (RequestShapeModel, with the shapes
vendored by tools/aws/request_shapes.py).

tools/aws/regen_ecs_shapes.py vendors botocore's ECS model as
src/main/resources/aws/ecs-request-shapes.json (botocore 1.43.113, the
release requirements.txt pins), registered in make aws-data-sync and
aws-data-check and in the shared generator's tests. EcsRequestShapes
walks a container's linuxParameters against the LinuxParameters shape
with ECS's InvalidParameterException messages, the ones measured on
RegisterTaskDefinition; EcsLinuxParameters' own member list is gone.
The messages and their order are unchanged.

The device change named host volumes only in two more descriptions of
floci.services.ecs.host-volume-roots: docs/configuration/
environment-variables.md and the configuration table in
docs/services/ecs.md now name devices too, as does the host volume
section and the allow-unsafe-host-volumes Javadoc.

Tests: EcsRequestShapesTest for every measured message against the
vendored model; EcsFargateEdgeCaseIntegrationTest passes unchanged.

* refactor(core): walk request shapes once, with each service's messages

Review of #5951: EcsRequestShapes walked the vendored model the same way
DynamoDbRequestShapes and SesV2RequestShapes do (a null is absent, an
unknown member is skipped, a structure's values are read as members and a
list's or a map's as elements, a boolean reads from "true" or "false" in
any case, a scalar of the wrong kind is named by its JSON token), with only
the error code and a few messages apart. That walk is now
RequestShapeCheck, next to RequestShapeModel in core.common, and each
service hands it its deserializer's wording as RequestShapeCheck.Messages:
DynamoDB's SerializationException with DECIMAL_VALUE and the base-64
message for a blob, SES v2's SerializationException with its "can not be
converted to a" wording and only strings and blobs checked, as probed, and
ECS's InvalidParameterException with no message for a list where none is
expected.

The three services' tests pass unchanged. SES v2's wording becomes
constants in SesV2Json, which its member helpers and the walk share.
2026-10-18 22:21:54 -04:00
Alessandro Lattao d60c973865 fix(cloudformation): keep a rule target's dead-letter queue, retry policy, role and ECS parameters (#5958)
* fix(cloudformation): keep a rule target's dead-letter queue, retry policy, role and ECS parameters

EventsCfnProvisioner built each AWS::Events::Rule target from Id, Arn, the
inputs, HttpParameters, SqsParameters and BatchParameters only. A target's
DeadLetterConfig and RetryPolicy were dropped, so ListTargetsByRule showed
neither, delivery ran on the defaults (185 attempts over 24 hours) and an
event the target could not take was logged and lost instead of reaching the
queue the stack declared. RoleArn and EcsParameters, which PutTargets keeps,
were dropped as well.

Targets set through PutTargets already get the delivery semantics from
TargetDispatcher, so the provisioner now passes the four members through,
validated by putTargets as the API validates them. EcsParameters is converted
to the API's shape: the resource schema spells AwsVpcConfiguration,
PlacementStrategies, TagList and the placement and capacity provider items
differently from the EventBridge API, which spells them awsvpcConfiguration,
PlacementStrategy, Tags and in camel case; ListTargetsByRule on AWS returns
the converted shape (measured). RoleArn is stored, not used for delivery, as
Floci does not invoke targets under the role.

Targets is resolved once, with the engine's resolveNodeOmittingNoValue, so an
Fn::If choosing the whole list works, and a member, a list item or an Fn::If
branch that is AWS::NoValue is left out of the call while a literal "" stays.
An earlier version marked AWS::NoValue itself before resolving, with a
sentinel; the engine's rule does the same without one.

The four members are read against the types AWS::Events::Rule's resource
schema gives them, before the rule exists, with the messages measured on
CloudFormation (eu-west-1): template validation's "Property
[MaximumRetryAttempts] expected type: Integer, found: Float", and the
handler's "Model validation failed (#/Targets/0/EcsParameters/
EnableECSManagedTags: expected type: Boolean, found: String)" for what only
the handler refuses, which waits until every target has passed template
validation, as on AWS. What CloudFormation converts is converted the same
way: "4" is 4, "TRUE" is true, 5 in a list of strings is "5". Reading them
with convertValue alone truncated 4.5 to 4, ignored a RetryPolicy given as a
string and failed on "abc" with Jackson's message.

A list of strings (Subnets, SecurityGroups) takes every form that yields a
list on AWS, as Lambda's list properties do since #5923 and #5949: a Ref to a
CommaDelimitedList, Fn::Split and an Fn::If choosing either, also inside an
EcsParameters an Fn::If chooses; a Ref to a String is refused (measured).
That is why the reader walks the template as written, with the engine's
omitNoValue, now public, and resolves each call it meets, instead of
checking the resolved tree, where a CommaDelimitedList is already text.

The check is the new CfnPropertyTypes, which also takes over
LambdaCfnProvisioner's requireType and its list-of-strings reading, so
template validation has one implementation for both provisioners.

* test(cloudformation): read the rule's only target without List.getFirst

The SDK compatibility tests compile for Java 17, which has no
List.getFirst; the image build of sdk-test-java and ec2-containers failed
on it. A local JDK 25 with source 17 does not check the API, so the class
was compiled again with --release 17.

* test(compat): wait for a stack 50 ms at a time against Floci

Review of #5958: TestFixtures.awaitStackTerminal slept 500 ms between
checks, so each stack, which Floci finishes in milliseconds, cost at least
half a second. It now checks every 50 ms against Floci, as the integration
tests' CfnStackWaits does, and keeps 500 ms against real AWS. The rule
target test waits 10 seconds for a stack against Floci instead of 60, and
10 minutes against AWS, where the queues take minutes.
2026-10-18 22:05:03 -04:00
David Phillips 678c5b82a6 fix(rds): require database role grants for PostgreSQL IAM login (#5945)
* fix(rds): require database role grants for PostgreSQL IAM login

* fix(rds): preserve standard proxy IAM authentication

* fix(rds): report PAM refusal for IAM member passwords
2026-10-18 20:44:10 -04:00
David 7dc514b52f feat(emr): ListReleaseLabels, DescribeReleaseLabel and ListSupportedInstanceTypes (#5748)
* feat(emr): ListReleaseLabels, DescribeReleaseLabel and ListSupportedInstanceTypes

None was served, so Terraform's aws_emr_release_labels and
aws_emr_supported_instance_types data sources failed against Floci.

A curated catalogue of EMR releases (emr-7.5.0, Floci's default, and
emr-7.4.0, emr-6.15.0, emr-6.14.0 and emr-5.36.2) carries each
release's applications and versions from the EMR Release Guide and its
recent Amazon Linux releases, with common instance types and their EC2
sizes. The three actions filter and page it as the API documents, and
answer InvalidRequestException for an unknown release, a bad token or
an out-of-range MaxResults. A configured default release outside the
catalogue is still listed.

Closes #5734

* fix(emr): report EMR architecture values and match application versions without regard to case

ListSupportedInstanceTypes returned the EC2 spellings x86_64 and arm64; the EMR model gives X86_64 and AARCH64 for Architecture. The ListReleaseLabels application filter matched the name without regard to case but not the version, so phoenix@4.14.3-hbase-1.4 missed emr-5.36.2.

* refactor(emr): page the release catalogue with the shared Pagination

ListReleaseLabels and ListSupportedInstanceTypes now page through
core.common.Pagination, with the filters in the token namespace so a token
replayed with other filters, or altered, is refused. DescribeReleaseLabel
answers every application, as AWS reserves its MaxResults and NextToken.
The EMR integration tests share one request helper.
2026-10-18 15:11:42 -04:00
Alessandro Lattao 1f4a46804c fix(cloudformation): refuse a list property that a parameter or an intrinsic makes a string (#5949)
* fix(cloudformation): refuse a list property that a parameter or an intrinsic makes a string

The follow-up asked on #5923. The engine kept parameter values but not
their types, so the Lambda provisioner's list readers could not tell a
Ref to a CommaDelimitedList parameter, which the engine resolves to the
comma-joined text, from a Ref to a String parameter: both read as lists,
where CloudFormation refuses the second.

Measured on CloudFormation (eu-west-1, 2026-10-18), Layers and
Architectures of AWS::Lambda::Function:
- a Ref to a CommaDelimitedList, AWS::SSM::Parameter::Value<List<String>>
  or AWS::SSM::Parameter::Value<CommaDelimitedList> parameter, Fn::Split,
  an Fn::If choosing a Ref to a list, and Ref AWS::NotificationARNs are
  lists;
- a Ref to a String or Number parameter, Ref AWS::Region, Fn::Select,
  Fn::Join, Fn::Sub and an Fn::If choosing a literal string fail the
  template's validation with "Property [Architectures] expected type:
  JSONArray, found: String";
- a resource's Ref and Fn::GetAtt fail only when the resource is
  provisioned, with "Properties validation failed for resource Fn with
  message: #/Architectures: expected type: JSONArray, found: String".

CloudFormationTemplateEngine now takes the declared parameter types, which
executeTemplate reads from the template (stacks, change sets, stack sets
and nested stacks all deploy through it), and yieldsString tells the
forms of the second group. The list readers refuse such an intrinsic
with the validation message, as they refuse a literal of the wrong type.
The third group is left as it was: the engine cannot tell a list-valued
attribute from a string one before provisioning, and a resource's own
message format is not modelled.

parameterType gives a declaration's Type, String when it is left out, for
the new reader and for GetTemplateSummary, which had its own copy.

Tests: CloudFormationTemplateEngineTest for yieldsString over every
measured form; CloudFormationLambdaObjectPropertyIntegrationTest for each
refused form, an Fn::If choosing a list, and a nested stack whose own
parameter types decide; CloudFormationLambdaObjectPropertyTest in
sdk-test-java for a String parameter through the SDK. The integration and
SDK tests fail on main.

* fix(cloudformation): take Fn::Base64 as a string where a list is expected

Review of #5949 (Qodo). Measured on CloudFormation (eu-west-1,
2026-10-18): Architectures: {"Fn::Base64": "x86_64"} fails validation with
"Property [Architectures] expected type: JSONArray, found: String", like
Fn::Sub. yieldsString left it out, so the Lambda reader split the encoded
text into a list and the function got an invalid architecture instead.

Tests: CloudFormationTemplateEngineTest and
CloudFormationLambdaObjectPropertyIntegrationTest gain the case; both fail
on the previous head.
2026-10-18 14:32:04 -04:00