Commit Graph
981 Commits
Author SHA1 Message Date
Abhigya d73e33fe4b fix(ecs): pull task images at launch so a moved tag reaches the next task (#4583)
* fix(ecs): pull task images at launch so a moved tag reaches the next task

Floci resolved an image reference to an image id the first time it saw it and
reused that id for the life of the process, so a rebuilt :latest pushed to the
registry never reached a new task, even through a new task definition revision
and a forced deployment, and nothing reported the mismatch.

ECS now pulls every container image when a task starts, before creating any of
its containers, following the agent's ECS_IMAGE_PULL_BEHAVIOR (configurable as
floci.services.ecs.image-pull-behavior, default "default": pull, and fall back
to the cached image when the pull fails). The cached image is whatever the
local tag names at launch rather than a remembered id. Each container reports
the manifest digest it runs as containers[].imageDigest.

* fix(ecs): create task containers from the image id their pull resolved to

An overlapping RunTask could pull the same moved tag between this task's pull
and its container creation, so the container was created from whatever the
shared tag cache named by then while reporting the digest this task pulled.
resolveForLaunch now returns the resolved image id with its digest, and ECS
builds each container from that id, so the image a task runs and the digest it
reports always come from the same pull.

The pull also now uses the reference the container is created from, including
floci.docker.image-registry-base, instead of the unprefixed name.

* fix(ecs): launch image ids without a pull and report the digest the pull resolved

A bare sha256 image id under always, or on the first once launch, went to the
registry as if it were a repository reference and failed the task although the
image was local. resolveForLaunch now runs an image id as it is, like
ensureImageExists.

The reported digest took the first RepoDigests entry for the repository, which
is not necessarily the manifest the tag resolved to when the image holds more
than one (an index and a platform manifest). It now comes from the Digest line
the daemon streams for the pull, kept while the tag still names that image; a
cached image falls back to its repo digest only when there is exactly one.

The shared test config uses prefer-cached so the other ECS Docker suites stop
adding a registry round trip per launch; the image pull integration test pins
default in its own profile. ContainerBuilder imports are back in order.

* fix(ecs): report a pull's digest only for the launch that pulled

The digest a pull reported was kept per reference and reused while the tag
still named the same image id, but on the classic image store an id is the
config digest and several manifests can share it, so an outside pull could move
the tag to another manifest and leave the reused digest stale. Only the launch
that pulled now uses the streamed digest. A cached launch uses the image's
repo digest for the repository when there is one, or the one equal to the id
(the containerd store names an image by its manifest), and otherwise none.

Also sorts the ContainerLifecycleManager imports.

* fix(ecs): pull the image-pull test's busybox and registry from Docker Hub

EcsImagePullDockerIntegrationTest pulled both images through the
public.ecr.aws/docker/library mirror, whose anonymous quota is shared per
runner IP; shard 3 failed on toomanyrequests: Data limit exceeded. Take
them from TestImages like the other Docker-backed tests, pinning the
registry image there, and prefetch both for the shard that runs the class.

* test(ecs): name the registry readiness probe's tolerated exception expected
2026-09-30 22:14:50 -04:00
TATSUNO “Taz” Yasuhiro be21e86057 fix(sqs): match AWS on stale, gone and invalid receipt handles (#4730)
* fix(sqs): reject empty, malformed and foreign receipt handles

* fix(sqs): accept receipt handles of gone and re-received messages

* fix(sqs): reject expired FIFO receipt handles

* fix(sqs): reject receipt handles that were never issued

* chore(sqs): parse receipt handles once and share the handle checks

* fix(sqs): sign receipt handles with a configurable secret

* test(sqs): merge the receipt handle error tests into one table

* fix(sqs): give a message moved by a move task a new message id
2026-09-30 21:29:09 -04:00
Hector Ventura 0bc85f3ef8 fix(sts): mint global STS and IAM ARNs per partition and add a strict partition mode (#4743)
* fix(sts): mint global STS and IAM ARNs per partition and add a strict partition mode

GetCallerIdentity's root fallback, the AssumeRole family's session ARNs, the
OIDC provider ARN and GetFederationToken built their ARNs with an empty
region, which falls back to the commercial partition, so they carried arn:aws:
whatever partition the request signed. They now go through
RegionResolver.buildGlobalArn. GetAccountSummary reports
GlobalEndpointTokenVersion only where the partition publishes a global STS
host, which is aws alone.

floci.partitions.strict (FLOCI_PARTITIONS_STRICT, default false) refuses a
request signed for a service AWS publishes in another partition but not in
the request's one (CloudFront in GovCloud, IAM in aws-eusc) with the
unknown-service guard's 404, mirroring the host that never resolves on AWS.
endpoints.json omits the services that ship only an endpoint ruleset, so a
service the data lists nowhere is served everywhere. Credential scopes carry
signing names, and 46 of them differ from the endpoints.json keys they cover
(73 keys, such as ecr for api.ecr); regen_partitions.py vendors that map as
signingNames and AwsPartition.offersSigningName joins it.

Part of #4272

* fix(core): read the gzipped botocore models the pip package ships when collecting signing names

The botocore wheel ships each service model as service-2.json.gz, while the checkout under local/aws/botocore ships it plain. collect_signing_names looked only for the plain file, so in CI, which resolves botocore to the installed package, it found no models, generated an empty signingNames and failed aws-data-check against the committed map. It now reads either form, as regen_dynamodb_shapes.py already does.

* fix(sts): keep an assumed-role session in its role's partition, and answer strict-mode Query requests in XML

GetCallerIdentity rebuilt an assumed-role session's ARN with an empty region, which falls back to the commercial partition, so a session AssumeRole issued as arn:aws-cn:sts:: came back as arn:aws:sts::, and a chained AssumeRole was then refused by a China trust policy as a caller from another partition. The session ARN now takes the partition its role ARN names.

Strict partition mode refused a form-encoded Query request (IAM in aws-eusc) with a JSON body; it now returns the Query XML error the unknown-region guard beside it already returns for such requests.

* fix(iam): mint IAM resource ARNs in the request's partition and keep them there

CreateUser, CreateGroup, CreateRole, CreatePolicy, CreateInstanceProfile and
CreateOpenIDConnectProvider minted arn:aws: whatever partition the request
signed, while STS now followed the request. Under China that denied
AssumeRoleWithWebIdentity (the trust policy names the arn:aws: provider ARN
CreateOpenIDConnectProvider returned, matched against arn:aws-cn:), and
AssumeRole reported the request's partition while GetCallerIdentity reported
the role's.

An IAM resource is now created in the request's partition and keeps it:
UpdateUser and UpdateGroup re-mint in the stored ARN's partition. Anything
derived from a stored role follows the role: all three AssumeRole handlers,
resolveCallerArn and the web identity OIDC provider ARN take the role ARN's
partition through AwsArnUtils.partitionOrDefault. The credential report's
root row takes the request's partition.

* fix(sts): mint a session from the stored role, and keep one credential report per partition

AssumeRole, AssumeRoleWithWebIdentity and AssumeRoleWithSAML find the role by
account and name, but minted the session ARN from the RoleArn the request
named. A China role assumed with an arn:aws: RoleArn therefore came back as an
arn:aws:sts:: session, while AssumeRole registered the session under the
stored role's ARN, so GetCallerIdentity reported aws-cn. All three handlers
now mint the session from the stored role's ARN when the role exists and
register it under the same ARN.

The credential report was cached once per account, so a report generated for
one partition was handed to a caller in another for four hours, with the
wrong partition's root row. It is now kept per partition.
2026-09-30 20:48:20 -04:00
Priamo Germosen 4e2c1d11ff fix(sts): evaluate AssumeRole trust-policy conditions against the real caller (#4716)
With IAM enforcement on, AssumeRole matched a trust policy on its Action and
Principal only. The Condition block was never read and the ExternalId request
parameter was ignored, so a role guarded by sts:ExternalId, the documented
confused-deputy guard, could be assumed without it, and a conditional Deny
applied whether or not its condition held.

Trust-policy conditions now go through IamPolicyEvaluator's condition engine,
through a new package-private conditionMatches, so they get the same operators
as identity and resource policies. The request context holds sts:RoleSessionName,
sts:ExternalId when the caller sends one, the global keys the enforcement filter
already provides, and aws:PrincipalArn.

A role session is now matched as the role that issued it, through that role's
own ARN, path included. AssumeRole records it on the session when it issues
one, and a new IamService.resolvePrincipalArn reads it back as is, so an old
session keeps naming its role even after a same-named role replaces it. The
evaluator used to rebuild the role ARN from
the assumed-role session ARN, which names the role without its path, so a
session of role/team/App was compared as role/App: a Principal naming the role
refused it, and a condition on aws:PrincipalArn saw the wrong value. IAM stores
a Principal naming a role as the role's unique ID, and aws:PrincipalArn is the
ARN of the role that was assumed, so both are the full role ARN.

A negated operator on an absent key now holds, as the IAM User Guide says for
every condition operator but the IfExists forms and Null: "If the policy
condition requires that the key is not matched, such as StringNotLike or
ArnNotLike, and the right key is not present, the condition is true."
evaluateConditionBlock failed every operator on an absent key, so once trust
conditions were evaluated a Deny with StringNotEquals on sts:ExternalId stopped
refusing a call that omits ExternalId. The change is in the shared engine, so
identity, resource and SCP conditions get the same rule; the set operators keep
their own rule for an absent key.

The AppSync service-trust path from #4555 had its own small condition evaluator
for aws:SourceArn and aws:SourceAccount. It now uses the same engine with those
two keys as its context, which also makes negated operators such as
StringNotEquals work there instead of refusing the document. A Condition that
is not an object of non-empty operator objects still invalidates the whole
trust document, now on every path.

The trust check also resolved the caller's account from the Authorization
header alone, where only a 12-digit key names an account. An IAM user's or a
role session's key, and any presigned request, therefore counted as the default
account and could assume a role that trusts only that account. The check now
uses the account the request was resolved to, and reads a presigned caller's
key from X-Amz-Credential.
2026-09-30 17:39:45 -05:00
Abhigya 55d37cfc41 feat(ecs): let the startup container sweep be turned off, and derive the credentials proxy owner from the shared helper (#4696)
* feat(ecs): let the startup container sweep be turned off, and derive the credentials proxy owner from the shared helper

The ECS startup sweep removes every task container carrying this deployment's
floci_owner_port label, so two Flocis sharing a Docker daemon with the same API
port and no resource namespace remove each other's task containers. EC2's sweep
already has an opt-out; ECS now has the same one,
FLOCI_SERVICES_ECS_RECONCILE_CONTAINERS_ON_STARTUP (default true). With it off,
containers are left alone and tasks start at once. The recorded load balancer
targets and Cloud Map instances are still released, since each Floci releases
only what its own persisted state recorded.

EcsCredentialsProxy.owner() now uses ContainerStorageHelper.ownerIdentity and
OWNER_LABEL instead of its own copy of the rule.

* fix(ecs): leave task-role credentials proxies alone when the startup sweep is off

The credentials proxy removed every proxy carrying this deployment's owner label
at startup regardless of reconcile-containers-on-startup. With the sweep off for
two instances sharing an owner identity, the second instance's startup still
tore down the first's proxy, and its running tasks lost their credentials
endpoint. The proxy's startup reap now follows the same setting.
2026-09-30 17:22:46 -05:00
Allen Sanborn 18128b432a fix(organizations): start a new root with no policy types enabled (#4756)
CreateOrganization (and EnableAllFeatures) seeded the root with
SERVICE_CONTROL_POLICY already ENABLED, so the first EnablePolicyType a
caller issues was rejected with PolicyTypeAlreadyEnabledException. That
is exactly what Terraform's aws_organizations_organization does with
enabled_policy_types right after CreateOrganization, so the common
"create the org and turn on SCPs" configuration failed at its first
resource.

On AWS a new root has an empty PolicyTypes list: the provider's
acceptance test for a plain organization asserts roots.0.policy_types
is empty, and its enabled_policy_types test enables SCPs on a fresh
organization successfully.

DescribeOrganization's AvailablePolicyTypes used to read the root's
list, which is what the seed was standing in for. It is now reported
separately and, as AWS documents for the deprecated field, lists only
SERVICE_CONTROL_POLICY for an ALL organization.

Tests that relied on the seed now call EnablePolicyType first, as a
real caller must. The CloudFormation test creates the stack without its
SCP, enables the type, then adds the SCP by UpdateStack, because no
CloudFormation resource enables a policy type.
2026-09-30 18:12:38 -04:00
Mario Toffia b5c428319f fix(apigateway): create API keys disabled unless enabled is set (#4731)
* fix(apigateway): create API keys disabled unless enabled is set

AWS creates an API Gateway API key disabled when the CreateApiKey request has no enabled field, and the AWS::ApiGateway::ApiKey CloudFormation schema declares Enabled with a default of false. Floci created such keys enabled, and a CloudFormation update whose template omitted Enabled switched the key on. AWS SDKs that model enabled as a plain boolean, such as the AWS SDK for Go v2, leave the field out of the request when it is false, so a client asking for a disabled key received an enabled one.

* fix(cloudformation): restore an API key when its stack update rolls back

When a stack update changed an AWS::ApiGateway::ApiKey and a later
resource in the same update failed, the stack ended in
UPDATE_ROLLBACK_FAILED and the key kept the new customer id,
description, enabled flag and tags. The provisioner had no rollback.

The provisioner now records those four values on the stack resource
before it changes the key, and puts them back when the stack update
rolls back. It also replaces the tags before patching the other
fields, so a refused tag change leaves the key untouched.

* fix(cloudformation): delete an API key an update recreated when the update rolls back

When a stack update found that its API key had been deleted outside
CloudFormation, it created a new key. If a later resource then failed
the update, the rollback reported success and left the new key live,
while the stack resource still named it.

The update now records the key it created, and the rollback deletes
that key and points the stack resource back at the previous key id.

The API key CloudFormation integration test now waits for the stack
to reach a final status before checking it, because stack create and
update run in the background.

* fix(cloudformation): put an API key's tags back when its own update fails

An API key update replaces the tags first and then patches the other
fields. If the patch failed after the tags were replaced, the stack
rolled back but the key kept the new tags. For a resource whose own
update fails, the stack restores the stored resource record and does
not call the provisioner's rollback, so nothing put the tags back.

The update now copies the tags before replacing them and puts the copy
back when the patch fails, then rethrows the original error.

* fix(cloudformation): undo the whole API key when its own update fails

An API key update replaces the tags and then patches the customer id,
description and enabled flag. Either call can fail after it has
already changed the stored key. Before, a failure only put the tags
back, and a failure to put them back was hidden, so the stack could
report a clean rollback while the key kept the failed update's values.

Now any failure in either call puts the key's four values back from
the snapshot taken before the update. If that restore also fails, the
resource is marked so the stack ends in UPDATE_ROLLBACK_FAILED, and
the original error is rethrown with the restore error attached.

* fix(cloudformation): roll an API key back by writing only what changed

Rolling back an API key update wrote every saved value back, even when
the update had changed nothing. For example, the service refuses a
reserved tag change before it writes anything, yet the rollback still
rewrote the tags and fields. That changed the key's last-updated time
for no reason, and if one of those writes failed, the stack reported
UPDATE_ROLLBACK_FAILED for an update that had not changed the key.

The rollback now reads the key as it is and writes back only the tags
and fields that differ from the saved values. The update and the
rollback share one function to decide which fields differ.

Also, when the rollback fails with the same exception object as the
update, it is no longer attached to itself, which threw an
IllegalArgumentException and hid the original error.

* fix(cloudformation): put back a reserved API key tag when an update rolls back

An API key can be created with a reserved tag, such as the id-override
tag _custom_id_. A stack update may remove that tag. When a later
resource failed the update, the rollback tried to put the tag back
through the same call the update uses, which refuses a reserved tag
that is being added. The stack then ended in UPDATE_ROLLBACK_FAILED
and the key stayed without its tag.

The API Gateway service gains a call that sets a key's tags exactly as
given, without the reserved-tag check. The rollback uses it. Tag
changes from a template still go through the checked call.

The test helper that applies patches now uses a switch expression, as
the repository's code style asks.
2026-09-30 15:48:46 -04:00
Aniket Shukla 055c411b9a fix(iam): share case-sensitive condition matching (#4725)
* fix(iam): share case-sensitive condition matching

* fix(iam): use iterative glob matching for conditions

* fix(iam): match wildcard before literal asterisk
2026-09-30 14:59:42 -04:00
Sam Fakhreddine 49501acb5a feat(dns): transparent AWS endpoint interception for spawned containers (#4610)
* feat(dns): resolve amazonaws.com to Floci inside spawned containers when spoof-aws-endpoints is on

SDK clients built with explicit real-AWS endpoints override AWS_ENDPOINT_URL and would otherwise escape to real AWS; off by default.

* fix(tls): cover every region and S3 endpoint form in the spoof SANs

The default-region-only SANs failed the TLS handshake for any other region.

* fix(dns): warn when spoof-aws-endpoints is set where the TLS certificate cannot see it

Startup logs a WARN when the flag is only in application.yml and TLS is on.

* fix(dns): derive spoofed AWS suffixes and SANs from partitions

Intercept every partition DNS and dual-stack suffix and name each region's
certificate SANs under its own partition suffix, so China, EUSC and ISO
endpoints are covered and cn-* regions are no longer named under the
commercial suffix. Add the s3-control SAN, drop the lambda-url SAN (function
URLs live under on.aws, which is not intercepted), and log the startup
warning with LOG.warnv.

* test(dns): name the new certificate tests as sentences

* docs(dns): document every AWS partition suffix spoof-aws-endpoints intercepts

The flag covers each partition's DNS and dual-stack suffix, not just amazonaws.com. List them in the config comments, env-var docs and EmulatorConfig javadoc, call out that live suffixes like api.aws and amazonaws.eu resolve to Floci, and use a single literal in the TLS visibility warning. Rename the certificate regeneration test to a sentence.
2026-09-30 13:42:08 -04:00
Aniket Shukla 894f20bb81 fix(lambda): reject invalid configuration numbers before mutation (#4726)
* fix(lambda): reject invalid configuration numbers before mutation

* fix(lambda): validate configuration ARN types and memory limit
2026-09-30 13:31:55 -04:00
Aniket Shukla 45b00779b7 fix(cognito): fail authentication when token triggers fail (#4727)
* fix(cognito): fail authentication when token triggers fail

* fix(cognito): reject empty Lambda trigger responses
2026-09-30 13:29:20 -04:00
mitsukado-shinagawaandmitsukado-shinagawa 955c11dc56 fix(stepfunctions): record the iterations a failing Map iteration cuts, and the state each was in (#4724)
* fix(stepfunctions): record the iterations a failing Map iteration cuts, and the state each was in

AWS records, for each iteration an inline Map failure cuts, a
MapIterationAborted and then the TaskStateAborted or WaitStateAborted
of the state it was in, all chained to the failing iteration's last
event and ahead of MapIterationFailed and MapStateFailed. Floci cancelled
the iterations and recorded nothing for them.

MapIterationScheduler cancelled the in-flight iterations without knowing
their chains, so the Map saw them only after they had left their states.
It now calls back with each in-flight index before cancelling, and the
Map reads and cuts each one in one step through abandonInState, as the
Parallel does. The failing iteration's MapIterationFailed is recorded by
the Map after the cut, so the aborted events come first; its
previousEventId is unchanged.

Closes #4722

* fix(stepfunctions): never report a Map iteration both ended and cut

The scheduler names every iteration it has not yet taken off its queue,
so an iteration that finished after the failing one was dequeued was
cut as well and recorded MapIterationAborted after its own
MapIterationSucceeded. The iteration's end event is now published under
the chain's lock together with an ended marker, and the cut reads that
marker in the same step it reads the state, so an iteration is reported
either ended or cut, never both.

* fix(stepfunctions): record the iterations a Map failure cut only with its MapIterationFailed

A States.Runtime failure records no MapIterationFailed. When it was a
declared tolerance that failure exceeded, the Map ended with
States.ExceedToleratedFailureThreshold instead, which passed the check
for the cut iterations, so they were recorded aborted without the
MapIterationFailed of the iteration that cut them. Both now follow the
one condition.

* fix(stepfunctions): record a cut Map iteration by the rule of the event it accompanies

The cut iterations are recorded right before MapStateFailed and now
follow its rule, that the failure ending the Map is not States.Runtime,
while MapIterationFailed keeps the iteration's own. Tying both to the
iteration's condition had dropped the cut iterations for an ItemSelector
that fails before its iteration starts, which has nothing to report
itself but still cuts the others and still records MapStateFailed.

An iteration is also reported cut only when its MapIterationStarted is
recorded: the start is published under the chain's lock with a started
marker, read by the cut in the same step, so an iteration cut while its
ItemSelector was still being evaluated records neither a start nor an
abort.

---------

Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
2026-09-30 10:33:37 -04:00
mitsukado-shinagawaandmitsukado-shinagawa fd094aee05 fix(stepfunctions): return the PascalCase execution envelope from states:startExecution, .sync and .sync:2 (#4737)
AWS returns, as the Task result of the optimized states:startExecution
integration (measured in ap-northeast-1 on 2026-09-30):

- request-response: the StartExecution response, {ExecutionArn, StartDate},
  StartDate in epoch milliseconds
- .sync: the child's DescribeExecution response, PascalCase with its keys
  in alphabetical order, dates in epoch milliseconds, Input and Output as
  JSON strings
- .sync:2: the same envelope with Input and Output as JSON values

Floci returned camelCase with dates in seconds for the first two and the
child's output alone for .sync:2, so a state machine written against AWS
found nothing at $.Output, $.ExecutionArn or $.Status.

The failure cause of the two .sync modes already built this envelope
(#4675). It now builds the success result too: a SUCCEEDED child carries
Output, OutputDetails and RedriveStatusReason and reports NOT_REDRIVABLE.
Request-response returns the response TaskSubmitted already records.

This changes the result shape for state machines written against Floci's
earlier one: the child output of .sync:2 moves from $ to $.Output.

Closes #4723

Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
2026-09-30 10:14:12 -04:00
Hector Ventura 99c1c4129a fix(iam): derive the AWS managed policy catalog per partition (#4742)
The bundled managed policy catalog is the commercial one, so
arn:aws-cn:iam::aws:policy/AdministratorAccess did not resolve and a China
deployment listed commercial ARNs. Every other partition's catalog is now
derived from the bundled data on first use and cached per partition: every
arn:aws: inside a document takes the partition, as AWS's SAM translator does
for managed policy ARNs (arn_generator.py), and the region-bearing
kms:ViaService hosts (s3.*.amazonaws.com) take the partition's DNS suffix.
Bare service principals and service-linked role paths are universal (#4633)
and are left alone, as is the ::aws:policy/ owner slot.

IamService resolves a managed policy under the partition its ARN names, so a
China ARN resolves under any signing scope, and ListPolicies lists the catalog
of the caller's partition.

Partition literal baseline 4 -> 3.

Part of #4272
2026-09-30 09:20:49 -04:00
David 5aad012e78 feat(emr-serverless): tag, untag and list tags for applications (#4667)
EMR Serverless had no tagging API: no TagHandler was registered for the
emr-serverless ARN service, so TagResource, UntagResource and
ListTagsForResource could not be routed, and a tagged
aws_emrserverless_application could not be planned.

Register an emr-serverless handler with the shared /tags dispatcher,
answering 200 as the model does, over the tags already stored on the
application. Validate keys and values, the user guide's 50 tag limit
and its reserved aws: prefix, refuse job run ARNs as not found, and
synchronize the application mutators so a tag write cannot lose a
concurrent update.

Closes #4662
2026-09-30 09:11:04 -04:00
Priamo Germosen 48214e04e0 fix(codeartifact): extend idempotent asset republish to Published versions (#4708)
Two follow-ups hectorvent flagged on #4619, approved but marked as
separate-PR material:

Compares an existing asset's persisted SHA-256 instead of reading its
bytes. The hash is normal metadata (not @JsonIgnore like the content
field), so this needs no disk read, no in-memory-store lookup, and no
special case for a backing file that happens to be missing - a stored
hash never "goes missing" the way a file can, and a genuinely different
republish still conflicts even when the file is gone, closing a gap the
previous byte-comparison approach had.

Extends the idempotent-retry allowance to an already-Published version.
AWS's "Overwriting package assets" rule isn't scoped to Unfinished, and
the terminal publish call (the one that actually finishes a version) is
the likeliest one a client retries after a dropped response. A brand-new
asset name against a Published version still always conflicts; only a
byte-identical replay of an asset that's already there is idempotent.
2026-09-30 08:00:43 -05:00
mitsukado-shinagawaandmitsukado-shinagawa 6ca104042b fix(stepfunctions): fail a Parallel the moment any branch fails, whichever is listed first (#4713)
executeParallelState joined the branch futures in declaration order, so a
failure in a later branch was only seen once every earlier branch had
returned: a .sync Task listed before the failing branch kept the Parallel
running until its job ended on its own, and a Wait listed first until the
Wait ended. AWS fails the Parallel within about 0.1 s of the failing branch
either way (measured in #4646).

The branches now go through an ExecutorCompletionService, as the Map
iterations already do, and are polled as they complete under the same two
deadlines. The failed branch is the one whose future came off the queue, so
continueFrom and the aborted-state events of #4660 attach to the same chain.
The outputs are collected by branch index and still come back in declaration
order.

Closes #4646

Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
2026-09-30 07:00:42 -04:00
mitsukado-shinagawaandmitsukado-shinagawa 2eadc106c5 fix(stepfunctions): record TaskSubmitted for a .sync Task, named as AWS names it (#4719)
* fix(stepfunctions): record TaskSubmitted for a .sync Task, named as AWS names it

AWS records TaskSubmitted for every .sync Task once the call that starts
the job has returned and before it waits on the job, chained to
TaskStarted and carrying that call's response as output in PascalCase:
{ExecutionArn, StartDate} in epoch milliseconds for states:startExecution
.sync and .sync:2, {Failures, Tasks} for ecs:runTask.sync. Floci recorded
nothing between TaskStarted and the terminal event, so a client reading
the job's id from the history found nothing until the Task ended.

The two poll loops do not have the HistoryChain; invokeResource hands
them a callback that publishes the event. The SDK's SdkHttpMetadata and
SdkResponseMetadata, which AWS folds into the response, are left out,
as everywhere else in Floci.

The task event profile also split a well-formed integration id at its
last colon, so every event of a .sync:2 Task read resourceType
states:startExecution.sync, resource 2. AWS reports states /
startExecution.sync:2, so a parsed id now splits at its service.

Closes #4648

* test(stepfunctions): name the types in the TaskSubmitted history test

* fix(stepfunctions): stop the job when TaskSubmitted cannot be recorded

TaskSubmitted is the first event after the job exists. When it is the
event that hits the 25,000-event history limit, the publish throws
before the poll loop whose catch stops the job is entered, so the parent
failed with States.Runtime while the child execution or ECS task ran on.
Both loops now abort the job on that path, the way the wait would have.

---------

Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
2026-09-30 06:35:09 -04:00
Mario Toffia 560de5c13f fix(tagging): find resources by the tags their own service holds (#4563)
* fix(tagging): list resources by the tags their own service holds

GetResources, GetTagKeys and GetTagValues merge the tagging store with every
ResourceProvider, so SQS, Lambda and Logs tags are discoverable. Resource type
filters now parse colon and leading-slash ARNs (function:f, log-group:x, /apikeys/k),
and TagResources/UntagResources write through to the owning TagHandler.

* fix(apigateway): expose tagged resources and API key tags to the tagging API

ApiGatewayService is a ResourceProvider for REST APIs, stages, API keys, usage plans and
domain names, and ApiGatewayTagHandler serves /apikeys/<id> ARNs, so GetResources finds
API Gateway resources by tag and tagging-API writes land on the API key itself.

* fix(cloudformation): forward AWS::Lambda::Function Tags

CreateFunction now receives the template Tags; an in-place UpdateStack untags dropped keys and retags the desired set, mirroring SqsCfnProvisioner.

* fix(tagging): scope global-ARN resources by region and clamp stale page tokens

Provider resources with an empty ARN region use their own region, stale page tokens
past the end return an empty page, and provider tags are copied inside the skip guard.

* test(compat): discover SQS, Lambda, Logs and API Gateway resources by tag

* docs(tagging): describe owning-service discovery

* fix(tagging): forward tags only for resources the owning service lists

* fix(apigateway): report the calling account and tag usage plans

* docs(cloudformation): note Lambda tag reconciliation on update

* fix(tagging): match declared resource types and scope owner writes to the request

API Gateway API key and usage plan ARNs must now name the key or plan at the
start of the resource part, so a nested /apikeys/ segment no longer tags the key.

* fix(tagging): match AWS type filters, regions and failure codes

Compared against a live AWS account: type filters, IAM listing, cross-region
TagResources and FailedResourcesMap entries now answer as AWS does.

* fix(cloudformation): keep Lambda tags added outside the template

* fix(tagging): route TagResources to V1 tag handlers too

* fix(apigateway): reject sub-resource ARNs when tagging a REST API

* fix(tagging): write tagging API tags through to SQS, Lambda and Logs

TagResources and UntagResources now reach the queue, function or log group's own tags through TagHandler beans qualified @TaggingApiOnly, so ListQueueTags, Lambda ListTags and Logs ListTagsForResource show them. The qualifier keeps these handlers off the /tags/{arn} and /v1/tags/{arn} paths, since each service defines tags in its own protocol.

* fix(cloudformation): forward SSM parameter tags

AWS::SSM::Parameter now applies its Tags after the overwriting put. On UpdateStack only the keys the previous template set and the new one drops are removed, tracked in the internal FlociSsmTemplateTagKeys attribute, so tags added outside the template are kept.

* fix(tagging): hide tagging-store copies of global resources

GetResources no longer lists an IAM role or user tagged through TagResources, since AWS never lists global resources.

* fix(tagging): reject every wildcard log group ARN

TagResources and UntagResources now send a log group ARN ending in :* to CloudWatch Logs even when the group does not exist, so it is rejected as in AWS instead of stored.

* fix(tagging): clear store tags on every untag

UntagResources now removes the keys from the tagging store for every ARN, even one the owning service rejects, so a copy stored earlier can always be cleared.

* fix(cloudformation): tag an adopted Lambda function

When CreateFunction conflicts and the provisioner adopts the existing function, the template's tags are now applied to it.

* fix(apigateway): tag only exact domain and stage ARNs

A domain or stage segment nested elsewhere in an API Gateway ARN, such as /restapis/<id>/domainnames/<d>, is now rejected instead of tagging that domain or stage.

* fix(cloudformation): leave an adopted Lambda function's tags alone

Adoption uses the existing function as it is, as before, so a function outside the stack keeps its tags.

* fix(cloudformation): record no template tag keys for an adopted Lambda function

An adopted function keeps its own tags, so a later update adds the template's tags without removing any it never set.

* fix(tagging): never list IAM ARNs from the tagging store

A role tagged through TagResources stays hidden after DeleteRole, as AWS never lists IAM resources.

* fix(tagging): fail a write when an owning service cannot be read

A provider that fails while routing TagResources or UntagResources now returns InternalServiceException instead of writing the tagging store and reporting success.

* fix(tagging): fail only unresolved ARNs when a provider cannot be read

A provider failure no longer fails the whole TagResources or UntagResources call; only ARNs whose owner could not be resolved are reported in FailedResourcesMap.

* fix(tagging): report another account's ARN instead of storing it

TagResources and UntagResources report an ARN from another account in FailedResourcesMap with AccessDeniedException, as AWS reports it per ARN, and never write it to the tagging store.

* fix(tagging): keep stored tags for an ARN an untag could not resolve

UntagResources leaves the tagging store unchanged for an ARN it reports as unresolved or from another account; an ARN its owner rejected is still cleared.

* fix(tagging): fail an unresolved ARN only when its own service cannot be read

A provider failure now only affects unlisted ARNs of the services that provider declares.

* fix(tagging): copy stored tags under the writers' lock

GetResources, GetTagKeys and GetTagValues no longer race a concurrent TagResources on a stored mapping.

* fix(apigateway): reject reserved tags when tagging a usage plan

TagResources on a usage plan now refuses floci:override-id as the other API Gateway tag paths do, instead of dropping it and reporting success.

* fix(apigateway): reject tag ARNs with an account or another region

The /tags path now answers an ARN with an account segment with BadRequestException and one naming another region with NotFoundException, as AWS does, instead of resolving the id in the caller's region.

* fix(ssm,lambda): reject tag keys outside the AWS pattern

AddTagsToResource, PutParameter, TagResource and CreateFunction now reject a tag key outside the AWS pattern or 1 to 128 characters with ValidationException, as AWS does, which also keeps the CloudFormation managed-key attributes lossless.

* fix(ssm,lambda): validate CloudFormation tag keys before changing the resource

* docs(tagging): say every handled ARN ending in :* reaches its service

* fix(tagging): read a negative pagination token as the first page
2026-09-30 06:10:27 -04:00
vamsiakandVamsi Akavarapu af3d387140 fix(apigateway): route REST execute-api virtual hosts (#4553)
* fix(apigateway): route REST execute-api virtual hosts

* fix(apigateway): preserve REST connection paths

* fix(apigateway): prioritize WebSocket connection routes

* fix(apigateway): honor explicit REST domain routes

* fix(apigateway): preserve WebSocket domain connections

* fix(apigateway): scope base path routes to REST APIs

* fix(apigateway): retain API type for domain mappings

* fix(apigateway): find WebSocket connection routes across accounts

---------

Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com>
2026-09-30 06:07:57 -04:00
武田隆志 94ea065cc3 docs(cloudwatch): describe how Logs Insights fails unsupported syntax (#4717)
Since #3139 an unsupported command or filter operator fails the query
(GetQueryResults reports status Failed) instead of being dropped with a
warning. The Logs Insights section still described the old behaviour,
where the stage was skipped and every row came back. Update the table
to the current behaviour, note that the reason is only in the server
log, and keep the compound-filter case, which still returns no rows
with status Complete and no log line.
2026-09-30 06:00:48 -04:00
TATSUNO “Taz” Yasuhiro e6ee346761 feat(sqs): expire messages after MessageRetentionPeriod (#4706)
* feat(sqs): expire messages after MessageRetentionPeriod

ReceiveMessage, GetQueueAttributes counts, the inspection endpoint and
StartMessageMoveTask skip messages older than the queue's retention
period. A sweeper frees expired messages every 60 seconds.

As on AWS, a standard DLQ keeps the original enqueue time, while a FIFO
DLQ and StartMessageMoveTask start the retention period over.
SentTimestamp is kept in all cases.

* fix(sqs): drop messages that expire during a rate-limited move task

* test(sqs): cover a failing retention sweep

* test(sqs): make the rate-limited move task expiry test deterministic

* test(sqs): assert the expiring message is live when the move task starts

* fix(sqs): reject MessageRetentionPeriod outside 60 to 1209600 seconds
2026-09-30 00:03:48 -04:00
mitsukado-shinagawaandmitsukado-shinagawa ae710c04d0 test(stepfunctions): pin that a failing Map iteration stops the .sync job of another (#4712)
* test(stepfunctions): pin that a failing Map iteration stops the .sync job of another

The Run a Job guide names an uncaught failure in a Map iteration, next to a
Parallel branch failure, as a reason a .sync job is aborted. #4660 covers it
through the same InterruptedException catch, because MapIterationScheduler
cancels the sibling iterations with cancel(true), but only Parallel was named
in step-functions.md and no test held the Map case. One executor test now runs
an inline Map whose "fail" item fails while the other item's Task waits on a
child execution, and asserts the child is aborted with the AWS cause. Without
the catch it fails (child never stopped). The doc names the Map case beside
the Parallel one, and the gaps paragraph no longer says a cut Parallel branch
is unrecorded, which #4660 changed.

Follow-up from the review of #4660.

* docs(stepfunctions): record what AWS writes for a Map iteration it cuts

Measured in ap-northeast-1: an inline Map iteration that fails records a
MapIterationAborted for each iteration it cuts and the *StateAborted of the
state it was in, all chained to the failing iteration's last event and before
MapIterationFailed and MapStateFailed. The child the cut Task waited on is
aborted within about 0.15 s with the Task-state cause, with or without a Catch
on the Map. The gaps paragraph and the test's javadoc now say so.

---------

Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
2026-09-29 23:47:30 -04:00
Simone Primarosa c0ec98b43e feat(ec2): return spot price history for known instance types (#4698)
* feat(ec2): return spot price history for known instance types

* fix(ec2): address review feedback on spot price history pagination and platforms

* style(ec2): fix import ordering and inline qualified class names
2026-09-29 22:05:16 -04:00
XuJian 433893d298 feat(cognito): support software-token MFA setup and challenges (#4620)
* feat(cognito): require TOTP MFA after primary authentication

* test(cognito): verify TOTP MFA with Java SDK

* fix(cognito): reject disabled users completing TOTP challenges

* fix(cognito): preserve new-password trigger through TOTP

* fix(cognito): gate custom password auth with required MFA

* fix(cognito): limit failed TOTP verification attempts

* fix(cognito): report code mismatch for invalid TOTP setup
2026-09-29 19:43:09 -05:00
Hector Ventura 43ed79d15b fix(core): service principals are universal in every partition; accept the legacy forms (#4633)
* fix(core): service principals are universal in every partition; accept the legacy forms

A service principal is <service>.amazonaws.com in every partition, the rule the CDK applies
(region-info.ts, principals.ts). Floci now emits it through ServicePrincipals.of: generated trust
policies, SAM's Lambda permissions, CloudTrail's eventSource, service-linked role paths (Macie,
GuardDuty, Connect, Application Auto Scaling, RAM, SSO) and the Redshift COPY trust check.

Policies may still name a service in the per-partition form AWS accepted before
(elasticmapreduce.amazonaws.com.cn, logs.cn-north-1.amazonaws.com.cn, config.c2s.ic.gov), and AWS
still honours them. ServicePrincipals.canonical folds a published DNS suffix and a regional label
away, and the trust-policy evaluator and CreateServiceLinkedRole compare in that form, so either
spelling matches.

DescribeVpcEndpointServices now lists China's S3 interface service, cn.com.amazonaws.<region>.s3,
beside the com.amazonaws gateway one, each with its own type; where the names agree it stays one
service carrying both types.

Partition literal baseline 34 -> 4 occurrences. The web-identity and pod-identity audiences keep
their commercial literals, escaped for the STS phase.

Part of #4272

* fix(iam): put a legacy-named service-linked role under the universal principal

CreateServiceLinkedRole derived the role name from the universal principal but kept the caller's legacy spelling (es.amazonaws.com.cn) in the path and the trust policy. All three now use the universal principal, so the role lists under /aws-service-role/es.amazonaws.com/ like one created from the universal name.

ServicePrincipals.canonical no longer lower-cases: service-principal matching is exact and case-sensitive since #4555, and AWS matches principals case-sensitively, so only a suffix written the way AWS publishes it folds.
2026-09-29 20:33:07 -04:00
Abhigya cea6d3e99f fix(s3): journal the object index under persistent storage (#4642)
* fix(s3): journal the object index under persistent storage

Under persistent mode every PutObject, CopyObject and DeleteObject
rewrote s3-objects.json in full, and that file holds the metadata of
every object in every bucket, so the cost of one write grew with the
total object count (two rewrites per write on a versioned bucket).

Create the object store with WriteProfile.APPEND_HEAVY, as CloudWatch
Logs events already are: a change is appended to s3-objects.wal and the
JSON file is rewritten on the WAL compaction interval and at shutdown.
An existing s3-objects.json is read as the first snapshot.

* fix(s3): journal both index entries of a current version's metadata update

A versioned put indexes the new object under its version key and the latest
key. Tagging, retention, legal hold, ACL and the SSE-C fields set on multipart
completion wrote back only one of the two. With the object index journaled,
each entry replays on its own, so a restart before compaction brought the
other entry back with the old metadata.

Write both entries when the update targets the current version. The restart
tests now shut down every factory and replay a copy of the stopped process's
directory, so no two writers share a journal.

* test(lambda): stub the WriteProfile overload for S3 stores in the stream poller test

* fix(s3): write object metadata under the bucket lock and the owner account

A metadata update checked whether the latest key still pointed at the object
and then wrote it without holding the bucket lock that puts and deletes take,
so a concurrent delete marker or overwrite could be replaced by the object it
had superseded. The check and both writes now run under that lock, and the
latest key is written only while it still refers to the updated object.

Multipart completion wrote the SSE-C fields back through the caller's account
partition, so with the global bucket namespace a cross-account completion
left a shadow latest entry and version in the caller's partition. It now goes
through the same helper with the bucket owner's account.
2026-09-29 19:18:51 -05:00
XuJian 600797db17 fix(tls): add key identifiers to local CA certificates (#4644)
* fix(tls): add key identifiers to local certificates

* test(tls): assert served certificate key identifiers

* style(tls): follow logging and import conventions
2026-09-29 19:18:37 -05:00
Simone Primarosa d1a9b50cf5 feat(ec2): resize volume backing files and loop devices on ModifyVolume (#4666) 2026-09-29 19:00:10 -05:00
Priamo Germosen a075e25290 fix(secretsmanager): require lambda:InvokeFunction for RotateSecret under IAM enforcement (#4697)
AWS requires the caller of RotateSecret to hold lambda:InvokeFunction on the rotation function as
well as secretsmanager:RotateSecret (Secrets Manager API Reference, RotateSecret, "Required
permissions"). Floci checked only RotateSecret and then invoked the function in-process, so under
IAM enforcement a caller refused lambda:InvokeFunction could still run any function it could name by
configuring it as a rotation function.

RotateSecret now authorizes the invoke for the same caller the filter evaluated, against the exact
function the rotation will run (the requested ARN, or the one already configured, with a bare name
or partial ARN resolved in the secret's account and Region), and the rotation then invokes that same
full ARN. Invoking the reference as given would let a name or partial ARN resolve in whatever account
the rotation thread sees, so the function checked and the function run could differ. The check runs
before the function is
looked up or the secret changed, so a refused call leaves nothing configured for the scheduled sweep
to invoke later. A refusal is reported as Secrets Manager reports one: AccessDeniedException with
HTTP 400 (API Reference, "Common Errors").

A rotation function that does not exist is now reported the way AWS reports it too:
AccessDeniedException, HTTP 400, "Secrets Manager cannot invoke the specified Lambda function. Ensure
that the function policy grants access to the principal secretsmanager.amazonaws.com.", with the
secret's rotation settings left as they were. It used to be ResourceNotFoundException with HTTP 404.

The caller credential reaches the handler through IamEnforcementFilter.requestAuthorization, the
filter's own header-or-presigned logic, so a presigned request is checked the same way. Requests
with no caller credential, such as API Gateway service integrations, and rotations started by the
scheduled sweep are unchanged. With IAM enforcement off the caller check does not run; the
missing-function response above applies either way.
2026-09-29 18:54:38 -05:00
mitsukado-shinagawaandmitsukado-shinagawa 7ff6a7cfa7 fix(stepfunctions): fail a .sync Task on its child with States.TaskFailed and the child's description (#4675)
* fix(stepfunctions): fail a .sync Task on its child with States.TaskFailed and the child's description

Measured on AWS (ap-northeast-1, 2026-09-29), six child endings under
both states:startExecution.sync and .sync:2: FAILED with a custom error
with and without a cause, FAILED with States.Timeout from a Task's own
TimeoutSeconds, FAILED with States.TaskFailed, TIMED_OUT, and ABORTED by
a StopExecution carrying an error and a cause. In every case the parent
Task fails with States.TaskFailed, and the cause is the child's
DescribeExecution response as JSON: PascalCase, keys in alphabetical
order, Cause and Error only when the child has them, dates in epoch
milliseconds, no Output.

Floci passed the child's own error and cause straight through, falling
back to States.TaskFailed and "Nested execution ended with status: X"
only when the child had none. The error name matched AWS in two of the
six cases and the cause in none, so a parent Catch on States.TaskFailed
missed a child that failed with its own error or timed out, and a Catch
on the child's error name fired where AWS never takes it.

Closes #4562

* fix(stepfunctions): read a nested child's terminal state consistently, and keep its alias and version

Review of #4675.

The poll read the child's status without the monitor its worker and
StopExecution write the terminal fields under (status last), so a
terminal status could be seen before the error, cause or stop date
behind it, and the cause built from a half-written child. The status is
now read under that monitor, which makes everything written before it
visible.

A child started through an alias or a version also carries
StateMachineAliasArn and StateMachineVersionArn in the cause, measured
on AWS (ap-northeast-1, 2026-09-29): an alias gives both, a version
only the version, each in its alphabetical place between StartDate and
Status.

---------

Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
2026-09-29 18:54:22 -05:00
mitsukado-shinagawaandmitsukado-shinagawa dc3beadf6a fix(stepfunctions): stop a .sync job whenever its Task is cut, and record the cut state (#4660)
* fix(stepfunctions): stop a .sync job whenever its Task is cut, and record the cut state

Measured on AWS (ap-northeast-1, 2026-09-29): Step Functions stops the
job a .sync Task waits on however the Task ends before the job does.
Besides the Task's own TimeoutSeconds and StopExecution, which #4519
covered, that is the execution's budget (child ABORTED, ECS task
UserInitiated, both at the budget) and a failure in a sibling Parallel
branch (both within about 0.1 s of the failure), always with the cause
"The Task state in AWS Step Functions execution [<arn>] which was
managing this resource was aborted". Floci left the job running in both
cases: the poll loops only stopped it on the Task's own timeout, and an
interrupt from a cut Parallel unwound through them untouched.

AWS also records the state each cut branch was in: one TaskStateAborted
per cut Task, or WaitStateAborted for a cut Wait, each chained to the
failing branch's last event and recorded before ParallelStateFailed,
which points at that same event. The Parallel now reads each branch's
current state before it cuts them and records those events with
HistoryChain.publishBeside. The execution's budget records none, as on
AWS.

Part of #4646

* fix(stepfunctions): read and cut a Parallel branch in one step

Review of #4660: the state a branch is in was published apart from the
event that enters or exits it, and read apart from the cut. A sibling
failure could therefore see a TaskStateEntered with no state marked and
record no TaskStateAborted, or mark a state that then exited before the
cut and record TaskStateAborted after its TaskStateExited.

HistoryChain now publishes the Entered and Exited events together with
the marker (publishStateEntered, publishStateExited), and the Parallel
reads and cuts each branch with abandonInState, all under the chain's
lock. A Task whose own failure ends its branch leaves the state and
records its TaskStateAborted in one step too (leaveStateAside), so a
concurrent cut reports it at most once. runState leaves the state in a
finally for the paths that end by throwing.

* fix(stepfunctions): let the cut branch's state alone decide its aborted event

Review of #4660: the cut read each branch's future after cutting it, so
a branch that finished in between had its Exited event suppressed by
the cut and its *StateAborted skipped by the isDone check, leaving a
state with neither. The future read is not needed: runState leaves
every state it entered before the branch returns, so a finished branch,
the failed one included, is always read as between states. The cut now
decides on the state it reads under the chain's lock and nothing else.

* test(stepfunctions): assert the parent's budget aborts a nested child over HTTP

StepFunctionsTimeoutSecondsIntegrationTest still said the child keeps
running when the parent's TimeoutSeconds fires, which this PR changes
to match AWS. The comment now says the child is aborted, and the test
asserts it through ListExecutions, so the change is covered end to end
and not only by the executor's unit tests.

---------

Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
2026-09-29 18:54:05 -05:00
Allen Sanborn b8aec4c50f fix(elasticache): serve a second cache asking for 6379 instead of refusing it (#4693)
* fix(elasticache): serve a second cache asking for 6379 instead of refusing it

CreateReplicationGroup answered a second cache on port 6379 with

  InvalidParameterValue: Port 6379 is already in use by another
  replication group.

AWS has no such rule. Port belongs to a cache's own endpoint, and 6379 is
the Redis default, so nearly every ElastiCache cluster uses it and they
coexist: AWS gives each cache a DNS name of its own and the port never has
to tell them apart. Floci puts every cache's proxy on one host, where a TCP
port is exclusive and the port IS the only thing that tells them apart. Any
module standing up two Redis clusters, and any suite running one per test in
parallel, failed at the second create.

A pinned port that is free and inside the proxy range is still honored. One
that is taken, or outside the range, now yields a port from the range rather
than a rejection, and that port is what the cache's endpoint reports.

The port a cache reports is always the port it is actually on. That is the
whole design, and it rules out the tempting alternative of reporting the
pinned port while listening elsewhere: the endpoint would then name a
DIFFERENT cache's listener, and a client following it reads the wrong
cache's data with no error at all. Measured, on a build that did exactly
that: two no-auth caches pinned to 6379, write through each, then read
through the second's advertised endpoint and get the FIRST cache's value,
from the host and from inside a container both. #4094 removed that same
failure from the restore path last week, where "the old endpoint then
reached an unrelated cache instead of failing cleanly".

What a caller gives up is the pinned port when Floci cannot serve it, which
terraform surfaces as a replacement-forcing diff on the next plan. A visible
difference, against a silent wrong answer: the create still succeeds, which
is what unblocks the modules.

The out-of-range rejection goes for the same reason. That range bounds what
this emulator may listen on and never bounded what AWS accepts. The only
rejection left is AWS's own, 1150 to 65535, as RdsService already applies.

Tests: the two that pinned the old rejections now pin the substitution, and
ElastiCachePortSharingIntegrationTest asserts at the DATA plane, writing
through each cache's own advertised endpoint and reading its own value back.
A control-plane-only test passes against the wrong-endpoint design too,
which is how that design survived review. ElastiCache surface: 214 tests,
0 failures.

Refs: floci-j55a

* test(elasticache): gate Docker per test, tie each endpoint to its own group

Five review points, no behaviour change. The service diff is the 1150 comment.

CORRECTING THE PREVIOUS COMMIT MESSAGE, which cannot be amended without a
force-push. It said a control-plane-only test "passes against the wrong-
endpoint design too, which is how that design got through four rounds". False
about this file: Order(2) compares the two REPORTED ports and requires them to
differ, and the withdrawn design reported 6379 for both, so it fails there
before anything connects. The general point stands, but not as stated. An
assertion about a SINGLE reported value cannot see a wrong-endpoint design,
because "the API says 6379" is satisfied whatever 6379 serves. An assertion
about a RELATIONSHIP between reported values often can. That is the
distinction, not control plane against data plane. Both javadocs said the
wrong thing and both are rewritten.

@BeforeAll gated the whole class on Docker, and only Order(6) needs it: a
group reaches available with no daemon reachable. On a Docker-less runner the
entire regression test for this fix would have vanished, silently and green,
including the control-plane assertion that catches the original bug. The
assumption now sits in Order(6) alone.

Order(6) claimed more than it proved. Writing "first" and "second" through the
two endpoints and reading each back passes under a consistent relabelling,
where each endpoint reaches a distinct cache that is not its own. Each group
now carries its own AuthToken and each proxy validates the token of the group
it was started for, so an endpoint reaching the other group's proxy is refused
its own group's token. The test AUTHs with its own token and requires the
other group's to be refused, which is what makes the method name true. Order(2)
stays: the two catch different things and neither subsumes the other.

Those refusal assertions check the proxy's actual error text, not the helper's
prefix, because a connection returning nothing would also fail to start with
"+OK" and must not read as a pass.

The docs section stated two rules as the service's that are false for
Memcached: CreateCacheCluster routes that engine to a path Port is not passed
to, so a pinned port is ignored and the 1150 check never runs. Scoped to
redis/valkey, with Memcached's behaviour stated. Third time on this work that
a Redis-path rule was written as though it covered the service.

The 1150 bound is no longer called AWS's own, in docs or javadoc. It is the
bound RdsService applies to the same argument; nothing here establishes
ElastiCache's real limit. It is strictly more permissive than the check it
replaced, so the risk is accepting a port AWS would refuse, never refusing one
AWS accepts. The upper arm was untested and now is.

ElastiCache surface: 215 tests, 0 failures, 0 skipped.

Refs: floci-j55a

* test(elasticache): stop the method name claiming the bound is AWS's

Two review points, both about claims rather than behaviour. The only
non-comment change in the diff is the rename.

aPortOutsideTheRangeAwsAcceptsIsStillRefused was the last place in the tree
still asserting that 1150 to 65535 is what AWS accepts, after the previous
commit removed that claim from the docs, the service javadoc and the unit
test. It is now aPortOutsideTheAcceptedRangeIsStillRefused, and its javadoc
says the bound is the one RdsService.reserveProxyPort applies to the same
argument, with nothing here establishing ElastiCache's real limit.

It survived a round that corrected the identical claim in three other places
because a method name does not present itself as prose. It is read far more
often than the body under it and re-read far less, which is true of a display
name, a bead title and a commit subject too.

Order(2) carried a one-line javadoc about the original bug, so a reader
landing there sees no reason it is not redundant against Order(6). It now says
what it catches that Order(6) cannot: comparing the two REPORTED ports is what
rejects a build reporting one port for both caches, it does so before anything
connects, and it still runs on a machine where Order(6) skips for want of
Docker. The non-subsumption was already stated in the class javadoc and in
Order(6)'s, which is not where someone doubting Order(2) is standing.

ElastiCache surface: 215 tests, 0 failures, 0 skipped. The renamed test is
present in the surefire report under its new name.

Refs: floci-j55a

* test(elasticache): SDK coverage for port sharing, and two test defects

Three Greptile findings on #4693, all in the tests. Verified live against
87d663e4e rather than trusting the stale marker: the single-read helper, the
absolute 6379 assertion and the absent SDK coverage were all still there.

SDK VALIDATION. AGENTS.md wants management APIs exercised through an AWS SDK
client, and src/test has no SDK dependency, so it cannot host that; the repo
keeps it in compatibility-tests/sdk-test-java. ElastiCachePortSharingTest goes
there. It proves what the RestAssured assertions cannot: that the substituted
port deserialises into the MODEL a caller reads, on the create response, on
the describe, and on the member cluster terraform follows. A response can be
well formed and still leave PrimaryEndpoint.Port null.

Self-contained by construction, after the shared-fixture trouble on #4598: its
own client, its own uniquely named groups, its own cleanup, no @Order coupling
and no fixture another class can tear down first.

Measured both ways rather than assumed. Against a build with the old refusal
put back, it fails with InvalidParameterValueException "Port 6379 is already
in use by another replication group"; against this branch it passes. An
assertion never seen red is not evidence.

PARTIAL READS. readReply did one in.read(), so a RESP reply split by TCP
misparsed. Theoretical over loopback until Order(6) went from four round trips
to six, and it fails against a WORKING proxy, which makes it a flakiness
source rather than a correctness bug. A flaky test in a regression suite is
worse than no test: it teaches people to re-run. It now reads a line at a time
and honours a bulk string's declared length.

THE FIRST PORT IS NO LONGER ASSUMED FREE. Order(1) required 6379 exactly. If
another class in the shared Quarkus instance holds it, substitution is the
feature working correctly, and the test would have failed on that before
reaching what it exists to check: broken by the code behaving as designed. It
now records whatever port comes back and asserts the relationship, which is
what the class is about anyway.

ElastiCache surface: 215 tests, 0 failures, 0 skipped. SDK suite: the new
class passes against a running emulator.

Refs: floci-j55a

* test(elasticache): guard the data-plane test with the service's own Docker check

The assumption gating Order(6) shelled out to `docker info`. Floci reaches its
daemon through DockerClientProducer, which resolves the endpoint from the
active Docker context rather than the platform default, so on a machine using
an OrbStack socket, or with no docker CLI installed, the guard can fail while
the client that actually starts the containers works.

It now calls ElastiCacheContainerManager.isDockerReachable(), which is the
method the service itself uses to tell a missing daemon from a container that
failed for its own reasons, pinging the same DockerClient bean the caches are
started with. Not a second check that happens to agree: the same one.

This is the failure mode worth spending a commit on. Order(6) is the only
data-plane assertion in the class, and it is the only thing standing between
us and an unverified endpoint-identity property now that the guard sits on it
alone rather than on the whole class. A guard that fires spuriously deletes
exactly the test the class exists for, and leaves a green run behind. Every
other defect on this branch was caught by somebody reading the code; a
spurious skip is invisible to that.

It is also the shape of most of the findings here: the check and the thing it
checks used different mechanisms. The docker CLI is not the connection under
test, a single read() is not a RESP reply, and 6379 is not the port a cache is
necessarily on.

ElastiCache surface: 215 tests, 0 failures, 0 skipped, with Order(6) present
in the surefire XML and no skipped tags.

Refs: floci-j55a

* test(elasticache): name the SDK model types the port test validates

AGENTS.md wants explicit types at call sites so the AWS models under
validation are visible, and three response values in the new SDK test were
var.

Not only style here. The reason that class exists is that a response can be
well formed and still leave PrimaryEndpoint.Port unset in the model a caller
reads, so the model types ARE the subject: var hid
CreateReplicationGroupResponse, DescribeReplicationGroupsResponse and
DescribeCacheClustersResponse at exactly the three places a reader checks what
is being deserialised.

Refs: floci-j55a
2026-09-29 18:47:50 -04:00
vamsiakandVamsi Akavarapu 0383ecf53e fix(apigateway): resolve AWS variables on REST import (#4547)
* fix(apigateway): resolve AWS variables on REST import

* fix(apigateway): preserve OpenAPI mapping templates

* fix(apigateway): resolve imported authorizer variables

* chore(ci): retry Docker Hub limited tests

* fix(apigateway): resolve import variables across definitions

* test(apigateway): cover variable imports with AWS SDK

* refactor(apigateway): remove unused import validation region

* style(apigateway): sort OpenAPI parser import

* fix(apigateway): preserve imported authorizer merge behavior

---------

Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com>
2026-09-29 15:32:17 -04:00
Mario Toffia 86c4904bcc fix(ssm): resolve Secrets Manager references in GetParameter (#4581)
* fix(ssm): resolve Secrets Manager references in GetParameter

GetParameter and GetParameters now answer
/aws/reference/secretsmanager/<secret-id>[:<version-id-or-label>] from
Secrets Manager, with the checks, error texts and response fields
measured against AWS: WithDecryption must be true, a missing secret is
ParameterNotFound, and GetParameters lists a reference it cannot answer
in InvalidParameters. ECS task secrets and CodeBuild parameter-store
variables read through the same path; a CloudFormation
AWS::SSM::Parameter::Value<String> parameter still refuses one, as on AWS.

* fix(ssm): check secretsmanager:GetSecretValue on a Secrets Manager reference

AWS reads /aws/reference/secretsmanager/ with the caller's own
secretsmanager:GetSecretValue, checked before the secret is looked up.
With IAM enforcement on, a caller allowed only ssm:GetParameter now gets
the ValidationException AWS sends, and GetParameters fails as a whole.

* fix(ssm): authorize a Secrets Manager reference on the secret's ARN

A grant on a secret's exact ARN, which CDK grantRead and a CloudFormation
Ref produce, did not match the suffix-less name ARN, so an allowed caller
was refused. The check now uses the secret's ARN and falls back to the
name only when the secret does not exist.

* fix(ssm): check a Secrets Manager reference's value on the secret it came from

The value is read by name after the check, so a secret force-deleted and
recreated in between was returned on the old secret's grant. The ARN of
the secret actually read is now checked too.

* fix(ssm): read a Secrets Manager reference's value from the secret it described

* docs(ssm): note the partial-ARN fallback a Secrets Manager reference read leaves

* fix(ssm): return SourceResult on a Secrets Manager reference

* fix(ssm): reject a malformed Secrets Manager reference before checking IAM

* chore(ssm): sort SsmService imports
2026-09-29 14:57:11 -04:00
Abhigya 014156a546 fix(ecs): register reachable task addresses in Cloud Map and bound synthesised ENI addresses (#4509)
* fix(ecs): register reachable task addresses in Cloud Map and bound synthesised ENI addresses

ECS service discovery registered an awsvpc task's ENI address, but task
containers never join the subnet's network, so peers resolved a name and
then timed out. Register the address the task container holds on its
Docker network instead, falling back to the ENI address only when there
is no running container.

The synthesised private-address fallback in EC2 counted past the subnet
CIDR (10.70.1.549) and restarted at .10 on every boot. It now allocates
inside the subnet CIDR, skips the AWS-reserved addresses and every address
a persisted ENI, instance or NAT gateway still holds, and reports
InsufficientFreeAddressesInSubnet when the subnet is full.

* fix(ec2): hold the synthesised-address lock until the resource is persisted

The allocator chose a free address under its lock but released it before the
network interface, instance or NAT gateway holding the address was stored, and
it decides what is free from stored resources. Two concurrent creates could
both take the same address, most visibly at the end of a /28 where the cursor
clamps back onto the last one handed out.

A dedicated lock now covers allocation through persistence at each caller:
CreateNetworkInterface, CreateNatGateway and the RunInstances loop, where it
is taken inside imageRegistryLock.

* fix(ecs): advertise the container port for an awsvpc task registered at its container address

* docs(ecs): state which Cloud Map address and port each network mode registers

* fix(ecs): look for stale Cloud Map instances at an awsvpc task's container address

The registrar registers an awsvpc task at the address its container holds on
its Docker network, but the eviction from #4513 resolved the task's addresses
through resolveContainerHost, which is 127.0.0.1 when Floci runs natively, so a
stale instance at the container address was never found. Load balancer target
eviction is unchanged, since targets are still registered through
resolveContainerHost.

* refactor(ec2): nest the address allocation lock visibly inside runInstances

Scope privateIpAllocationLock to the instance-building loop, the only part that
allocates and persists addresses, and indent it under imageRegistryLock.

* fix(ec2): allocate a launch's addresses before storing any of its instances

A RunInstances larger than the subnet's free addresses failed with
InsufficientFreeAddressesInSubnet only after the instances that fit had been
stored with their root volumes. The launch now allocates every address first,
counting the ones it has already picked as taken, and releases any Docker
leases it took when the subnet runs out.
2026-09-29 14:36:28 -04:00
Simone Primarosa b2d668d9ae fix(eks): stop mirroring cluster audit logs to the Floci console (#4589)
* fix(eks): stop mirroring cluster audit logs to the Floci console

* docs(eks): clarify audit stream console flag

* fix(eks): scope console flag to audit exec stream

* test(eks): reuse shared log capture helper
2026-09-29 14:27:48 -04:00
Aniket Shukla ef08877837 fix(eks): isolate capacity backups from live clusters (#4663) 2026-09-29 14:25:29 -04:00
XuJian 78c06239be feat(sns): support SMS account preferences (#4597)
* feat(sns): support SMS account preferences

* fix(sns): include result element in SetSMSAttributes response

* fix(sns): validate SMS sender IDs and cover JSON updates

* refactor(sns): centralize SMS preference storage key
2026-09-29 14:20:34 -04:00
XuJian 95cbe7de34 feat(appsync): execute VTL pipeline resolvers on sidecar (#4586)
* feat(appsync): execute VTL pipeline functions

* fix(appsync): validate VTL functions before early return
2026-09-29 11:36:27 -04:00
Aniket Shukla 33617e340d fix(iam): match condition values case-sensitively (#4672)
* fix(iam): match condition values case-sensitively

* chore(ci): retry transient registry pull failure
2026-09-29 11:05:26 -04:00
Aniket Shukla 970bdf2e54 fix(iam): return protocol-correct access-denied statuses (#4673)
* fix(iam): return protocol-correct access-denied statuses

* chore(test): alphabetize IAM enforcement imports
2026-09-29 10:52:39 -04:00
Aniket Shukla 9ae71eceda fix(rds): recover metadata after backend startup failures (#4532)
* fix(rds): recover metadata after backend startup failures

* fix(rds): restore control-plane and member retry relays

* fix(rds): isolate member relay recovery failures

* fix(rds-data): retry member relays for running clusters

* fix(rds-data): avoid locking healthy cluster resolution
2026-09-29 08:08:43 -04:00
Abhigya e8b768382a fix(lambda): apply FunctionResponseTypes on UpdateEventSourceMapping (#4584)
* fix(lambda): apply FunctionResponseTypes on UpdateEventSourceMapping

UpdateEventSourceMapping ignored FunctionResponseTypes, so turning
ReportBatchItemFailures on or off for an existing mapping succeeded but
changed nothing: GetEventSourceMapping kept the old list and the pollers
kept retrying whole batches. Apply the member when present, sharing the
create path's parsing; an empty list clears it.

* fix(lambda): validate FunctionResponseTypes on event source mappings

AWS accepts at most one FunctionResponseTypes entry, and only
ReportBatchItemFailures. Reject anything else with
InvalidParameterValueException on both CreateEventSourceMapping and
UpdateEventSourceMapping instead of storing it.

* fix(lambda): validate every UpdateEventSourceMapping member before applying any

A request that failed on a later member (FunctionName in another region,
empty Topics) still changed the members parsed before it on the stored
mapping, which the pollers share. A JSON null FunctionResponseTypes is now
an absent member, and a non-array value is a SerializationException rather
than silently clearing ReportBatchItemFailures.

* fix(lambda): honour ReportBatchItemFailures on Kinesis event source mappings

The Kinesis poller checkpointed the whole batch after a successful invoke,
so records the function reported in batchItemFailures were never retried.
It now checkpoints just before the lowest reported record and retries the
whole batch on a malformed response, matching the DynamoDB Streams poller.
2026-09-29 08:00:57 -04:00
Aniket Shukla 1d646c6fea fix(cloudwatch): retain metric-math alarm query definitions (#4594)
* fix(cloudwatch): retain metric-math alarm query definitions

* test(cloudwatch): use shared XML parser for alarm assertions
2026-09-29 07:42:52 -04:00
Langning Zhang cfc9a440c1 fix(apigateway): merge OpenAPI imports in PutRestApi (#4570)
* fix(apigateway): merge OpenAPI imports in PutRestApi

Signed-off-by: zhanglangning <zln1905391059@163.com>

* fix(apigateway): preserve authorization across API merges

Signed-off-by: zhanglangning <zln1905391059@163.com>

* fix(apigateway): preserve authorization across API merges

Signed-off-by: zhanglangning <zln1905391059@163.com>

* fix(apigateway): reject invalid PutRestApi modes

Signed-off-by: boulea7 <zln1905391059@163.com>

---------

Signed-off-by: zhanglangning <zln1905391059@163.com>
Signed-off-by: boulea7 <zln1905391059@163.com>
2026-09-29 07:37:44 -04:00
stodan 2ec5300029 fix(apigateway): drop the SigV4 Authorization header before REST integrations (#4567)
* fix(apigateway): drop the SigV4 Authorization header before REST integrations

API Gateway drops the inbound Authorization header on its way to a REST
Lambda or HTTP integration when the method is AWS_IAM, or on any method
when the header carries a SigV4 signature. Floci forwarded it into the
AWS_PROXY event and the HTTP_PROXY request, so a function serving both
Bearer-token users and IAM-signed services saw "AWS4-HMAC-SHA256 ..."
where AWS delivers no header at all.

X-Amz-Date, X-Amz-Security-Token and every other header still pass
through, a Bearer token on a non-IAM method is unchanged, and REQUEST
authorizer events keep the header. HTTP API (v2) is unchanged: AWS
documents no such stripping there.

* test(apigateway): cover method.request.header.Authorization mappings on AWS_IAM routes

* test(apigateway): fold the Authorization header tests into ProxyEventIamIdentityTest
2026-09-29 07:29:26 -04:00
Simone Primarosa 047d0d848c feat(eks): bound cluster containers and derive kubelet reservations (#4590)
* feat(eks): bound cluster node capacity and reserve kubelet resources

* fix(eks): use the large managed node pod cap

* fix(eks): preserve node capacity through restart failures and restores

* fix(eks): retain restored node until capacity replacement starts

* fix(eks): let concurrent node groups share user data execution

* fix(eks): finalize first node group after bootstrap

* fix(eks): retain restored replacement when backup cleanup fails

* fix(eks): stop live node before retrying backup cleanup

* ci: retry transient mqtt port collision

* fix(eks): preserve cluster API port during node capacity change

* test(docker): verify exec attach stream closes on timeout

* fix(eks): keep capacity backup names outside cluster namespace
2026-09-29 07:14:19 -04:00
mitsukado-shinagawaandmitsukado-shinagawa ac41ff339a fix(stepfunctions): bound a .sync Task by its TimeoutSeconds, not by a poll count (#4519)
* fix(stepfunctions): bound a .sync Task by its TimeoutSeconds, not by a poll count

A Task waiting on ecs:runTask.sync or states:startExecution.sync gave up
after 600 polls at 100 ms, about 60 seconds, whatever its TimeoutSeconds
said; that clock was read for a task-token wait alone. The deadline is
now computed once at schedule time and shared by awaitToken and both
.sync loops, which poll until it or the execution's budget fires. The
Task's clock ends the state as States.Timeout with a TaskTimedOut event
and no cause, the shape the token wait already used.

Closes #4518

* fix(stepfunctions): stop the job a timed-out .sync Task was waiting on

Measured on AWS: when a Task's TimeoutSeconds fires around an
ecs:runTask.sync or states:startExecution.sync, Step Functions stops
the ECS task (stopCode UserInitiated) or aborts the child execution,
both with the cause "The Task state in AWS Step Functions execution
[<arn>] which was managing this resource was aborted". Floci left the
job running. Best effort, like AWS: a job already gone is logged and
the timeout is still what the state reports.

* fix(stepfunctions): end a .sync wait on StopExecution and start its clock at schedule time

Review follow-ups on #4519. The Task's TimeoutSeconds is read before the
scheduled event is built, so a large input cannot extend it. A late wake
re-reads the execution's clock, so a spent budget ends the execution
TIMED_OUT rather than the Task. Both .sync loops read the execution back
each poll and, once StopExecution has marked it ABORTED, stop the job and
unwind without writing an event, instead of polling until a clock ran
out. Tests cover .sync:2 under a Catch on States.Timeout and the aborted
parent; the nested test imports its types.

* docs(stepfunctions): drop the two em dashes the .sync timeout change added

* chore(stepfunctions): let sleepOrTimeOutExecution delegate to sleepOrTimeOutTask

With no Task deadline (Long.MAX_VALUE) sleepOrTimeOutTask parks on the
execution's budget alone and ends the execution TIMED_OUT, which is
exactly what sleepOrTimeOutExecution did in its own copy.

---------

Co-authored-by: mitsukado-shinagawa <mitsukado-shinagawa@users.noreply.github.com>
2026-09-29 07:05:49 -04:00
Aniket Shukla 071a170ce9 fix(lambda): return current reserved concurrency in GetFunction (#4592)
* fix(lambda): return current reserved concurrency in GetFunction

* fix(lambda): omit concurrency for qualified GetFunction reads
2026-09-28 23:48:33 -05:00