Commit Graph
2856 Commits
Author SHA1 Message Date
Priamo Germosen ea77da8a2a refactor(codeartifact): split the pypiserver sidecar into a manager and a client (#5281)
PypiserverSidecarManager now owns only the container lifecycle: starting,
readiness, release, and teardown. The HTTP protocol and PEP 427/440 filename
matching move to PypiserverSidecarClient, which implements
RepositorySidecarManager and is what the registry and CodeArtifactPypiController
use, matching the Verdaccio and Reposilite pairs.

Wire-contract tests move to PypiserverSidecarClientTest against a JDK
HttpServer fake. No behavior changes.
2026-10-07 23:32:27 -05: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
Matheus Oliveira f6e76bbe30 fix(cloudformation): default CreateChangeSet type to UPDATE (#5287)
Follow-up to #5015.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-10-07 22:36:43 -04:00
Matheus Oliveira 673c809eff fix(lambda): add cookies array to function URL events (#5288)
* Fix #5255

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-10-07 22:35:51 -04:00
Hector Ventura 985921c3db fix(core): fail a Docker call after 30 seconds when its connection pool is full (#5285)
* fix(core): fail a Docker call after 30 seconds when its connection pool is full

With no connection-request timeout set, a call that could not lease a
pooled connection waited httpclient5's default three minutes before failing.
A full pool means the emulator is saturated, so the wait is now configurable
through floci.docker.connection-request-timeout-seconds (default 30), applied
to both pools. The transport retry already treats a lease timeout as pool
exhaustion and never replays it, so the call fails once, after the timeout.

* fix(core): reject a Docker lease timeout below one second

httpclient5 reads a zero connection-request timeout as no timeout, so
floci.docker.connection-request-timeout-seconds=0 let a call on a full
pool wait forever, and a negative value reached the client unchecked.
It now has to be at least 1, checked the way the two pool sizes are,
through one helper that names the setting and its environment variable.

The two producer tests that build the beans from a mocked config now
stub the timeout; they ran with zero before. The lease test's socket
list is shared with the acceptor thread, so it is a concurrent list.
2026-10-07 20:59:11 -04:00
Hector Ventura 2c2ac5dbfa test(partition): smoke-test ARN minting across partitions and gate new minting services (#5282)
* test(partition): smoke-test ARN minting across partitions and gate new minting services

Partition behaviour was proven in the emulator for a few services only.
PartitionCrossServiceSmokeIntegrationTest creates one resource in each of
the seven non-commercial partitions for SNS, Kinesis, Firehose, API
Gateway V2, ELBv2, Glue, IoT, ACM, CodeBuild, Batch and EFS and asserts
the ARN or host carries the request's partition, skipping only where the
vendored data says the partition does not offer the service.

PartitionSmokeInventoryTest scans the service packages that mint ARNs or
AWS hosts and fails unless each is covered by the smoke test or listed
with a reason in src/test/resources/partition/smoke-exemptions.tsv, so a
new minting service cannot arrive without a partition check. The file
starts with 92 rows: 10 covered by an existing partition test, 82 not
yet covered. AGENTS.md adds the step to the new-service checklist.

* test(partition): count direct Arn construction as minting and pin the HTTP API host

The inventory scan did not match new AwsArnUtils.Arn(...), so ssoadmin,
which mints its instance ARNs that way, was neither covered nor
exempted. The scan now matches the constructor, and ssoadmin is exempt
with its reason: one Identity Center instance per account, minted in
its primary region's partition, so a request signed in another
partition sees that ARN (BL-243). AGENTS.md names the constructor too.

The HTTP API case checked only the DNS suffix, so an endpoint minted
with another region of the same partition passed. It now asserts the
whole <apiId>.execute-api.<region>.<suffix> host.
2026-10-07 20:58:44 -04:00
Hector Ventura a3027c07cf fix(lambda): keep watching for a runtime exit after the wait stream fails (#5284)
* fix(lambda): keep watching for a runtime exit after the wait stream fails

The exit watcher streams Docker's wait-for-exit and was never re-armed once
that stream ended with an error. On a tcp:// Docker host the control-plane
client's five-minute response timeout becomes the socket read timeout, and
the stream sends nothing until the container exits, so any container alive
past five minutes lost its watcher: a runtime that crashed after that was
reported as Function.TimedOut instead of Runtime.ExitError, the case #3314
fixed. Any other stream failure (a dropped connection, a daemon restart) had
the same effect on every host.

The watcher moves to LambdaExitWatcher. When the stream ends with an error it
inspects the container: still running re-arms the watch, already exited
reports the inspected exit code, and gone reports nothing. Repeated immediate
failures stop the re-arming, so a daemon that cannot hold the stream does not
spin it.

* fix(lambda): retry the exit watch after a delay, and through a failed inspect

A dropped connection or a daemon restart usually fails the inspect that
follows the stream error too, and that path ended the watch for good;
the quick re-arms also ran back to back, spending the whole budget
within milliseconds of the daemon going away. A failed inspect now
counts as a quick failure, and each quick failure re-arms after a delay
that starts at one second and doubles, up to five in a row (31 seconds
in all). A stream that lived past five seconds still re-arms at once
and resets the count.

The clock and the scheduler are injected, so the tests drive the
backoff, the reset after a long-lived stream, and a failed inspect
followed by the exit it then reports.
2026-10-07 20:46:28 -04:00
TATSUNO “Taz” Yasuhiro 362d89f74f test(iot): retry the Paho WebSocket handshake race in concurrent tests (#5286)
* test(iot): retry the Paho WebSocket handshake race in concurrent tests

Paho 1.2.5 encodes the Sec-WebSocket-Key and checks the server's
Sec-WebSocket-Accept with one Base64 encoder that every client shares
unlocked. Clients that connect at the same time can read each other's
value and fail with "Incorrect Sec-WebSocket-Key" before the server is
involved. The concurrent WebSocket tests now retry that failure only.

* test(iot): set MQTT 3.1.1 inside the Paho WebSocket connect helper

With the default version, Paho answers a failed handshake by reconnecting
as MQTT 3.1, which the broker closes, so the race shows up as
"Connection lost" and is not retried. That is the EOFException of #3763.
The helper now sets 3.1.1 itself, so the race always surfaces as the
handshake error it retries and callers cannot forget the pin.

* test(iot): drop the unit test of the Paho WebSocket connect helper
2026-10-07 20:30:51 -04:00
jwoa95 ecdecf2ae2 fix(apigatewayv2): infer the 2.0 response body and answer function errors with a message (#5153)
* fix(apigatewayv2): infer the 2.0 response body and answer function errors with a message

* fix(apigatewayv2): keep format 1.0 response rules for 1.0 integrations on HTTP APIs
2026-10-07 19:31:34 -04:00
Priamo Germosen 1f1d4f94dd fix(cloudfront): stream origin responses and viewer request bodies (#5278)
A distribution read every origin response whole before answering the
viewer: an S3 origin's object through getObject, a custom origin's body
through the HTTP client into a byte array. A viewer's POST, PUT, PATCH
or DELETE body was likewise read whole before it was forwarded. So an
object or upload of about 2 GiB or more failed, and a smaller one could
run the heap out of memory.

S3 origins now open the object as a stream, the snapshot GetObject
serves, and custom origins return their response before its body is
read; either body is written to the viewer as it arrives, with its
Content-Length, or chunked as the origin sent it. A viewer's body is
streamed to the custom origin with its Content-Length, or chunked when
the viewer sent it chunked or, as HTTP/2 allows, with no length.

An origin response closed before its end, as when the viewer goes away
or a custom error page replaces it, cancels its request instead of
reading the rest of the body to reuse the connection. Since a streamed
response holds its connection for the whole transfer, one origin may
now use the whole connection pool, as CloudFront sets no per-origin
limit.
2026-10-07 18:02:42 -05:00
Priamo Germosen f5d48bb5e0 test(core): compare every Query handler's dispatched actions with its routing (#5279)
#5032 was 28 IAM operations that had drifted out of AwsQueryController's IAM set,
and nothing stopped the two lists drifting apart again, or caught the same gap in
the other Query services. This adds the comparison as a test and pins the gaps
that exist today so they can only shrink.

The test calls inferServiceFromAction itself rather than re-reading the routing
sets, so it measures what requests actually experience, including the chain order.
Only the dispatched-action list is parsed out of handler source, bounded to the
one switch the handler dispatches on: taking every case label in the file picks up
parameter names and state values from other switches, which is why the docs
generator carries per-service exclusions to undo exactly that.

Brace counting runs over a masked copy of the source rather than the source, so a
closing brace inside a comment or a literal cannot end the switch early. Greptile
raised that on the first version, and it is the worst way for this test to fail:
a truncated switch shortens the action list, and a handler with no listed gaps
would keep passing both checks while no longer checking anything. Masking the
comments also stops a commented-out case arm counting as a dispatched action.
Measured across all seventeen handlers, no truncation was happening today, so the
counts below are unaffected; five parser tests cover the cases, each failing with
the masking removed.

Three parity assertions, each probed by breaking it. Dropping a correctly routed
name from its set fails the first. Fixing a listed gap without delisting it fails the
second, which is what stops the list rotting into a place regressions can hide.
The third caught a real mistake while this was being written: StsQueryHandler
lives in the iam package, and the registry pointed at a path that does not exist.

The gaps are 189 entries over 10 services, in a data file so that fixing one is a
line removed. They are not all the same problem, and the file separates them:

  171 fall through to the chain's `return "sqs"` because no set holds the name.
      Mechanical to fix per service, the way #5032 did for IAM, once checked that
      no earlier service claims the name.

   18 are claimed by a service earlier in the chain, so adding the name to the
      right set changes nothing. EC2 owns DeleteTags and Auto Scaling, Redshift
      and ELBv2 all dispatch it; SNS owns ListTagsForResource over RDS,
      CloudWatch, DocDB and Neptune; IAM owns CreateUser and DeleteUser over
      ElastiCache. These need the Version form field, the way isElbClassicRequest
      already reads it, which is a cross-service routing change of its own.

Two things the measurement turned up that are worth knowing. SQS is in the list
despite being the fallback the chain ends in, because being the default does not
help a name an earlier service claims: AddPermission and RemovePermission reach
SNS. And the five services named in the #5227 discussion are ten, the additions
being CloudWatch, CloudFormation, SES, the ELB pair and SQS.

No production code changes here. Fixing any of the 189 is a separate change per
service, each of which deletes its lines from the file.

Refs #5032
2026-10-07 18:01:17 -05: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
Aniket Shukla 43c616d757 test(lambda): clean up hot reload functions (#5205)
* test(lambda): clean up hot reload functions

* test(lambda): preserve creation failures during cleanup
2026-10-07 16:50:27 -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
Mario Toffia 0f94d6213c fix(apigateway): resolve component parameter references on REST import (#4855)
An OpenAPI 3 operation that listed a parameter as
$ref: '#/components/parameters/<Name>' failed ImportRestApi, PutRestApi
and AWS::ApiGateway::RestApi with an HTTP 500: the document is parsed
without reference resolution, so the parameter arrived with no "in" and
the switch on it threw a NullPointerException.

The import now looks the reference up in components.parameters and maps
the parameter exactly as one written in place. It also accepts the
Swagger 2 form '#/parameters/<Name>', which an
x-amazon-apigateway-any-method keeps because the ANY method is read from
the raw vendor extension after conversion, and skips one naming a body
or formData parameter, as the in-place form is skipped. A reference that
names no component, or a chain of references that loops, fails the
import with a BadRequestException.
2026-10-07 16:07:46 -04:00
Sam Fakhreddine f661923faf feat(codepipeline): roll back a single stage from a successful target execution (#4618)
* feat(codepipeline): roll back a single stage from a successful target execution

RollbackStage now validates the stage and target, then re-runs only the source stages and the target stage as a ROLLBACK execution.

* fix(codepipeline): keep a rollback's stage filter across restart and retry

Persist the rolled-back stage name and derive the include-stages filter from it on start, resume and retry.

* fix(codepipeline): tighten RollbackStage eligibility, trigger type, events and source pinning

* fix(codepipeline): report a busy pipeline from RollbackStage as ConflictException

* fix(codepipeline): refuse rollbacks of source stages, rollback targets and running stages

RollbackStage now answers UnableToRollbackStageException when the stage is a source stage, when the target execution is itself a ROLLBACK execution, or when another execution is still running the stage, per the CodePipeline User Guide considerations for rollbacks.

* fix(codepipeline): reject RollbackStage on PARALLEL pipelines and close the concurrent rollback window

RollbackStage now answers ValidationException for PARALLEL pipelines, checks for a running stage (including a rollback still fetching sources) under the pipeline start lock, records the manual-start triggerDetail instead of the target id, and shares one source-action helper.
2026-10-07 15:54:47 -04:00
Sam Fakhreddine b9625bf7f7 fix(lambda): check the RevisionId precondition in UpdateFunctionCode (#4641)
* fix(lambda): check the RevisionId precondition in UpdateFunctionCode

Fixes #4639

- M1 PASS: RED run: [ERROR] io.github.hectorvent.floci.services.lambda.LambdaServiceTest.updateFunctionCode_withMismatchedRevisionId_throwsPreconditionFailedException -- Time elapsed: 0.457 s <<< FAILURE!
- M2 PASS: gates green, last summary: [INFO] Tests run: 192, Failures: 0, Errors: 0, Skipped: 0
- M3 PASS: 2 file(s), all in scope
- M4 PASS: no new public members in main code
- M5 PASS: main diff 11 changed lines, limit 25
- M6 PASS: no em-dash in added lines
- A1 PASS: `LambdaService.java:+671-+678` throws `AwsException("PreconditionFailedException", "...", 412)`; `LambdaServiceTest.java:+1780-+1781` asserts exact code, status, and message literals.
- A2 PASS: `LambdaService.java:+671-+678` sits before all `fn.set...` calls; `LambdaServiceTest.java:+1770-+1788` captures `initialRevisionId` before call and asserts `unchangedFn.getRevisionId()` matches it.
- A3 PASS: `LambdaServiceTest.java:+1790-+1794` sends matching RevisionId and asserts update succeeds; Gate 2 output `Tests run: 192, Failures: 0, Errors: 0, Skipped: 0` confirms no regression.
- A4 PASS: `LambdaServiceTest.java:+1779` invokes public `service.updateFunctionCode(...)`; `LambdaServiceTest.java:+1780-+1781` asserts literal error code `"PreconditionFailedException"` and status `412`.
- G1 PASS: `LambdaService.java:+671-+678` directly implements the missing optimistic locking logic identified in the diagnosis, not a test workaround.
- G2 PASS: `LambdaServiceTest.java:+1780-+1781` asserts hardcoded literals for errorCode, httpStatus, and message; `LambdaServiceTest.java:+1788` asserts exact pre-call `initialRevisionId` value.
- G3 PASS: Diff modifies only `LambdaService.java:+671-+678` (a guard clause); Gate 2 shows 0 failures across the full suite, proving other paths are untouched.
- G4 PASS: `LambdaServiceTest.java:+1780-+1781` enforces AWS-correct `PreconditionFailedException` and `412`; `LambdaServiceTest.java:+1788` verifies state is unmutated after rejection.

* refactor(lambda): share the RevisionId precondition check

UpdateFunctionCode and UpdateFunctionConfiguration now call one helper. The stale-RevisionId test also asserts CodeSha256 is unchanged after the rejected call, so it fails if the check moves below code extraction.

* fix(lambda): use the RevisionId mismatch message AWS returns
2026-10-07 15:50:23 -04:00
Salil Chincholikar d0fec13cae fix(s3): url-encode event record keys and add sequencer (#5192)
* fix(s3): url-encode event record keys and add sequencer

S3 event notification records now carry s3.object.key form URL-encoded
as AWS sends it (space as +, + as %2B, / kept) and an s3.object.sequencer
of 18 uppercase hex digits that increases for every event.

* fix(s3): assign the event sequencer when the object is stored

The sequencer was taken when the notification was built, after the bucket
lock was released, so two concurrent writes to one key could get values in
the reverse of the order they were stored in. It is now assigned in
storeObjectInternal under the bucket lock and carried on the stored object
for its ObjectCreated event. Any other event names an object that already
existed, so it still takes a new value when it is built.

* fix(s3): take annotation event sequencers under the bucket lock

putObjectAnnotation and deleteObjectAnnotation fire their notification
after the bucket monitor is released, so an overwrite of the key landing
in between could get a lower sequencer than the annotation event for the
object it replaced. Both now take the sequencer inside the synchronized
block and hand it to fireNotifications, as the delete paths already do by
firing inside it.
2026-10-07 15:36:27 -04:00
Kenshin Okinaka 86371d86cb fix(ses): match AWS tag ARN parsing and configuration set name errors (#5235)
* fix(ses): match AWS tag ARN parsing and configuration set name errors

The SES v2 tag endpoints rejected malformed ARNs with messages that were
never checked against AWS, refused ARNs whose service was not "ses", and
compared the region before checking the resource exists. Configuration
set names were rejected with an invented message on both APIs.

Probed against AWS in us-west-2:

- Every malformed ARN (missing partition, service, account or resource
  name, unknown type, ":" or "/" in the name) is BadRequestException
  "ResourceArn is not the expected format", including an unknown type,
  which was a 404.
- The partition and service are required but never compared.
- An invalid configuration-set name in the ARN is a message-less
  ValidationException after the account check.
- TagResource and UntagResource check existence before the region.
- An omitted ResourceArn on Tag/Untag is a message-less
  ValidationException. ListTagsForResource keeps a 400 where AWS
  answers 500.
- "ResourceArn=" is read raw, since @QueryParam binds an empty value
  as null.
- Configuration set names use AWS's three messages on every v1 and v2
  operation, including sends: must be specified, cannot exceed 64
  characters, and invalid characters.

* refactor(ses): share the configuration set name check and map tag domains by type

The v1 helper and the v2 CreateConfigurationSet handler now call the
service's validateName instead of repeating the empty-name check, and the
name pattern no longer restates the 64-character limit the length check
owns.

The seven taggable domain services implement SesTaggable, and SesService
keys them by ARN type in one map. That map replaces the type set and the
three dispatch switches, whose default arms could no longer be reached.
2026-10-07 14:27:36 -04:00
Salil Chincholikar 74b3cecf78 feat(ses): support Content.Simple.Attachments in SESv2 SendEmail (#5190)
* feat(ses): support Content.Simple.Attachments in SESv2 SendEmail

Parse and validate Simple attachments, assemble them into one MIME message
with the relay's encoder, run the content scan over it as for raw sends,
relay them over SMTP, and expose them in the /_aws/ses mailbox as an
Attachments summary plus the base64 MIME message in RawData.

* fix(ses): sort SesService imports and document attachment encoding and RawData recipients

RawData keeps the To and Cc recipients the request named, including any
suppression later kept from delivery, and ContentTransferEncoding is validated
but every attachment part is base64-encoded. Both are now stated in the SES docs.

* fix(ses): reject line breaks in attachment MIME header members

ContentType, ContentDescription and ContentId are written verbatim into the
attachment part's MIME headers, so a CR or LF in any of them added header lines
to that part. They are now refused with BadRequestException by the same rule
MessageHeader.isSafe applies to custom headers. missingHeaderMember now builds
its message through constraintViolation.

* fix(ses): refuse attachments with unsupported file extensions

SES does not accept attachments whose file names end in one of the
extensions listed under "SES unsupported attachment types" in the developer
guide. The content scan now walks the parsed MIME for attachment file names,
from Content-Disposition or the Content-Type name parameter, and both the
Simple-with-attachments and raw send paths refuse such a message with
MessageRejected before anything is recorded.

* refactor(ses): share one MIME part walk between the content scans

hasBlockedAttachment repeated the worklist entityContains already used.
Both now go through anyPart, which walks every part, forwarded messages
and multiparts included, and runs the given check on each.
2026-10-07 14:22:34 -04:00
Allen Sanborn 4eae79d546 fix(ec2): canonicalize VPC and subnet CIDR blocks on create (#5214)
* fix(ec2): canonicalize VPC and subnet CIDR blocks on create

AWS stores the IPv4 CidrBlock of CreateVpc and CreateSubnet in canonical
form ("100.68.0.18/18" becomes "100.68.0.0/18"); Floci stored it
verbatim. Canonicalize once at the top of createVpc and createSubnet so
the stored block, the VPC CIDR association, the subnet conflict check and
the network declaration all use the canonical value. A null subnet CIDR
(IPv6-only subnet) stays null.

The CloudFormation VPC and subnet provisioners compare the template's
CidrBlock against the stored one to decide reuse on update; compare in
canonical form so an unchanged template with host bits set is not
replaced on every update.

* fix(cloudformation): compare saved VPC and subnet CIDRs canonically on update

VPCs and subnets persisted before CIDR canonicalization can still hold host
bits (10.0.1.9/24). Canonicalizing only the template side made an unchanged
range look changed after upgrade: the subnet path called createSubnet and hit
InvalidSubnet.Conflict, the VPC path created a replacement. Canonicalize both
sides of the reuse comparison.

* docs(ec2): generalize canonicalizeIpv4Cidr to its VPC and subnet callers

The helper now canonicalizes CreateVpc and CreateSubnet CIDRs as well as
route destinations, but its Javadoc and parameter name still described
DestinationCidrBlock only. Rename the parameter to ipv4CidrBlock, cover all
three callers in the Javadoc, and drop its em-dashes. No behavior change.

* refactor(cidr): add CidrCanonicalizer.sameBlock for the provisioner comparisons

The subnet and VPC reuse checks each canonicalized both sides inline. Move
that comparison into one helper next to canonicalize, with the same
fallback to the raw string for an unparseable side and the same null
handling. No behavior change.
2026-10-07 14:09:24 -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
Younes Beriane bdb37f0ca3 fix(rds-data): accept parameter names that start with a digit (#5119)
* fix(rds-data): accept parameter names that start with a digit

* fix(rds-data): do not treat array-slice bounds as numeric parameters

* fix(rds-data): decide array slices at the opening bracket

A [ right after a name other than ARRAY, a ] or a ) is a subscript, and a
:digit directly inside it is a slice bound however it is spaced. ARRAY[:1]
is a constructor, so :1 there stays a parameter. Tests use no var.

* fix(rds-data): track the last operand to tell slice bounds from parameters

Inside an array subscript a :digit is a slice bound only after an operand
(or directly after the opening bracket) and a parameter after an operator,
comma or paren, so arr[1 + :1] binds :1. The scan now remembers the last
significant token, skipping comments, so arr /* note */ [1:2] is still a
subscript.

* fix(rds-data): drop clause words from the non-operand keyword list

SET, BY, VALUES, SELECT, FROM, WHERE, ON and RETURNING never sit right
before a [ or a :digit inside a subscript, and a column may carry such a
name, so set[1:2] no longer turns :2 into a parameter. Make
isNonOperandWord a switch expression.
2026-10-07 11:29:50 -04:00
jwoa95 c6369b321a fix(apigatewayv2): send cookies and comma-joined duplicates in the 2.0 event (#5152)
* fix(apigatewayv2): send cookies and comma-joined duplicates in the 2.0 event

* fix(apigatewayv2): send cookies and comma-joined duplicates to the 2.0 Lambda authorizer

The HTTP API Lambda authorizer gets the same 2.0 payload as the integration, so both builders now share one helper for cookies, headers and queryStringParameters.
2026-10-07 10:53:50 -04:00
jwoa95 1199f3a790 fix(rds): forward PostgreSQL startup parameters through the proxy (#5151)
* fix(rds): forward PostgreSQL startup parameters through the proxy

The RDS proxy parsed the client's StartupMessage but opened the backend
session with only user and database, so options, application_name and
every other run-time parameter were silently dropped.

Forward them in the order the client sent them. The proxy keeps setting
user and database itself, and drops _pq_. protocol extension requests,
which it does not negotiate with the backend.

An IAM login for a role other than the master still sends only user and
database: its backend session is the master's until the handover, and a
startup "-c role=<master>" would outlive SET SESSION AUTHORIZATION, so
RESET ROLE would regain the master. Redshift keeps today's behaviour, as
its drivers send parameters PostgreSQL rejects.

* fix(rds): relay PostgreSQL's refusal of the backend login to the client

Forwarding startup parameters makes new backend refusals possible, such as
replication=true with no pg_hba.conf entry allowing it. PostgreSQL answers
those with an ErrorResponse where the proxy expected an Authentication
message, and the proxy reported only "Backend database authentication
failed". Every read that expects an Authentication message now reads a
refusal whole and the proxy sends it to the client unchanged, so the client
sees PostgreSQL's SQLSTATE and reason. This covers a refusal before the
password exchange and one after it. Other unexpected replies keep the
generic error.

* test(rds): reuse the IAM auth harness and the handler's startup parser

Fold the IAM startup-parameter check into iamSessionRunsAsTheRoleNamedInTheToken, let backendStartupFor start its auth thread through startIamAuth, and make PostgresProtocolHandler.parseStartupParams package-private so the test no longer keeps its own copy.
2026-10-07 10:42:11 -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
Aniket Shukla d8b170a144 fix(rds): restrict custom endpoint mutations to Aurora (#5206)
* fix(rds): restrict cluster endpoints to Aurora

* fix(rds): preserve legacy cluster endpoints

* fix(rds): align cluster endpoint restrictions
2026-10-07 09:52:42 -04:00
Hector Ventura 9d49e619c1 fix(appsync): front custom domains with the partition's CloudFront zone (#5237)
* fix(appsync): front custom domains with the partition's CloudFront zone

CreateDomainName returned a random hosted zone id and an appsync-api
regional host as appsyncDomainName. AppSync serves a custom domain
through CloudFront: the CDK aliases appsyncDomainName into the
partition's CloudFront hosted zone (aws-route53-targets AppSyncTarget),
so a DNS alias built from Floci's answer pointed at a zone that does not
exist. The domain now gets a CloudFront distribution name on the
configured CloudFront suffix and the partition's CloudFront hosted zone
(Z2FDTNDATAQYW2 in aws, Z3RFFRIM2A3IF5 in aws-cn), as an edge-optimized
API Gateway domain does.

* refactor(appsync): share the CloudFront front with edge-optimized API Gateway domains

An AppSync custom domain and an edge-optimized API Gateway domain both
get a CloudFront distribution name and the partition's CloudFront hosted
zone, and the two services built that pair with the same copied
statements. CloudFrontEdgeDomain now builds it once for both.

RequestRegionArnIntegrationTest still expected appsyncDomainName to
carry the request region; it now asserts the CloudFront form, while its
domain ARN assertion keeps checking the region.
2026-10-07 09:34:02 -04:00
Allen Sanborn 73133b472a fix(mq): return CreateBroker members from DescribeBroker (#5211)
* fix(mq): return CreateBroker members from DescribeBroker

CreateBroker accepted securityGroups, subnetIds, logs,
maintenanceWindowStartTime, storageType, authenticationStrategy,
encryptionOptions and configuration, but discarded them, so
DescribeBroker never returned them. Carry them through
CreateBrokerParams to the persisted Broker and into the DescribeBroker
response, with configuration reported as configurations.current as in
the AWS shape. Absent members are omitted, and brokers persisted before
this change still load.

RabbitMQ users stay out of DescribeBroker (#1951).

* fix(mq): report DescribeBroker logs as a LogsSummary

general and generalLogGroup are required in LogsSummary; general defaults
to false and the log group is /aws/amazonmq/broker/<broker-id>/general.
audit/auditLogGroup are reported only when audit logging was requested.

* fix(mq): report only the general log group in LogsSummary

Audit logs are ActiveMQ-only, and Floci emulates RabbitMQ brokers.
Document DescribeBroker's logs as a LogsSummary rather than an echo.

* fix(mq): stream broker logs to the general log group DescribeBroker reports

RabbitMqManager streamed container logs to /aws/amazonmq/broker/<id>
while DescribeBroker named /aws/amazonmq/broker/<id>/general. Both now
take the name from Broker.generalLogGroup().
2026-10-07 09:14:41 -04:00
Priamo Germosen 5fc8b0418c fix(iam): separate a constraint failure from an invalid value in PutAccountProperties (#5240)
The key pattern and length checks answered InvalidInput while carrying the
"failed to satisfy constraint" wording that every other constraint check in
IamService pairs with ValidationError. The model declares InvalidInputException
on the operation and says nothing about which code a pattern miss produces, so
the two had drifted apart with nothing to settle them.

The API Reference settles it in Common Error Types rather than the operation's
own error table. ValidationError is a common error for every action, defined as
"The input doesn't meet the required format or constraints", 400. InvalidInput,
the one the operation declares, is "an invalid or out-of-range value was supplied
for an input parameter". PutAccountProperties publishes a Key Pattern of
^[A-Za-z][A-Za-z0-9/_-]*$, a key length of 1 to 50 and a value length of 1 to
1024, and the model declares all three on accountPropertyKeyType and
accountPropertyValueType. Violating a published pattern or length is a format
failure; a value that satisfies them and is still wrong is not.

So it is a split rather than a rename. The key pattern and length, and the value
length, are now ValidationError and keep the constraint wording, which was
already right for them. The Namespace/PropertyName rule stays InvalidInput: the
published pattern admits a key with no slash, with several, and with a trailing
one, so that rule only applies once the format is already good. Its message drops
the constraint wording and reads as prose, since that wording is what made the
pair look inconsistent. The same-namespace rule is unchanged.

aMalformedKeyIsRejected asserted one code for seven keys that fall on both sides
of that line, so it splits in two, each asserting its own code and the absence of
the other. As written it could not tell a pattern failure from the slash rule.

Not touched, though the same reading would question it: createServiceLinkedRole
answers InvalidInput for a check that is exactly the declared constraint on
AWSServiceName. Its message is prose rather than the front-end format, there is
no recording either way, and CreateServiceLinkedRole's error table is structured
identically to this one, so it proves nothing. Left alone rather than changed on
inference.

Refs #5177
2026-10-07 08:03:02 -05:00
Priamo Germosen 3a8f974554 fix(iam): answer AWS's own errors for a malformed service-credential id, and for DeleteUser (#5239)
Three answers on the service-specific credential operations did not match what
AWS sends. All three are recorded against real AWS in LocalStack's IAM snapshots,
under @markers.aws.validated.

A ServiceSpecificCredentialId that does not match the model's [\w]+ was looked up
regardless, so it came back NoSuchEntity 404. AWS checks the format first and
answers ValidationError 400 quoting the pattern, on UpdateServiceSpecificCredential,
ResetServiceSpecificCredential and DeleteServiceSpecificCredential alike. A
malformed id and an unknown one are different mistakes, and they now get
different answers.

An id that does satisfy the pattern and names no credential of that user was
"The Service Specific Credential with id <id> cannot be found." AWS says "No such
credential <id> exists", still NoSuchEntity 404.

DeleteUser named the credential in its refusal: "must delete service-specific
credentials first." This case gets no message of its own on AWS, unlike the
access-key and policy cases beside it, and falls back to the generic "Cannot
delete entity, must remove referenced objects first.", DeleteConflict 409.

The API Reference publishes a length of 20 to 128 on the id as well as the
pattern, so both are now enforced, and an id breaking both is reported as two
validation errors rather than one, which is what the counted prefix is for. Only
the pattern message is recorded; the length wording is the form AWS uses for a
member carrying both bounds, which validateLoginProfilePassword already spells
the same way.

The same snapshots show an invalid Status answered with "1 validation error
detected: Value at 'status' failed to satisfy constraint: Member must satisfy
enum value set", naming neither the offending value nor the permitted set, where
the code named both. statusType is one shape, validated by one front end, and
UpdateSigningCertificate, UpdateSSHPublicKey and UpdateServiceSpecificCredential
all take it, so the recording of one is the rendering of all three. They had the
same message copied three times and now share a helper, placed ahead of all three
rather than inside one family's section. Elsewhere in the tree this message does
carry the permitted set, and those are other services with their own renderings,
so they are left alone.

UpdateSSHPublicKey had no test for a status outside the enum at all, and the two
that did have one asserted only the code, so the message none of them pinned
could have been reverted with the suite still green. All three now assert the
counted prefix and the absence of both the value and the set.

UpdateAccessKey takes the same shape and is further off: "Status must be Active
or Inactive." is not AWS's format at all, it refuses the Expired that statusType
allows, and it validates the status only after looking the key up, so a bad key
and a bad status answer NoSuchEntity where the front end would answer
ValidationError first. That is a behavioural change with its own tests to write,
so it is not folded in here.

Refs #5084
2026-10-07 08:02:43 -05:00
Priamo Germosen a927c5aac6 refactor(codeartifact): split the Verdaccio sidecar into a manager and a client (#5234)
VerdaccioSidecarManager now owns only the container lifecycle: starting,
readiness, release, and teardown. The HTTP protocol moves to
VerdaccioSidecarClient, which implements RepositorySidecarManager and is what
the registry and the npm data plane use, matching the Reposilite pair.

Wire-contract tests move to VerdaccioSidecarClientTest against a JDK
HttpServer fake. No behavior changes.
2026-10-07 07:43:26 -05:00
Priamo Germosen 4495ade6bb fix(iam): route every dispatched IAM action, and require the parameters the model requires (#5227)
28 operations IamQueryHandler dispatches were missing from AwsQueryController's
IAM set. Without a usable credential scope the controller infers the service from
the action name alone, and that chain ends in `return "sqs"`, so those answered
UnsupportedOperation in the SQS namespace. IamEnforcementFilter resolves the
policy namespace through the same code, so they were also authorized as
sqs:<Action>, and a policy denying iam:* missed them.

The set now matches the handler exactly in both directions: 158 dispatched, 158
routed, nothing routed that is not dispatched. None of the 28 names is defined by
another service here, so this adds no ambiguity to the 14 action names that
already collide across services.

Separately, five operations in the permissions-boundary family read
model-required parameters through the nullable accessor, so a missing one reached
the service as null and surfaced as InternalFailure from a null map key:
UpdateAssumeRolePolicy, PutUserPermissionsBoundary, PutRolePermissionsBoundary
and DeleteRolePermissionsBoundary did, DeleteUserPermissionsBoundary happened to
fail cleanly. That was already reachable through an IAM credential scope, so it
predates this change; routing by action name adds a second way in. All five now
answer ValidationError, and the test supplies the name on the three that take a
second required parameter, so the check on PolicyDocument and PermissionsBoundary
is exercised rather than shadowed by the one on the name.

What this does not do is decide whether Version should disambiguate a shared
action name. That is a cross-service routing change, it affects 14 names in
services this does not otherwise touch, and it is the prerequisite for IAM
ChangePassword rather than for these 28.

Refs #5032
2026-10-07 07:42:39 -05:00
Hector Ventura 7f5a332620 fix(ec2): derive flow log az-id the way subnets do (#5238)
Flow log records derived az-id with a mapping of their own (use1-az1,
and cnnorth1-az1 for China), while subnets and DescribeAvailabilityZones
derive zone ids with Ec2Service.zoneIdForZoneName (us-east-1-az1), so a
record's az-id never matched the AvailabilityZoneId of the subnet it
came from. Flow logs now use the same derivation in every region.
2026-10-06 23:59:22 -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
Hector Ventura 8a1d1ddcd3 fix(partition): read strict-mode service availability from endpoint rulesets too (#5231)
* fix(partition): read strict-mode service availability from endpoint rulesets too

Strict partition mode refused services AWS serves. The per-partition
service list came from botocore's endpoints.json alone, which leaves out
IAM, Route 53, Budgets and Cost Explorer in aws-eusc and IAM and Cost
Explorer in aws-iso-e, although each service's endpoint ruleset has an
explicit branch for the partition (iam.eusc-de-east-1.amazonaws.eu). The
generator now adds those partitions, for services endpoints.json lists
somewhere, and records them under servicesFromRulesets.

The execute-api signing name was mapped to Connect Participant only, so
IAM-authorized API Gateway invokes were refused in China, EUSC and the
ISO partitions. A signing name is now left out of the alias map when a
service whose own endpoint prefix is that name is listed nowhere, so
strict mode no longer judges execute-api.

The docs and config comments no longer say IAM is absent from aws-eusc.

* test(partition): assert API Gateway answers the strict-mode execute-api probe

The execute-api strict-mode test accepted any response but a 200 that
lacked the strict-mode error, so a 500 or an unrelated rejection would
also pass. It now requires API Gateway's own answer for a missing API:
a 404 NotFoundException with "Invalid API id specified".
2026-10-06 23:07:22 -04:00
Hector Ventura e1cd6fe6d4 fix(partition): serve a pseudo signing region as its partition's global region (#5233)
A request whose SigV4 scope named a <partition>-global pseudo-region
(aws-cn-global) kept the label as its region, so regional services
stored state under it and minted ARNs such as
arn:aws-cn:sqs:aws-cn-global:... for a region that does not exist. AWS
never signs with a pseudo-region: endpoints.json maps each to a real
credential scope region. RegionResolver now serves such a scope as the
partition's implicit global region (aws-cn-global becomes
cn-northwest-1) wherever it reads the region from a request.

With floci.partitions.allow-unknown-regions in a non-commercial
deployment, an unknown label was scoped to the deployment's partition
but RegionResolver.buildArn minted it as aws. buildArn now uses the
same partition as the request. ARNs built directly with Arn.of keep
the commercial fallback, which partitions.md now states.
2026-10-06 23:00:22 -04:00
Salil Chincholikar c0b2b299b0 feat(sns): sign deliveries with a served RSA certificate like AWS (#5189)
* feat(sns): sign deliveries with a served RSA certificate like AWS

Replace the EXAMPLE Signature and SigningCertURL placeholders with real
signatures over the documented canonical string. Notifications and
subscription confirmations delivered to HTTP/HTTPS endpoints, Lambda
records and non-raw SQS envelopes are signed with SHA1withRSA, or
SHA256withRSA when the topic sets SignatureVersion to 2.

The RSA 2048 key and its self-signed certificate are kept in SNS storage
and the certificate is served at
/_aws/sns/SimpleNotificationService-<fingerprint>.pem, so a new key always
gets a new URL. The SQS envelope now carries UnsubscribeURL and the Lambda
record a real UnsubscribeUrl, as on AWS.

* fix(sns): drop a delivery when signing fails and regenerate the key on reset

A signing failure in the Lambda, SQS and HTTP builders was caught with the JSON
fallback and delivered an empty placeholder as if it had succeeded. Only a JSON
serialization error falls back now; a signing failure fails that delivery.

SnsMessageSigner is now Resettable: a reset drops the cached key instead of
writing it back to the cleared store, so the next delivery generates a new one.

* style(sns): sort SnsService imports

* refactor(sns): build the SQS envelope with the builder Firehose uses

buildSnsSqsEnvelope duplicated buildSnsEnvelope apart from the signature and UnsubscribeURL. buildSnsEnvelope now takes the subscription ARN and signature version and adds both only when a subscription is given, so SQS and Firehose share one builder again.
2026-10-06 22:50:56 -04:00
Hector Ventura 1b61945f28 fix(partition): hold escaped host regexes to the DNS suffix gate (#5232)
The partition literal gate's dns-suffix pattern matched amazonaws.com but
not a Java regex that escapes its dots (amazonaws\\.com), so hand-written
host patterns escaped it. With the dots allowed to be escaped, the gate
found two on main:

- ECR's pull-through cache recognised an ecr upstream only on the
  commercial and China suffixes, while Floci's own registry recognises an
  ECR image URI in every partition. The upstream host pattern is now
  built from AwsPartitions.dnsSuffixRegex() the same way.
- The console sign-in host pattern in SigninService has no published
  non-commercial form, so it carries a partition-literal escape like the
  console literals beside it.
2026-10-06 22:49:23 -04:00
Priamo Germosen a0a2a5f0d6 fix(s3): run S3 Select over CSV and JSON a record at a time (#5178)
SelectObjectContent loaded the whole object into a byte array and built
the whole response before sending it, so an object over about 2 GiB
failed with an internal error, and a large object or result could run
the heap out of memory.

The object is now opened as a stream, the snapshot GetObject uses. The
Java evaluator parses the statement before reading anything, then reads
CSV a line at a time and JSON a line or an array element at a time,
stops once a LIMIT is reached, and writes the result as it goes, in
Records events of whole records, then Stats and End. Queries floci-duck
runs read the object themselves and no longer load it just to count
BytesScanned.
2026-10-06 20:32:13 -05: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
Priamo Germosen 2cf011f726 fix(codeartifact): make npm republish of identical content idempotent (#5163)
Real AWS CodeArtifact documents PublishPackageVersion as idempotent: republishing
an existing asset with identical content succeeds. Verdaccio, which backs the npm
data plane, and real npm registries reject every republish of an existing version
with 409, even for byte-identical content, so Floci inherited that behavior.

A PUT to a bare package path is now spooled to a temp file in bounded chunks and
scanned as a stream. Each attachment's base64 data is hashed as it passes, and the
publish answers 200 without reaching Verdaccio only when every version's integrity
matches the stored packument, every dist-tag the publish sends already points where
it says, and no attachment is left unaccounted for. Anything else forwards the
spooled body unchanged, so Verdaccio's response stays authoritative. Envelope size
never has to fit on heap.

At most four publishes run this check at once; a publish beyond that waits in a
bounded queue, and when the queue is full it is answered 429 with Retry-After.
2026-10-06 20:31:50 -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
Younes Beriane a7e2447a34 fix(rds-data): reject an ExecuteStatement response over 1 MiB (#5120)
* fix(rds-data): reject an ExecuteStatement response over 1 MiB

* fix(rds-data): count records array brackets and commas in the response size limit

* fix(rds-data): throw UnsupportedResultException for a response over the size limit
2026-10-06 14:57:29 -04:00
jwoa95 45f45e590e fix(cognito): send email from the pool's EmailConfiguration sender (#5150)
* fix(cognito): send email from the pool's EmailConfiguration sender

Cognito email always came from no-reply@verificationemail.com. It now
follows EmailConfigurationType: with DEVELOPER, From when set, otherwise
the SourceArn identity's address; with COGNITO_DEFAULT, the SourceArn
address. A domain identity takes its address from From. Without a
SourceArn, the default address is kept.

* test(cognito): read captured mail without the ?email= filter

* fix(cognito): send from the configured sender only when SES has verified it

A pool's EmailConfiguration sender is now used only when its SourceArn
names an SES identity in the pool's account that SES has verified in the
SourceArn Region (the pool's Region for a wildcard Region), and a From
that supplies the sender is one mailbox at that address or in that
domain. Anything else sends from no-reply@verificationemail.com and logs
a warning, so a pool can no longer send as an address its account has
not verified.

When From has a sender name, the bare address now goes in ReturnPath.
SES takes Source as the default return path, so the captured message's
ReturnPath, and the envelope sender handed to the SMTP relay, was
"Name <address>". The relay's mail client happened to strip the name
from MAIL FROM; the envelope no longer depends on that.

* style(cognito): use one parameterised message in the sender fallback log

* fix(cognito): accept subdomains of a domain identity and match email identities exactly

A verified SES domain covers its subdomains, so a From in one of them now sends instead of falling back. Email address identities are case sensitive, domain part included, so the From must equal the identity. The SourceArn must also be in the user pool's partition, not only its account.

* refactor(ses): keep one definition of a verified identity

SesService.isVerifiedIdentity now delegates to SesIdentityService.isIdentityVerified, made package-private, instead of repeating its check.
2026-10-06 13:51:51 -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
jwoa95 69b4d17c67 fix(cognito): run the PreSignUp trigger on AdminCreateUser (#5149)
* fix(cognito): run the PreSignUp trigger on AdminCreateUser

AWS invokes the pre sign-up trigger when AdminCreateUser creates a user,
with triggerSource PreSignUp_AdminCreateUser, the request's ValidationData
and ClientMetadata, and ignores the response's autoConfirmUser,
autoVerifyEmail and autoVerifyPhone. A trigger error refuses the user.

The trigger runs before anything is stored, so a refused ForceAliasCreation
request no longer moves the alias off the existing user.

* fix(cognito): invoke PreSignUp outside the user lock on AdminCreateUser

AdminCreateUser held the lock stripe of the requested username while
the pre sign-up trigger ran. A function that called back into the pool
for an identifier on the same stripe, such as AdminCreateUser for the
same username, waited for that lock until the invocation timed out.

The trigger now runs with no lock held. A taken username or alias is
still refused before the trigger is invoked, and the checks run again
under the lock once it accepts, so a user created while the trigger ran
still fails the request with UsernameExistsException.

With ForceAliasCreation, the alias holder was read before the trigger
and written back after it, which could undo a change made to the holder
in the meantime or restore a deleted holder. The holder is now looked up
under the lock after the trigger, just before its alias is moved.

* fix(cognito): run PreSignUp once per in-flight AdminCreateUser username

With the pre sign-up trigger running outside the user lock, two
overlapping AdminCreateUser requests for the same free username could
both pass the existence check and both invoke the trigger. The later
one was then refused under the lock after its function had already run,
or failed with the function's own error instead of
UsernameExistsException.

AdminCreateUser now claims the username before checking it and gives
the claim up once the user is stored or the request fails. An
overlapping request for the same username, including one the function
makes for the username it was given, is refused with
UsernameExistsException before it invokes the trigger.
2026-10-06 08:18:14 -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