Commit Graph
3210 Commits
Author SHA1 Message Date
XuJian e6894119f4 fix(iam): populate PrincipalIsAWSService for signed requests (#4695)
* fix(iam): set PrincipalIsAWSService for signed IAM requests

* fix(iam): apply global conditions to additional resources

* fix(iam): accept JSON booleans in Bool conditions
2026-09-29 20:37:36 -04: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
XuJian a247b68abb fix(s3): include bucket name in bucket-scoped errors (#4624)
* fix(s3): include bucket name in bucket-scoped errors

* fix(s3): preserve multipart precondition error details

* fix(s3): include CORS bucket name in error response
2026-09-29 16:57:18 -04:00
Goooooooooody 90c55114f9 fix(appconfig): resolve AppConfigData identifiers by name as well as ID (#4661)
* fix(appconfig): resolve AppConfigData identifiers by name as well as ID

StartConfigurationSession looked the application, environment and profile
up by ID only. AWS accepts either, and the AppConfig agent and Lambda
extension are normally given names, so they got ResourceNotFoundException
against Floci. Resolve each identifier by ID first, then by name.

* fix(appconfig): prefer an exact ID over a name and skip nameless resources

Resolve each AppConfigData identifier with a direct ID lookup first (kept
within the parent application), so an ID is never shadowed by another
resource's name and legacy unprefixed keys stay reachable; only a miss
scans by name, and the name match is null-safe.

* fix(appconfig): answer a missing session identifier with ResourceNotFoundException

An omitted or null Application, Environment or ConfigurationProfile
identifier reached the name fallback and threw a NullPointerException.
It now returns ResourceNotFoundException, as the direct lookups did.

* style(appconfig): brace the null-identifier guards

* fix(appconfig): reject a missing session identifier with BadRequestException
2026-09-29 16:49:27 -04:00
Sam Fakhreddine e6d22e8bcf fix(lambda): validate enum and pattern-constrained request fields (#4611)
* fix(lambda): validate enum and pattern-constrained request fields

CreateFunction, UpdateFunctionConfiguration, PublishLayerVersion, the event source mapping calls, and the function URL calls now reject values outside the botocore Runtime/Architecture/FunctionResponseType/FunctionUrlAuthType/InvokeMode enums and the Role/Handler/KMSKeyArn/LayerVersionArn/Alias/Arn patterns (including AWS-managed awslayer ARNs and eusc- regions), and ListEventSourceMappings honors its EventSourceArn filter. Constraint failures use ValidationException, matching the existing pattern checks in LambdaArnUtils.

* fix(lambda): validate KMSKeyArn on update, alias names, event source ARNs, and PackageType

Adds KMSKeyArn pattern on UpdateFunctionConfiguration, alias name pattern and length on Create/UpdateAlias, EventSourceArn pattern on CreateEventSourceMapping, and PackageType enum on CreateFunction.

* fix(lambda): accept every botocore NamespacedFunctionName in ListEventSourceMappings

Add eusc- region, dotted names and $LATEST.PUBLISHED to the function name pattern.

* fix(lambda): reject non-list members and validate before mutating on update

UpdateFunctionUrlConfig now validates AuthType and InvokeMode before applying
either, so a rejected request leaves the stored config unchanged. A non-list
Layers, CompatibleRuntimes or CompatibleArchitectures is a SerializationException
instead of being read as absent. Get and DeleteFunctionUrlConfig enforce the
FunctionUrlQualifier constraint, UpdateFunctionConfiguration enforces the 256
character Description limit, and an empty or missing alias name is rejected.
2026-09-29 16:07:56 -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
TiM 18ef1f58e9 fix(s3): honour If-Match on DeleteObject and the ETag element on DeleteObjects (#4526)
* fix(s3): honour If-Match on DeleteObject and the ETag element on DeleteObjects

A conditional delete was ignored: DeleteObject with a stale If-Match answered
204 and deleted the object, and a DeleteObjects entry carrying a stale <ETag>
was reported under <Deleted> and removed. S3 treats both as preconditions.

The precondition is evaluated against the current version of the key, as S3
documents, including when versionId addresses an older version. A matching
ETag (or *) proceeds; a mismatch answers 412 PreconditionFailed and leaves the
object in place; a missing key or a current delete marker answers 404 NoSuchKey.
In DeleteObjects each entry is checked on its own and a failure is reported
under <Error> while the rest of the batch proceeds.

The check runs under the bucket monitor that PutObject's conditional write
already holds, so an overwrite cannot land between the check and the delete.

* fix(s3): require s3:GetObject for a conditional delete by ETag

An ETag condition on DeleteObject, or an <ETag> element in DeleteObjects,
tells the caller whether the object still has that ETag, so S3 requires
s3:GetObject alongside s3:DeleteObject for it. The If-Match: * existence
check needs only s3:DeleteObject. DeleteObjects reports a refused entry
under <Error> as AccessDenied and deletes the rest.

* fix(s3): require s3:GetObject for an ETag-conditional delete under IAM

The bucket-policy check added earlier left the IAM identity-policy layer
alone, so an IAM user allowed s3:DeleteObject but not s3:GetObject could
still delete by ETag. IamEnforcementFilter now authorizes that read for a
DeleteObject whose If-Match is an ETag, the way it already does for a
conditional PutObject. If-Match: * still needs only s3:DeleteObject.

* fix(s3): limit the IAM conditional-delete read to DeleteObject

AbortMultipartUpload is also a DELETE on an object key filed under
s3:DeleteObject, and it has no object ETag to compare, so an If-Match on it
must not ask for s3:GetObject. The read is now required only when the DELETE
carries no subresource besides versionId.

* fix(s3): skip the IAM delete read only for routed subresources

Allowing only versionId as a query key let any other parameter bypass the
check, including the x-id=DeleteObject SDKs add and the X-Amz-* parameters of
a presigned URL, while the controller still handled the request as a
conditional DeleteObject. The read is now skipped only for the subresources
S3Controller routes elsewhere: uploadId, tagging and annotation.

* style(s3): import XmlPath in the conditional-write test

* docs(s3): record why a delete marker answers 404 on a conditional delete

The conditional-deletes guide says 412, real S3 answered 404 when measured. The comment keeps the next reader of the guide from flipping it back.
2026-09-29 11:44:08 -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
TATSUNO “Taz” Yasuhiro 1465251e0c fix(dynamodb): reject a request member of the wrong JSON type (#4636)
* chore(dynamodb): vendor the input shapes of botocore's DynamoDB model

tools/aws/regen_dynamodb_shapes.py keeps each operation's input shape and
the type of every shape it reaches, from the pinned botocore release.
make aws-data-sync regenerates it and make aws-data-check keeps it in sync.

* fix(dynamodb): reject a request member of the wrong JSON type

DynamoDB answers a member of the wrong JSON type with a
SerializationException before it runs the operation, such as
"NUMBER_VALUE cannot be converted to String" for a number BillingMode or
IndexName. The message names the JSON token and the Java type, or says
"Unexpected field type", "Unexpected value type in payload",
"Start of structure or map found where not expected" or "UnknownError"
by where the value sits. The first bad member in body order is reported.
A JSON null counts as absent and an unknown member is ignored.

Floci now checks every DynamoDB JSON request against the vendored input
shapes. A number in an ExclusiveStartKey S value is one of these errors on
AWS, so that test now expects the SerializationException.

* fix(dynamodb): keep provenance out of the shapes freshness check

The shapes file now carries its provenance in a _source block, like the
other vendored AWS data, and --check compares it without that block. A
run against --botocore-data or a local checkout no longer reports the
file as stale when only the botocore label differs.
2026-09-29 11:18:40 -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
XuJian 89344b76dc feat(appsync): authorize data source service roles (#4555)
* feat(appsync): authorize data source service roles

* test(appsync): verify service role at dispatch boundary

* fix(appsync): tighten service role authorization checks

* fix(appsync): honor IAM enforcement setting for data sources

* fix(appsync): adapt Lambda resolver test to authorizer dependency
2026-09-28 23:48:19 -05:00
Priamo Germosen aeb304d7b4 docs(iam): describe the list-violation value omission as a choice (#4626)
The javadoc on checkListLength said leaving the value out of a list
constraint violation matched how AWS reports one. That is not established:
captured violations elsewhere in AWS do quote the list, such as Lambda's
"Value '[x86_64, arm64]' at 'architectures'", and IAM's own are
inconsistent about it. The wording generalised the helper's existing
behaviour into a claim about AWS that nothing here verified.

The behaviour is unchanged and deliberate, so the comment now says it is
Floci's choice and gives the actual reason: a request that breaks the
limit should not echo every member back in the error message.

Comments only; the emitted message is byte-identical.
2026-09-28 23:39:09 -05:00
TATSUNO “Taz” Yasuhiro 3b70ce0827 perf(docker): trim docker-java reflection, 3 MB off the native image (#4625)
* perf(docker): register only the docker-java classes Jackson uses

The native image registered every docker-java class for reflection,
including the command interfaces, the command classes and their executors.
docker-java creates those with new, so the registration only kept code for
commands Floci never runs, like swarm, services and secrets.

Keep the model classes and the Jackson-annotated response, request body
and config file classes. Jackson reads and writes only these.

* perf(docker): register only the docker-java classes Floci's commands reach

Keep the model and Jackson-annotated classes reached from the Docker
commands Floci runs. This drops the swarm, service, secret, config, event
and image list models, and the request bodies of commands Floci never
sends.
2026-09-28 23:25:58 -05:00
Abhigya 451a30f98e fix(ecs): release stale task containers and registrations, and evict ones that would misroute a reused address (#4513)
* fix(ecs): release a previous run's task containers and registrations at startup

Task state is memory-only, so a restarted Floci knows no task and the
service scheduler starts a replacement for each service. A run that ended
without a graceful shutdown left its task containers serving beside those
replacements, and even a graceful one left their load balancer targets and
Cloud Map instances registered, so a dead task's target followed its
address to whichever container Docker handed it to next.

At startup, before the scheduler runs, ECS now removes the containers this
Floci owns (task containers now carry the floci_owner_port label EC2 and
the security-group helpers already use), deregisters the IP targets in each
service's target groups, and deregisters the Cloud Map instances its tasks
registered. The owner identity is computed by one shared helper.

* fix(ecs): release only the registrations ECS recorded, and retry failed container removal

The startup sweep recognised a previous run's load balancer targets by
their address shape and its Cloud Map instances by their ECS attributes,
so it also removed a target or instance registered by hand into the same
target group or Cloud Map service. Both registrars now persist each
registration they make, keyed by task ARN, drop the record on
deregistration, and at startup release exactly what was recorded.

Removing a leftover container now uses strict removal, and the result
says whether every leftover is gone. Until it is, each reconciliation
tick retries the sweep and starts no service task. The sweep only
considers containers created before this process started, so a retry
never touches a task this run launched.

* fix(ecs): tell a previous run's containers apart by run label, and record registrations before making them

The startup sweep kept every container created in the same second this process started, so a run killed within that second left an orphan the sweep reported as gone. Containers now carry a per-process floci.ecs-run label, also stamped on security-group helpers, and the sweep keeps only the current run's.

Target and Cloud Map registrations are now written to the ledger before they are made, so a process killed in between still leaves a record for the next run to release.

* fix(ecs): leave a target already in its group to whoever registered it

ELBv2 registration is idempotent, so a task whose address and port matched a target registered by hand adopted it: the ledger recorded it, and a task stop or the startup release then removed it. The registrar now skips and never records a target that is already registered.

* fix(ecs): deregister only the targets a task recorded when it stops

A task whose targets were all already in their groups records nothing, and its stop fell back to deregistering the targets its containers resolve to, removing the ones registered by hand. Every task this process knows went through the recording registrar, so the fallback now serves only a task without an ARN, which cannot be recorded.

* fix(ecs): retry the leftover sweep only when a service needs a task, and warn once

With Docker unreachable, the boot sweep failed and every 5 second tick then
logged two WARNs forever, even with no service to run. The retry now runs only
where a service is about to start a task, and both the sweep failure and the
blocked-launch message are WARNs the first time and DEBUG after.

* fix(ecs): log a repeated blocked service launch at DEBUG

* fix(ecs): retry the leftover sweep before RunTask and StartTask launches too

A task started through RunTask or StartTask no longer bypasses a failed sweep:
the common launch path retries it and stops the task with TaskFailedToStart
while a previous run's containers remain. Sweep failures are tracked per kind,
a failed listing and each container that would not go, so a new failure is
still a WARN after an earlier one cleared.

* fix(ecs): evict unrecorded registrations at a starting task's address, and adopt its own target

A target already in its group when a task started was skipped and never recorded, so a registration no task recorded, as one a Floci version without the ledger made, survived every task stop and restart. When a task of the same service came up on its address it left it in place, and when another service's task took the address the target or Cloud Map instance routed the first service's traffic to it.

A target at the task's own address and port is now recorded as the task's, so its stop deregisters it, as ECS does on AWS. When a task starts, every target and Cloud Map instance at one of its addresses that no live task recorded is deregistered from the target groups and Cloud Map services the region's ECS services name, with a warning. A loopback address matches only on the task's host ports.

* fix(ecs): evict only registrations that actually point at a starting task

The eviction matched every unrecorded target at any of a task's addresses on any port, including its ENI address. ECS registers no target at the ENI address, and an ENI address is unique only within its VPC, so an IP target for something in another VPC could be removed; a target on a port the task does not publish sends it nothing either.

Targets are now matched only at a container's Docker address on the ports its bindings declare. Cloud Map instances still match a container address on any port, since a DNS answer carries none, and match the ENI address only in a namespace of the task's own VPC.
2026-09-28 23:25:48 -05:00
Priamo Germosen 0232d5d224 fix(codeartifact): treat identical-content asset republish as idempotent (#4619)
PublishPackageVersion silently overwrote a generic-format asset's stored
bytes whenever the same asset name was republished to an Unfinished
package version, with no comparison against what was already there. AWS's
own docs ("Overwriting package assets" in the CodeArtifact packages
overview) say a republish is only rejected when the content actually
differs from what's already stored; byte-identical content succeeds
idempotently. Compares the new upload against the existing asset's real
bytes (read the same way GetPackageVersionAsset does, not the in-memory
PackageAsset.content field, which is @JsonIgnore and unreliable after a
reload) and now returns ConflictException on a genuine mismatch instead of
silently replacing the content.
2026-09-28 22:58:39 -05:00
Hyun Lee 1ea5a865e3 fix(cloudformation): keep unchanged AWS::ApiGateway::Resource on update and remove it on delete (#4511)
* fix(cloudformation): keep unchanged AWS::ApiGateway::Resource on update and remove it on delete

UpdateStack runs provision again for every resource, and the Resource
arm called CreateResource unconditionally. For a resource whose
RestApiId points at an API outside the stack, the second CreateResource
under the same parent failed with "Another resource with the same
parent already has this name" and the update rolled back.

The delete side had the same gap. Only AWS::ApiGateway::RestApi had a
delete, relying on its cascade, which never runs when the API is not
part of the stack. DeleteStack left the stack's resources and methods
on the API, and deploying the stack again failed with the same error.

- Resource: RestApiId, ParentId and PathPart are all createOnly, so an
  update that keeps them keeps the resource. A changed one creates the
  replacement and then removes the old resource. The API a resource was
  created on is recorded with it, since a resource id alone does not
  name its API, and DeleteStack removes the resource from that API.
- Method: DeleteStack removes the method named by its physical id. An
  update that changes RestApiId, ResourceId or HttpMethod removes the
  method it replaced.

* fix(cloudformation): leave replaced API Gateway resources to stack cleanup

A Resource or Method whose createOnly properties changed deleted the
entity it replaced while the update was still running. When a later
resource failed, the rollback could not bring it back, and
UpdateReplacePolicy: Retain was ignored.

The displaced entity is now recorded with ReplacementCleanup, like the
other provisioners that replace: it is deleted in the cleanup after
the update commits, kept under Retain, and a rollback deletes the
replacement and restores the previous physical id.

Deleting a method split its physical id on hyphens, which named the
wrong method when the HTTP method itself had one. Resources and methods
now record their API, resource and HTTP method keyed by physical id,
and every delete path uses that record. Splitting the id is kept only
for methods provisioned before the record existed.

* fix(cloudformation): report nothing to roll back for an unchanged API Gateway resource

When an update kept an AWS::ApiGateway::Resource and a later resource
failed, rollbackUpdate returned false because no replacement had been
recorded. The rollback walker then reported "Rollback is not
implemented" for the resource, and the stack ended in
UPDATE_ROLLBACK_FAILED although nothing about it had changed.

RestApiId, ParentId and PathPart are all createOnly, so an update that
kept the resource's physical id left it untouched, and rollback now
reports success for it without calling the API.

AWS::ApiGateway::Method is unchanged: an update rewrites its method,
integration and responses in place, and rolling back an in-place
update belongs with the broader work in #4385.
2026-09-28 22:55:14 -05:00
Mario Toffia c326dce977 feat(dynamodb): optional DynamoDB Local backend (#4504)
* feat(dynamodb): add the external Local operation client

Adds DynamoDbLocalClient, which forwards DynamoDB and DynamoDB Streams
wire calls to an external DynamoDB Local over SigV4-signed HTTP/1.1.
The caller's account becomes the access key and its region the signing
region, so Local keeps each account and region apart. Requests are
never retried.

Reply.successBody now owns the AWS error body conversion, which the
API stream reader reuses.

* feat(dynamodb): add the DynamoDB Local backend

Adds DynamoDbLocalBackend, a DynamoDbBackend that forwards every wire
call to an external DynamoDB Local through DynamoDbLocalClient.

- Namespaces: the caller's account and region select the Local
  namespace; table and stream ARNs from another account or region are
  rejected.
- Identities: table, index and stream ARNs in replies are rewritten
  from Local's fixed ddblocal shape to public ARNs, and stream records
  carry the caller's region.
- Metadata: tags live in a Floci store because Local keeps none;
  replica updates are refused; a global table is its single-region
  table; stream enable and disable are idempotent like native.
- Lifecycle: startup waits up to 30s for Local to accept connections,
  and emulator resets are refused because the data lives outside
  Floci.

DynamoDbBackend groups the four seam interfaces so one object is the
whole engine.

* feat(dynamodb): enable the optional Local backend

floci.services.dynamodb.backend selects the engine: native (default)
or local, which forwards to the DynamoDB Local at local-endpoint.
Both engines are client proxies, so the unselected one is never
constructed. With local selected, the stream reader keeps checkpoints
for the life of the stream, and /_floci/info reports the backend in
dynamodb_backend.

DynamoDbLocalBackendIntegrationTest runs against a real DynamoDB Local
when FLOCI_SERVICES_DYNAMODB_LOCAL_ENDPOINT is set.

* docs(dynamodb): document the DynamoDB Local backend

* fix(dynamodb): harden the Local backend endpoint check, stream paging and startup probe

Reject AWS endpoints in every partition, with a trailing dot, and endpoints with user info.
Translate ListStreams paging ARNs, retry any I/O failure until the startup deadline, and
call DescribeTable outside the tag lock.

* fix(dynamodb): tighten Local ARN ownership, batch table names and global TableId

A table ARN of another account or partition is ResourceNotFoundException, a stream ARN of
another partition is refused, and a batch naming one table twice is a ValidationException
instead of a dropped entry. A global table on Local has an empty TableId instead of a random
one. Document the Resource Explorer limit.

* fix(dynamodb): mark the Local readiness probe region as partition-invariant

* test(dynamodb): pin the table record of an untagged typed Local create

* docs(dynamodb): state the Local readiness bound and stack delete protection

* fix(dynamodb): lift deletion protection on the Local direct delete and cap the readiness probe

- DynamoDbTableAccess.deleteTable is the direct engine delete with no
  deletion-protection check. The Local backend now clears
  DeletionProtectionEnabled before DeleteTable, so CloudFormation deletes
  behave the same on both backends. The wire DeleteTable still enforces it.
- Each readiness probe is bounded by the remaining 30 second budget and never
  exceeds the configured request timeout, so startup fails within the budget.

* fix(dynamodb): align Local tag errors with the native wire path

- ListTagsOfResource on a missing table is AccessDeniedException, as on the
  native wire path.
- A table ARN whose partition is not an AWS partition is a
  ValidationException instead of a foreign resource.
- Tag operations report a table ARN of another region as
  ResourceNotFoundException, as native does; TableName fields keep the
  region-mismatch ValidationException.
- Document which regions Resource Explorer searches, and note that a failed
  direct delete leaves deletion protection off.

* docs(dynamodb): state the tested DynamoDB Local version
2026-09-28 22:54:00 -05:00
Hector Ventura 833a43bfa7 feat(core): vendor the per-region hosted zones, SAML URLs and VPC endpoint prefixes (#4545)
* feat(core): vendor the per-region hosted zones, SAML URLs and VPC endpoint prefixes

tools/aws/regen_region_facts.py transcribes the per-region and per-partition constants AWS publishes only as prose tables into src/main/resources/aws/region-facts.json: the Terraform provider's load balancer and S3 website hosted-zone maps, the CloudFront hosted zone per partition (cross-checked against the CDK), and the CDK's SAML sign-on URLs and VPC endpoint service-name exceptions. AwsRegionFacts serves them, as Optionals where a partition publishes nothing (the ISO and EUSC partitions have no hosted zones). make aws-data-check regenerates and compares where the local reference checkouts exist, and verifies the file's shape where they do not.

Behaviour this changes: network load balancers report their own hosted zone per region instead of the Application one, Classic and Application load balancers report their region's zone, API Gateway EDGE domains carry the CloudFront zone of their partition, SAML assertions are checked against the sign-on URL of the provider's partition, and the AWS-managed S3 and DynamoDB prefix lists carry the partition's service-name prefix.

Also carries the follow-ups from the #4494 review: bucketRegionForCreate cites the S3 model for the us-east-1 rules, docs/services/s3.md gains a Bucket Regions section, and the Marketplace files are gated per line with stated reasons instead of being allowlisted by path, so a new region literal there is caught.

Part of #4272

* fix(core): harden the region facts against restarts, partitions without CloudFront, and CI without sources

The source-free data check rejected real twelve-character hosted zone ids such as ap-southeast-1's NLB zone ZKVM4W9LS7TM, which failed the vendored-data job. It now accepts Route 53's id length range and checks substance: every partition has an entry whose VPC endpoint prefix is its reversed DNS suffix, every region is published in partitions.json, SAML URLs are https sign-on URLs, and unknown fields are refused.

Load balancers restored from storage take the hosted zone of their region and type again, so balancers stored before the per-region lookup stop reporting the old fixed zone. An EDGE API Gateway custom domain is refused where the partition has no CloudFront, since it would have no distribution zone to alias to. A customer prefix list may not take the prefix of the AWS-managed lists its region carries, cn.com.amazonaws. in China. The partitions doc now says which ISO hosted zones exist.

* fix(core): hold only a changed endpoint type to the partition, and name malformed region facts

UpdateDomainName checked the partition for EDGE on every patch, so an EDGE custom domain stored in GovCloud before the rule could no longer take a certificate or security-policy update; only a patch that changes the endpoint type is held to the partition now. The source-free region-facts check reports a partition or region entry that is not an object by name instead of failing with a traceback, and its test asserts on computed results rather than on calls that write the fixture.

* fix(core): keep gateway endpoint names on com.amazonaws, allow EDGE only in the commercial partition, and keep SAML working where no sign-on URL is published

The AWS-managed prefix lists belong to the S3 and DynamoDB gateway endpoints, which the CDK names com.amazonaws.<region>.<service> in every partition (GatewayVpcEndpointAwsService); the reversed-suffix table applies to interface endpoints only. The managed lists are back to that name and the cn.com.amazonaws. reservation is gone; DescribeVpcEndpointServices now names the interface services through the table instead, keeping the S3 gateway entry on com.amazonaws.

Edge-optimized API Gateway exists only in the commercial partition: China has CloudFront but no edge-optimized APIs or domains (its API Gateway documentation says so), so EDGE custom domains are refused everywhere else. Where the CDK publishes no SAML sign-on URL (aws-iso-e, aws-iso-f, aws-eusc) assertions keep being checked against the commercial URL, as every partition was before, instead of all being refused. applyEndpointType has its javadoc back.
2026-09-28 23:52:35 -04:00
Abhigya 0a786207d6 fix(lambda): return event source mapping ARN and support tagging mappings (#4587)
* fix(lambda): return event source mapping ARN and support tagging mappings

CreateEventSourceMapping now stores Tags, every mapping response carries
EventSourceMappingArn, and TagResource/ListTags/UntagResource route
event-source-mapping ARNs to the mapping instead of rejecting them as
non-function ARNs.

* fix(lambda): address review on event source mapping ARN and tags

- CloudFormation builds EventSourceMappingArn from the region and account
  the mapping is stored in, not the stack's, so it matches Lambda's ARN.
- TagResource rejects a non-object Tags or a non-string tag value with
  SerializationException instead of persisting it.
- The tag APIs match a mapping ARN exactly, so an ARN in another partition
  is reported as ResourceNotFoundException.
- Explain the tolerated teardown failures in LambdaEsmTagsTest.
2026-09-28 23:43:54 -04:00
GoooooooooodyandGoooooooooody 76f8c09341 fix(docker): make the Docker client pool size configurable, default 1024 (#4276)
The shared DockerClient's connection pool was hard-coded to 100. Each live
Lambda container holds two of those connections for its whole lifetime
(the followed log stream and the exit watcher), so about 50 warm
containers exhaust the pool. Create, start, stop and remove then wait for
a free connection, including the idle-container stop that would release
one, and the emulator stalls.

Expose the size as floci.docker.max-connections
(FLOCI_DOCKER_MAX_CONNECTIONS), reject values below 1, and default it to
1024 so that the 500-port Lambda runtime API range, not the Docker pool,
is the ceiling on concurrent Lambda containers.

Refs #2219, #2224

Co-authored-by: Goooooooooody <205637002+Goooooooooody@users.noreply.github.com>
2026-09-28 22:04:05 -05:00
Priamo Germosen 240fd865f0 fix(iam): match IAM's constraint-violation message shape (#4613)
The MaxItems and ServiceNamespaces validation messages added in #4543 did
not read the way IAM's do. AWS leads with the error count, quotes the
offending value, and names only the bound that was actually broken, so a
MaxItems of 1001 says "Member must have value less than or equal to 1000"
and nothing about the minimum.

Both messages now go through the helpers this handler already had for that
shape. tagValidationError builds the scalar form, so it is renamed
validationError now that it serves more than the tag paths, and MaxItems
reports whichever side of the range it fell outside rather than reciting
both. checkListLength builds the list form, which deliberately does not
quote the value, and takes its limit as an argument so ServiceNamespaces
can use it instead of echoing 201 namespaces back in an error message.

The tests asserted only that the response contained "ValidationError",
which is what let the wrong shape through in the first place. They now
assert the whole message, on the parsed Error.Message element rather than
the raw body, since the XML escapes the quotes AWS puts around the value.
2026-09-28 22:02:28 -05:00
Priamo Germosen 26146a3f94 feat(iam): expand wildcard service grants against a vendored namespace catalog (#4544)
GetServiceLastAccessedDetails reports the services an entity can reach, but
a grant that names no namespace could not be expanded: "Action": "*", a
globbed prefix such as s3*, and any NotAction all denote a set no policy
document spells out. A user holding only AdministratorAccess came back with
an empty report. Closes #4487.

The list of namespaces is vendored in aws/iam-service-namespaces.json and
generated by tools/aws/regen_service_namespaces.py from AWS's Service
Reference Information index, whose per-service "service" field is the IAM
namespace itself. botocore is deliberately not the source, even though every
other vendored file here comes from it: a namespace is not any botocore
field, since CloudWatch's endpointPrefix is monitoring and its serviceId is
CloudWatch against an IAM namespace of cloudwatch. A rule over botocore
metadata is wrong for some service, and a wrong namespace is worse than a
missing one because it names something IAM does not have.

That index is a live endpoint rather than a pinned dependency, so unlike
regen_partitions.py a fresh generation is not byte-identical and byte
equality is the wrong gate. What must be guaranteed is that nothing in the
file is invented, which is checked directly: make iam-namespaces-check
validates the file's shape offline, and make iam-namespaces-verify checks
online that every namespace in it still exists upstream, failing on one that
does not. Services AWS has added since the last sync are reported without
failing, since the file being behind makes the report incomplete rather than
wrong.

A namespace a policy names outright is kept whether or not the catalog knows
it, so a catalog trailing an AWS launch still reports an explicitly named
service; only wildcard expansion depends on it being current. A globbed
prefix now expands to the namespaces it matches rather than being treated as
every service and then dropped.
2026-09-28 22:02:13 -05:00
Abhigya b830ade6cd fix(elbv2): scope SetRulePriorities conflicts to the rule's listener (#4507)
* fix(elbv2): scope SetRulePriorities conflicts to the rule's listener

SetRulePriorities rejected a priority held by any rule in the region, so a
rule on one load balancer could not move to a priority used on another. AWS
scopes rule priorities to a listener ("A listener can't have multiple rules
with the same priority"), as CreateRule already did here.

Conflicts are now checked per listener, against that listener's rules that
are not part of the request. Two rules of the same listener given the same
priority in one request now fail with PriorityInUse instead of both being
applied.

* test(elbv2): keep SetRulePriorities compatibility tests in execution order

* fix(elbv2): check SetRulePriorities collisions against the concurrent rule map

The listener index lists are plain ArrayLists that CreateRule and DeleteRule
mutate without a lock, so iterating them could throw
ConcurrentModificationException. Iterate the region's ConcurrentHashMap and
filter by listener instead.
2026-09-28 22:46:06 -04:00
Abhigya e1cc7439f6 fix(elbv2): tunnel WebSocket upgrades to instance and ip targets (#4517)
* fix(elbv2): tunnel WebSocket upgrades to instance and ip targets

The ALB data plane stripped Connection and Upgrade as hop-by-hop headers and
proxied a WebSocket handshake as a plain request, so the target answered it as
a non-upgrade (typically 400) and socket.io clients stayed on long-polling.

Forward the handshake with its upgrade headers, relay the target's 101, then
tunnel bytes both ways until either side closes or the load balancer's
idle_timeout.timeout_seconds passes with no data. A target that refuses the
upgrade has its answer relayed unchanged. Upgrades to Lambda targets are
rejected with 400, as AWS does.

Closes #4516

* fix(elbv2): bracket IPv6 target literals in the proxied Host header

Covers WebSocket upgrades to instance targets as well.
2026-09-28 22:36:42 -04:00
Kenshin Okinaka 673c8838cf refactor(ses): model SES sends as an envelope plus content, like the v2 SDK (#4529)
* refactor(ses): model SES sends as an envelope plus content, like the v2 SDK

The five SES send methods took up to 15 positional parameters, and every
new send field cascaded through all of them and their callers. Sends now
follow the v2 SDK shape: a SendEmailRequest envelope carrying a sealed
EmailContent (Simple, Template, InlineTemplate or Raw), and a
SendBulkEmailRequest for bulk. SesService exposes sendEmail, which
switches on the content, and sendBulkEmail.

The controllers keep their validation, error codes and tenant gates;
each maps its wire input onto the envelope and picks the content
variant. The request always carries the content being sent: rendering
and header sanitizing rebuild it rather than holding a second copy.

No wire behaviour changes.

* refactor(ses): share the recipient join between the request and MIME headers
2026-09-28 21:40:58 -04:00
XuJian 11b762d08b fix(appsync): send VTL Lambda payload to function (#4579)
* fix(appsync): pass JS Lambda request envelope to function

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

* fix(appsync): send VTL Lambda payload to function

---------

Signed-off-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-28 21:25:53 -04:00
TATSUNO “Taz” Yasuhiro dad5648b7b fix(dynamodb): validate GSI and LSI index names like AWS (#4601)
AWS checks IndexName on CreateTable GSIs and LSIs and on every UpdateTable
GSI Create, Update and Delete. It must be present, match [a-zA-Z0-9_.-]+
and be 3 to 255 characters long. The error names the member path, lists
the pattern error before the length error, and comes before the table
lookup. Floci accepted any name, and a malformed name on Update or Delete
was reported as a missing index.
2026-09-28 21:19:53 -04:00
Vũ Thế Huy 5ae46c2bd3 fix(ssm): support parameter selectors in GetParameter and align LabelParameterVersion with AWS (#4461)
* fix(ssm): support name:version and name:label selectors in GetParameter

- Support name:version and name:label selectors in GetParameter and GetParameters
- Resolve selector against parameter history copies without mutating stored parameters
- Validate labels in LabelParameterVersion per AWS spec (reject numeric and reserved labels)
- Return invalid labels in InvalidLabels response
- Synchronize labelParameterVersion and clone history entries to handle concurrent updates without in-place mutation
- Enforce 10-label maximum limit per parameter version
- Default to latest version only when ParameterVersion is omitted
- Guard against NPE and trailing colons in getParameter selector lookup

Closes #4396

* fix(ssm): enforce label validation constraints in LabelParameterVersion

- Reject empty labels and labels exceeding 100 characters with ValidationException
- Reject empty label lists and lists with more than 10 labels with ValidationException
- Update findSelectedVersion comment to reflect that labels are unique across versions
2026-09-28 21:07:46 -04:00
Vũ Thế Huy b8cae89a2d refactor(glue): extract shared Glue and Redshift role helpers (#4459)
* refactor(glue): move PartitionProjection from athena to glue package

PartitionProjection resolves Glue table partition layout, not Athena-specific
logic — Athena is only its current caller. Moving it into services/glue gives
the upcoming GlueTableResolver (Redshift Spectrum Phase 2) a home for it
without a glue-depends-on-athena layering inversion.

readPath and assertInjectedColumnsFiltered become public (their callers stay
in services/athena, a different package now); enabled/parameter stay
package-private since nothing outside the class uses them.

* refactor(glue): extract GlueTableResolver from GlueViewDdlBuilder

GlueViewDdlBuilder now delegates table-to-read-plan resolution (read function
inference, read expression, Iceberg detection, column projection) to a new
public GlueTableResolver, so Redshift Spectrum's Glue-backed external tables
can reuse the same logic Athena already proved correct.

* refactor(redshift): extract RedshiftRoleAccess from S3CopySimulator

COPY and UNLOAD's IAM role resolution and S3 authorization now live in a
standalone RedshiftRoleAccess, matching the existing ManifestReader
extraction pattern in this package, so Redshift Spectrum's Glue-backed
external schemas (IAM_ROLE-authorized reads) can reuse it instead of
duplicating role-session and policy-evaluation logic. Adds direct coverage
for the enforced-policy-denial path, which only had implicit
enforcement-off coverage before this extraction.

* fix(redshift): follow RedshiftRoleAccess in native init list and partition baseline
2026-09-28 18:51:53 -05:00