Commit Graph
561 Commits
Author SHA1 Message Date
TiM e023ae9ff4 fix(s3): refuse DeleteBucket while versions or delete markers remain (#5548)
* fix(s3): keep versioned buckets until history is purged

Reject DeleteBucket while any account-scoped object metadata remains under the bucket prefix. Cover hidden versions and markers through service, HTTP, and persistent storage tests, and purge them in CLI and Java compatibility cleanup.

* test(s3): purge versioned enforcement fixtures

Delete every listed object version and marker before removing fixture buckets, repeating the first page so deletions do not invalidate continuation markers. Cover null versions, mixed history, and a page boundary inside one key with a direct bucket absence assertion; register the formerly exempt versioned fixture for cleanup.

* test(s3): assert fixture purge removes a null version

Seed an untouched object before enabling versioning and assert that ListObjectVersions reports its literal null version ID. This makes the direct purge guardrail exercise the null-version branch as intended.

* test(s3): encode versioned fixture keys during purge

* test(s3): share SDK bucket cleanup helper
2026-10-13 10:21:42 -04:00
David Phillips 41517f3c2f fix(autoscaling): pause suspended capacity adjustments (#5545)
* fix(autoscaling): pause suspended capacity adjustments

* test(autoscaling): cover suspended capacity through AWS clients

* fix(autoscaling): coordinate suspension with capacity changes

* fix(autoscaling): keep capacity locks within each account

* test(autoscaling): check suspension without scheduler waits
2026-10-13 09:37:17 -04:00
XuJian ebae2ba0e0 feat(cloudformation): provision Cognito resource servers (#4832)
* feat(cloudformation): provision Cognito resource servers

* fix(cloudformation): align rollback tests with deletion cleanup

* fix(cloudformation): abandon exhausted Cognito replacement cleanup

* fix(cloudformation): verify Cognito resource server ownership

* test(cognito): use switch expression for ownership writers

* fix(cloudformation): share optional resolution and delete cleanup hooks

* fix(cognito): use resource server API addresses for stack lifecycle

* fix(cloudformation): avoid repeated Cognito cleanup on stack deletion

* fix(cloudformation): keep consumed resource server cleanup removed

* fix(cloudformation): abandon exhausted Cognito cleanup

* test(cloudformation): cover Cognito resource servers with AWS SDK

* fix(cloudformation): validate Cognito scopes and replace missing servers

* refactor(cloudformation): keep Cognito resource server change scoped
2026-10-12 23:20:09 -04:00
jwoa95 0edb6993ce fix(ses): require a verified sender to send email (#5156)
SendEmail, SendRawEmail and SendTemplatedEmail (v1) and SendEmail (v2)
accepted any Source or FromEmailAddress, so a send from an address that
was never verified succeeded and landed in /_aws/ses. The SendEmail API
Reference says "The message must be sent from a verified email address
or domain", and AWS rejects anything else with MessageRejected.

The send path now checks every address the developer guide names for
this error ("This error could apply to the "From", "Source", "Sender",
or "Return-Path" address"): the Source or FromEmailAddress, the
ReturnPath or FeedbackForwardingEmailAddress and, on a raw message,
every mailbox of its From header, its Sender and its Return-Path
header. A v2 raw send reads the From header only in place of a missing
FromEmailAddress and accepts any From header when one is given
(probe-confirmed), so the header is checked only then. An address
counts as verified when the address itself, its domain or a parent
domain is a verified identity ("if you create and verify an identity
for example.com, you don't need to create separate identities for
a.example.com, a.b.example.com, user@example.com, user@a.example.com").
The error matches AWS: one MessageRejected, "Email address is not
verified. The following identities failed the check in region
US-EAST-1: <address>, <address>", and nothing is captured or relayed.
The check runs after the request's own validation, so the existing
error order is unchanged.

A delegate sender names the owner's identity with SourceArn, FromArn
and ReturnPathArn, their X-SES-SOURCE-ARN, X-SES-FROM-ARN and
X-SES-RETURN-PATH-ARN headers, or v2 FromEmailAddressIdentityArn and
FeedbackForwardingEmailAddressIdentityArn. These are now read (a
parameter wins over its header, and only the first instance of a header
counts), and an address covered by another account's identity ARN is
not checked against the caller's identities. Floci does not evaluate
sending-authorization policies, so it lets such a send through, as it
did before. On a raw send the source ARN also covers the From and
return-path addresses that have no ARN of their own, as SendRawEmail
describes.

Cognito's verification codes and invitations go through SES too, from
Cognito's own no-reply@verificationemail.com or a pool's
EmailConfiguration sender that Cognito has already found verified. They
now use a separate entry point, sendServiceEmail, that skips the check.

Tests and compatibility tests that sent from an unverified address now
verify it first; where a test sent from an address under a domain
identity, the domain is verified by publishing its DKIM records, since
Floci keeps a domain Pending until they exist. SesDomainIdentityTestHelper
does that, and the two copies of the same setup in the configuration-set
tests and the one in SesV2IntegrationTest now use it.

Closes #5141
2026-10-12 23:11:15 -04:00
Priamo Germosen cd4703bbcc test(iam): round-trip the Organizations access report through the SDK (#5492)
The compatibility suite's IamTest covers the last-accessed trio and not this
pair, and only a real client settles whether the XML parses: the RestAssured
tests pull fields out of the document by path, which says nothing about a
strict client accepting it.

The round trip builds an organization with service control policies enabled on
its root, generates a report for the root's entity path and reads it back. What
the SDK has to parse rather than the test asserting on strings: the 36
character job id, JobStatus as the modeled enum, both dates as instants, and
every AccessDetail with its two required members, a zero count and no attempt
details, which is the shape the reference's own example gives a service nobody
reached. The counts describe the whole report while the member list is one
page, so the marker is followed once and the page it points at is held to the
same assertions, down to the members: nothing says a later page carries the
same shape.

The organization is built under a management account of its own, so it never
contends with the one the Organizations suite builds for the default account,
and it is deleted in a finally inside the clients' try-with-resources, so the
delete runs before they close and both close whichever way the assertions go.
The suite assumes a fresh instance, and an organization left behind would fail
the next run instead of this one.

Follow-up to the review note on #5467.
2026-10-12 20:51:42 -05:00
Vũ Thế Huy b318794fa2 fix(elasticache): use the AWS wire codes UserNotFound and UserAlreadyExists (#5452)
* fix(elasticache): use the AWS wire codes UserNotFound and UserAlreadyExists

* fix(elasticache): tolerate UserNotFound on CFN user delete and fix SDK test assertions

The CloudFormation user delete still tolerated the old UserNotFoundFault
code, so deleting a stack whose user was already gone would report
DELETE_FAILED. The SDK compatibility test also asserted
UserAlreadyExistsException on the duplicate replication group test
instead of the duplicate user test.
2026-10-12 21:47:33 -04:00
Vũ Thế Huy ae75a653d6 feat(redshift-data): add async execution and statement status events (#5383)
* feat(redshift-data): add async execution and statement status events

* fix(redshift-data): address review findings on async Data API

- Mark a statement FAILED when its worker dies unexpectedly instead of leaving it active
- Let unexpected publisher errors propagate; the delivery pool logs them at error level
- Run CREATE/DROP INDEX CONCURRENTLY, REINDEX CONCURRENTLY, ALTER SYSTEM and tablespace DDL outside a transaction
- Drop WaitTimeSeconds from Scheduler targets so the shared dispatcher thread never blocks
- Share result rows and column metadata between snapshots; ListStatements no longer copies results
- Replace the global monitor with a ReentrantReadWriteLock for status writes and reset

* fix(redshift-data): reject CancelStatement on terminal statements

- Throw ValidationException ("Could not cancel a query that is already in <STATE> state.") instead of returning Status false, as AWS does
- Use WaitTimeSeconds instead of 30 s polling in the Serverless compatibility test and the Spectrum integration test

* fix(redshift-data): match AWS CancelStatement message and tidy test signature

- Append "with ID: <id>" to the terminal-state ValidationException message
- Drop the unused throws InterruptedException from workgroupLifecycleUsesAwsSdk
2026-10-12 19:46:58 -04:00
Mohith 431748f740 fix(ecs): launch service tasks through capacity provider strategies (#5500) 2026-10-12 16:46:32 -04:00
lex00 991bf3ab9e fix(autoscaling): round-trip InstanceMaintenancePolicy, AvailabilityZoneDistribution, CapacityReservationSpecification, ServiceLinkedRoleARN, WeightedCapacity and EnabledMetrics (#5513)
* fix(autoscaling): round-trip InstanceMaintenancePolicy, AvailabilityZoneDistribution, CapacityReservationSpecification, ServiceLinkedRoleARN, WeightedCapacity and EnabledMetrics

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

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

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

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

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

Roles and customer managed policies are listed in name order so a marker
keeps pointing at the same place between calls.
2026-10-12 15:40:59 -04:00
outofplaceandPriamo 5092713a6e feat(cognito): support passkeys (WebAuthn) registration and sign-in (#5102)
* feat(cognito): register passkeys and sign in with WEB_AUTHN

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

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

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

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

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

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

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

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

---------

Co-authored-by: Priamo <pgermosen@gmail.com>
2026-10-12 15:27:36 -04:00
Aniket Shukla 2823a15c35 test(s3): cover ignored multi-range requests through the SDK (#5506) 2026-10-12 14:58:31 -04:00
Jay 669548277f fix(cloudformation): apply an S3 bucket's NotificationConfiguration (#5493)
* fix(cloudformation): apply an S3 bucket's NotificationConfiguration

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

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

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

The notification integration test polled DescribeStacks with a private helper
that waits out the CREATE_FAILED or UPDATE_FAILED a stack shows on its way to a
rollback, which awaitTerminal returns on. It is now CfnStackWaits.awaitStatus,
so other suites can wait for a rollback the same way.
2026-10-12 14:22:51 -04:00
Som Samantray 34c11b8981 fix(cognito): include domains in user pool responses (#5448)
* fix(cognito): include domains in user pool responses

* test(cognito): cover UpdateUserPool domain fields

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

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

* fix(cognito): drop redundant domain delete lock
2026-10-12 12:09:33 -04:00
David Phillips 03a0dfefdd fix(rds): honor restore IAM flags and reject malformed booleans (#5473)
* fix(rds): reject malformed restore flags

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

* fix(rds): honor IAM settings on instance snapshot restore
2026-10-11 23:25:34 -04:00
David Phillips b86268e459 fix(ec2): preserve original Spot instance user data (#5468)
* fix(ec2): preserve original Spot instance user data

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

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

* refactor(ec2): simplify Spot user-data handling
2026-10-11 18:27:48 -04:00
Mario Toffia 8c61aa441d fix(cloudformation): report CREATE events for a resource an update adds (#4932)
A logical id the stack did not hold before an UpdateStack is created, so AWS
reports CREATE_IN_PROGRESS and CREATE_COMPLETE (or CREATE_FAILED) for it and
DescribeStackResource shows CREATE_COMPLETE. Floci used the stack-wide update
flag and reported UPDATE_* instead. The resource loop now decides per resource
from whether the stack held it; stack-level statuses and the rollback of an
added resource are unchanged.
2026-10-11 15:12:12 -04:00
Mario Toffia 9a7ec1c9d0 fix(dynamodb): mark time-to-live deletions on the stream as AWS does (#4930)
AWS writes a TTL deletion to the table's stream as a REMOVE record whose
userIdentity names the DynamoDB service. A DeleteItem removal has none.
The member names depend on where the record is read:

- The DynamoDB Streams API (GetRecords) capitalises them, as the SDK's
  Identity shape expects:
  {"PrincipalId": "dynamodb.amazonaws.com", "Type": "Service"}.
- The Lambda and EventBridge Pipes event record and the Kinesis Data
  Streams destination payload use lowercase names,
  {"type": "Service", "principalId": "dynamodb.amazonaws.com"}, the
  shape the developer guide's TTL filter pattern matches.

With the DynamoDB Local engine, Floci passed Local's record through as
is: eventName UNKNOWN_TO_SDK_VERSION and no userIdentity.
DynamoDbLocalBackend now rewrites such records in a successful Streams
GetRecords reply to REMOVE with the Streams API identity, the one place
the public API, the Lambda poller, Pipes and the Redshift zero-ETL
consumer all read through.

The native engine wrote REMOVE but no identity, so a TTL deletion could
not be told from a DeleteItem. The sweep now marks its stream records
(a new in-memory DynamoDbStreamRecord flag) and its Kinesis CDC records.
GetRecords writes the Streams API identity, and the Kinesis record the
lowercase one.

The Lambda event source mapping poller and the Pipes poller rename the
Streams API identity to the event record shape before filtering and
delivery. DynamoDbTtlIdentity.Shape holds the member names of every
output. DeleteItem removals are unchanged.
2026-10-11 09:42:23 -04:00
David Phillips 80e8b7465d fix(ec2): preserve endpoint IP types across updates and templates (#5438)
* fix(ec2): preserve endpoint IP types across updates and templates

* fix(ec2): honor omitted endpoint address types in templates
2026-10-11 09:06:25 -04:00
David PhillipsandJason van Zyl 47d1e10e5c fix(ec2): preserve VPC endpoint IP address types (#5427)
* fix(ec2): preserve SDK endpoint compatibility

Return endpoint states that AWS SDK clients recognize and preserve the
requested address family, so endpoint create and describe responses
round-trip correctly. Keep documented state-filter values working.

* fix(ec2): preserve saved endpoint states and reject invalid IP types

* fix(ec2): reject unsupported endpoint IP types safely

* fix(ec2): retain endpoint states and address-type metadata

---------

Co-authored-by: Jason van Zyl <jason@vanzyl.ca>
2026-10-11 00:34:40 -04:00
XuJian 58ac05433a fix(ses): return Easy DKIM signing hosted zone (#5068)
* fix(ses): expose DKIM signing hosted zone

* fix(ses): keep DKIM signing hosted zone constant

* fix(ses): align signing zone tests with review
2026-10-10 15:13:20 -04:00
Mario Toffia 1082941bc2 feat(iot): search the supported fleet index subset (#4913)
Floci served the fleet indexing configuration but not SearchIndex, so
an application that finds its things by name, type, group or attribute
got "Unknown operation: POST /indices/search".

SearchIndex now runs on POST /indices/search over the things of the
caller's account and region, in thing name order. Its page token names
the last thing returned, so a page continues after it even when things
before it were deleted, as measured on AWS. Like AWS's, a token
continues only the request that issued it: another queryString, or an
indexName or queryVersion sent differently, is "nextToken was from a
request with different parameters", and an empty, forged, edited or
truncated token is "Invalid nextToken". A new parser,
IotFleetIndexQuery, evaluates field:value terms with case-insensitive
values, case-sensitive field names, * and ? wildcards, existence and
match-all, quoted values, AND, OR and NOT with their symbolic forms,
leading - negation and parentheses. Precedence is the one measured on
AWS, where whitespace is an AND that binds looser than OR. The fields
are thingName, thingId, thingTypeName, thingGroupNames and attributes.*.

Requests are validated with the messages and in the order measured on
AWS: a body that is not a JSON object and every member type, member
constraints, index name, query version, a disabled index, the query,
then the page token. Within the query a syntax error comes first, then
the 12-term limit, in which each value of a field group counts and the
field does not, then the first other error, where the field of a group
is checked like any other field. A range counts as one term, and a
malformed range or an unescaped bracket outside one is a syntax error.
AWS's limits hold: a queryString of at most 1000 characters, at most 12
terms, at most two * wildcards in a value and no value starting with ?.
maxResults takes any number, truncated toward zero and capped at the int
range as on AWS. A classic shadow field needs REGISTRY_AND_SHADOW
indexing, and a named shadow field named shadow indexing and a shadow in
its filter, or it is AWS's invalid field name. Constructs AWS accepts
but Floci does not evaluate, such as ranges, comparisons, free text,
field grouping and shadow or Device Defender fields, are refused with
InvalidQueryException instead of matching nothing, and so is a search of
AWS_ThingGroups. Connectivity fields are refused like shadow and Device
Defender fields: AWS's InvalidRequestException while connectivity
indexing is off, InvalidQueryException once it is on. Documents leave
out the members a thing lacks and never carry a shadow or a
connectivity member, where AWS adds connectivity while connectivity
indexing is on.
2026-10-10 13:56:54 -04:00
Vũ Thế Huy 141fd747ee feat(redshift-serverless): add usage limit actions (#5378)
* feat(redshift-serverless): add usage limit actions

Add CreateUsageLimit, GetUsageLimit, ListUsageLimits, UpdateUsageLimit and
DeleteUsageLimit, following the botocore redshift-serverless model.

Usage limits are stored and echoed, not enforced: Floci does not meter RPU
consumption, so breachAction never fires. A limit belongs to a workgroup,
at most one per usageType, and disappears with it. The service checks the
workgroup on read instead of hooking deleteWorkgroup, so deletes through
CloudFormation are covered too.

* fix(redshift-serverless): reject malformed usage limit members and purge stale limits on read

- Usage limit string members of another JSON type (a numeric period,
  breachAction, resourceArn, usageType, usageLimitId or nextToken) were read
  as absent, so a create took the defaults, an update ignored the action and
  a list dropped its filter. They are now a ValidationException.
- maxResults accepted fractional and out-of-range numbers and truncated them.
  It must be an integer that fits an int.
- GetUsageLimit and the other id lookups answered 404 for a limit whose
  workgroup was gone but left the record in storage; they now delete it.
- Listing checked every limit with a full workgroup scan. It now takes one
  snapshot of the Region's workgroup ARNs per scan.
- Add a paging test that deletes the limit behind the nextToken.

* fix(redshift-serverless): permit multiple usage limits per type and return 400 on missing resources

- Remove the one-limit-per-usageType check on CreateUsageLimit so a workgroup can have multiple limits for the same usage type with different periods (e.g. daily and monthly serverless-compute).
- Align ResourceNotFoundException on usage limit actions with the AWS Redshift Serverless API specification by returning HTTP 400 instead of 404.
- Update documentation and test assertions accordingly.
2026-10-10 11:06:34 -04:00
Priamo Germosen 46f9c23c8b fix(iam): refuse inactive keys and unreadable credentials in enforcement (#5346)
With enforcement on, three kinds of request got past the filter's
credential checks, and an expired session was answered as a key that
exists nowhere.

A deactivated access key could still be used. Account routing skips an
inactive key, so its requests landed in the default account. A key of a
user there kept that user's permissions, since resolveCallerContext
reads the user's policies whatever the key's status. A key of another
account matched no user in the default account, and isKnownAccessKey,
which counts every key in every account, let the request through as a
credential the filter could not map, with no policy check at all.
Deactivating a key of a user allowed nothing let it create IAM users
and mint session tokens. The IAM User Guide ("Manage access keys for
IAM users") says that once deactivated a key "can no longer be used by
API calls" until it is activated again.

An Authorization header the filter could not read a credential from made
it return before any check. That covered a header naming no access key
at all (a Bearer token, SigV2, a Credential without the SigV4 scheme or
with the key left out) and a SigV4 scope missing a part, such as its
aws4_request terminator. Any caller could make any call that way,
including the management calls an unsigned request is refused. Such a
request is now refused as AWS refuses a header it cannot read:
IncompleteSignature for Query services and IncompleteSignatureException
for JSON and CBOR ones (the common errors, and the IAM User Guide's
SigV4 troubleshooting section), and S3's AuthorizationHeaderMalformed
with the wording S3HeaderSignatureFilter already uses, all 400. A
presigned S3 URL sends no header, and S3 answers a mal-formed
X-Amz-Credential with AuthorizationQueryParametersError, so that is
what it gets. Otherwise the request is treated as an unsigned one is: an
operation AWS serves without credentials is left alone, and a REST
request is refused only when the header claims SigV4 and its route maps
to an action, since AppSync, CodeArtifact's package endpoints, Identity
Store's SCIM endpoint and API Gateway's authorizers take Bearer and
Basic tokens of their own. An empty header with nothing else to read is
refused the same way, not as a missing one; next to a presigned URL's
X-Amz-Credential it still defers to that credential. Where the guide
gives the message, the refusal uses it: "Authorization header cannot be
empty." and, for a SigV4 header with no Credential, "Authorization
header requires 'Credential' parameter.". The other shapes get the
common errors' "The request signature does not conform to AWS
standards.".

sts:GetCallerIdentity answered a key that exists nowhere, as the
default account's root, because its exemption ran before the
unknown-key check. The exemption is about permissions only, so the key
checks now run first.

An expired session was refused with InvalidClientTokenId or
UnrecognizedClientException, because resolveCallerContext deletes it and
the known-key check then finds nothing. The common errors of the IAM,
STS, EC2, SNS, CloudFormation, Lambda and Step Functions API references
give ExpiredTokenException, 403, "The security token included in the
request has expired", and S3's error list gives ExpiredToken, 400. The
filter now asks isExpiredSession before resolving the caller, so it no
longer deletes the session, and later uses get the same answer. Both
lookups are asked about one moment: read apart, a session expiring
between them would be deleted and answered as unknown, or on the
presigned POST path below allowed with no policy check. Once Floci's own
sweep has removed the session (the first presigned URL it generates in a
process runs one), the key reads as unknown again, as
docs/services/iam.md says.

The inactive-key, expired-session and unknown-key checks run before the
action is used, on every Query, JSON and CBOR call and on every REST
request whose route maps to an action. A REST request no rule maps is
left alone, as an unsigned one already is: the filter cannot tell it
from the API Gateway execute path, Lambda function URLs and the other
paths it sees that are unsigned by design, and the execute path answers
a bad AWS_IAM signature in its own shape. Every refusal to a CBOR call,
AccessDenied included, now arrives CBOR-encoded, where only the
unsigned-call refusal did before; the others were JSON bodies the client
could not read. AccessDenied keeps its 403, the status the Kinesis and
CloudWatch common errors give it. The filter's JSON errors are now
written from AwsErrorResponse, as AwsExceptionMapper writes every other
JSON error, rather than built as strings. That gives a REST JSON
refusal, such as Lambda's, the X-Amzn-Errortype header the rest of
Floci's REST JSON errors carry.

A presigned POST carries its credential in the form body, which the
filter never sees, so authorizeAdditionalResource is the only IAM check
it gets. That evaluated an inactive key with its user's policies, and
resolved an expired session, which deleted it. Both are now refused
there as the filter refuses them, before the caller is resolved:
InvalidAccessKeyId, 403, and ExpiredToken, 400. A key that exists
nowhere, or a credential that cannot be read, is still left to S3's own
presigned-POST check, and uploads as an unsigned request would when that
check is off. docs/services/iam.md now says so.

isKnownAccessKey keeps counting inactive keys: GetSessionToken relies
on it, so a session minted with an inactive key has no issuer rather
than acting as the account root. resolveCallerContext keeps returning
an inactive key's user policies rather than null, which AppSync and RDS
read as allowed; both verify the signature first, which an inactive key
fails. isInactiveAccessKey looks in the request's account before
scanning the others, since routing sends an active key to its own
account.

Integration tests cover a same-account and another account's inactive
key (including GetCallerIdentity, GetSessionToken, S3, a JSON service,
a presigned POST, and reactivation); an expired session on Query (asked
twice), JSON (with its X-Amzn-Errortype header), S3 and presigned POST
calls; an unreadable credential on Query (eight header shapes, none of
which creates the user), JSON, CBOR and S3 calls, on a presigned S3 URL,
and with the guide's two messages; the cases left alone (a Cognito flow
AWS serves without credentials, a Bearer token on S3, a REST route no
rule maps); an unknown key on GetCallerIdentity and on a CBOR call; and
AccessDenied on a CBOR call. Every refusal fails without this change.
IamServiceTest and IamEnforcementFilterTest check that the expiry check
and the caller lookup are asked about one moment. The SDK compatibility
suite's IamEnforcementTest adds a deactivated key, refused by STS and S3
with the codes the SDK reads and accepted again once activated.
docs/services/iam.md lists the cases in both enforcement tables and
under unsigned requests.
2026-10-09 20:16:31 -05:00
Mario Toffia f413a667d0 feat(iot): indexing configuration (#4896)
AWS IoT fleet indexing had no routes in Floci, so a stack or script
calling UpdateIndexingConfiguration or GetIndexingConfiguration failed
with "Unknown operation: POST /indexing/config", and there was no
stored configuration for a later SearchIndex to consult.

A new IotFleetIndexingService and IotFleetIndexingController, wired
into the iot descriptor beside the domain configuration controller,
serve UpdateIndexingConfiguration and GetIndexingConfiguration on
/indexing/config and DescribeIndex on /indices/{indexName}. There is
one configuration per account and region, kept through StorageFactory;
a region never updated reports the OFF shape AWS returns.

The behaviour follows what real AWS returned when measured: an update
that carries only one of the thing and thing group configurations
keeps the other, turning thing indexing OFF clears the whole thing
configuration, and managedFields are derived from the modes rather
than stored. Client sent managedFields are only checked against the
fields AWS manages and their types. Validation uses AWS's messages for
a missing configuration, null and out of set enum values (the modes,
field types, filter socket information and geolocation order),
secondary modes without thing indexing, named shadow indexing without
shadow names, unknown managed fields, and a thing custom field named
after a managed field. A geolocation sent without an order is stored
with LatLon, the default AWS returns. DescribeIndex returns the
schema the modes select and is ACTIVE at once, a disabled index is
ResourceNotFoundException and an unknown name InvalidRequestException.

Thing group managedFields are checked the same way, also while group
indexing is OFF, and neither group managedFields nor customFields are
stored. A member of the wrong JSON type is a SerializationException,
as on AWS. The fleet indexing, domain configuration and authorizer
controllers now share one strict body reader, so a malformed body or
content after it is a SerializationException on all three, which is
what AWS returns there.

ListIndices, SearchIndex and the statistics APIs are not modeled.
2026-10-09 16:52:30 -04:00
Ovidiu (Ovi) 4f34a903fc feat(ssm): support UnlabelParameterVersion (#5339)
* feat(ssm): support UnlabelParameterVersion

Remove one or more labels from a parameter version. Labels attached to
the version are returned in RemovedLabels; labels that are not on that
version, including ones attached to a different version, are returned in
InvalidLabels and left in place. A missing parameter is ParameterNotFound,
a missing version ParameterVersionNotFound, and an omitted ParameterVersion
or an empty or oversized label list a ValidationException.

* fix(ssm): match AWS errors and ordering in UnlabelParameterVersion

Verified against real AWS (us-east-1):

- Report every missing or invalid member in one ValidationException, in
  the order name, parameterVersion, labels, and render the label list
  the way AWS does ('[prod, ]').
- Reject a string or boolean ParameterVersion and a non-string Name or
  label with SerializationException; truncate a fractional version and
  clamp one outside the range of a long, as AWS does.
- Reject an ARN, a malformed or ssm-prefixed name, and deny an
  aws-prefixed one before the lookup; ignore surrounding whitespace in
  the lookup but echo the name as sent in error messages.
- Word ParameterVersionNotFound as AWS does.
- Return RemovedLabels in the order the labels are stored on the
  version, and InvalidLabels in request order.

LabelParameterVersion shares the label-list parsing, so its label
validation messages and non-string labels now match AWS too.

* fix(ssm): take the service monitor when deleting parameters

PutParameter, LabelParameterVersion and UnlabelParameterVersion already
run under the SsmService monitor, but DeleteParameter and
DeleteParameters did not. A delete landing between a label or unlabel
call's lookup and its history write left orphaned history that a later
PutParameter of the same name appended to.

Also pin LabelParameterVersion's AWS-verified label validation messages
and its SerializationException for a non-string label in its own
integration test, and share the parameter-name format rule between the
two reserved-name messages.
2026-10-09 13:11:29 -04:00
Mario Toffia 0ec64add2d fix(cloudformation): wait for a stable ECS service (#4880)
AWS CloudFormation reports an AWS::ECS::Service CREATE_COMPLETE or
UPDATE_COMPLETE only once the service is stable: it polls
DescribeServices until the desired number of tasks of the current
task definition are running. Floci reported the resource complete as
soon as CreateService or UpdateService returned. The tasks were
started later by the ECS reconciler, every five seconds, and the
service's runningCount only caught up a tick after that, so a client
reading the service right after the stack operation saw runningCount
0.

EcsService.awaitServiceStable now waits, like
Ec2Service.awaitContainerLaunch, for runningCount to equal
desiredCount, for the current deployment to run that many tasks, and
for no task of an earlier deployment to be running. Instead of idling
until the next tick it submits up to three reconcile passes to the
single reconciler thread, so they never overlap a scheduled tick.
After five minutes it fails with "Service <arn> did not stabilize.".

The wait ends at once when the service's tasks cannot start. The
reconciler now keeps, in memory, why its last attempt to launch a
task for a service failed, for example an unknown subnet, and the
deployment it was launching for. Only a failure of the deployment
being awaited ends the wait, so a pass that began before an update
cannot fail the update. The record is cleared on a successful launch,
on DeleteService and on a state reset. A task that stops with
TaskFailedToStart during the wait ends it too. A task the reconciler
launches is stamped with the deployment read before its task
definition, not after the launch, so a launch that an update overtakes
counts as the earlier deployment's and is replaced.

The ECS provisioner calls the wait after an in-place update and after
a create. A created service stays marked as owned by the stack while
it waits, so the create rollback deletes it. A replacement created by
a stack update is deleted when it does not stabilize. A service
updated in place that does not stabilize is put back on the task
definition, desired count and network configuration it had, and the
provisioner waits for that to stabilize too, as CloudFormation's
rollback does. A restore that fails or does not stabilize is reported
as a rollback failure, so a rolled-back stack does not claim the prior
configuration is running when it is not.

The ECS service test in CloudFormationIntegrationTest used subnets
and a security group that do not exist, so its tasks could never
start. It now uses the default VPC's.
2026-10-09 10:05:39 -04:00
David PhillipsandJason van Zyl d22b4f107c fix(iam): enforce inline role policy quota (#5327)
* fix(iam): enforce inline role policy quota

Reject role policy updates that exceed the aggregate non-whitespace
quota without changing previously accepted policies, including concurrent
writes and policies restored after a restart.

* fix(cloudformation): rename role policies within quota

* test(iam): share inline policy fixtures

---------

Co-authored-by: Jason van Zyl <jason@vanzyl.ca>
2026-10-08 21:52:36 -04:00
David Phillips da6a7dd085 build: enforce Java import order with Checkstyle (#5326)
* style: align Java imports with project guidelines

* build: enforce consistent Java import order

* style: follow IntelliJ import order
2026-10-08 20:50:53 -04:00
Vũ Thế Huy dc41417e79 fix(ec2): avoid Docker waits on the first CreateVpc (#5179)
* fix: avoid Docker waits on first EC2 CreateVpc

* fix(ec2): reseed default VPC resources after a state reset

Ec2Service now implements Resettable: clear() forgets the seeded account
scopes and seeds the default region again, so a reset followed by
DescribeVpcs still returns the default VPC and subnets.

Also run Ec2CreateVpcLatencyTest in the non-mock EC2 compatibility job,
where VPC planning is active and a regression of the first-call Docker
wait would be caught.

* refactor(ec2): share one default-region seeding method between startup and reset

Ec2Startup and Ec2Service.clear() repeated the same enabled check and seed call. Both now go through Ec2Service.seedDefaultRegionIfEnabled() so they cannot drift apart. Also reorder the Resettable import.
2026-10-08 19:25:31 -04:00
Clement 0848fa6a48 feat(elasticache): add user groups and associate them with replication groups (#4435)
CreateUserGroup, DescribeUserGroups, ModifyUserGroup and DeleteUserGroup
returned UnsupportedOperation, and ModifyReplicationGroup read
UserGroupIdsToAdd as user ids, so RBAC could not be set up the way AWS
and Terraform (aws_elasticache_user_group, user_group_ids) do it.

User groups are now stored resources. CreateReplicationGroup takes
UserGroupIds and ModifyReplicationGroup adds and removes user groups; the
proxy authenticates the members of a replication group's user groups, read
at AUTH time so a ModifyUserGroup applies at once, each by its own
authentication mode. A replication group with a user group associated
admits only its members, even while the group is empty. An id in
UserGroupIdsToAdd that names no user group but names a user still
associates that user directly, so existing setups keep working.

A cache uses either its AUTH token or user groups, as on AWS: while a user
group is attached the token is not accepted and AuthTokenEnabled reads
false. ModifyReplicationGroup takes AuthTokenUpdateStrategy DELETE, which
removes the token and is only allowed together with a user group, and
RemoveUserGroups. Removing the last user group leaves the cache without
access control, still encrypted in transit; a token that was never deleted
applies again. The proxy reads the cache's auth mode per connection, so
these changes take effect without a restart.

Validation follows the RBAC rules: a redis user group needs a user named
default (DefaultUserRequired), members cannot share a user name
(DuplicateUserName), valkey users only join valkey groups, a valkey group
cannot hold a no-password user or serve a redis cache, association needs
in-transit encryption, and a user group in use cannot be deleted
(InvalidUserGroupState). ModifyUser refuses an engine or authentication
change that a user group holding the user would reject. Deleting a user
removes it from its user groups.
2026-10-08 00:24:28 -04:00
yarammanasa2001-maxandyarammanasa2001-max 9934b39a42 feat(redshiftserverless): add snapshot and restore operations (#5184)
* feat(redshiftserverless): add snapshot and restore operations

Adds CreateSnapshot, GetSnapshot (by name or ARN), ListSnapshots (filterable
by namespace), DeleteSnapshot and RestoreFromSnapshot on top of the existing
workgroup support. A snapshot is AVAILABLE as soon as it is created, so a
snapshot created in a standby region stands in for a cross-region copy.
RestoreFromSnapshot restores into an existing namespace and workgroup and
never creates either.

* docs(redshiftserverless): document snapshot and restore actions

* docs(redshiftserverless): update service matrix operation count

* fix(redshiftserverless): validate snapshot restore and ARN lookup

Reject a RestoreFromSnapshot workgroup that belongs to another namespace,
resolve snapshotArn only for this account and Region, and register the
snapshot model for reflection so persisted snapshots survive a native restart.

* fix(redshiftserverless): harden snapshot restore and add lifecycle tests

Validate namespaceName and snapshot names, accept snapshotArn on
RestoreFromSnapshot, read the snapshot once during restore, and cover the
handler with an integration lifecycle test and a Java SDK compatibility test.

* feat(redshiftserverless): dump and restore snapshot data and model retention, tags and filters

CreateSnapshot dumps a running workgroup with pg_dump and RestoreFromSnapshot
empties the public schema and replays the dump, reusing the provisioned
Redshift container manager. Snapshots now report adminUsername, kmsKeyId and
retention, accept tags (taggable by ARN), ListSnapshots filters by
namespaceArn, ownerAccount and a time window, and RestoreFromSnapshot rejects
snapshotName and snapshotArn together.

* fix(redshiftserverless): make snapshot restore atomic and strict

Dump the current contents before a restore and put them back when the replay
fails, drop every user schema rather than only public, run psql with
ON_ERROR_STOP so a failing statement fails the restore, and fail a restore
whose recorded dump file is missing.

* fix(redshiftserverless): keep the catalog bootstrap schema out of snapshot restore

The reset dropped floci_internal and with it the pg_catalog svv_external_*
views, so the strict replay failed. Leave that schema out of the reset and
out of the dump.

* fix(redshiftserverless): drop large objects when resetting before a restore

* refactor(redshift): share container lookup and defaults in the container manager

* docs(redshiftserverless): document the bootstrap schema left out of snapshots

* style(redshiftserverless): order imports in the runtime test

---------

Co-authored-by: yarammanasa2001-max <271440416+yarammanasa2001-max@users.noreply.github.com>
2026-10-07 17:08:39 -04:00
Niels Kootstra 13738f89de fix(cloudformation): reject resources that depend on each other in a cycle (#5208)
* fix(cloudformation): reject resources that depend on each other in a cycle

A template whose resources form a dependency cycle was created anyway: the
topological sort appended the resources it could not order and created them in
template order. CloudFormation rejects such a template with a ValidationError
naming the resources, before any of them is created.

The sort now throws that error when resources remain unsorted, and the
synchronous pre-check that runs before CreateStack, UpdateStack and
CreateChangeSet calls the sort instead of repeating its dependency checks, so
the request fails before any stack state is created.

* fix(cloudformation): keep dependency order when deleting a stack saved with a cyclic template

A stack saved before circular templates were rejected can still carry one.
Deleting it hit the new circular-dependency error while ordering its resources,
so the delete fell back to insertion order for every resource and could remove
a resource before one still using it. The delete now orders what it can and
places the circular resources after it, as before.

* fix(cloudformation): order resources that depend on a cycle when deleting a saved stack

A resource that depends on a dependency cycle cannot be ordered either, so the
delete of a stack saved with a cyclic template ranked such resources in
template order and could remove a target group before the listener using it.
When the sort stalls it now releases a resource on the cycle itself and goes on,
so everything that depends on the cycle keeps its dependency order.

* fix(cloudformation): delete linked dependency cycles in dependency order

When a saved stack's template has a cycle that depends on another cycle, the
sort could release a resource of the dependent cycle before the cycle it uses
was placed, so the delete removed that cycle's resources first. When the sort
stalls it now releases a resource from the first strongly connected component
Tarjan's algorithm completes over the resources left, which depends on no other
cycle.

* fix(cloudformation): order a saved cyclic stack in one pass and name only the cycle

Breaking one cycle at a time searched again at every stall and recursed, so a
long dependency chain could exhaust the thread's stack and stop the delete of a
stack saved with a cyclic template. The resources left at a stall are now
ordered in one pass by their strongly connected components, dependencies
first, with an iterative Tarjan search. The circular-dependency error names only
the components that are cycles, not resources that merely depend on one.

* test(cloudformation): cover circular dependency rejection with the AWS SDK

* test(cloudformation): assert only the cycle's resources in the SDK test's message
2026-10-07 16:39:14 -04:00
TATSUNO “Taz” Yasuhiro ee2d1a68a6 feat(cloudformation): pass Lambda DurableConfig through (#5218)
* feat(cloudformation): pass Lambda DurableConfig through

AWS::Lambda::Function.DurableConfig reaches CreateFunction and
UpdateFunctionConfiguration. As on AWS, a RetentionPeriodInDays the
template leaves out is 14 on update too, a durable function created
without Timeout gets min(ExecutionTimeout, 900), and adding or removing
DurableConfig replaces the function.

* test(terraform): cover aws_lambda_function durable_config

The provider creates a durable function, reads it back without a diff,
updates execution_timeout in place, and before destroy stops a RUNNING
durable execution through ListDurableExecutionsByFunction,
StopDurableExecution and GetDurableExecution.

* fix(cloudformation): honor AWS::NoValue, cleared keys and large numbers in DurableConfig

A DurableConfig that Fn::If removes with AWS::NoValue leaves the
function plain. A KMSKeyArn the template leaves out or sets to "" clears
the key, as CloudFormation does on AWS, since Lambda keeps a stored key
when the update omits the member. A number beyond an integer reaches
Lambda unchanged, so its range check rejects it.

* fix(cloudformation): reject a DurableConfig that is not an object

Only an intrinsic that resolves to AWS::NoValue removes DurableConfig.
CloudFormation rejects a string, number or list in its schema check
before the function is touched, so an update with one no longer
replaces and deletes a durable function.

* test(cloudformation): cover Lambda DurableConfig with the AWS SDK

The CloudFormation and Lambda SDK clients create a durable function,
update DurableConfig in place, and remove it by replacing the function.

* fix(cloudformation): require ExecutionTimeout and known members in DurableConfig

CloudFormation checks DurableConfig against the schema on update too: an
update without ExecutionTimeout, or with a member the schema does not
list, fails before the function is touched. Floci let such an update
through and kept the old timeout.

* refactor(cloudformation): look up a Lambda function once per deploy

The name choice and the replacement decision now share one lookup and one
durable check, so they cannot disagree.
2026-10-07 12:39:36 -04:00
Mario Toffia efd9512578 fix(cloudformation): accept the stack ID in UpdateStack and CreateChangeSet (#4846)
* test(cloudformation): cover UpdateStack and CreateChangeSet by stack ID against AWS

* fix(cloudformation): accept the stack ID in UpdateStack and CreateChangeSet

StackName is "the name or the unique stack ID" for both actions, but an
UPDATE change set looked the stack up by the raw value, so a stack ARN
missed the name-keyed map and failed with "Stack with id ... does not
exist". Resolve the canonical stack name first, as ExecuteChangeSet
already does, and record it on the change set. CREATE change sets are
unchanged.

Closes #4842

* fix(cloudformation): refuse updating a stack that has finished deleting

A delete marks the stack DELETE_COMPLETE before it leaves the live map, so an
update in that window was accepted and its persist could revive the stack.
An update of a DELETE_COMPLETE stack now reports that the stack does not exist.

* test(cloudformation): delete each stack once after the stack ID tests

* test(cloudformation): wait until a deleted stack's name is free before reusing it

Floci reports DELETE_COMPLETE just before it drops the stack, so a same-name CreateStack
could hit AlreadyExistsException; wait until DescribeStacks no longer finds the name.

* test(cloudformation): name the stale stack ID test plainly

* fix(cloudformation): refuse a deleted stack's ID with AWS's DELETE_COMPLETE message

UpdateStack and UPDATE change sets given the stack ID of a deleted stack now fail with
"Stack:<id> is in DELETE_COMPLETE state and can not be updated.", as measured on AWS.
A stack name, or a stack ID that never existed, still gets "does not exist".
2026-10-07 10:14:11 -04:00
danielxoi bcfb9c786c fix(cognito): surface sign-in denials with the exception classes Cognito uses (#5223)
* fix(cognito): surface sign-in denials with the exception classes Cognito uses

A disabled user was rejected with UserNotConfirmedException ("User is disabled");
Cognito returns NotAuthorizedException with "User is disabled.". A PreAuthentication
trigger that returned an error payload surfaced as NotAuthorizedException; Cognito
returns UserLambdaValidationException with "PreAuthentication failed with error
<errorMessage>.", the same mapping floci already applied to PreSignUp on
AdminCreateUser. PreSignUp on SignUp is aligned the same way (it reported
NotAuthorizedException "PreSignUp trigger denied signup: ...").

The five duplicated eligibility checks now share requireSignInEligible /
requireEnabled, and the three blocking triggers share blockingTriggerFailure.
Integration tests that pass against AWS failed on these two codes.

* test(cognito): cover trigger invocation failures and assert the SDK exception classes

PreAuthentication and PreSignUp now get cases for an uninvokable function
(UnexpectedLambdaException) and a malformed response
(InvalidLambdaResponseException). A new sdk-test-java compat test asserts
NotAuthorizedException for a disabled user and UserLambdaValidationException
for a PreAuthentication trigger that raises, through the AWS SDK v2 client.

* test(cognito): drop the em-dash from the compat test display name
2026-10-06 23:28:03 -04:00
Priamo Germosen 04a3b97346 feat(iam): model account properties and outbound web identity federation (#5177)
Adds GetAccountProperties, PutAccountProperties, SetSecurityTokenServicePreferences,
EnableOutboundWebIdentityFederation, DisableOutboundWebIdentityFederation and
GetOutboundWebIdentityFederationInfo, which completes step 9f of the IAM gap plan.

A property key is Namespace/PropertyName with exactly one forward slash and
neither a leading nor a trailing one, and every key in one request must share a
namespace, which AWS states directly. A request mixing namespaces is rejected
whole rather than partly applied.

Enabling federation twice is FeatureEnabled 409 and disabling it twice is
FeatureDisabled 404, an asymmetry AWS documents. The getter answers
FeatureDisabled too when the feature is off, reusing the disable operation's own
wording, which is matched rather than improved.

The issuer URL is derived from the request's partition rather than the literal in
the API Reference's example: api.aws is only the commercial partition's dual-stack
suffix. It is minted once per account and survives a disable, since a relying
party verifying tokens will have pinned it. AWS documents neither that nor
JwtVendingEnabled's source, so both are recorded in the docs as choices.

The OIDC discovery endpoints the issuer is documented to host, and the
GetWebIdentityToken API the feature references, are not modelled: these six are
the management operations only.
2026-10-06 20:32:03 -05:00
outofplace a5db3975c4 feat(cognito): support TOTP MFA when MFA is optional (#5101)
* feat(cognito): store software-token MFA preferences and report MFA settings

* feat(cognito): challenge users with TOTP turned on when MFA is optional

* docs(cognito): document optional TOTP MFA and MFA preferences

* fix(cognito): report required TOTP and keep email-code sign-in for email MFA users

* docs(cognito): describe required TOTP reporting and the USER_AUTH choice
2026-10-06 17:33:00 -04:00
Vũ Thế Huy 950b6fe774 feat(redshift): add relational queries for Redshift Spectrum (#5095)
* feat: add relational queries for Redshift Spectrum

* fix(redshift): harden Spectrum relational query preparation

Catch RuntimeException during preparation so the client gets an ErrorResponse
instead of a dropped connection, skip preparation while the backend discards
until Sync, defer schema binding until the transaction commits, make the
catalog functions SECURITY DEFINER, and track COMMIT and ROLLBACK from the
command tag.

* fix(redshift): address review findings on transaction handling in Spectrum relational queries

- Undo Glue tables created inside a rolled back transaction (Data API batch and wire proxy)
- Keep bindings and Glue tables on ROLLBACK TO SAVEPOINT; only a closed transaction discards them
- Report the real transaction status for locally handled simple queries instead of idle
- Use a switch expression in BackendResponseCoordinator
- Map host.docker.internal into the floci-duck container on Linux

* fix(redshift): undo Glue tables across sessions and on rollback to savepoint

- Scope staged Glue tables by the backend socket so the proxy rollback finds tables created by another session
- Track SAVEPOINT, ROLLBACK TO and RELEASE so a Data API batch undoes only the tables created after the savepoint

* fix(redshift): defer Glue undo on rollback to savepoint until the backend confirms and bundle bootstrap catalog in native image

* fix(redshift): reject CREATE EXTERNAL TABLE inside a transaction like AWS

AWS does not allow CREATE EXTERNAL TABLE inside a transaction block, and a
Data API batch runs as one transaction. Return SQLSTATE 25001 instead of
staging Glue tables and undoing them on rollback, which removes the savepoint
tracking and cross-session undo code. Reuse ExternalTableMaterializer.quote.

* fix(redshift): reject CREATE EXTERNAL TABLE in a transaction for legacy schemas too
2026-10-06 15:30:53 -04:00
Mario Toffia a33eea05cd feat(iot): enforce custom authorizer decisions on MQTT connections (#4835)
* test(iot): cover custom authorizer invocation and enforcement against AWS

* feat(iot): enforce custom authorizer decisions on MQTT connections

Serve TestInvokeAuthorizer and invoke an authorizer's function on an MQTT
CONNECT that names it, on the plaintext listener and the /mqtt WebSocket
bridge. The event, the request and answer checks, signed-token
verification and the refusal per MQTT version follow what was measured
against AWS IoT Core. The bridge hands the upgrade's headers, query and
server name to the broker keyed by its connection's local address.

Closes #4823

* fix(iot): evaluate WebSocket custom authorizer policies against the client's address

* docs(iot): note that a non-UTF-8 MQTT password reaches the authorizer altered

* test(iot): cover custom authorizer CONNECTs on the plain MQTT listener

* fix(iot): refuse TestInvokeAuthorizer tokens and signatures outside their length bounds

* fix(iot): refuse authorizer JSON with trailing content

TestInvokeAuthorizer, CreateAuthorizer and UpdateAuthorizer bodies, a custom authorizer's answer and each policy document it returns are now read with FAIL_ON_TRAILING_TOKENS, as the shared JSON controllers do, so a valid prefix followed by junk is refused instead of half-read.

* fix(iot): keep address literals out of the WebSocket server name

Over WSS without SNI the bridge fell back to the Host header unfiltered,
so a client dialing an IP got that IP as tls.serverName in the authorizer
event and as iot:DomainName in policy evaluation. Apply the same address
literal filter SNI already uses. Also name the context validation ceiling
in TestInvokeAuthorizer's ponytail note.
2026-10-06 10:44:28 -04:00
Mario Toffia e9f2463103 fix(cloudformation): replace Cognito user pool groups like CloudFormation (#4841)
* test(cloudformation): cover AWS::Cognito::UserPoolGroup replacement against AWS

* fix(cloudformation): replace Cognito user pool groups on create-only changes

AWS::Cognito::UserPoolGroup left the old group behind on a rename, kept
the explicit name when GroupName was dropped, and tried to update a
group that did not exist when UserPoolId changed.

The provisioner now creates the group whenever a create-only property
changes and hands the displaced group to ReplacementCleanup, which
deletes it once the update commits or deletes the replacement and
restores the prior name and pool when the update rolls back. A pool
move that keeps an explicit name keeps the physical id, so, as on AWS,
nothing is deleted and the old-pool group stays. A generated name is
kept only for an in-place update; a pool move or a dropped explicit
name generates a fresh one. Each provisioned name is recorded with its
pool so a displaced group is deleted from the pool it lives in.

Closes #4836

* test(cloudformation): cover a failed update after moving a named Cognito group against AWS

* fix(cloudformation): roll back named Cognito group pool moves and read legacy name modes

A named pool move keeps the physical id, so it now records a replacement that displaces nothing. A failed update points the group back at the old pool and, as measured on AWS, leaves the new pool's group, and the stack delete reads the pool from UserPoolId. A resource persisted without FlociGroupNameMode reads its name as generated only when it has the generated shape, so dropping an explicit GroupName replaces it.

* test(cloudformation): cover declaring a Cognito group's generated name explicitly against AWS

Measured on AWS (eu-west-1): updating an unnamed group to declare GroupName
equal to its generated name, same pool, fails the Group with UPDATE_FAILED
"CloudFormation cannot update a stack when a custom-named resource requires
replacing. Rename <name> and update the stack again." before anything is
created. The stack ends UPDATE_ROLLBACK_COMPLETE, Ref and the physical id stay
the generated name, and the group keeps its pool, description, precedence and
creation date.

* fix(cloudformation): refuse declaring a Cognito group's generated name explicitly

GroupName is create-only, so declaring an unnamed group's generated name
explicitly in the same pool requires a replacement that keeps both the pool
and the name. Measured on AWS, CloudFormation refuses it before creating
anything: the Group goes UPDATE_FAILED with "CloudFormation cannot update a
stack when a custom-named resource requires replacing. Rename <name> and update
the stack again.", the stack ends UPDATE_ROLLBACK_COMPLETE, and Ref and the
group stay unchanged. Floci updated the group in place and reported
UPDATE_COMPLETE; it now raises the same ValidationError.

* fix(cloudformation): keep only owed and current Cognito groups in the pool record

The group pool record added the prior and current name on every provision and
never dropped one, so it grew with every name the resource ever had. It is now
rebuilt after the replacement record, keeping only the names still owed a
delete, with their recorded pools, plus the current name.

* fix(cloudformation): refuse a declared generated Cognito group name only when the mode was recorded

The refusal of a declared generated name read the prior mode from the name's
shape when no mode was recorded, so a legacy group explicitly named in the
generated shape had a valid in-place update refused. Only a recorded generated
mode refuses now; a legacy record updates in place, as before the mode existed.

* test(cloudformation): read stack outputs with XmlParser

The Cognito group integration test read stack outputs by splitting the
DescribeStacks XML on tag strings. It now uses XmlParser.extractPairs, as the
other CloudFormation integration tests do.
2026-10-06 10:24:56 -04:00
TATSUNO “Taz” Yasuhiro 6e6ce61eea feat(lambda): durable function chained invokes (#5164)
* feat(lambda): durable function chained invokes

A CHAINED_INVOKE operation runs another function. A durable target
needs a version or alias and runs as its own durable execution with a
random name; its close completes the operation as SUCCEEDED, FAILED,
TIMED_OUT ("CHAINED_INVOKE timed out after N seconds.") or STOPPED. Any
other function is invoked once, and an output over 1 MB fails the
operation. A missing function or an unqualified durable one fails the
operation at once. Stopping the parent leaves the child running.

A plain chained invoke lost with the process runs again after a restart,
and a durable child that closed before its report reaches the parent
reports then.

* fix(lambda): close the gaps in durable chained invokes

A durable child that closes during a restart reports to its parent
under its own lock, and recovery triggers an execution once. A durable
target invoked without Payload starts its child with no input, while a
plain target gets {}. A target started in the batch that closes the
execution still runs and its result is ignored, as on AWS.

* fix(lambda): reject a chained invoke of another account or region

AWS rejects the checkpoint with InvalidParameterValueException "Cannot
start a CHAINED_INVOKE on a function in another account." or "... in
another region." Cross-account chained invocations are not supported.

* fix(lambda): keep durable chained invokes across a crash

The parent is saved before the child it starts, so a crash in between
leaves no child the parent does not know. On restart a child the parent
recorded but the store lost is started again under the same ARN, and a
plain target started by the checkpoint that closed the execution runs
again until its result is recorded. A child reports only to the
operation that started it.

* fix(lambda): recreate a lost durable child on the version its ARN names

An alias the chained invoke named may point to another version after a
restart, and a child recreated there would not match the ARN the parent
saved.
2026-10-06 08:17:51 -04:00
Priamo Germosen 9c0102559d feat(iam): model service-specific credentials (#5084)
Adds CreateServiceSpecificCredential, ListServiceSpecificCredentials,
UpdateServiceSpecificCredential, ResetServiceSpecificCredential and
DeleteServiceSpecificCredential, the five the wire model defines.

A credential takes one of two shapes, decided by the service: CodeCommit and
Keyspaces get a ServiceUserName and a ServicePassword, while the long-term API
key services get a ServiceCredentialAlias and a ServiceCredentialSecret and
accept CredentialAgeDays. The quota is two per service rather than two per user,
and the version behind a service user name's +n suffix is the lowest one free
rather than a count, so deleting out of order cannot mint a name already in use.

A credential blocks DeleteUser until it is removed, the last item on AWS's list
of what to delete first, and follows the user across an UpdateUser rename.
2026-10-05 22:57:54 -05:00
Kenshin Okinaka 3f6fb371d1 feat(ses): add the S/MIME identity certificate operations (#5111)
* feat(ses): add the S/MIME identity certificate operations

Implement AssociateEmailIdentityCertificate,
DisassociateEmailIdentityCertificate and ListEmailIdentityCertificates
as a control plane only: associations are stored per region and Floci
never signs mail.

Request validation, messages and precedence follow real SES: a domain
identity needs a FromAddress in the domain or a subdomain, one
certificate per address regardless of case, the request members are
checked before the identity, and the certificate is not inspected on
association. The reported status is Floci's own rule: ACTIVE while the
ARN names an issued, unexpired ACM certificate (with its expiry as
CertificateExpiryTime), FAILED otherwise. Disassociation is immediate
and idempotent, and the list pages through SesListPaging.

DeleteEmailIdentity now refuses an identity that still has a
certificate associated, as SES does. The v1 DeleteIdentity and
DeleteVerifiedEmailAddress share the identities and refuse it too.

* fix(ses): apply the documented S/MIME certificate requirements

ListEmailIdentityCertificates now reports ACTIVE only when the
association meets the SES Developer Guide's S/MIME certificate
considerations: the identity is verified, and the certificate is
currently valid, has an allowed key (RSA 2048/3072/4096 or EC P-256,
P-384, P-521, read from the certificate itself since ACM's stored key
algorithm folds other sizes into those) and an RFC822Name SAN equal to
the From address, case-sensitively. The docs link that section instead
of calling the criteria undocumented.

* fix(ses): require an email-signing end-entity S/MIME certificate

A probe against SES found requirements beyond the Developer Guide's
list: a CA certificate fails even with the right usages, and the
certificate needs both a key usage including digitalSignature and an
extended key usage including emailProtection, while other usages may
sit alongside them. ListEmailIdentityCertificates now applies them, and
the docs list them next to the guide's link.

* refactor(ses): reuse SesIdentityService's verified-identity check
2026-10-05 20:24:51 -04:00
David f157d354f2 feat(rds): Aurora custom cluster endpoints (#5090)
Serve CreateDBClusterEndpoint, DescribeDBClusterEndpoints,
ModifyDBClusterEndpoint and DeleteDBClusterEndpoint.

A custom endpoint is stored per Region with the rules from the API
reference and the Aurora user guide: type READER or ANY, a static or an
exclusion member list but not both, members that are instances of the
cluster, no writer in a READER endpoint, an RDS identifier stored lower
case and unique in the Region, and at most five per cluster. Its ARN
(cluster-endpoint:<id>) works with the tagging actions.

DescribeDBClusterEndpoints lists each cluster's built-in WRITER and
READER endpoints with its custom ones, and supports the cluster and
endpoint identifiers, the four documented filters and paging. Deleting a
cluster deletes its custom endpoints, and a deleted instance drops out of
the member lists.

Custom endpoints are modelled, not routed: one reports the cluster's own
endpoint host, so connections through it go where the cluster endpoint
sends them.

Closes #5072
2026-10-05 14:48:06 -04:00
Mario Toffia 4be8309e8d feat(cloudformation): provision AWS::IoT::Authorizer (#4830)
* test(cloudformation): cover AWS::IoT::Authorizer against AWS

* feat(cloudformation): provision AWS::IoT::Authorizer

CloudFormation stubbed AWS::IoT::Authorizer with a fake ARN and created
nothing. IotAuthorizerCfnProvisioner now creates a real authorizer
through IotAuthorizerService.

Ref is the authorizer name and Fn::GetAtt Arn the ARN. A missing
AuthorizerFunctionArn fails with the registry's model validation error
before any call. Status, EnableCachingForHttp, AuthorizerFunctionArn and
the token settings update in place, sending only the declared
properties, tags are reconciled, and a failed stack update restores
them from a snapshot. Changing AuthorizerName or SigningDisabled
replaces the authorizer and deletes the old one once the update
commits; a replacement that keeps an explicit name is refused. Delete
deactivates the authorizer first and tolerates one already gone.

Closes #4822

* chore(cloudformation): move the IoT authorizer snapshot constant

It sat at the same insertion point as other pull requests' snapshot constants, so they could not be merged together.

* fix(cloudformation): treat only an empty intrinsic result as AWS::NoValue for IoT authorizers

* fix(cloudformation): undo an IoT authorizer update whose tag reconcile fails

* fix(cloudformation): report a SigningDisabled change on an IoT authorizer as a replacement

* fix(cloudformation): create an IoT authorizer over a dispatcher stub and refuse declaring its generated name

* fix(cloudformation): refuse an IoT authorizer boolean that is neither true nor false

* fix(cloudformation): never delete a dispatcher stub's id in replacement cleanup

* fix(cloudformation): tell a stub from a migrated resource and roll back a stub migration that kept its id

* fix(cloudformation): name an unnamed IoT authorizer <LogicalId>_<12 chars> as CloudFormation does
2026-10-05 14:37:54 -04:00
vamsiakandVamsi Akavarapu d508a4e197 fix(apigateway): return embedded resource methods (#5109)
* fix(apigateway): return embedded resource methods

* fix(apigateway): guard method maps during concurrent reads

---------

Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com>
2026-10-05 11:44:40 -04:00
TATSUNO “Taz” Yasuhiro a1ed65c51d feat(lambda): durable function callbacks (#5100)
* feat(lambda): durable function callbacks

A CALLBACK operation started at checkpoint gets a callback id that
SendDurableExecutionCallbackSuccess, Failure and Heartbeat complete or
keep alive, after which the function is invoked again to see it.
TimeoutSeconds and HeartbeatTimeoutSeconds time it out with
Callback.Timeout or Callback.Heartbeat. A completed, timed out or
stopped callback answers CallbackTimeoutException, an unreadable id
"Invalid callback id". The callback id carries the execution ARN, which
IAM authorizes the callback actions against.

Option range errors now name the update, as AWS does
("updates.1.member.waitOptions.waitSeconds").

* fix(lambda): name a repeated durable update as AWS does

AWS rejects two updates of one operation in a batch, other than a START
closed by its STEP or CONTEXT action, with "Cannot update the same
operation twice in a single request."

* fix(lambda): leave a durable execution waiting after a body-less callback failure

AWS marks a callback failed with an empty request body as FAILED but does
not invoke the function again, so the execution keeps waiting. The SDKs
send {} when Error is omitted, which does invoke it.

* fix(lambda): bound a durable callback failure's error at 1 MB

AWS rejects an Error over 1048576 bytes, measured as compact JSON, with
InvalidParameterValueException "Error object size must be less than or
equal to 1048576 bytes."

* test(lambda): keep a pending durable callback across a restart

* fix(lambda): reject a durable callback failure body that is not a JSON object

AWS treats only an empty body as a failure with no Error. Whitespace,
null or broken JSON get 400 SerializationException and leave the
callback open.

* docs(lambda): note the durable callback result limit AWS enforces
2026-10-05 10:27:50 -04:00
Aniket Shukla a6df1dbb12 fix(cloudformation): apply stack tags during updates (#5031)
* fix(cloudformation): apply stack tags during updates

* test(cloudformation): cover tags-only and failed stack updates

* fix(cloudformation): distinguish empty tags from omitted tags

* fix(cloudformation): reject implicit CREATE with previous template

* test(cloudformation): validate stack tag updates with AWS SDK

* test(cloudformation): fail on SDK cleanup errors

* fix(cloudformation): allow previous template with omitted type
2026-10-05 10:20:35 -04:00
Aniket Shukla b988a061b4 fix(apigateway): preserve and update method response parameters (#5030)
* fix(apigateway): preserve and update method response parameters

* fix(apigateway): serialize method response patches and decode header paths

* fix(apigateway): return created for method response updates
2026-10-05 09:38:09 -04:00