Commit Graph
2175 Commits
Author SHA1 Message Date
Allen Sanborn daecc6da17 fix(route53resolver): CreateResolverEndpoint reads IpAddresses, as AWS names it (#4180)
* fix(route53resolver): CreateResolverEndpoint reads IpAddresses, as AWS names it

CreateResolverEndpoint read its address list from a member called
IpAddressRequests. AWS names that member IpAddresses; the list's SHAPE is named
IpAddressRequest, which is where the wrong wire name came from.

The distinction is not cosmetic. Every AWS SDK, the CLI and the Terraform
provider serialise IpAddresses, and the CLI refuses to send IpAddressRequests at
all because no such member exists in its model. So the operation dispatched and
no real client could call it:

  {"Name":"ep","Direction":"INBOUND","SecurityGroupIds":["sg-1"],
   "IpAddresses":[{"SubnetId":"subnet-1"}]}
  -> 400 InvalidParameterException: IpAddressRequests is required

That is the worst shape a gap can take, because every cheap check says the
service works: it is in the service directory, /_floci/health lists it, an
operation-name grep finds it, and a does-it-route probe passes.

Reads IpAddresses, still accepting the old spelling so anything written against
the previous behaviour keeps working — the existing CustomResources tests use it
and are untouched. The error message names only the AWS member, since it is the
sole hint a caller gets. The idempotency record keeps its internal member name
deliberately: renaming it would make every endpoint stored by an earlier build
read as absent, which that code reports as a replay conflict.

Tests: the AWS member is accepted, the legacy one still is, a retry that switches
between the two spellings is not a conflict, and the missing-member error names
IpAddresses. 55 Route53Resolver tests pass.

Reported as #4108. Found while confirming that an earlier finding — Route53Resolver
absent entirely — had been fixed upstream: the probe written for it asserted only
that the call dispatches, which is what let this hide behind it.

* style: use -- rather than an em dash in added prose

AGENTS.md forbids em dashes in all content and the conformance check flags them.
Two in javadoc lines this branch added. Comments only, no behaviour change.

* docs(route53resolver): name the list shape correctly, and trim the member note

The list shape is `IpAddressesRequest`; `IpAddressRequest` is the shape of each
element, and that element name is where the wrong wire spelling came from. Both
the service doc and the Javadoc on ipAddressesOf had it as the list's own name.

The Javadoc also carried a paragraph on how the bug stayed hidden, which the PR
description already covers at length. What a reader of this method needs is the
member name and the legacy alias, so that is what is left.
2026-09-23 11:20:50 -04:00
Aniket Shukla de50859273 fix(sns): match nested message-body policies in arrays (#4234) 2026-09-23 11:03:10 -04:00
Allen Sanborn aba5f4e919 fix(ec2): release a capture when a whole batch of instances is terminated (#4127)
* fix(ec2): release a capture when a whole batch of instances is terminated

TerminateInstances excluded only the instance currently being processed when
deciding whether a deregistered AMI's capture still had a live dependant. Every
other instance of the same request still read as running or shutting-down, so
each reclaim attempt in the batch was blocked, and since nothing revisits the
batch once its asynchronous teardown finishes the committed Docker layer stayed
on disk for the lifetime of the emulator.

Thread the ids of the whole request through terminateInstances ->
reclaimCapturesPinnedBy -> reclaimCapturedImage, so none of them counts as a
live dependant. The reclaim is now attempted on the first instance of the batch,
while the other containers may still exist and the daemon may refuse to delete
the layer; the reference is only cleared on success, so the attempt comes round
again on each remaining instance and the last one succeeds. Both behaviours are
covered by new tests that terminate a batch in a single call, with the container
manager stubbed to leave instances shutting-down as production does.

* fix(ec2): retry the capture reclaim once container teardown has finished

Threading the batch through the dependency check was not enough on its own.
terminate() only schedules the container removal, so every attempt made inside
the TerminateInstances loop can run while a container of that same batch still
exists. Docker then refuses to delete the image, and because the loop is the
only thing that retries, a batch whose containers all tear down slowly left the
captured layer on disk for the lifetime of the emulator.

Give terminate() an optional callback that runs on the teardown executor once
the container is really gone, and have terminateInstances pass one that
attempts the reclaim again. The callback is invoked from a finally block so a
failure earlier in teardown does not skip it, and anything it throws is logged
rather than killing the executor task. The synchronous attempt stays: by the
time the loop reaches later instances the earlier containers are often already
gone, and it costs one refused call when they are not.

The existing stubs move to the two-argument form. The default one runs the
callback, modelling teardown that completes immediately;
terminationLeavesInstancesShuttingDown holds it instead, so a test can decide
when teardown finishes. The new test covers the case this commit fixes: every
in-loop attempt refused, then the layer reclaimed once teardown completes.
aRemovalTheDaemonRefusesKeepsTheReferenceForALaterAttempt now expects the extra
post-teardown attempt, with the counts explained in the test.

* fix(ec2): run the teardown hook only once the container is gone

The hook ran from a finally block, so a teardown that threw before the
container was removed still fired it. A capture reclaim would then be
attempted while Docker still referenced the image, be refused, and have no
later retry behind it, which is the state the hook exists to avoid.

Track whether the container is actually gone: removed, already absent, or
never launched. Everything after removal can fail without making the hook
wrong, so it still runs from the finally block, but a failed removal now skips
it and logs why.

Two tests in Ec2ContainerManagerTest: the hook fires on the ordinary path, and
it does not fire when removeContainerCmd throws. The second fails without the
guard.

* style(test): place the AtomicBoolean import with the other java.util.concurrent.atomic entries

* docs(ec2): drop the duplicated teardown-hook rationale, and fix the skip message

The Javadoc's third paragraph and the comment at the top of the teardown
lambda explained the same rule in almost the same words; the Javadoc is the
one callers read, so the inline comment now just names the variable's role
and points there.

The skip message claimed the container "could not be removed", but
unpublishAll runs first inside the same try: if it throws, containerGone is
still false and the same message is logged with no removal ever attempted.
It now says the container is not established to be gone, which is what the
flag actually means on both paths.

* fix(ec2): run the post-teardown reclaim as the account that owns the instances

The hook runs on the teardown executor, which carries no request context, so
every account-aware store it touched resolved under the default account. For a
batch in any other account capturedImageFor looked the AMI up under
000000000000, found nothing, returned null, and the reclaim returned at its
first guard. That is silent: no exception and no log, because having no capture
is the ordinary case this path returns quickly for. The slow-teardown batch is
the whole reason the hook exists, so the leak stayed open exactly there.

The account is captured in terminateInstances, on the request thread where the
context is still active, and the hook runs under RequestScopes.runAs. That is
what the other background workers do, and its Javadoc names this failure.

Scoping the whole hook rather than threading scanForAccount/putForAccount into
reclaimCapturesPinnedBy is deliberate: capturedImageFor runs FIRST and reads
registeredImages.get(), so a fix confined to the scan and the write-back would
still have returned null before reaching either.

The regression test drains the teardown callbacks on a bare thread, because the
existing batch tests run them on the test thread where the request context is
active, which is why none of them could see this. It fails without the change:
the two synchronous in-loop attempts still happen, since those run on the
request thread, and only the third one, the hook's, goes missing.
2026-09-23 11:02:27 -04:00
Aniket Shukla 97aa084209 fix(sns): require IAM role ARN for Firehose subscriptions (#4233) 2026-09-23 10:57:28 -04:00
Aniket Shukla b6d5d51bde fix(sns): validate Publish Subject (#4172)
* fix(sns): validate Publish Subject

* fix(sns): validate Subject for SMS publishes too

* fix(sns): accept 100-character subjects and leading spaces
2026-09-23 10:52:50 -04:00
Niels Kootstra 2c3332c7cf fix(opensearch,mwaa): remove containers on explicit delete when shutdown retention is on (#4225)
keepRunningOnShutdown made stopDomain and stopEnvironment return early, so
DeleteDomain and DeleteEnvironment left their containers running. Only the
shutdown hook now honours the setting, matching how MWAA already guards its
shutdown path.
2026-09-23 10:17:48 -04:00
Allen Sanborn 4b3923712a feat(redshiftserverless): add namespace lifecycle and tagging (#3631)
* feat(redshiftserverless): add namespace lifecycle

Amazon Redshift Serverless was absent entirely: every call returned
UnknownOperationException, so Terraform's aws_redshiftserverless_namespace
could not be planned or applied against Floci.

Add a JSON 1.1 service under the RedshiftServerless. target prefix with
CreateNamespace, GetNamespace, ListNamespaces, UpdateNamespace, and
DeleteNamespace. Namespaces are account and Region scoped and stored through
StorageFactory. AWS defaults are applied on create (dbName dev, kmsKeyId
AWS_OWNED_KMS_KEY, empty logExports, status AVAILABLE), adminUserPassword is
accepted and never returned, DeleteNamespace returns the removed namespace
with status DELETING, and UpdateNamespace applies only the supplied fields.

Workgroups, snapshots, and the tagging operations remain unemulated.

* feat(redshiftserverless): add namespace tagging operations

Terraform's aws_redshiftserverless_namespace calls ListTagsForResource on
every read once tags are involved, so the namespace lifecycle alone left the
resource broken as soon as a config set tags.

Add ListTagsForResource, TagResource, and UntagResource. Lookup is by
resourceArn rather than namespace name, scoped to the caller's Region, since
that is how AWS keys these operations; the namespace is currently the only
taggable Redshift Serverless resource, so any other ARN is reported absent.
TagResource merges into the existing tags, UntagResource removes by key, and
tags passed to CreateNamespace are readable back and survive UpdateNamespace.

* fix(redshiftserverless): emit creationDate as ISO-8601 per the API model

The awsJson1.1 default is epoch seconds and 133 call sites use it, but this
model overrides it: TimestampFormatTrait ISO_8601 on creationDate (and on all
eleven other timestamp members in the package, audited). Strict clients broke
on the number: Terraform's Go SDK failed to decode and orphaned the created
namespace outside state; the Java SDK failed to unmarshall. Only botocore's
lenient parsing let CLI checks pass. Emitted via the repo's millisecond-ISO
idiom; format pinned by regex in the integration test and by a new
handler-level unit test class covering the wire layer that had none
(timestamp shape, nextToken emission, maxResults type guard). Checklist note
added to AGENTS.md + CONTRIBUTING.md so the next service checks the trait
before reaching for the epoch idiom.

* docs(redshiftserverless): the ISO-8601 rule is per member, not model-wide

Review follow-up: the earlier claim that every timestamp member in this model
carries TimestampFormatTrait(ISO_8601) is wrong — 15 of the model's 30 INSTANT
members carry no trait and fall back to the awsJson1.1 epoch default. The
shipped code is unaffected (creationDate, the only timestamp emitted, is
genuinely ISO_8601), but the claim was load-bearing guidance: whoever adds
snapshots or scheduled actions next would have applied ISO-8601 to trait-free
members and reintroduced the bug in the opposite direction. Narrowed in all
four places it appeared.

* fix(redshiftserverless): validate collection types, copy-on-update; drop em dashes

A present iamRoles, logExports, tags or tagKeys member that was not a JSON
array parsed to null and was then indistinguishable from an omitted member,
so a malformed UpdateNamespace silently kept the stored value and returned
200 instead of reporting the request as invalid. Only a missing or null
member now means "omitted"; a present member of the wrong type, or a
collection holding a non-string element, is a ValidationException naming the
member.

updateNamespace mutated the stored Namespace in place while GetNamespace and
ListNamespaces read without taking the same monitor, so a concurrent reader
could observe a torn object with some fields updated and some not. Build the
new state on a copy and store that instead, which also makes the write-back
explicit. The same in-place mutation was present in tagResource,
untagResource and deleteNamespace, so all four now copy. Merge semantics are
unchanged.

Replace the em dashes in the timestamp guidance with commas and periods, per
the repository ban.

* fix(redshiftserverless): reject Redshift reserved words as namespace names

CreateNamespace rejects a namespace name that is an Amazon Redshift SQL
reserved word, so names like select or user passed the length and
[a-z0-9-] checks here and were persisted. Add the documented reserved
word list to the shared namespace-name validator, which create, get,
update and delete all reach, so the rejection is consistent.
2026-09-23 10:13:24 -04:00
Simone Primarosa dc70f60a66 fix(eks): claim the cluster user data slot atomically (#4190)
* fix(eks): claim the cluster user data slot atomically

* fix(eks): propagate user data execution result to concurrent node groups
2026-09-23 09:12:46 -04:00
Simone Primarosa 7c94f69571 feat(ec2): bound instance containers to their instance type resources (#4189) 2026-09-23 09:08:37 -04:00
XuJian d8a4f5e58e fix(iam): enforce case-insensitive resource names (#3986)
* fix(iam): enforce case-insensitive resource names

Reject duplicate IAM user, group, role, and managed policy names that differ only by case.

Signed-off-by: XuJian <265865031+xujiantop-crypto@users.noreply.github.com>

* test(iam): cover case-insensitive resource names

Signed-off-by: XuJian <265865031+xujiantop-crypto@users.noreply.github.com>

* test(iam): verify case-insensitive names end to end

Signed-off-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>

* fix(iam): enforce instance profile name uniqueness

* fix(iam): preserve name uniqueness on group rename and legacy data

* fix(iam): exclude managed catalog mirrors from name conflicts

---------

Signed-off-by: XuJian <265865031+xujiantop-crypto@users.noreply.github.com>
Signed-off-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-23 09:06:17 -04:00
TATSUNO “Taz” Yasuhiro 133ef62d27 feat(dynamodb): vector indexes and SearchVectors (#4215)
* feat(dynamodb): define vector indexes on the table control plane

* feat(dynamodb): serve SearchVectors against vector indexes

* feat(dynamodb): validate vector attributes on write

* feat(dynamodb): report vector write capacity on writes

* fix(dynamodb): reject a PartiQL read of a vector index

* test(dynamodb): cover vector search in Floci's own suite

* fix(dynamodb): match AWS on vector member paths and the f32 number format

* fix(dynamodb): match AWS on the vector search validation gaps

* perf(dynamodb): stop retaining and recomputing per candidate in vector search

* docs(dynamodb): document that indexes are not stored
2026-09-23 08:57:08 -04:00
Hector Ventura 6fadba8d57 fix(cloudformation): apply EC2 Instance UserData and IamInstanceProfile in place (#4206)
UpdateStack kept a reused AWS::EC2::Instance's prior UserData and
IamInstanceProfile because Ec2Service had no in-place path for either: the
provisioner reconciled only InstanceType and SecurityGroupIds. On AWS both are
mutable, UserData with the "some interruptions" of a stop and a start.

EC2 gains the three association actions, AssociateIamInstanceProfile,
ReplaceIamInstanceProfileAssociation and DisassociateIamInstanceProfile, with
botocore's wire names, all five members of the association including the
timestamp the instance now records, and the errors moto documents
(IncorrectState for a second association, InvalidAssociationID.NotFound for
an unknown id). ModifyInstanceAttribute accepts UserData.Value on a stopped
instance, answering IncorrectInstanceState otherwise, the order Terraform's
provider performs as stop, modify, start. The association id derivation moves
from the handler into Ec2Service so the provisioner can name an association.

Ec2InstanceCfnProvisioner rewrites a changed UserData across a stop and a
start (an already stopped instance stays stopped), resolves the profile name
to its ARN at provision time as the RunInstances handler does, associates or
replaces a changed profile, and disassociates one only when the template
declared it last time, recorded in a __Floci attribute so a profile a launch
template set is never stripped. A dropped UserData is left as it is, the same
rule SecurityGroupIds follows.

Tests: Ec2InstanceCfnProvisionerTest covers the stop/modify/start order, the
stopped case, associate, replace, disassociate and the undeclared-profile
guard; Ec2IamInstanceProfileAssociationIntegrationTest and
Ec2UserDataAttributeIntegrationTest pin the wire behaviour;
CloudFormationEc2InstanceIntegrationTest updates both properties on one
instance and reads them back through EC2.
2026-09-23 08:51:47 -04:00
Kenshin Okinaka 678b50f14b feat(ses): run custom verification emails through the shared send preamble (#4212)
* feat(ses): run custom verification emails through the shared send preamble

SendCustomVerificationEmail accepts a ConfigurationSetName like the other
send APIs but skipped everything the other send paths do first. It now
resolves the identity's default configuration set, refuses a paused set,
honours the account suppression list, scans the template subject and body
like any other content, and publishes its Send, Bounce or Reject events
through the shared classifier. A suppressed or rejected verification email
is recorded but not relayed.

* test(ses): give the builder's cvetService accessor the same guard as its peers

It was the only accessor that lazily created its service instead of
requiring build() first, so a caller could get a service the built
SesService did not use. build() now assigns the field with the others.
2026-09-23 08:47:16 -04:00
Hector Ventura fac87a6cf4 fix(cloudformation): make a stack's collections safe for concurrent requests (#4199)
A Stack is shared state: it lives in the service's concurrent map and is
handed to every request that names it while the operation executor provisions
it, but its collections were plain LinkedHashMaps and an ArrayList mutated
outside any lock. DescribeStackEvents copied the event list while a running
ExecuteChangeSet appended to it (41 addEvent sites), resources were put and
removed while DescribeStackResources walked them, and DeleteChangeSet removed
from the change-set map under nothing.

The model now owns its thread safety: synchronized maps over LinkedHashMap, so
the insertion order the XML responses reproduce survives; a CopyOnWriteArrayList
for the append-mostly event log; setters that wrap whatever Jackson or the
service hands in; and *Snapshot() accessors that copy under the map's monitor.
Jackson serializes through the snapshots under the same property names, so
persisting a stack mid-deploy no longer races the deploy and the stored shape
is unchanged. Every iterating site in CloudFormationService and the query
handler reads a snapshot; the one removeIf on the change-set map runs under
its monitor. #3564 had already made the change-set claim atomic; #2473 carried
this shape but was closed after a broken rebase.

A whole-map replace is one step too. clear() and putAll() are two separately
locked calls on a synchronized map, so a snapshot between them copied an empty
map: a DescribeStacks mid-update reporting no Outputs. Stack's replace*
methods hold the map's monitor across the pair, and the nine clear/putAll
sites (parameters, the update's outputs, exports and export names, both
rollback restores) go through them.

Closes #2419
2026-09-23 00:49:23 -05:00
Abhigya 8d9ae9554d fix(elbv2): dispatch a shared listener port by the hostnames rules declare (#4207)
* fix(elbv2): dispatch a shared listener port by the hostnames rules declare

Two load balancers with a listener on the same port both answered 502.
Floci serves every load balancer from one socket per port, and listener
selection keyed only on the load balancer's own DNS name, so a request
carrying any other Host header matched neither key. With one load balancer
a size-1 fallback covered that up; adding a second removed the fallback and
silently broke both.

Listener selection now also consults the host-header conditions the
listener's rules already declare. A load balancer that names the hostname it
serves, which is the configuration AWS needs anyway, claims that hostname
here too. The DNS-name match and the single-listener fallback are unchanged
and still take precedence in that order.

A port taken by a second load balancer now logs a warning naming both, since
nothing else reported the collision: the targets behind them stay healthy and
no API call fails.

Real AWS has no load-balancer selection step, because every load balancer has
its own DNS name and addresses; host-header rules only choose a rule inside
one listener. Selecting a listener by Host header is a Floci deviation forced
by the shared socket, and is documented as one.

* test(elbv2): pin the AWS host-header matching semantics selection relies on

The AWS docs state that a hostname is not case-sensitive, that * matches 0
or more characters and ? exactly 1, and that the rule *.example.com matches
test.example.com but not example.com. Listener selection now depends on that
matching, so cover it directly: a case-shifted Host still resolves, and a
wildcard rule does not let its listener claim the bare domain.

Also record that HostHeaderConfig.RegexValues is unsupported, so a load
balancer naming itself only through a regex cannot be selected this way.
2026-09-23 00:39:31 -05:00
Sergei Kesarev 51b6485173 feat(kms): support RSA imported key material (#4152)
* refactor(kms): encapsulate import key material logic in KmsKeyType implementations

* feat(kms): support RSA key import

* fix(kms): check aes key length

* fix(kms): wrapping algorithm value validation

* docs(kms): update docs to reflect asymmetric RSA import support

* fix(kms): add private CipherUtils constructor

* test(kms): add tests for rsa key material import
2026-09-23 00:21:50 -05:00
Vũ Thế Huy f8542e628b refactor(efs): move library usages to imports (#3903)
* refactor(efs): move library usages to imports

* refactor(efs): replace wildcard imports and inline types with explicit imports
2026-09-23 00:11:18 -05:00
vamsiakandVamsi Akavarapu ffe56f735d feat(stepfunctions): route RDS Data execute statement (#4179)
Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com>
2026-09-23 00:25:04 -04:00
XuJian 9dd2bd62e4 feat(kms): implement ReplicateKey for multi-region keys (#4176) 2026-09-23 00:21:23 -04:00
Kenshin Okinaka e947b6a2a1 feat(ses): add v2 GetMessageInsights (#4157)
* feat(ses): add v2 GetMessageInsights

Serves the per-recipient event timeline for a sent message. The timeline is
derived at send time from the events SesRecipientEvents classifies for the
send, the same classification that drives configuration-set event publishing
and identity notifications, then stored on the SentEmail record, so the read
path is a plain lookup and no new event store is needed. SentEmail also gains
the EmailTags the operation returns, and a raw send now stores its parsed MIME
subject, when present, as a simple send does.

Insights additionally report DELIVERY for an ordinary recipient so a plain
send does not look stuck at SEND; a suppressed recipient never gets DELIVERY,
since it is dropped before the relay, and a message the content scan rejected
ends every recipient's timeline at REJECT. What gets published is unchanged.

Probed against real SES in us-east-1: the operation is gated on Virtual
Deliverability Manager and reports that before it looks at the message id, a
missing message names the account alongside the id, Isp carries the literal
UNKNOWN_ISP when the provider cannot be identified, BounceType is the
upper-case enum member, and an account-suppressed recipient is reported with
BounceSubType ON_ACCOUNT_SUPPRESSION_LIST and SES's own suppression text as
the diagnostic, the upper snake spelling this operation uses where the
published events say OnAccountSuppressionList. Floci deliberately records the
mailbox-simulator sends and the multi-recipient mail that VDM drops, because
dropping both would leave insights permanently empty, and returns one entry
per envelope recipient where an AWS response carries at most one.

* test(ses): pin the message-insights VDM gate to one account

The gate reads the account VDM attributes, which are account-scoped like
every other SES store, but no test said so: the isolation test enables VDM
for both of its accounts. An account that never enabled it now has to meet
the gate while others in the same region are past it.

* feat(ses): report a content-rejected raw send in message insights

The raw send path classified its recipients with a hardcoded false, because
the content scan did not exist on this branch's base. It does now, so the
real scan result reaches the timeline: a rejected raw send reports SEND then
REJECT instead of a delivery it never had.

Its stored tags follow the same rule the published events already use, the
request's own tags only, so tags read off a refused message's headers cannot
resurface through GetMessageInsights.
2026-09-23 00:17:28 -04:00
Niels Kootstra a0cb86cc13 fix(cloudwatchlogs): journal log events instead of rewriting the store under persistent mode (#4187)
* perf(storage): append WAL batches once and skip compaction of an unchanged store

A putAll batch was N locked appends and N flushes; it is now one contiguous run of records and one flush. Compaction rewrote the snapshot on every tick even when nothing had changed since the last one, so an idle store kept rewriting its file; the store now tracks whether it changed and compaction returns early otherwise. Entries replayed from the log at load mark the store changed so the next compaction folds them in.

* fix(storage): recover from a corrupt WAL tail instead of failing boot

The replay reader trusted the signed length headers it read: a negative length threw IllegalArgumentException out of load() and failed the owning service at boot, and a length past the end of the file read to EOF. After any stop, the writer reopened behind the unreadable bytes, so every entry appended after a torn tail was lost on the next load until a compaction happened. Lengths are now bounded by the bytes left in the file, every framing or decode failure stops replay with a warning, and the unreadable tail is cut off before the writer reopens. An unreadable snapshot is quarantined to a .corrupt sibling like the other file-backed stores do, instead of being overwritten by the next compaction.

* fix(storage): journal append-heavy stores under persistent mode

PersistentStorage rewrites the whole store file on every mutation, so the cost of a write grows with the store. A store can now declare an APPEND_HEAVY write profile on StorageFactory.create; under persistent mode such a store is backed by WalStorage with the store's own JSON file as the snapshot and a .wal file next to it. The snapshot layout means an existing store file is picked up as the first snapshot and the file is current again after a clean shutdown, so no migration is needed in either direction. The other modes ignore the profile.

* fix(cloudwatchlogs): journal log events under persistent storage

Every PutLogEvents batch rewrote the whole cwlogs-events.json file under persistent mode, so the cost of one batch grew with the number of stored events. The events store now declares the APPEND_HEAVY write profile: a batch is appended to cwlogs-events.wal and the JSON file is rewritten on the WAL compaction interval and at shutdown. Groups, streams, filters and policies keep the file that is rewritten on every call.

Closes #2500

* docs(storage): describe journaled stores under persistent mode

Explain that CloudWatch Logs events are journaled to cwlogs-events.wal under persistent mode, that the compaction interval now governs that store too, and that the JSON file is current after a clean shutdown and up to one interval behind while running. Also corrects the documented CloudWatch Logs flush interval default from 5000 to 15000, which is what EmulatorConfig ships.

* docs(storage): describe journaled stores as append-heavy

The pages said the CloudWatch Logs event store only ever grows, but the 20,000-event cap, retention pruning and DeleteLogStream all remove events. What qualifies a store for journaling is its write pattern, which is what WriteProfile.APPEND_HEAVY says, so the pages now say that.
2026-09-23 00:08:45 -04:00
Hector Ventura 024c2cbe27 fix(cloudformation): publish EC2 Instance State via Fn::GetAtt (#4203)
The registry schema lists State as a read-only property of AWS::EC2::Instance,
but it is a nested object with Code and Name, and Fn::GetAtt exposes only the
dotted members: cfn-lint's GetAtt derivation for this type yields State.Code
and State.Name and no bare State, the same shape as an RDS Endpoint. Floci
never published either, so a template reading them got the literal
"Server.State.Name" back.

Ec2InstanceCfnProvisioner now publishes State.Code (the code as a string, the
schema's type) and State.Name, removing both when the instance carries no
state, and the create path re-reads the instance once the launch settles, as
CloudFormation's own stabilization does. Without the re-read a mock-mode
instance would publish "pending", since it only reaches "running" on the next
DescribeInstances. The State gap row now records the dotted form, like the
RDS Endpoint rows.

Tests: Ec2InstanceCfnProvisionerTest pins both keys, the settled state and the
no-state case; CloudFormationEc2InstanceIntegrationTest asserts both GetAtt
forms against the state DescribeInstances reports.
2026-09-23 00:03:29 -04:00
Abhigya fcc89c0e8d feat(ecs): implement ExecuteCommand (#4121)
* feat(ecs): implement ExecuteCommand

ECS Exec was accepted at the API but opened nothing: a client got a
response it could not connect to. This implements the whole path, so
`aws ecs execute-command` gives a real shell in a task's container.

The gate matches AWS. The session must be interactive, which is the only
mode ECS supports; the task must belong to the cluster the request
names, must be RUNNING and must have been run with enableExecuteCommand;
and the container must have a runtime behind it, so a mock-mode task
answers TargetNotConnectedException.

The response carries a session with a single-use tokenValue and a
streamUrl pointing at Floci's own data channel, which is where
session-manager-plugin then connects. Floci plays the SSM agent's half
of the Session Manager protocol on that channel, the binary AgentMessage
framing, the handshake, sequenced acknowledgements and terminal resizes,
and bridges it to a docker exec with a TTY.

Two threads meet on that channel. Every call into the Docker daemon
blocks, so it runs on a worker rather than on the event loop, and the
daemon streams the container's output back on its own thread; frames are
written from the channel's Vert.x context only, which also keeps the
outbound sequence numbers in the order they reach the wire. The command
is attached to only once the client has accepted the handshake, so no
output can be written to a channel that is still being opened.

Deliberate limits, documented in docs/services/ecs.md:

- The command runs through /bin/sh -c, so an image without a shell
  cannot be exec'd into.
- Sessions are in memory, single use, and expire after five minutes if
  nobody connects.
- ExecuteCommand logging, the executeCommandConfiguration that sends
  session transcripts to S3 or CloudWatch, is not implemented. The
  cluster field still round-trips.

EcsExecSessionRegistry holds a SecureRandom, so it is registered under
--initialize-at-run-time for the native image.

AgentMessageTest covers the wire framing against a JDK-side encode and
decode, EcsExecuteCommandIntegrationTest covers the API gate, and
EcsExecChannelDockerIntegrationTest runs a real session end to end under
Docker.

* fix(ecs): compare the ECS Exec session token in constant time

The token is the single gate in front of an interactive shell in a
container, so compare it with MessageDigest.isEqual on the UTF-8 bytes
rather than String.equals, which returns on the first differing
character. Matches the constant-time comparison the repo already does in
ScimController, IamAuthValidator and LambdaLayerService.

A failed claim still leaves the session in place: dropping it would let
anyone holding a session id cancel somebody else's session.

* fix(ecs): expire an unclaimed ECS Exec session on read

Only create() swept the session map, and neither claim() nor find()
looked at createdAt, so a session nobody connected to stayed claimable,
token included, until the next ExecuteCommand call happened to come in.
On an idle emulator that is forever, which also made the five minute
expiry documented in docs/services/ecs.md untrue.

claim() and find() now go through liveSession(), which drops a session
past SESSION_TTL and reports it as gone: claim() rejects it before the
token comparison, and the WebSocket upgrade refuses to open a channel
for it. The registry takes the CDI Clock so the tests exercise expiry
without waiting out the TTL.
2026-09-22 23:47:40 -04:00
Abhigya 899c6f5ec1 feat(ui): add a bind address for the web console sidecar (#4175)
The console sidecar is published with a bare host port, so Docker binds it on every
interface. That matches the documented deployment, where Floci's own port is published
the same way, but it does not follow an operator who narrowed theirs: a
"127.0.0.1:4566:4566" mapping keeps the API off the network while the console, which is
unauthenticated and can drive every emulated service, stays reachable on 4500.

floci.services.ui.bind-address (FLOCI_SERVICES_UI_BIND_ADDRESS) names the host interface
the console publishes on. It is unset by default, so nothing changes for anyone who has
not asked; setting it to 127.0.0.1 is how the narrowed deployment keeps the console where
the API is. A blank value is a hard error rather than a silent fall back to the wildcard.

ContainerBuilder.withPortBinding(containerPort, hostPort, hostIp) and a portBindingHostIps
component on ContainerSpec carry the address through to the Docker binding.
withLoopbackPortBinding is unchanged, and a port that asks for neither still publishes on
every interface, which is Docker's own default.
2026-09-22 23:33:14 -04:00
TATSUNO “Taz” Yasuhiro 65b2b13f5c fix(dynamodb): add missing ConsumedCapacity for PartiQL's ExecuteStatement and BatchExecuteStatement (#4165)
* fix(dynamodb): add missing ConsumedCapacity for PartiQL's ExecuteStatement and BatchExecuteStatement

* fix(dynamodb): reject an invalid ReturnConsumedCapacity on PartiQL statements

* fix(dynamodb): charge the base table when an unkeyed LSI read selects an unprojected attribute
2026-09-22 23:03:32 -04:00
Abhigya f084243fc0 fix(core): serve HTTP/1.0 requests that omit the Host header (#4174)
A health probe written without a Host header answered 500 on a healthy
emulator:

    GET /_floci/health HTTP/1.0                   -> 500
    GET /_floci/health HTTP/1.1 + Host: localhost -> 200

Host is mandatory only from HTTP/1.1 on, so Vert.x answers 400 to a 1.1
request without one and exempts 1.0 by design. A 1.0 request then reached
the application with no authority anywhere: HttpServerRequest.absoluteURI()
is null, and UriInfo.getRequestUri() fails inside new URI(null). Every
host-routing filter reads the request URI, through RequestHost or directly,
so LambdaUrlRoutingFilter threw a NullPointerException before routing ever
reached a resource. Nothing about it was health-specific: every endpoint
answered 500 the same way.

MissingHostHeaderFilter is a pre-matching filter that fills in the missing
authority. For an origin-form target, which names no host anywhere, that is
the local socket the request arrived on, the address the client actually
reached. An address literal names no S3 bucket, Lambda function URL, or
custom domain, so the request routes path-style, which is what a client
sending no Host asked for.

An absolute-form target states an authority of its own, which RFC 9112
section 3.2.2 has the server route by, and it answered 500 for the same
reason: the authority vertx-web builds its absolute URI from is the Host
header alone. So GET http://bucket.s3.localhost:4566/key HTTP/1.0 takes the
bucket from the target and keeps routing to it. Asterisk-form names no host
at all and is left alone, as it is with a Host header.

The repair is the request URI rather than the Host header. Vert.x resolves
the authority once, in RoutingContextImpl.route(), before any handler runs,
and caches the absence, so a header set afterwards is never looked at again.
Rewriting the JAX-RS request URI is the same mechanism the virtual-host
filters already use to reroute a request.

HTTP/1.1 without Host keeps answering Vert.x's 400 with the message naming
the missing header.
2026-09-22 22:54:20 -04:00
Allen Sanborn 684239b0ef fix(elasticache): create single-node redis clusters and close provisioning races (#3634)
* feat(elasticache): support single-node redis clusters in CreateCacheCluster

CreateCacheCluster refused every engine but memcached, telling callers to use
CreateReplicationGroup instead. Real AWS accepts Engine=redis and Engine=valkey
there as long as the cluster has one node, and that is exactly the call
terraform's aws_elasticache_cluster with engine = "redis" emits, so every such
example failed against Floci.

A single-node redis or valkey cluster is now provisioned the way a
cluster-mode-disabled replication group is: the same Valkey container, fronted by
the same auth proxy on a port from the same range, so the endpoint a describe
reports actually answers RESP. It is stored apart from replication groups, since
one created this way has none and must not appear in DescribeReplicationGroups.

NumCacheNodes greater than 1 is refused with the message a live account gives.
Following AWS, the cluster carries no ConfigurationEndpoint (that is memcached's
node discovery endpoint) and reports its node under CacheNodes when the request
sets ShowCacheNodeInfo, which is where terraform-provider-aws reads the port.

The memcached path is unchanged. ElastiCacheMemcachedIntegrationTest asserted the
old refusal with Engine=redis; it now asserts it with an engine ElastiCache
really does not have.

* fix(elasticache): address review findings

Cross-type id collision closed both directions through one provisioningIds
claim set (the claimed thing is one namespace: container name + proxy key);
wire code corrected to CacheClusterAlreadyExists; create request grown to
round-trip the optional members Terraform reads back, guarded by a
compat-terraform bats config asserting plan -detailed-exitcode after apply;
ListTagsForResource cluster arm brought to parity with the replicationgroup
arm without regressing memcached/member fall-through; standalone clusters
join getResources; create/delete responses no longer leak CacheNodes.

* fix(elasticache): correct review-round test assertion, bats port pin, docs note

The cross-type guard test asserted never() on a tryStart its own setup
legitimately performs — times(1), matching the sibling test. The single-node
bats config pinned port 6379, which the parallel bats runner's sibling
replication-group config fills first from the range base (the allocator
refuses rather than substitutes) — pinned to 6395. AtRestEncryptionEnabled
noted in docs as output-only on real AWS's CreateCacheCluster.

* docs(elasticache): the output-only note belongs to the single-node prose, not the CreateReplicationGroup row

AtRestEncryptionEnabled is a legitimate input member of
CreateReplicationGroupMessage; it is absent only from CreateCacheClusterMessage.

* fix(elasticache): reserve persisted ports on restore, cross-store id uniqueness, validate subnet group

Three findings from the PR review, all on the single-node cache cluster path.

Ports of records that survive a restart are now reserved before Floci serves
anything. Standalone cache clusters and cluster-mode-disabled replication groups
are not re-provisioned, but they still advertise the port they were given, and
nothing put those ports back into the in-use set: a create after a restart was
handed a port a live record still published, and the two then contended over one
reservation, so the first delete freed it and the next create took it again. A
delete now releases only a port this process actually reserved for that record,
since a restored record whose port was already taken advertises one it does not
own.

The id check spans all three stores that answer DescribeCacheClusters. A
standalone redis cluster, a Memcached cluster and a replication group can no
longer share an id in either direction. Both services read the same backends:
StorageFactory keys them by file path and hands the second caller the first
caller's instance, so no new wiring is needed for the two services to agree on
one namespace.

CacheSubnetGroupName must now name a subnet group that exists, instead of being
stored as a reference a describe reports and a caller cannot look up.
CreateReplicationGroup still does not make that check; it is called out in the
service and in the docs rather than changed here.

* style(elasticache): drop em dash in transient-field comment

* fix(elasticache): close the id and port gaps the delta review found

CreateReplicationGroup's duplicate-id check read only the group and redis
cluster stores, so a group could take the id of a live memcached cluster
while CreateCacheCluster refused the same collision the other way round.
Check the third store too, which is what makes the documented "an id is
taken across all three at once" actually hold.

Two port-reservation fixes alongside it. The claim on a new cache
cluster's port was recorded after the synchronized block that stores the
record, so a delete landing in the gap found nothing to release and
stranded the reservation; it now happens under the same monitor as the
put. And deleteReplicationGroup freed the group's port unconditionally,
while the cluster path has guarded that since the restore work went in: a
record restored from disk whose port was already taken advertises a port
it does not own, and freeing it hands a live record's port to the next
create. The holder set now covers both kinds, keyed by id, which is safe
because an id is unique across the stores.

* docs(elasticache): say which engines the subnet-group check covers

CreateCacheCluster with Engine=memcached routes to a create that takes
only the cluster id, so CacheSubnetGroupName is dropped on that path: not
checked, not echoed. The page claimed the check unqualified. Also name
CreateReplicationGroup in the id-uniqueness paragraph, now that it makes
the same check.

* test(elasticache): cover the ordinary group delete that frees its port

The two port tests around it both step past the create path: one deletes a
group written straight into the store, the other one restored after a
restart. So the claim recorded when a group is created in process had
nothing behind it, and dropping it would leave the suite green while every
DeleteReplicationGroup leaked its proxy port for the life of the process.

* fix(elasticache): claim the id on the memcached create path too

CreateCacheCluster for memcached checked the three stores for a duplicate id
and went straight on to start its container, without joining the in-flight
claim set the redis cluster and replication group paths take. No create path
persists its record until after container startup, so a memcached create and
a redis create for one id could both read three empty stores and both write,
leaving the id in two stores with DescribeCacheClusters reporting it twice
and the two containers and proxy registrations colliding under one name.

Move that set out of ElastiCacheService into an ElastiCacheProvisioningIds
bean both services inject, so the claim covers every engine, and take it in
the memcached path before the store checks with the same try/finally release.
A collision with an in-flight create is refused with the fault the store-hit
path already produces, CacheClusterAlreadyExistsFault.

* fix(elasticache): complete the CacheNode shape and correct the memcached fault code

DescribeCacheClusters returned a CacheNode carrying only an id, a status and an
endpoint. terraform-provider-aws dereferences CacheNodeCreateTime and
ParameterGroupStatus while adopting the resource without a nil check, so the
compat-terraform job created floci-tf-redis-single successfully and then died on
the very next refresh with "Unexpected nil pointer" naming both fields. The
endpoint was never the problem; the node shape was incomplete.

Both are stable metadata AWS returns on every available node, and both were
already known here: a single-node cluster's node was created with the cluster,
and its parameter group carries the same in-sync status already reported for the
cluster. CustomerAvailabilityZone is emitted from the cluster's AZ for the same
reason -- a node whose AZ disagrees with its cluster is a permanent plan diff.
Memcached returns early well above this block, so its wire output is unchanged.

Separately, the id claim added on the memcached create path threw
CacheClusterAlreadyExistsFault. The wire code is CacheClusterAlreadyExists -- the
Fault suffix is the botocore shape name, not the code an SDK matches on -- which
this branch had already established on the redis side and then contradicted.
Both memcached throw sites now use the wire code, including the pre-existing one,
and the five test assertions that pinned the wrong spelling are corrected.

* test(elasticache): stop the single-node fixture pinning the shared suite's port

The compat-terraform job runs every stack against one Floci, and this branch's
new elasticache-single-node-tf pinned port 6395 -- the same port main.tf already
pins for the replication group the `terraform` suite creates. ElastiCache
refuses a pinned port that is already reserved, by design, so the two stacks can
only both succeed if the first is fully destroyed before the second applies.

That is what the last run showed: elasticache_single_node failed its apply, so
its destroy never ran, 6395 stayed held, and the `terraform` suite then failed
with "Port 6395 is already in use by another replication group" -- a second
failure that reads like an allocator bug and is really a fixture collision.
Fixing the node shape removes the trigger but not the collision, which would
remain a teardown-ordering dependency between two independent suites.

6396 is free and inside the 6379-6399 proxy range.

* test(elasticache): name the extracted XmlPath instead of inferring it with var

Review follow-up: this was the only `var` in the file, and the type it hides
(io.restassured.path.xml.XmlPath) is the one a reader needs in order to follow
the getString/getInt calls immediately below it.

No behaviour change.

* style(test): import ArrayList and LinkedHashMap instead of naming them inline

AGENTS.md asks for imports rather than inline fully-qualified names.
ElastiCacheQueryHandlerTest had three: new java.util.ArrayList<>(...) and
two new java.util.LinkedHashMap<>(...). LinkedHashMap was already imported;
ArrayList is added.
2026-09-22 22:26:15 -04:00
Hector Ventura d96e41cf2f fix(dynamodb): report a global table's home region as a replica in DescribeTable (#4197)
On AWS a global table (version 2019.11.21) has no primary: the region it was
created in is one of its replicas, and DescribeTable lists it under Replicas
as ACTIVE next to the others. The CDK's TableV2 calls that table the default
replica and refuses a declared replica in the primary table's region
(aws-dynamodb/lib/table-v2.ts:280,394), which is why the CloudFormation
provisioner filters the deployment region out of its ReplicaUpdates reconcile.
Floci only knew the other regions, so a single-region
AWS::DynamoDB::GlobalTable described with no replicas and a two-region one
listed only the second.

TableDefinition.globalTableHomeRegion records the creating region once a
replica is added (UpdateTable ReplicaUpdates, Custom::DynamoDBReplica) or when
the GlobalTable provisioner calls the new idempotent ensureGlobalTable, and
DescribeTable appends it as an ACTIVE replica after the tracked ones with
GlobalTableVersion. A plain table has no home region and reports neither.
2026-09-22 22:23:31 -04:00
Priamo Germosen 5c72502551 docs(cognito): fix stale enabledAuthFlows javadoc (#4159)
Follow-up from #4081: the javadoc still described the AWS default as covering a client persisted before the default was materialised into storage. Floci never stores that default, so it applies to every client with no ExplicitAuthFlows, not just a legacy one.
2026-09-22 20:01:12 -05:00
Priamo Germosen 04b75fd1f5 feat(iam): add SimulateCustomPolicy and GetContextKeysFor*Policy (#4185)
SimulateCustomPolicy evaluates requested actions and resources against a
standalone set of policy documents plus an optional permissions boundary,
reusing the same identity/boundary evaluation as SimulatePrincipalPolicy.
GetContextKeysForCustomPolicy and GetContextKeysForPrincipalPolicy list the
context keys referenced across a set of documents, or a resolved principal's
policies plus any extra documents supplied.

contextKeysReferencedIn collects every Condition operator's key, every
${...} policy variable named in a Resource pattern, and every one named in
a Condition value, in statement order, without sorting or de-duplicating:
AWS's own documented example response for GetContextKeysForPrincipalPolicy
repeats a key referenced by more than one statement. A variable's default
value (${key, 'default'}) is stripped to just the key name, and the three
single-character escapes (${*}, ${?}, ${$}) are excluded, since AWS
defines those as literal-character substitutions, not context-key
references. NotResource is not scanned: AWS documents policy variables as
usable only in Resource and in Condition values, never in NotResource,
Action or Principal.

Also completes AwsQueryController's IAM_ACTIONS fallback set for the three
new actions, matching SimulatePrincipalPolicy's existing entry there.

Known limitations, documented in iam.md: PolicySourceArn resolves a user or
role only, not a group (inherited from SimulatePrincipalPolicy); only one
PermissionsBoundaryPolicyInputList document is honored, matching AWS's own
stated limit; ResourcePolicy, ResourceOwner, ResourceHandlingOption and
OrderedOrganizationPolicyInputList are not evaluated; MatchedStatements,
ResourceSpecificResults and PermissionsBoundaryDecisionDetail are never
populated; ContextKeyType is accepted but not read, since the comparison is
driven by the policy's own condition operator.
2026-09-22 20:00:44 -05:00
Hector Ventura 03a2d969f2 fix(cloudformation): replace IAM InstanceProfile on a createOnly change (#4133)
AWS::IAM::InstanceProfile rejected any createOnly change on UpdateStack (a name
or Path change threw ValidationError). Both InstanceProfileName and Path are
createOnly, so a change should replace the profile.

- A rename creates the new profile under the new name; dropping the explicit
  name mints a generated one; a Path change on an auto-named profile mints a
  fresh name so the replacement does not collide with the profile it displaces.
  The old profile is deleted once the update commits, or restored on rollback,
  via ReplacementCleanup, the same path Ec2Instance uses.
- Whether the profile was created under an explicit name is recorded at create
  time in a __Floci attribute (filtered from the published ones), not inferred
  from the id's shape: a generated name loses its <stack>-<logicalId> prefix
  past 128 characters, so a shape check would have replaced every auto-named
  profile of a long-named stack on each update. A prior profile with no record
  is kept.
- A Path change that keeps an explicit name is attempted with that same name, so
  CreateInstanceProfile collides and IAM answers EntityAlreadyExists, exactly as
  CloudFormation surfaces that update, rather than being rejected up front.
2026-09-22 20:27:13 -04:00
Roberto Perez Alcolea 343e1574fa fix(s3): reject unsigned checksum headers on presigned requests (#4153)
Match S3 behavior by requiring supported x-amz-checksum-* headers to be included in X-Amz-SignedHeaders. Return AccessDenied with HeadersNotSigned when a presigned request includes an unsigned checksum header.
2026-09-22 20:21:40 -04:00
Simone Primarosa 7eafd2f706 fix(eks): accept IAM authentication tokens for the authenticator's token lifetime (#4186) 2026-09-22 16:26:26 -04:00
Simone Primarosa b7a66d4aaf feat(eks): run node group launch template user data in cluster containers (#4149) 2026-09-22 16:20:42 -04:00
Niels Kootstra 76c103fd8c fix(kinesisanalytics): isolate applications by account and region (#3760)
* fix(kinesisanalytics): scope applications by account and region

* fix(kinesisanalytics): migrate legacy application lookups

Use the account-aware synchronized migration path for regional application lookups and listing. Reject foreign-account resource ARNs and cover legacy tagging migration.
2026-09-22 16:16:34 -04:00
Matheus André 2bf92a9beb fix(s3): verify SigV4 signatures against the wire path for leading-slash keys (#4125)
A key that starts with a slash travels as a double slash on the wire
(PUT /bucket//email.txt) and the client signs that path verbatim, since
S3 never normalizes the canonical URI. Both signature filters rebuilt the
canonical request from the JAX-RS UriInfo path, which collapses the
consecutive slashes, so every such request was rejected with
SignatureDoesNotMatch under enforce-auth and, conversely, a signature
over the normalized path verified for the other object.

Both filters now take the path from the raw Vert.x request, the way
S3Controller already extracts the key. The virtual-hosted key extraction
also kept dropping the leading slash, because it compared the raw path
against the collapsed rewritten URI; it now accepts the collapsed form.

Closes #4123

Signed-off-by: Matheus André <matheusandr2@gmail.com>
2026-09-22 16:02:12 -04:00
Niels Kootstra 4753428567 fix(rds): bind PostgreSQL IAM tokens to the published endpoint and authorize rds-db:connect (#4100)
* fix(rds): bind PostgreSQL IAM tokens to the published endpoint

The PostgreSQL proxy validated IAM auth tokens with the two-argument
validator, so a token generated for any host, port or region was
accepted as long as the signature and DBUser matched. The MySQL proxy
already checked the token against the endpoint it publishes. Thread the
same binding into the PostgreSQL handler and validate against it.

* fix(rds): carry account and resource ids in the proxy binding

RdsService now builds the proxy binding itself at every relay start
(instances, clusters, RDS Proxy relays and restart restores) from the
published endpoint, port, region, account and DbiResourceId or
DbClusterResourceId, so the auth proxy has everything rds-db:connect
is scoped to. The convenience startProxy overload that re-derived the
region from the relay key is gone along with it.

* feat(rds): authorize rds-db:connect when IAM enforcement is on

After the token signature checks out, the auth proxy now asks IAM whether
the token's principal may perform rds-db:connect on
arn:aws:rds-db:<region>:<account>:dbuser:<resource-id>/<db-user>, the
same check AWS runs. It only applies when services.iam.enforcement-enabled
is on; a caller IAM does not know keeps the filter's bypass. The client
still sees the engine's generic authentication failure, and the denial is
logged in AWS's wording so the cause is visible server-side.

* refactor(rds): rename RdsMysqlBinding to RdsProxyBinding

Both engines, Aurora clusters and RDS Proxy relays now validate IAM
tokens against it, so the MySQL-specific name was misleading.

* docs(rds): describe IAM token endpoint binding and rds-db:connect

* test(rds): cover a replayed IAM token in the JDBC compat suite

* fix(rds): accept IAM tokens generated for the loopback name of the endpoint

Floci advertises the name containers reach it by (host.docker.internal
natively, its own address in Docker), while a client on the host connects
to the same proxy over the loopback interface and generates its token for
localhost or 127.0.0.1. Binding tokens strictly to the advertised host
therefore refused every native client; the published port still has to
match, so a token for another instance on the same host is still refused.

The compatibility workflow sets FLOCI_SERVICES_RDS_ENDPOINT_HOST=floci as
it already does for Redshift, so the tests' tokens name what the
containerised Floci publishes.

* feat(rds): make the PostgreSQL IAM token endpoint binding opt-in

Refusing a PostgreSQL token generated for another hostname, port or
region matches RDS but breaks clients whose tokens name a different
host than the endpoint publishes, so the check now sits behind
services.rds.iam-token-endpoint-binding
(FLOCI_SERVICES_RDS_IAM_TOKEN_ENDPOINT_BINDING), off by default.
MySQL and MariaDB keep requiring the endpoint as before, and the
rds-db:connect check still runs whenever IAM enforcement is on.
The compatibility workflow turns the flag on so the replayed-token
case stays covered.

* fix(rds): refuse an IAM token that reaches the validator without a binding

Every proxy publishes a binding, so a token without one has nothing to
be checked against; validating its signature alone was a fail-open
path. The signature-only validate(token, user) overload and the MySQL
handleAuth overloads that passed no binding are removed; production
only ever used the ones that pass it.

* fix(rds): sanitize the rds-db resource named in the refused connection warning

The database user is part of that resource and comes straight from the
client's startup message, so it is stripped of control characters like
the other client-controlled values in the warning.

* docs(rds): call a refused IAM token the engine's ordinary authentication failure

The exact message differs per engine, and RDS PostgreSQL words it
differently from Floci's handler today, so the docs no longer promise
one wording.

* docs(rds): move the IAM token binding row into the RDS variables table

The row had landed above the page heading, where it rendered as a
stray one-row table; it now follows FLOCI_SERVICES_RDS_ENDPOINT_HOST
as it does on the RDS page.

* fix(rds): bind PostgreSQL IAM tokens to the endpoint by default

A stock Floci still accepted a PostgreSQL token generated for another
endpoint, the replay this change set out to close, and PostgreSQL and
MySQL disagreed about it in a way RDS never has. The endpoint check is
now on for every engine. services.rds.iam-token-endpoint-binding
(FLOCI_SERVICES_RDS_IAM_TOKEN_ENDPOINT_BINDING=false) stays as the
escape hatch for clients that generate tokens for a container name or
DNS alias the endpoint does not publish. The compatibility workflow no
longer needs to turn the check on.

* chore(ci): rerun after a Docker Hub rate limit failed shard 1
2026-09-22 15:49:14 -04:00
Mihai Blidaru f07b3fd3be fix(sns): apply the subscribed queue's DelaySeconds to SQS fan-out (#4170)
The SQS arm of the fan-out passed a literal 0 as the per-message
delaySeconds. On a standard queue a non-null value is an explicit
per-message delay and overrides the queue attribute, so a queue created
with DelaySeconds never withheld a published message, while a direct
SendMessage to the same queue did. SNS carries no per-message delay, so
the argument is now null and the queue default applies, as on AWS. FIFO
queues were unaffected: that branch ignores the argument.
2026-09-22 15:46:49 -04:00
vamsiakandVamsi Akavarapu 1abc817c5d fix(stepfunctions): serialize Scheduler target input (#4168)
Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com>
2026-09-22 15:45:58 -04:00
Niels Kootstra 3cf6c76811 fix(rds-data): reject invalid secret credentials (#3759)
Return AWS-compatible errors for secret retrieval and invalid credentials,
without falling back to master credentials, with focused coverage.
2026-09-22 15:01:41 -04:00
Anders Wasen 27633bf94d feat(appsync): execute APPSYNC_JS resolvers via a Node sidecar (#3422)
* feat(appsync): execute APPSYNC_JS resolvers via a Node sidecar

A field with a resolver resolved to null: no data fetchers were registered, so graphql-java
fell through to its property fetcher on an empty root. This runs the resolver instead, for
UNIT and PIPELINE alike, over NONE, AWS_LAMBDA, RELATIONAL_DATABASE and AMAZON_DYNAMODB data
sources.

Resolver JavaScript runs in a Node sidecar container rather than in process. Floci's published
image is a Mandrel native executable, which carries no Truffle languages, so there is no
in-process JavaScript to embed; running real Node also means a bundle executes as written, ES
modules and all. @aws-appsync/utils is a shim the sidecar writes at boot rather than the
published package, so a resolver call never depends on npm being reachable.

The pipeline follows AppSync's: ctx.stash threads through every stage, each stage sees the last
as ctx.prev.result, runtime.earlyReturn stops everything, util.error fails the field with the
type the resolver chose, and util.appendError returns its errors beside the data. A data source
failure does not fail the field on its own: the stage's response() handler is called with
ctx.error set and decides whether to re-raise or suppress, which is why resolvers carry an
explicit if (ctx.error) branch.

VTL mapping templates are not executed. A VTL stage fails its field saying so rather than
resolving to null, since a null that means "not implemented" is indistinguishable from a null
that means "no rows".

Carries model/FunctionConfiguration and AppSyncService so it builds and tests standalone; both
are identical to the copies in the AppSync CloudFormation change and collapse on merge.

* feat(appsync): enforce the APPSYNC_JS subset before evaluating resolver code

The sidecar is real Node, so it accepted JavaScript AWS rejects: async functions, promises,
classes, try/catch, while loops, this, and imports of Node builtins. For an emulator that is
the worst failure available, since a local run green-lights resolver code that cannot deploy.

Imports are restricted by a module resolve hook rather than a source scan, so a dynamic import
of a builtin cannot slip past either. An async handler is caught before it runs and a handler
returning a promise after. The remaining constructs are found by scanning the source with
comments, strings and template text blanked first, so the same keywords inside them are not
flagged. A rejected resolver fails its field with errorType UnsupportedFeature and the line.

Enforcement is on by default and can be turned off with
floci.services.appsync.js-runtime.enforce-appsync-subset, which exists only so a false positive
cannot block someone whose code AWS does accept.

Checking real resolvers against it found a gap of the same kind in the other direction:
@aws-appsync/utils/dynamodb is a real module the shim did not provide, so valid code was being
rejected. It now implements get, put and remove; the helpers that compile a condition or update
expression throw by name rather than returning something the data source would mishandle.

Also from review: cap the /evaluate request body, keep integer precision in the DynamoDB NS
branch as the N branch already did, reject two SQL parameters bound to the same name instead of
letting the Data API report it, drop the container id and close the log follower in reset(), and
bound the docker probe in the integration test so an unresponsive daemon cannot hang CI.

* feat(appsync): add the js-runtime url knob and stop the sidecar through ContainerTeardown

Follows the sidecar contract the other managed containers use. floci.services.appsync.
js-runtime.url points the runtime at a Node server that is already running, in which case
ensureStarted skips container management entirely: nothing is created, adopted or stopped, and
the URL is probed with the short adopt budget so a wrong one says so instead of holding the
first resolver for the full start timeout. Same shape and meaning as floci.services.duck.url.

NodeAppSyncJsRuntime now implements ContainerTeardown, so EmulatorLifecycle stops the sidecar
with the other process-bound containers at a deterministic point rather than only through
@PreDestroy, which the interface documents as running too late for the final storage flush.
Teardown is a no-op for a pre-configured URL, since that server is not ours to stop.

* fix(appsync): serialize reset() and stop the sidecar it gives up on

reset() touched started, baseUrl, containerId and logStream without holding the monitor that
ensureStarted() and stopManagedContainers() both take. A failed evaluation could therefore clear
those fields in the window after a container had been created and its id recorded but before
started was set, dropping the only handle to a live container: teardown then saw a null id,
treated the sidecar as never started, and the container was leaked rather than stopped.

reset() is now synchronized on the same monitor, and reentrant so the callers already holding it
are unaffected. The failure path in post() goes through discardSidecar(), which stops and removes
the container before clearing the fields instead of forgetting it, since forgetting is what leaks:
nothing else holds the id. A pre-configured url owns no container, so teardown there stays a no-op.

The regression races eight failing evaluations against startup and asserts every container the
runtime created was also stopped. It needs a transport-level failure to reach the path: a 500 is
rethrown as an AwsException before it, so the stub drops the connection instead. Against the
previous reset() it fails with expected <[container-1]> but was <[]>.

* refactor(appsync): run resolvers through the GraphQL sidecar callback

out of Floci, which left this branch building DataFetchers for a schema that no
longer has any. Resolver execution moves onto the sidecar's batched resolver
callback instead, so the engine stays in the sidecar and the resolvers, the data
sources and the Node runtime stay here.

/v1/execute now carries a resolve block naming every planned coordinate that has
a resolver, with a callback URL and a token minted for that one operation. The
sidecar batches each execution level into one POST /appsync-resolve, which runs
the field's resolver and answers with a value or an error. denyFields still win,
so a denied coordinate is never listed and never reaches a resolver, and the
token stops working as soon as the operation returns.

AppSyncResolverExecutor takes a ResolverInvocation record instead of a
DataFetchingEnvironment. Every value it read off the environment is on the
record, so the pipeline, the data source invokers and the JS runtime are
unchanged. ResolverDataFetcher is gone: fields with no resolver are the sidecar's
own property fetcher again, and a resolver that disappears mid-operation falls
back to the source property rather than failing.

One AppSync behaviour does not fit the callback response, which carries a value
or an error per field and never both. util.appendError means report this and
keep the data, so those errors come back on the operation's session and are
merged into the response envelope, which keeps data and appended errors together
as AppSync returns them.

Also gives the sidecar container host.docker.internal on Linux, since it now has
to reach Floci back, moves the JS runtime image pin into application.yml so CI
prefetches it the way it does the sidecar pins, and puts the Docker integration
test on the shared AppSyncGraphqlSidecarProfile so it is namespaced and gated
like the other AppSync integration tests.

* ci(appsync): prefetch the Node image only on the shard that starts it

The js-runtime prefetch matched /appsync/, so all four shards pulled
node:22-alpine although only the shard carrying
AppSyncJsResolverDockerIntegrationTest starts that container. Every other test
in the package is a unit test. Matching the class name instead is three fewer
Docker Hub pulls per run, which is what this script exists to avoid.

* fix(appsync): keep null arguments and move the resolver callback under _floci

Two review points from #3422.

ResolverInvocation copied arguments and variables with Map.copyOf, which rejects
a null value, so getMessages(nextToken: null) threw out of the callback and
answered 500. That failed every field in the batch, not only the field carrying
the null. Both copies are now null tolerant, and an explicit null stays
distinguishable from an absent argument: it is present in ctx.args and null,
where an absent one is not there at all.

The callback moves from /appsync-resolve to /_floci/appsync/resolve, with the
EKS webhooks. A bare path is reachable as a path-style S3 request for a bucket
of that name, and an S3 bucket name cannot begin with an underscore, so the
prefix cannot be shadowed.

The null case is covered both ways: a unit test in ResolverCallbackResourceTest
that fails with a NullPointerException against the previous code, and three
queries in the Docker round trip covering an explicit null, its value reaching
ctx.args, and an absent argument for contrast.
2026-09-22 14:41:55 -04:00
Kenshin Okinaka 235ee91a76 feat(ses): scan raw sends for the EICAR test file and keep it out of the mailbox store (#4156)
* feat(ses): scan raw sends for the EICAR test file and keep it out of the mailbox store

The content scan now covers raw sends: the wire bytes are searched for the
plain and the base64-encoded signature before parsing, so a message the
lenient MIME parser cannot walk is still caught, and the parsed message is
walked part by part, decoding attachments, descending into forwarded
messages and decoding RFC 2047 header words. A candidate found on the wire
is confirmed by decoding the run around it, so a base64 near-miss of the
signature is not rejected.

A rejected record keeps only its source, its envelope and RejectReason;
subject, headers, reply-to addresses, bodies and raw data are dropped, and
the inspection endpoint lists it in neither the Simple nor the raw shape, so
the signature never reaches the mailbox store on disk. A MIME parse failure
logs the exception class only, since the message text could echo content.

* test(ses): pin that a rejected raw send publishes no parsed subject

The raw rejection test checked the header block and the recipient lists but
read commonHeaders only for the recipients, so a subject leaking back into
the event would have gone unnoticed.
2026-09-22 14:12:02 -04:00
Simone Primarosa 90d8c355d9 fix(eks): validate the node group launchTemplate against EC2 on CreateNodegroup (#4148)
Validate node group launchTemplate specifications against EC2 during
CreateNodegroup. Reject requests where neither or both of id and name
are supplied, or where the referenced launch template or version does
not resolve in EC2, with InvalidParameterException (400). Resolve
launch templates and construct nodegroup ARNs using the cluster's region
rather than the default region.
2026-09-22 14:06:04 -04:00
TATSUNO “Taz” Yasuhiro 8f2706a903 perf(s3): speed up CompleteMultipartUpload by reusing part ETags (#4145)
* perf(s3): reuse part ETags for the composite ETag on multipart completion

CompleteMultipartUpload hashed every part with MD5 again to build the
composite ETag. UploadPart already stores that MD5 as the part ETag, so
the completion now parses it instead.

* chore(s3): replace the java.util wildcard import in S3Service
2026-09-22 13:56:20 -04:00
Daniël van Ziel 00cfcef8f9 fix(stepfunctions): honor Wait Timestamp and TimestampPath (#4099) 2026-09-22 13:42:52 -04:00
Daniël van Ziel 8e6faffcaf fix(kinesis): paginate ListShards with an opaque NextToken (#4098) 2026-09-22 13:38:28 -04:00
Hector Ventura f9e96f3d22 feat(cloudformation): apply DynamoDB GlobalTable Replicas (#4134)
AWS::DynamoDB::GlobalTable was provisioned as a plain table and its Replicas
property was ignored. Now the declared replica regions are reconciled onto the
table via the same applyReplicaUpdates the UpdateTable ReplicaUpdates path uses.

- Create adds every declared replica region; update diffs declared vs tracked,
  adding new regions and removing dropped ones so an edited Replicas list
  converges.
- The deployment region is served by the table itself and the service rejects a
  replica there, so it is filtered out rather than tracked.
2026-09-22 13:34:03 -04:00
Hector Ventura 32856bfee0 feat(cloudformation): write Route53 RecordSet records into the zone (#4132)
AWS::Route53::RecordSet was a name-only resource: it set a physical id and wrote
nothing, so the record never existed. Now the declared record is applied to its
hosted zone via ChangeResourceRecordSets and removed on stack delete.

- Validate the schema-required Type and Name, and reject a non-numeric TTL (the
  schema types TTL as a string) with a ValidationError rather than letting a raw
  NumberFormatException escape.
- Resolve the zone from HostedZoneId (a Ref resolves to the real id) or by an
  exact name match against HostedZoneName. listHostedZonesByName is a starts-at
  paginator, so the result is filtered to the zone whose name equals the request,
  rejecting when none or more than one matches, rather than writing into whatever
  zone sorts first.
- Apply the record as an UPSERT so create and update both converge; delete
  reconstructs a matching DELETE change from the zone id and type recorded at
  create time, tolerating a zone or record already gone.
- When an update changes the record's identity (zone, Name, Type or
  SetIdentifier), remove the record the prior provision wrote so it does not
  linger in the zone and later block the zone's own delete.

Ref stays the record name; no Fn::GetAtt attribute is published (Id remains
gapped, as before).
2026-09-22 13:29:07 -04:00
Chiara Forresi e8b03538e6 feat(glue): add security configuration CRUD (#3870)
* feat(glue): add security configuration CRUD

Implement AWS Glue security configuration create, get, list, and delete operations with encrypted configuration round trips, account and region isolation, persistence, and integration coverage.

* fix(glue): close catalog encryption handler case

Close the PutDataCatalogEncryptionSettings switch arm so the merged security configuration cases compile.

* test(glue): cover empty security configuration lists

Restore coverage for the empty GetSecurityConfigurations response and keep the test setup aligned with the rebased GlueService constructor.

* refactor(glue): name security configuration length limit

Use a named constant for the documented 255-character security configuration name limit.

* fix(glue): serialize security configuration timestamps
2026-09-22 13:21:15 -04:00
Matheus André cde8f48084 fix(cloudwatchlogs): return creationTime in DescribeLogGroups and DescribeLogStreams (#4137)
The LogGroup and LogStream API shapes carry the creation timestamp as
creationTime, but both responses wrote it as createdTime, so SDK clients
and the CLI saw it as unset. Only the response key changes; the persisted
model field keeps its name so existing data is unaffected.

Closes #4084

Signed-off-by: Matheus André <matheusandr2@gmail.com>
2026-09-22 13:17:48 -04:00