Commit Graph
3835 Commits
Author SHA1 Message Date
Alessandro Lattao 964756145e fix(cloudwatch): match FilterLogEvents with the filter pattern syntax (#5903)
FilterLogEvents kept an event when its message contained filterPattern as
a substring. A JSON pattern such as { $.template = "sign-in-code" } then
never matched, and terms matched where AWS does not: an unquoted
sign-in-code, which AWS reads with its own term rules, matched every
message containing those characters.

Measured on AWS (eu-west-1, 2026-10-16) on five events, JSON, plain and
mixed: JSON patterns over nested paths and numbers, case-sensitive terms,
quoted phrases, ?alternatives and -exclusions each matched exactly the
events the parser Floci already uses for metric and subscription filters
matches. So FilterLogEvents now parses its pattern with it, once, before
the scan, and an invalid one is refused with InvalidParameterException
whatever the group holds.

The error text is the parser's own, as for PutMetricFilter and
TestMetricFilter; AWS words these differently per action, which is left
for a change of its own.

Tests: the measured events and patterns in CloudWatchLogsServiceTest and,
through the SDK, CloudWatchLogsFilterPatternTest, which fails on main.
2026-10-17 20:17:59 -04:00
c229311f8f perf(logs): evict past the ceiling and retention without scanning the store (#5167)
* perf(logs): evict past the ceiling and retention without scanning the store

Every PutLogEvents listed the account's whole event store twice: once
to apply the group's retention policy, once to enforce the stored-event
ceiling, which also loaded and sorted every event once the store was
full. Each listing walks every key of every account. So once an account
reached max-stored-events (20000 by default), each call cost a sort of
the full store, however few events it carried.

Sources that put one event per call pay that on every line: EKS
control-plane audit logs forward each audit record as its own call.
At the default ceiling with a retention policy set, a single-event
call took about 4.3 ms; it now takes about 5 us.

An account's event keys are now kept in an in-memory index ordered as
the store is read (timestamp, ingestion sequence, event id), with one
ordered set per log group. Retention removes a group's events older
than the cutoff from the head of its set; the ceiling removes the
oldest across the account. Which events are dropped, and when, is
unchanged, except for names that hold "::".

Keys join region, group and stream with "::" and are not escaped, so
"r::/app::" is a prefix of "/app::logs"'s keys and of "/app"'s stream
"logs", and "/app"'s stream "logs::s" and "/app::logs"'s stream "s"
share one stream key. For retention and stream deletion the group now
comes from the group, not the prefix:

- each index entry carries the group it was written to, so retention
  for "/app" takes neither "/app::logs"'s events nor the reverse
- deleting a stream removes only keys that are that stream's prefix
  followed by the timestamp and id, and drops them from the index by
  key, whatever group they are filed under
- PutLogEvents and DeleteLogStream refuse, as a missing stream, a
  stream found by key whose recorded group is another;
  DescribeLogStreams lists only streams that record its group
- DeleteLogGroup deletes only the streams, metric filters and
  subscription filters that record its group
- a refill reads each key's group off the stream it names, one stream
  lookup per stored event; an event whose stream is gone is deleted,
  as DeleteLogStream would have, since nothing says which group it
  was in

Every stream is created with its group recorded. A record without one
can only be built by hand, and counts as the caller's.

Reads (GetLogEvents, FilterLogEvents, Insights) still select events by
prefix, as before; this change leaves them alone.

Each account keeps one index for the life of the service, and every
write to its events (PutLogEvents and deleting a stream or group)
changes the store and the index while holding the index's lock, so the
two change together and concurrent calls no longer overshoot the
ceiling. The index starts stale and the first call holding it fills it
from the store, so events stored before a restart count. A key leaves
the index only after its store delete succeeds. A store write that
throws part-way, exception or Error, marks the index stale. Emulator
reset empties every index and marks it stale in beforeReset(), clear()
and afterReset(), so an account that never writes again holds nothing
for the wiped events; the next call refills from the store. The index
is never replaced, so a call waiting on its lock never writes under a
different one.

A put racing DeleteLogStream could write events after the stream was
gone, or write the deleted stream's metadata back. DeleteLogStream and
DeleteLogGroup now remove the stream record and its events together
under the lock. PutLogEvents checks the stream again under it, and
writes the stream's metadata there too. So a put lands before the
delete or finds no stream, and a stream recreated under the same name
cannot write until the old one's events are gone.

Calls for one account now take that lock in turn, store write
included; different accounts do not wait on each other.

* refactor(logs): read an event's group off its key

AWS allows no colon in a log group or stream name, so the key layout
needs no defending inside this change. The index takes each event's
group from its key, the refill no longer probes streams split by split
or deletes events it can't place, and the stream lookups go back to
what main does. The tests for separator-bearing names go with it.

---------

Co-authored-by: Robin Baeckman <27041454+RobinBaeckman@users.noreply.github.com>
Co-authored-by: Priamo <pgermosen@gmail.com>
2026-10-17 18:00:18 -04:00
Alessandro Lattao 58097a832a fix(lambda): send a function's logs to the log group its LoggingConfig names (#5895)
* fix(lambda): send a function's logs to the log group its LoggingConfig names

Floci stored LoggingConfig.LogGroup and read it back, but every execution
environment still wrote to /aws/lambda/<name> and told the function so in
AWS_LAMBDA_LOG_GROUP_NAME. Measured on AWS (eu-west-1, 2026-10-16): a
function whose LoggingConfig names a group writes INIT_START, START, its
own output, END and REPORT there, Lambda creates the group when it is
missing, and /aws/lambda/<name> is never created. AWS_LAMBDA_LOG_GROUP_NAME
and AWS_LAMBDA_LOG_STREAM_NAME name that group and stream.

Once LoggingConfig names a group, which several functions can share, each
stream's name carries the function's name: 2026/10/16/my-fn[$LATEST]<id>
instead of 2026/10/16/[$LATEST]<id>. It does even when the group named is
/aws/lambda/<name> itself, so the rule is whether a group is named, not
whether it differs from the default.

Both launchers, Docker and Kubernetes, and GetFunctionConfiguration's
LoggingConfig now take the group and the stream from one place,
LambdaLogDestinations.

Floci skips delivering a log group to a Lambda subscription destination
that writes its own logs there, which would feed the function its own
output forever. That check assumed the group was /aws/lambda/<name>, so a
forwarder subscribed to the group its LoggingConfig names would loop. It
now asks LambdaLogDestinations for the function's group, and falls back
to the default name, from the same place, for a function it cannot find.

* fix(logs): skip only a function's own streams when it forwards its log group

The guard that keeps a subscription from feeding a Lambda destination its
own output looked the function up by name in the caller's account and
Region at $LATEST, and skipped the whole group once it matched. In a group
LoggingConfig names, which several functions can share, a forwarder then
lost every other function's logs; a destination naming a published version
or alias was checked against $LATEST's group; and a function in another
account than the ambient one was not found, so its own custom group was
fed back to it.

The function is now the one the destination ARN names, through
getFunctionByArn, with its account, Region and qualifier, and in a named
group only the streams carrying its name are skipped, the shape measured
on AWS for a named group (2026/10/16/<name>[$LATEST]<id>); every stream of
the default group is still the function's own. A destination ARN that
does not parse as a function's is not a loop and is no longer caught as
any RuntimeException.

Tests: another function's stream in a shared group reaches the
forwarder while its own is skipped, and a destination naming a published
version is checked against that version's group (both fail on the
previous head); the stream ownership rule in LambdaLogDestinationsTest.
2026-10-17 17:54:30 -04:00
Hector Ventura 9dcb1b65ae feat(core): translate LocalStack variables in Java instead of the entrypoint (#5851)
* feat(core): translate LocalStack variables in Java instead of the entrypoint

The LocalStack-to-Floci variable mapping (PERSISTENCE, EDGE_PORT,
LOCALSTACK_HOST, GATEWAY_LISTEN, LS_LOG/DEBUG, the Lambda and Docker
variables, the DNS suffixes, USE_SSL, CUSTOM_SSL_CERT_PATH) lived in
docker/localstack-parity.sh, sourced by the image's entrypoint. A JVM run or
a native binary on the host never saw it.

LocalStackParity now computes the same mapping and LocalStackParityConfigSource
serves it at ordinal 301, just above environment variables, as the exported
variables did. A key is produced only when its Floci variable is unset, so an
explicit Floci setting still wins; the DNS suffixes are still appended to any
configured ones; LOCALSTACK_PARITY=false still turns it all off.
TlsConfigSource, which reads its properties before the configuration exists,
consults the mapping too.

The script, its shell test and every Dockerfile copy of it are removed; the
test cases move to LocalStackParityTest.

Refs #5767

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* fix(core): keep TLS backends on loopback, keep configured DNS suffixes, and pass LocalStack settings to hooks

Review follow-ups for the Java LocalStack translation:

- Dockerfile.compat took docker-entrypoint.sh from the published native
  image, which still sourced the removed localstack-parity.sh, so the compat
  image never became healthy. It now copies the entrypoint from the build
  context, as it already does healthcheck.sh.
- At ordinal 301 the parity source outranked TlsConfigSource's loopback pin
  (300): with TLS on and GATEWAY_LISTEN set, the backends bound the gateway
  address while the proxy dialled 127.0.0.1. It now sits at 299, below
  environment variables and the TLS source and above .env and
  config/application.yml, where the exported variables used to be.
- floci.dns.extra-suffixes is no longer a translated property, which on JVM
  and native runs replaced suffixes set in application.yml. The five
  readers append LocalStack's and Floci's suffixes to the configured list
  through LocalStackParity.withDnsSuffixes instead.
- GATEWAY_LISTEN=0.0.0.0:4566 (or [::]:4566, or a list) gives the host to
  quarkus.http.host and the port to floci.port when EDGE_PORT is unset,
  instead of a host Floci rejects as malformed.
- Init hooks get the translation as FLOCI_*/QUARKUS_* variables again, as
  they did when the entrypoint exported them.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* fix(core): parse LOCALSTACK_HOST and GATEWAY_LISTEN the way LocalStack does

Both take LocalStack's host-and-port forms (HostAndPort.parse in its
config.py): host:port, host, :port, [v6]:port and [v6].

- LOCALSTACK_HOST is <hostname>:<port>, localhost.localstack.cloud:4566 by
  default. Its port went into floci.hostname, so the base URL came out as
  http://localhost.localstack.cloud:4566:4566. floci.hostname now gets the
  host alone.
- GATEWAY_LISTEN=:4566, LocalStack's default host on 4566, did not match
  and stopped startup with "Refusing to listen on malformed host". An empty
  host now keeps Floci's own bind address and takes just the port.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-17 17:37:15 -04:00
Andre Kurait 4e47507a7b fix(autoscaling): match DescribeTags input validation (#5894)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-17 16:39:21 -04:00
Andre Kurait ae7e6d1240 fix(lambda): preserve immutable deployment snapshots (#5818)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-17 16:31:16 -04:00
Andre Kurait e1fe876149 fix(swf): deliver Lambda outcomes through one decision task (#5859)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-17 15:53:59 -04:00
Alessandro Lattao de94e3cfcc fix(ecr): give every data plane exchange its own registry connection (#5883)
* fix(ecr): give every data plane exchange its own registry connection

An HTTP/2 client such as crane sends a whole push as streams on one
connection. The data plane paused each stream until the shared Vert.x
client handed it a registry connection, from a pool of five. With more
uploads than that, the waiting streams kept their unread bytes, which
hold the client connection's flow-control window; the five uploads that
had a registry connection stopped receiving data, never finished, and
never gave their connection back. Every later registry request,
GET /v2/ included, then waited behind them until Floci restarted.

A larger pool only moves the threshold: HTTP/2 allows any number of
concurrent streams, and several client connections can fill a pool of
any size while each still has a stream waiting. So each exchange now
opens a client of its own and closes it when the exchange ends, and no
request ever waits for a connection another request holds.

An exchange also ends when its client goes away mid-upload (#5573). A
client that reset its HTTP/2 stream or closed its connection left the
registry request waiting for the rest of a body with a Content-Length,
which registry:2 never answers, and the exchange kept its connection and
its immutable tag lock. The response's close handler, which HTTP/2
always calls when the stream closes, and the request's exception handler
now end the exchange, closing its client and so its registry connection.
The end runs once: the close handler also fires after an exchange that
ended normally, by which time another exchange may hold the same
immutable tag, which a second release would drop.

Tests: eight HTTP/2 uploads on one connection all reach the registry and
every exchange closes the connection it opened (they time out on main);
an upload reset mid-body closes its registry connection (it stays open
on main). The data plane tests build their data plane through one helper
instead of four copies of the same mocks, router and server.

* fix(ecr): end an exchange whose client leaves during the tag check

The handlers that end an exchange when its client goes away were set only
once the registry check of an immutable tag had finished. A client that
reset its stream during that check was never seen: the exchange then
proxied a request that was already gone, its registry request waited for
a body that never came, and the tag stayed locked, so every later write
of it was refused as if the tag existed.

The exchange now starts before the check, with those handlers, and the
check's result is dropped when the client has already left: nothing of it
reaches the registry, and its tag is free at once. Once an exchange has a
registry client, its tag is freed only when that client has closed the
registry connection, so another write of the tag cannot start its check
while this one can still reach the registry. A failure answer is no longer
written to a client that went away.

Tests: a write reset during the tag check never reaches the registry and
the next write of the tag succeeds (on the previous head it is refused
with TAG_INVALID); the two HTTP/2 tests now assert that their exchanges
are HTTP/2.
2026-10-17 15:46:53 -04:00
Alessandro Lattao 553411bc70 fix(ecr): pull rewritten ECS and Lambda images from localhost (#5882)
Floci rewrites an AWS-shaped ECR image of an ECS task or an image-backed
Lambda to its loopback registry and hands that address to the Docker
daemon, as <account>.dkr.ecr.<region>.localhost:<port>/<repo> in the
hostname style. A daemon with the containerd image store, the default
from Docker Engine 29, cannot pull from it. Measured on Docker 29.9.1:
against a plain HTTP registry:2, localhost:<port> and 127.0.0.1:<port>
are reached over HTTP, while any *.localhost name is tried over HTTPS
only ("server gave HTTP response to HTTPS client"), the 127.0.0.0/8
insecure CIDR notwithstanding. With Floci's TLS on, the same names reach
Floci's TLS port and fail on its certificate instead (unknown authority,
and *.localhost names are not in it). The containers never start: ECS
reports TaskFailedToStart.

So the rewrite now always gives localhost:<port>/<account>/<region>/<repo>,
path style, in either URI style and with or without TLS: the address
every daemon, classic or containerd store, pulls from over plain HTTP.
The data plane claims path-style requests on a loopback host (localhost,
127.0.0.0/8, ::1) in the hostname style too, so those pulls still go
through it and its repository name mapping. Nothing else changes: the
advertised repositoryUri, the login endpoint and pushes keep their style.
2026-10-17 14:11:08 -04:00
Jackson Price f22c2a4db1 feat(cloudformation): support SAM's optional AutoPublishAlias version properties (#5823)
* feat(cloudformation): support SAM's optional AutoPublishAlias version properties

With AutoPublishAlias, read the three function properties SAM uses to
shape the version it publishes:

- AutoPublishCodeSha256: a string names the version by its first ten
  characters instead of the hash, so new code under the same value
  publishes nothing. A Ref to a parameter resolves first.
- AutoPublishAliasAllProperties: the hash covers every property the
  transform gives the function, plus its SnapStart.
- VersionDeletionPolicy: the version's DeletionPolicy when the
  function sets none; a function with a CapacityProviderConfig
  defaults to Delete, any other to Retain. An intrinsic value is
  copied unresolved, as SAM copies it.

Each gets SAM's type checks and messages: AutoPublishCodeSha256 must
be a string and make an alphanumeric id, AutoPublishAliasAllProperties
a boolean, and VersionDeletionPolicy Delete or Retain, only with
AutoPublishAlias.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): pin the default Ref hash and AutoPublishAliasAllProperties coverage

Keep the check that a Ref in the code changes the version id without
AutoPublishAliasAllProperties, and show that with it a Timeout change
names a new version and false hashes as if the property were absent.
Pin that an AutoPublishCodeSha256 Ref resolving to an empty value
leaves the hash in place. The docs say that ids under
AutoPublishAliasAllProperties are floci's own and that a Ref to a
parameter works for AutoPublishCodeSha256.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): refuse AutoPublishCodeSha256 in SAM Globals

SAM refuses a Globals property it does not list for a section, and
Globals.Function does not list AutoPublishCodeSha256. Now that the
property names the version, merging it from Globals would give every
function the same version id, so a code change would never publish.
Refuse the template with SAM's message, without the list of supported
properties that SAM appends.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): pin the AutoPublishAliasAllProperties ids and SAM version updates

Pin two version ids under AutoPublishAliasAllProperties to the SHA-1 of
the generated function's properties, worked out by hand, and that a
given AutoPublishCodeSha256 still names the version there. Show that
Globals.Function carries AutoPublishAliasAllProperties and
VersionDeletionPolicy. On a stack, a Timeout change under
AutoPublishAliasAllProperties publishes version 2 with the new timeout,
and VersionDeletionPolicy: Delete reports the replaced version
DELETE_COMPLETE instead of DELETE_SKIPPED. An intrinsic
VersionDeletionPolicy is copied unresolved, which the assertion now
says.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(cloudformation): say when a new SAM version id publishes

Say which statements about the version id hold by default, that
AutoPublishCodeSha256 outranks AutoPublishAliasAllProperties and cannot
come from Globals, and when a new id publishes nothing: SnapStart, a new
AutoPublishCodeSha256 alone, or, under AutoPublishAliasAllProperties, a
Tags or ReservedConcurrentExecutions change, which AWS fails with "A
version for this Lambda function exists". A hot-reloaded function
publishes for every new id. State the DeletionPolicy order, and that
CloudFormation takes intrinsic functions only in resource properties,
outputs, metadata and update policies. The javadocs of the version id
and of AutoPublishAlias say the same.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(cloudformation): note IgnoreGlobals and LanguageExtensions for SAM versions

Say that floci does not honour IgnoreGlobals, so a function cannot opt
out of a VersionDeletionPolicy in Globals, and that an intrinsic
VersionDeletionPolicy reaches CloudFormation only through a transform
such as AWS::LanguageExtensions, which floci does not implement. Under
AutoPublishAliasAllProperties the code's parameter references are still
resolved, and any SnapStart change publishes nothing.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): pin the SnapStart id under AutoPublishAliasAllProperties

Pin the id a SnapStart with ApplyOn None gives under
AutoPublishAliasAllProperties, worked out by hand like the others, and
show that a version VersionDeletionPolicy: Delete reports deleted is
still listed, as the docs say floci keeps every version it publishes.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(cloudformation): say that IgnoreGlobals is the opt-out floci ignores

A function can still clear a Globals VersionDeletionPolicy with a null
of its own; what floci does not honour is IgnoreGlobals.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-17 14:04:04 -04:00
Vũ Thế Huy c33823bd48 feat(redshift): complete Glue external table lifecycle (#5866)
* feat(redshift): complete Glue external table lifecycle

* fix(test): use existing frame helper in Spectrum bridge test

* fix(redshift): safeguard external catalog lifecycle operations

* fix(redshift): shorten spectrum catalog lock waits and reuse test helper
2026-10-17 13:59:29 -04:00
TATSUNO “Taz” Yasuhiro ffb3d84bad fix(appsync): refuse a long-term access key sent with a session token (#5880)
AWS answers 403 UnrecognizedClientException "The security token included
in the request is invalid" to a long-term key with a session token, and to
a temporary key with a wrong one. An unknown key, a temporary key with no
token and an empty token get the same message with a period.

AppSync now uses the session token check API Gateway and Lambda Web share.
2026-10-17 13:55:03 -04:00
Kenshin Okinaka 115a919a83 fix(cloudformation): roll back without a transient stack FAILED status (#5878)
When a resource failed, rollbackFailedExecution set the stack status to
CREATE_FAILED or UPDATE_FAILED and added a stack event with that status
before moving the stack to ROLLBACK_IN_PROGRESS or
UPDATE_ROLLBACK_IN_PROGRESS; the update exception path did the same. AWS
reports those statuses on the failed resource only, and on the stack only
when rollback is disabled. A DescribeStacks poll landing between the
writes read UPDATE_FAILED and stopped, which made the nested stack
rollback test in CloudFormationDeletionPolicyIntegrationTest flaky.

Drop the transient status and event, and publish each rollback status
after its reason and event so a poll that sees the status sees both.
CfnStackWaits no longer needs to wait out the transient status.
2026-10-17 13:47:42 -04:00
David Phillips 23edd58992 fix(ssm): separate shell execution and delivery timeouts (#5865)
* fix(ssm): separate shell execution and delivery timeouts

* fix(ssm): require a command list for public shell requests

* test(ssm): share command request and cleanup fixtures
2026-10-17 13:43:37 -04:00
David Phillips 043b919e85 fix(rds): require headroom for enabled storage autoscaling (#5863)
* fix(rds): require headroom for enabled storage autoscaling

* fix(rds): retain autoscaling headroom during storage growth

* fix(rds): check thresholds against current storage
2026-10-17 12:40:31 -04:00
Kenshin Okinaka 043daa5da6 feat(ses): validate v2 tracking configuration overrides (#5871)
* feat(ses): validate v2 tracking configuration overrides

SendEmail and SendBulkEmail now check ConfigurationOverrides.Tracking's
values the way SES v2 does: a value outside ENABLED/DISABLED is a
validation error, both values reported together with the click one first,
ahead of the tags and the configuration set. The shapes pre-check already
refuses a wrong JSON type. Floci has no open or click tracking, so a valid
override is accepted and has no effect.

* test(ses): check a refused tracking override records no message

* refactor(core): share the Smithy validation-error message

The "N validation error(s) detected: a; b" message is Smithy's, not SES's, yet
SES built it in eight places, plus five helpers that wrote the single-violation
form by hand. They now all go through core.common.SmithyValidationErrors,
which takes the protocol's error code. No message changes.
2026-10-17 12:23:02 -04:00
Priamo Germosen faf344afd1 feat(codeartifact): add CopyPackageVersions for the generic format (#5854)
Copies one or more versions of a package between repositories in the same
domain, matching AWS's documented all-or-nothing batch semantics: a version
missing from the source fails NOT_FOUND, a version already identical at the
destination is a silent no-op, a differing one fails ALREADY_EXISTS unless
allowOverwrite is set, and any one failure reports every other requested
version as SKIPPED rather than performing a partial copy. versionRevisions
is checked against the source's actual revision (MISMATCHED_REVISION on a
mismatch). Maven, npm, pypi, and nuget are not yet bridged, the same
restriction PublishPackageVersion already has for those formats, and are
documented as a known limitation.
2026-10-17 10:17:47 -05:00
Priamo Germosen b0777a4020 fix(iam): check the actions an S3 operation needs besides its own (#5846)
Under IAM enforcement an S3 object operation was checked only as its own
action. A PutObject, CopyObject or CreateMultipartUpload that set tags,
an ACL, a retention period or a legal hold needed only s3:PutObject,
GetObjectAttributes needed only the read, and a retention change or a
delete asking to bypass governance retention needed no
s3:BypassGovernanceRetention. No Object Lock condition key was offered.

Each now also needs the actions the S3 user guide's permissions table
and the API references require besides its own. An object creation
needs the action of each setting it applies: s3:PutObjectTagging,
s3:PutObjectAcl, s3:PutObjectRetention or s3:PutObjectLegalHold. A copy
under the default COPY tagging directive keeps a tagged source's tags,
so it needs s3:PutObjectTagging too, checked where the source is read
against the request's credential, a presigned URL's included, and it
offers no request tag keys from the x-amz-tagging header it ignores.
GetObjectAttributes needs s3:GetObjectAttributes, or
s3:GetObjectVersionAttributes for a version. A PutObjectRetention or
DeleteObject that sends x-amz-bypass-governance-retention needs
s3:BypassGovernanceRetention; an annotation delete does not, as the
user guide says the permission does not apply to annotation operations.

s3:PutObject, s3:PutObjectRetention and s3:PutObjectLegalHold are
offered the Object Lock keys from the request's headers or body, and an
object creation offers its tag and Object Lock keys to each extra action.
A denial names the missing permission, and CloudTrail records the
operation that was refused, PutObjectRetention and GetObjectAttributes
included. Generated presigned URLs refuse all four creation settings,
as they refused tags.

Refs #5716
2026-10-17 10:17:28 -05:00
Priamo Germosen 30d8d3ff5c fix(core): route a Query action by its service's botocore model (#5879)
A Query request without a usable credential scope is routed by its
Action and Version, and IAM enforcement authorizes it under the service
that routing picks. The names each service routed were kept by hand in
AwsQueryController and had drifted from what the services serve: 170
names Floci dispatches, across eight services, reached no service and
fell through to SQS. They answered UnsupportedOperation in SQS's
namespace and were authorized as SQS actions.

Each Query service's API versions and operations now come from its
botocore models: tools/aws/regen_query_services.py writes them, from the
pinned botocore, to aws/query-services.json, and make aws-data-check
fails when the file is stale. Every name a service defines reaches it,
implemented here or not. Floci keeps the list of services and their
order, Cognito's names, which no Query model holds, and ElastiCache's
ValidateIamAuthToken, which no model defines.

A name several services define goes to the first of them when the
request names no Version. Ten such names get a pinned owner instead,
the service that serves them here, where the order would pick an
earlier one that does not. The routing parity test checks every
dispatched action with and without a Version and no longer needs its
list of known gaps.
2026-10-17 10:17:18 -05:00
TATSUNO “Taz” Yasuhiro 4f4db89d8f fix(apigateway): refuse a long-term access key sent with a session token (#5875)
* fix(apigateway): refuse a long-term access key sent with a session token

AWS answers 403 "The security token included in the request is invalid"
when a long-term key comes with X-Amz-Security-Token, signed or not. The
same message without the period answers a temporary key with a wrong token.

The session token check moves to core.common.auth, and Lambda Web IamAuth
uses it too.

Closes #5858

* fix(apigateway): read the session token where the signature is and refuse an empty one

AWS ignores a token in the query of a header-signed request and a token
header on a presigned one. It refuses an empty token with any key.
2026-10-17 09:30:35 -04:00
seniorescobar 9705b2584d fix(cognito): forward SignUp ValidationData and ClientMetadata to the pre-signup trigger (#5825)
* fix(cognito): forward SignUp ValidationData and ClientMetadata to the pre-signup trigger

Real Amazon Cognito delivers the SignUp request's ValidationData and
ClientMetadata to the pre-signup Lambda trigger as request.validationData
and request.clientMetadata (see the pre sign-up trigger docs). The SignUp
path parsed only UserAttributes and called signUp without them, so
firePreSignUp always received empty maps — unlike AdminCreateUser, which
already parses and forwards both fields. The auto-confirm PostConfirmation
firing dropped ClientMetadata the same way.

Parse both fields in handleSignUp and thread them through signUp →
signUpWithReservedUsername → firePreSignUp, mirroring the AdminCreateUser
plumbing, pass ClientMetadata on to PostConfirmation when PreSignUp
auto-confirms, and cover both with JSON-handler-level regression tests.
Adapted to #5783's signup restructure (callers of signUp in its new tests
pass explicit empty maps).

* refactor(cognito): extract name/value pair parsing helper

The Name/Value forEach loop was copied six times across AdminCreateUser,
AdminUpdateUserAttributes, SignUp and UpdateUserAttributes. One
readNameValuePairs helper next to readStringList now serves all six.

* fix(cognito): forward ClientMetadata to CustomMessage trigger sources

fireCustomMessage hardcoded an empty clientMetadata map. It now takes the
calling action's metadata so SignUp can pass the request's ClientMetadata
to CustomMessage_SignUp, as the developer guide lists for that source.
The other sources keep an empty map: ResendConfirmationCode and
ForgotPassword do not accept ClientMetadata at all yet, and the guide
excludes InitiateAuth-family metadata from custom message requests, so
the MFA and OTP CustomMessage_Authentication paths deliberately pass
none. Regression test asserts CustomMessage_SignUp receives the signup
metadata.
2026-10-17 09:27:45 -04:00
Kenshin Okinaka de4f91f990 fix(ses): check v2 contact request bodies against the service model (#5867)
* fix(ses): check v2 contact request bodies against the service model

CreateContactList, UpdateContactList, CreateContact, UpdateContact and
ListContacts read their members by hand. A Topics or TopicPreferences
value that was not an array was a Floci-specific BadRequestException,
and a topic or preference member of the wrong JSON type was read as its
text, so it reached the enum and name validation instead of failing
deserialization as on AWS.

These operations now check their body against the SES v2 shapes right
after the JSON object check, like the send operations. The first member
of the wrong JSON type, in body order, is a SerializationException with
AWS's deserializer message, ahead of the name validation, the page size
and the contact list lookup. The type checks this makes unreachable are
removed, including the hand-built AttributesData messages, which the
walk now produces through the shared helper. UnsubscribeAll and
UseDefaultIfPreferenceUnavailable keep their boolean coercion, and
PageSize its integer check.

* docs(ses): note the null contact topic element deviation

A null element of Topics or TopicPreferences passes the SES v2 shape
check like a null address element, but SES then answers it with a 500
InternalFailure. Floci keeps a 400 BadRequestException naming the
element. The request member types section only described the address
case, "as on AWS", so it now says that this one deviates.
2026-10-17 09:26:34 -04:00
TATSUNO “Taz” Yasuhiro e21d25a829 fix(dynamodb): report an empty or mistyped ExclusiveStartKey value the way AWS does (#5861)
* fix(dynamodb): report an empty or mistyped ExclusiveStartKey value the way AWS does

* refactor(dynamodb): share the key value error builders between writes and start keys

* fix(dynamodb): brace the Scan start key early return and pin the index key wording
2026-10-17 09:14:44 -04:00
Alessandro Lattao 9ea977cafa fix(cognito): give an email sign-in code eight digits (#5873)
Floci issued six digits for every code. Measured on AWS (eu-west-1,
2026-10-16), through a Custom Email Sender that printed what Cognito
handed it: the USER_AUTH EMAIL_OTP sign-in codes were 06988020, 50415180
and 81488702, eight digits, while the sign-up, resent, forgotten-password,
UpdateUserAttribute and VerifyUserAttribute codes had six. A client that
checks the length, or a test that reads the code from a message, sees the
difference.

Only the email sign-in code changes. MFA codes (SMS_MFA, EMAIL_MFA) and
SMS_OTP keep six digits: they were not measured, and nothing here
guesses. The Cognito tests now read codes through one CognitoCodes
helper, in place of the six copies of the same extraction they carried.
2026-10-17 09:14:04 -04:00
Alessandro Lattao e12b878b77 fix(cloudformation): resolve Fn::GetStackOutput as CloudFormation does (#5848)
* fix(cloudformation): resolve Fn::GetStackOutput as CloudFormation does

Fn::GetStackOutput was not implemented, and an intrinsic the template
engine does not know falls through to the node's text, which for an
object is "". A weak cross-stack reference, which aws-cdk-lib synthesizes
as Fn::GetStackOutput, therefore deployed CREATE_COMPLETE with an empty
string wherever the value was used.

The engine now resolves it through a StackOutputResolver that
CloudFormationService answers as DescribeStacks would in the referenced
account and Region, and the YAML parser maps the !GetStackOutput short
form. Every rule follows what CloudFormation does, measured in eu-west-1,
where that departs from the function's reference page: a missing stack
or output fails the resource and the stack rolls back, an output that
cannot be read rolls the stack back once the resources exist, an output
whose Condition is false is never read, a dynamic reference reaches
DescribeStacks unresolved, and the function is refused in Conditions and
inside Fn::ImportValue when the operation is requested, AWS::Include
fragments included. A RoleArn has to name an existing role: Floci runs
no stack operation under an execution role, so, as AssumeRole does with
IAM enforcement off, its trust policy is not evaluated.

* fix(cloudformation): refuse Fn::GetStackOutput in export names and nested stacks as AWS does

Answers the review of #5848, each point measured on CloudFormation in
eu-west-1 on 2026-10-17.

An output's Export.Name holding Fn::GetStackOutput is refused when the
operation is requested, with "Template format error: Output O is
malformed.  The Name field of Export must not depend on any resources,
imported values, or Fn::GetAZs.", so it never reaches execution. A
nested stack's template is checked when the child is created: the Child
resource fails with the template error and the parent rolls back.

A dynamic reference inside an Fn::Sub variable map of the function's
arguments is left as written too: CloudFormation hands it to
DescribeStacks unresolved, which refuses the name. The engine suspends
dynamic references while it resolves the arguments.

An output that cannot be read now logs the stack and the output before
the rollback, and the placement check skips only a template that does
not parse or an AWS::Include that fails, which the operation reports
where it processes them.

* fix(cloudformation): check a Fn::GetStackOutput role's trust and permissions under IAM enforcement

With IAM enforcement on, a RoleArn only had to name an existing role, so a
stack could read another account's outputs through any role there,
whatever the role trusted. GetStackOutputRoleAuthorizer now decides the
role as AssumeRole and AppSyncDataSourceAuthorizer do: its trust policy
has to allow a principal in the consuming account, and its policies,
through IamPolicyEvaluator, have to allow cloudformation:DescribeStacks
on the referenced stack. The refusals carry the messages measured on
CloudFormation: STS's AccessDenied, and DescribeStacks' for the
GetStackOutput session. With enforcement off nothing changes.

Which principal CloudFormation acts as is not known in Floci, which runs
stack operations under no execution role and keeps no caller, so a grant
to any principal of the consuming account is enough: its root, or any
principal of it the policy names, such as the CDK's execution role.
That question is AssumeRolePolicyEvaluator.allowsAnyPrincipalOf, built on
its own decide(), so the trust policy is parsed and evaluated in one
place.

Reuse instead of copies: the tests use EnforcementFixtures.auth, a new
EnforcementFixtures.createRole overload taking the trust policy, and
PartitionCleanup, and the two GetStackOutput tests share their stack and
parameter helpers. The placement checks find the function with
JsonNode.findValues instead of three hand-written walks, and the
resolveOutputValue wrapper of resolve() is gone.
2026-10-17 09:09:24 -04:00
Aniket Shukla 5fc58a9a9c fix(ec2): preserve elastic IP pool and border group (#5821)
* fix(ec2): preserve elastic IP pool and border group

* test(ec2): share account-scoped query requests
2026-10-17 08:23:47 -04:00
TATSUNO “Taz” Yasuhiro 5eb4eecf99 feat(lambdaweb): enforce IamAuth on Web Function endpoints (#5855)
* fix(lambdaweb): accept role and user ARNs as resource policy principals

AWS checks an ARN principal against a pattern that allows a slash, so a
role or user ARN passes. Any other AWS principal value is still checked
against the pattern without a slash.

* feat(lambdaweb): verify SigV4 and InvokeWebFunctionEndpoint on IamAuth endpoints

An IamAuth endpoint takes a request signed for the service lambda in the
endpoint's region, in the Authorization header or a presigned query. The
X-Amz-Content-SHA256 header is required and is the payload hash, as on
AWS. A refused request gets the AWS 403 page with no error type. The
check runs after the rateLimit 0 page and before the rate limit.

Under IAM enforcement the signer also needs
lambda:InvokeWebFunctionEndpoint on the endpoint ARN from its identity
policy or the function's resource policy, with the auth type and the
function tags as condition keys.

An Authorization that is an AWS signature is dropped before the app on
every endpoint, together with X-Amz-Security-Token.

* fix(lambdaweb): give the app the path without dot segments and sign only the normalized path

Lambda removes dot segments before the app sees the path, on every
endpoint, and keeps repeated slashes and encoded dots. An IamAuth
signature counts only over the path as signers normalize it. A signature
over the path as sent is refused when the two differ. Floci forwarded
the path as sent and took a signature over either form, so a request
signed for /a/c could reach the app as /a/./b/../c.

* fix(lambdaweb): answer 502 when the caller check fails inside Floci

A malformed date or query is still a refused signature. Any other
failure, such as in IAM storage, no longer looks like a 403. The endpoint
answers it with 502 and no error type, as AWS answers its own failures.

* fix(lambdaweb): check a principal against the ARN pattern only under AWS

Lambda allows a path only in an ARN under the AWS key. A CanonicalUser or
Federated value never matches that pattern.

* docs(lambdaweb): MultiRegion SigV4, presigned queries and dot segments on the way to the app

* chore(auth): share SigV4 signature parsing and age limits with API Gateway

The API Gateway authorizer and Lambda Web IamAuth read a SigV4 signature
from the Authorization header or a presigned query, and check its age, in
the same way. Both now use one record in core.common.auth. Each still
decides which placement wins and where it reads the session token, so
neither behaves differently.
2026-10-17 08:12:48 -04:00
Allen Sanborn 20b7a3673e fix(dms): accept explicit default subnet group on CreateReplicationInstance (#5820)
* fix(dms): accept explicit default subnet group on CreateReplicationInstance

CreateReplicationInstance with ReplicationSubnetGroupIdentifier=default
(any case) returned ResourceNotFoundFault because only stored groups were
consulted. AWS creates the default group on first use, so naming it
explicitly is one way it comes into existence. It is now accepted whenever
the region has default subnets, and the instance then makes it listed,
keeping the rule that default is listed only once an instance uses it.

* fix(dms): resolve the instance subnet group only after create validations

CreateReplicationInstance resolved ReplicationSubnetGroupIdentifier=default
before the duplicate-identifier, ResourceIdentifier and tag checks. Resolving
default reads the region's subnets, which seeds its default VPC, so a request
rejected by a later check still left a default VPC and subnets behind. The
group is now resolved after every other check has passed, just before the
instance is stored; successful requests behave as before.
2026-10-17 08:07:21 -04:00
Jackson Price 0be4581d4e fix(ec2): preserve IAM instance profile identity (#5671)
* fix(ec2): preserve IAM instance profile identity

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): probe metadata readiness with IMDSv2

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(autoscaling): preserve launch profiles and metadata options

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): preserve automatic public addresses across launch paths

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): honor metadata token requirements and profile identity

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): keep synthesized node identity and mock addresses consistent

- IMDS iam/info serves the instance profile identity EKS synthesizes for
  its cluster nodes while IAM holds no such profile. The node carries a
  stable IAM-shaped profile id, which DescribeInstances now copies too.
- Mock instances get their automatic public address however the launch
  completes, DescribeInstanceStatus included. An associated Elastic IP
  replaces it, disassociating gives a running instance a new one, and
  termination leaves none.
- CreateFleet forwards the launch template's metadata options and its
  primary interface AssociatePublicIpAddress.
- Launch templates store a profile name and ARN pair as given and the
  launch from them rejects it, since AWS does not fully validate
  template parameters at creation.
- CloudFormation launch-configuration MetadataOptions resolve Fn::If and
  AWS::NoValue.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): refuse profile pairs for groups and keep Elastic IPs exclusive

- Auto Scaling refuses a group whose launch template, directly or
  through its mixed instances policy, names both an instance profile
  name and an ARN, with ValidationError, instead of accepting a group
  that can never launch.
- AssociateAddress disassociates the Elastic IP an instance already
  has, as AWS documents. In mock mode a terminated instance takes no
  address, and an unchanged address is not written again.
- IMDS iam/info falls back to a cluster node's synthesized identity
  only while IAM holds no profile at that ARN; a held profile without a
  role answers 404.
- CreateFleet takes the subnet of the device-index-0 interface first,
  as RunInstances does.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(ec2): assert profile ids and launch configuration metadata via the SDK

Ec2InstanceProfilePathTest now checks that direct, template, override
and fleet launches report IAM's InstanceProfileId, and AutoScalingTest
round-trips launch configuration MetadataOptions through the AWS SDK for
Java v2, including the absent structure and a rejected hop limit.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): displace an Elastic IP a retained interface carries

- AssociateAddress also disassociates an Elastic IP held by the
  instance's primary interface, which a retained network interface
  carries from an earlier instance, so one instance never holds two.
- Mock stop and terminate change the instance's state and public
  address under its lock, like the launch and Elastic IP writes.
- Docs and comments say where the profile pair fails and when
  CreateFleet falls back to another interface's subnet.
- Tests cover the retained-interface address, the group update path,
  the full refusal message and the fleet's availability zone, and the
  SDK launch configuration test cleans up on failure.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(ec2): refuse reserved RunInstances tags before resolving the profile

Resolving the instance profile called the EC2 service before tag parsing,
so a reserved aws: tag was refused only after that lookup. Parse tags first,
as the reserved-tag check requires.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(autoscaling): assert the refresh launched the replacement

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(autoscaling): describe what the refresh assertion checks

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): cover invalid launch-configuration metadata options

Invalid HttpTokens, invalid HttpEndpoint, hop limits of 0 and 65 and a
non-integer hop limit each fail the AWS::AutoScaling::LaunchConfiguration
resource with the validation message, roll the stack back and leave no
launch configuration behind.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): pin metadata failure reasons and accepted hop limits

Assert the exact resource failure reason, and cover hop limits of 1 and 64,
a string hop limit and one from a Number parameter.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* refactor(ec2): leave IMDS token enforcement to a separate change

HttpTokens=required enforcement, the IMDSv2 readiness probe and the helper
shell environment reset move to their own pull request, so this change
keeps only the instance profile identity.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* refactor(ec2): leave mock public addresses to a separate change

Mock public IPv4 assignment, primary-interface public IP and subnet handling
and Elastic IP displacement move to their own pull request.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* refactor(autoscaling): leave launch metadata options to a separate change

Launch-configuration MetadataOptions over Query and CloudFormation, and
metadata options forwarded from launch templates and EC2 Fleet, move to
their own pull request. Launch-configuration profile resolution stays.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(ec2): use the shared metadata and authorization fixtures

Ec2MetadataProfileIntegrationTest starts its metadata server and requests
tokens through Ec2MetadataTestFixture, and it and
Ec2InstanceProfileIdentityIntegrationTest build their Authorization header
with EnforcementFixtures.auth.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(ec2): close the Auto Scaling profile paragraph's code fence

Removes a stray fence that rendered the launch-configuration profile
paragraph as code, and a doubled blank line before the iam/info paragraph.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(ec2): find profile identity launches by a run tag

Each launch carries a tag unique to the test run, and the tests look their
instances up by that tag rather than by client token.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* refactor(ec2): leave the client-token filter to a separate change

The instance filter is not part of the profile identity, and this copy let
a wildcard match instances launched without a token.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-17 08:03:38 -04:00
Vũ Thế Huy fa2a49e771 feat(redshift-serverless): add scheduled action actions (#5852)
Add CreateScheduledAction, GetScheduledAction, ListScheduledActions,
UpdateScheduledAction and DeleteScheduledAction. An action is recorded and
echoed, never run, and a cron schedule reports no upcoming invocations. It is
tied to the namespace by the namespace's generated id, so a namespace recreated
under the same name does not inherit it.

Required members, name patterns, the snapshot name prefix length and the tag
shape come from the AWS model through RedshiftServerlessRequestShapes. Only what
the model cannot express stays in the service: the schedule union, the time
window, the retention range and the namespaces that must exist.
2026-10-17 00:04:32 -04:00
Suja Shaj a611e9ea6f fix(iam): authorize Secrets Manager requests against the secret's ARN (#5781)
* fix(iam): authorize Secrets Manager requests against the secret's ARN

IAM enforcement evaluated CreateSecret against secret:* because the
builder read only SecretId, and a secret named by its name was evaluated
as secret:<name>, without the random suffix every secret ARN carries.
A secret:<name>-?????? policy, the pattern AWS documents for granting
access to a secret that may not exist yet, matched neither.

CreateSecret is now evaluated against secret:<Name>-??????, standing in
for the suffix that is assigned at creation, and a name-based SecretId
resolves to the stored secret's full ARN in the target account.

Closes #5364

* fix(iam): pick the Secrets Manager target by the serving operation

CreateSecret now reads only Name and other actions only SecretId, so a
field the handler ignores cannot choose the resource. Minted ARNs take the
request's partition, and a name lookup also reads a legacy unprefixed
secret for the default account. Adds an SDK compatibility test.

* fix(iam): resolve a partial-ARN SecretId to the stored secret's ARN

A SecretId given as an ARN without the random suffix is now authorized
against the stored secret's full ARN, resolved in the caller's account in
the order the operations use: an exact ARN first, then the ARN read as a
partial one. The enforcement tests share EnforcementFixtures' auth, a new
assumeRole helper, and a new createRole helper that removes the role after
the test. The Secrets Manager enforcement test also deletes the secrets it
creates.
2026-10-16 23:24:38 -04:00
Vũ Thế Huy 1cb8b0f747 feat(redshift-serverless): accept customDomainName in GetCredentials (#5856) 2026-10-16 23:11:42 -04:00
TATSUNO “Taz” Yasuhiro 5b12c620aa fix(dynamodb): check the Scan segment pairing after the Select checks (#5857)
* fix(dynamodb): check the Scan segment pairing after the Select checks

* fix(dynamodb): check the Scan Select conflicts before the segment pairing
2026-10-16 23:01:25 -04:00
Vũ Thế Huy 2a012cf9a4 feat(redshift-serverless): add snapshot copy configuration actions (#5798)
* feat(redshift-serverless): add snapshot copy configuration actions

Add CreateSnapshotCopyConfiguration, ListSnapshotCopyConfigurations,
UpdateSnapshotCopyConfiguration and DeleteSnapshotCopyConfiguration. A
configuration is recorded and echoed; Floci copies no snapshot. A namespace has
one configuration at a time and the destination Region must differ from its own.
The configuration is tied to the namespace by the namespace's generated id, so a
namespace recreated under the same name does not inherit it.

Required members come from the AWS model through RedshiftServerlessRequestShapes.
The destination Region name and the retention range are checked by hand because
the model leaves them unconstrained.

* fix(redshift-serverless): validate boundary inputs and scope snapshot copy pagination tokens

* refactor(redshift-serverless): share maxResults range check and invalidPagination helper
2026-10-16 22:42:36 -04:00
David Phillips d4158b954b fix(ssm): retain command ownership during background execution (#5841)
* fix(ssm): retain command ownership during background execution

* fix(ssm): keep agent fallback messages within their owner

* test(ssm): share region-scoped authorization fixtures
2026-10-16 22:34:08 -04:00
XuJian d1509c368f fix(s3): default new buckets to BucketOwnerEnforced (#5782)
* fix(s3): default new buckets to bucket owner enforced

Initialize ownership controls at bucket creation and opt ACL-focused tests into legacy ownership modes. Repair existing import grouping so repository-wide Checkstyle passes.

* fix(s3): honor bucket ownership and ACL headers

Preserve explicit CreateBucket ownership and ACL grants, and reject grants incompatible with enforced ownership. Validate multipart grants at initiation and carry accepted grants through completion. Adapt ACL-focused regressions to opt into legacy ownership modes.

* fix(s3): respect account public ACL setting at bucket creation

* refactor(s3): share create-bucket ownership XML builder
2026-10-16 22:26:24 -04:00
Allen Sanborn 708dc32fa1 feat(ec2): support egress-only internet gateways (#5822)
* feat(ec2): support egress-only internet gateways

CreateEgressOnlyInternetGateway fell through to UnsupportedOperation, so
aws_egress_only_internet_gateway could not be created, and
DescribeEgressOnlyInternetGateways always answered an empty set.

Egress-only gateways are now stored (ec2-egress-only-internet-gateways.json,
through StorageFactory) and created attached to an existing VPC, with
TagSpecification and CreateTags applied. Describe filters by ID,
egress-only-internet-gateway-id, attachment.vpc-id, attachment.state and
tags; Delete returns returnCode. DeleteVpc reports DependencyViolation
while one is attached. The three actions are added to EC2 query routing,
which removes DescribeEgressOnlyInternetGateways from the known gaps.

* fix(ec2): settle Qodo findings on egress-only internet gateways

- CreateEgressOnlyInternetGateway validates TagSpecification tags before it
  creates anything, so an aws: key no longer leaves an attached gateway behind.
  Tags are applied with the gateway, under the topology lock.
- A ClientToken replay compares the creation tags as well as VpcId: changed tags
  fail with IdempotentParameterMismatch, and a matching replay returns the
  gateway unchanged instead of re-tagging it.
- DescribeEgressOnlyInternetGateways honours MaxResults (5 to 255 in the EC2
  model) and NextToken, ordered by ID, using the service's existing token codec.
- DeleteEgressOnlyInternetGateway takes the resource lock createSystemTags
  takes, and leaves routes that targeted the gateway in place as blackhole, the
  state AWS documents for a route whose target is gone.

* fix(ec2): DeleteEgressOnlyInternetGateway without an id is MissingParameter

The EC2 model marks EgressOnlyInternetGatewayId required. A request
without it answered InvalidGatewayID.NotFound for 'null'; it now gets
the same MissingParameter the other EC2 handlers return. An unknown id
still fails with InvalidGatewayID.NotFound.
2026-10-16 22:25:09 -04:00
Allen Sanborn f031e4052d fix(ecs): serialize create, update and delete of one service (#5845)
* fix(ecs): serialize create, update and delete of one service

DeleteService removed a service's deployment and revision records after
stopping its tasks, so an UpdateService that had passed its status check
could record a new deployment afterwards, and a CreateService landing in
that window had its first deployment removed by the delete's cleanup.

Take one lock per service key (region, cluster, name) in CreateService,
UpdateService and DeleteService, from the status check to the last write.

* fix(ecs): take no service lock for a service that does not exist; make race tests fail on worker errors

* style(ecs): order imports in EcsServiceDeleteDeploymentsTest

* fix(ecs): drop the service locks on a state reset

* refactor(ecs): share the existing-service lock lookup in update and delete

updateService and deleteService each repeated the check that a service
exists before taking its per-key lock. Move it into lockForExisting so the
no-lock-for-unknown-names rule lives in one place.

* fix(ecs): serialize service writes on fixed lock stripes

The per-key lock map grew with every failed CreateService name and was
cleared on reset, so a delete still holding the old lock could run beside
a recreate on a new one and remove the recreated service's deployment.
A fixed, never-cleared stripe array removes both: nothing grows, and
lock identity survives a reset.

Race tests now release parked workers in finally, use daemon threads,
interrupt stragglers, and fail when a worker neither blocks nor finishes.

* test(ecs): use ThreadStates.awaitBlockedOrDone for the delete-race waits

Adds a Thread overload to ThreadStates sharing the Future overload's poll
loop, and drops the ECS test's local copy.
2026-10-16 22:19:36 -04:00
Matt Van HornandMatt Van Horn d988a137c5 fix: evaluate SNS filter-policy suffix, equals-ignore-case, wildcard, cidr, and nested anything-but (#5624)
* fix: evaluate SNS filter-policy suffix, equals-ignore-case, wildcard, cidr, and nested anything-but

Both object-rule matchers now evaluate suffix, equals-ignore-case,
wildcard, and cidr, and they treat an anything-but object as one nested
positive operator. Strings go through matchesStringOperator, which
requires a textual operand and a non-null value; wildcardMatches is an
anchored case-sensitive scan where only * is special, and cidrContains
keeps a literal IPv4 or IPv6 address in the same family when the prefix
bits agree, with host bits in the network address masked off.
excludesNestedOperator returns the inverse of that single operator,
including numeric parsed from an attribute string or a JSON number in
the body, and returns false for an empty object, an unknown key, more
than one key, or a nested anything-but or exists. New SnsServiceTest
cases cover both filter scopes, String.Array any-element matching, the
anything-but veto when any array element is excluded, and the wildcard
and CIDR edges.

Fixes #5587

* fix: keep nested anything-but closed for malformed operands

A nested anything-but negated whatever its operator returned, so a
non-textual string operand or a malformed numeric condition (which
returns false) was inverted into a match. Check the operand before
negating: a non-textual prefix, suffix, equals-ignore-case, wildcard or
cidr operand, or numeric conditions that are not comparator/number
pairs, now fail closed in both filter scopes.

* refactor: keep SNS numeric comparators in one place

evaluateNumericCondition is now the only list of numeric comparators.
It returns empty for an operand that is not comparator/number pairs, so
anything-but still fails closed on a malformed numeric condition without
a separate well-formedness check.

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
2026-10-16 22:02:31 -04:00
Alessandro Lattao 197ccb5fb7 fix(cloudformation): refuse an update that has nothing to change (#5849)
* fix(cloudformation): refuse an update that has nothing to change

UpdateStack ran a full update for a stack resubmitted as it was, ending
UPDATE_COMPLETE, and CreateChangeSet created an AVAILABLE change set for
it. CloudFormation refuses the update with "No updates are to be
performed." and creates the change set FAILED, UNAVAILABLE, with "The
submitted information didn't contain changes. Submit different
information to create a change set."; the CDK and aws cloudformation
deploy read that reason as "no changes".

What CloudFormation compares was measured in eu-west-1: each active
resource's Type, Properties, Metadata, DeletionPolicy, UpdateReplacePolicy
and UpdatePolicy, and each active output's Value, Description and Export,
with whatever does not depend on a resource resolved first, and the tags
as a set (absent Tags keep the stack's). ComparedTemplate brings a
template to that form: a new Description, an unused parameter, a
DependsOn or a literal written as Fn::Join is no change, while a used
mapping value, a Ref of a resource rewritten as Fn::Sub, or a dynamic
reference whose stored value moved is one. Templates are compared as
processed, AWS::Include fragments read again and the SAM transform
applied with the stack's parameter values, and a stack with a nested
stack is always updated. The change set diff uses the same form.

The CDK deletes the FAILED change set and deletes it again by name
before its next deploy, so DeleteChangeSet now answers success for a
change set the stack does not have, as CloudFormation does. A stack set
instance whose stack has nothing to change is left as it is. Tests that
resubmitted an identical template to exercise an update add an output
through CfnUpdates.forceUpdate, which is an update on AWS too.

* fix(cloudformation): record dynamic reference values when an operation commits

Answers the review of #5849.

The value each dynamic reference resolved to is now recorded when the
stack's operation commits, from the template the stack then has and
keyed as ComparedTemplate hands the references over, instead of while
the engine provisioned each resource. Recording and comparison so see
the same strings, an Fn::Sub that also reads a resource included; an
update that fails and rolls back records nothing and keeps the last
deployment's values; a reference the template dropped is dropped; and
AWS::RDS::DBInstance's master credentials, which its provisioner
resolves itself with ssm-secure, are compared like any other reference.
The values are kept as an HMAC-SHA256 under a random key of the stack's
own rather than a bare SHA-256.

ComparedTemplate keeps an AWS::NoValue inside a function it compares as
written, and gives the array form of Fn::Sub the static variable
substitution the string form has, its own variables left as written.

A stack set instance with nothing to change succeeds whatever status an
earlier rolled-back update left its stack in, and the change set that
found it so is deleted. DeleteChangeSet by a change set's ARN alone
succeeds when the change set is gone, as measured on CloudFormation in
eu-west-1 on 2026-10-17.

The comparison now catches only what it can meet: a template that does
not parse, and the AwsException an AWS::Include, the SAM transform or an
SSM parameter raises, which the update itself then reports.
2026-10-16 21:53:03 -04:00
TATSUNO “Taz” Yasuhiro c8de16ffc7 fix(lambdaweb): never run a request twice when the app crashes (#5842)
* fix(lambdaweb): retry a failed request only when Floci saw the exit before sending it

A request that found its environment dead was retried when Docker's exit
time came before the request start. Docker takes that time from the
daemon's clock, which can be seconds behind Floci's. So a request the app
had received could run a second time. Docker also reports an exit late
under load. Until then the dead environment stayed in the pool, and the
next request got a 503 too.

Floci now follows each environment with an attach stream. The stream ends
when the process exits, and Floci notes the time on its own clock. A
failed request waits for that, up to one second. It is retried only if
the exit came before it was sent. Otherwise it gets the 503 page after
the dead environment has left the pool.

* docs(lambdaweb): note the short window after an exit in the 503 row

* fix(lambdaweb): clean up an exited environment off the reaper thread

Docker can take seconds to report an exit status under load. On the
reaper this held up the rearm of dropped exit watches and the idle checks.

* test(lambdaweb): wait for Floci to see the exit instead of polling for the container
2026-10-16 21:44:24 -04:00
Vũ Thế Huy 7cab804d22 feat(redshift-serverless): add custom domain association actions (#5766)
* feat(redshift-serverless): add custom domain association actions

Add CreateCustomDomainAssociation, GetCustomDomainAssociation,
ListCustomDomainAssociations, UpdateCustomDomainAssociation and
DeleteCustomDomainAssociation. An association is recorded and echoed; Floci
serves no traffic on the domain and reads no ACM certificate. It is tied to the
workgroup by the workgroup's generated id, so a workgroup recreated under the
same name does not inherit it.

The domain name and certificate ARN patterns, lengths and the required members
come from the AWS model through RedshiftServerlessRequestShapes, so the service
carries no validation of its own.

* fix(redshift-serverless): address review findings for custom domains

- Expose custom domain name and certificate ARN in workgroup responses.
- Ensure custom domain names are unique across workgroups in a region.
- Remove ambiguous Pagination.paginate overload in favor of paginateNamespaced.
- Add domain name and certificate ARN validation patterns and length checks.
- Enforce validation for required parameters in custom domain operations.

* fix(redshift-serverless): enforce single custom domain per workgroup and populate certificate expiry

* fix(redshift-serverless): read certificate expiry dynamically and share custom domain serialization
2026-10-16 21:18:45 -04:00
David Phillips 92be67d2df fix(logs): enforce group permissions for lifecycle changes (#5840)
* fix(logs): enforce group permissions for lifecycle changes

* fix(logs): accept bare group ARNs in lifecycle policies
2026-10-16 20:59:38 -04:00
Mario Toffia 534571b2a3 feat(iot): route shadow events through topic rules (#5260)
* feat(iot): route shadow events through topic rules

Successful classic and named shadow changes, from the REST API and from MQTT
reserved topics, now reach the topic rules engine and MQTT subscribers on the
AWS response topics with AWS payload shapes. Shadow documents keep metadata,
clientid() reports N/A for messages without an MQTT client, and MQTT rejected
responses carry the numeric status code.

Closes floci-io/floci#5256

* fix(iot): compute the shadow delta through nested objects

GetThingShadow and the update/delta event compared desired and reported only at the top level, so one differing nested field put the whole desired object in the delta. AWS compares nested objects key by key and arrays whole, and the delta event carries the stored desired metadata of exactly the delta values.

* fix(iot): give a shadow stored without metadata its leaf metadata

A shadow persisted before metadata was kept now reads back with a metadata mirror of its state stamped with its stored timestamp, so GetThingShadow and the update/documents and update/delta events carry metadata for its existing leaves, as AWS does for every state leaf.

* fix(iot): reject a shadow name outside the AWS pattern

A whitespace-only shadow name no longer addresses the classic shadow, so DELETE ?name=%20 cannot delete it. As on AWS, an empty name is the classic shadow and any name that is not 1 to 64 of [a-zA-Z0-9:_-] fails with InvalidRequestException.

* fix(iot): ignore a shadow request on a named topic with an invalid name

As on AWS, an MQTT request on $aws/things/<thing>/shadow/name/<name>/<op> whose name is not a valid shadow name, empty included, is not a shadow request: nothing is published and the classic shadow is untouched. Before, an empty name updated the classic shadow and a blank one was rejected on the classic shadow's topic.

* docs(iot): note that wildcard rule filters receive shadow events

Verified on AWS IoT: rules FROM '#' and '+/things/<thing>/shadow/#' receive the $aws shadow update events. Adds a test locking in the existing matcher behavior.

* fix(iot): keep only the most recent recorded publish events

The recorder kept every publish, and shadow events now go through it too. Only tests read it, so it now keeps the most recent 1,000 events and drops the oldest.

* test(iot): read shadow rule queues without the 5s poll

* fix(iot): match AWS shadow names, delta numbers and clientToken echo

Accept the reserved $package shadow name and reject any other name containing $ with 'Invalid shadow name : <name>'; a name failing the pattern answers 'Bad Request'. Compare delta numbers as AWS does (equal when both double and long values are, integers beyond long exactly), which also stops a number beyond the double range failing the update, and echo a whitespace clientToken.
2026-10-16 20:47:34 -04:00
Allen Sanborn f7240b8ace fix(config): drop a conformance pack's tags when the pack is deleted (#5779)
* fix(config): drop a conformance pack's tags when the pack is deleted

* fix(config): serialize PutConformancePack and DeleteConformancePack per pack

An update Put is a get-then-put. A Delete landing between the two removed
the pack and its tags, then the Put re-inserted it under the old ARN: the
Delete reported success while the pack survived with its tags gone. Both
operations now take the per-key lock aggregation authorizations already use.

* test(config): force the pack update/delete overlap instead of sampling it

Replace the 100,000-round race sample with a deterministic test, as
SnsPolicyAndSandboxEditsTest does: park PutConformancePack in its persist
(inside the per-pack lock), start DeleteConformancePack, and assert with
ThreadStates.awaitBlockedOrDone that the delete waits. Removing the lock
from either put or delete fails it.

* test: share ParkingStore in floci.testing, parking the next read or write

Moves the two private copies (SNS parked a read, Config parked a write)
into one store next to ThreadStates; the caller arms parkNextRead or
parkNextWrite.
2026-10-16 20:36:55 -04:00
Tyler Webb ad57ac837f fix(dynamodb): compare numeric key attributes by value in UpdateItem (#5837)
* fix(dynamodb): compare numeric key attributes by value in UpdateItem

UpdateItem and the TransactWriteItems Update path rejected a request
whose key carried an equivalent but differently written number, such as
a sort key of {"N":"1700000000.0"} against a stored {"N":"1700000000"},
with "Cannot update attribute timestamp. This attribute is part of the
key". Stored numbers are normalized on write, and the key-modification
check compared AttributeValue JSON nodes structurally.

The check now uses attributeValuesEqual, which requires matching types
and compares N by numeric value, as DynamoDB does. The item lookup
already treated these keys as the same item.

* fix(dynamodb): reject key attribute values with more than one type member in UpdateItem

Comparing key attributes with attributeValuesEqual matches on the first
type member the two values share, so an UpdateExpression that set a key
attribute to a value carrying an extra type member passed the key check
and the malformed key was stored. The request key is already validated
for shape and schema type when the item key is built, so checking that
the updated value has exactly one type member is enough for the
comparison to imply a matching schema type.
2026-10-16 19:46:44 -04:00
Priamo Germosen 3db18d58a5 feat(codeartifact): add NuGet/BaGetter sidecar for the nuget format (#5790)
Bridges the nuget package format to a real per-repository BaGetter
container, the same Manager/Client sidecar shape already established for
Maven (Reposilite), npm (Verdaccio), and pypi (pypiserver): a real NuGet V3
push/install round trip through CodeArtifactNuGetController, GetPackageVersionAsset
and GetPackageVersionReadme bridged to the live sidecar, and DeletePackage wired
through the same CONTAINER_BACKED_FORMATS dispatch the other three formats use.

GetPackageVersionReadme is answered live against BaGetter (its own readme-file
and nuspec-description endpoints) rather than captured at publish time, since
unlike Verdaccio and pypiserver, BaGetter can answer for a specific historical
version after the fact.

Pins bagetter/bagetter, the actively maintained fork of the original,
long-stale loic-sharma/BaGet (no commits since mid-2024, every one of its own
releases tagged -preview/-prerelease), confirmed directly against a live
container for push/download/readme/delete semantics before relying on them.
2026-10-16 18:19:33 -05:00
Allen Sanborn feafbfe083 fix(ec2): list i386 alongside x86_64 for t2 instance types (#5815)
* fix(ec2): list i386 alongside x86_64 for t2 instance types

* fix(ec2): map i386 AMIs to the linux/386 container platform

t2 instance types now accept i386 images, but the resolver only mapped
arm64 and x86_64, so an i386 catalog image started without a platform
and ran as whatever the host defaults to.

* fix(ec2): allow i386 images on t2.medium

AWS lists t2.nano, t2.micro, t2.small and t2.medium as the t2 sizes that
can run 32-bit AMIs; t2.medium was missing i386 so RunInstances refused
an i386 image there.

* test(ec2): share catalog image setup and drop duplicated t2 pin

Extract serviceWithCatalogImage for the catalog image and resolver stubs
used by the arm64 and i386 runInstances tests, and stop
i386CatalogImageLaunchesOnTheLinux386Platform at the platform; the t2
sizes stay pinned in Ec2InstanceTypeCatalogTest.t2FamilySupportsI386AndX86_64.
2026-10-16 19:06:17 -04:00
Hector Ventura 050f93e600 feat(core): make the init hook directory configurable (#5801)
* feat(core): make the init hook directory configurable

Hook directories were fixed at /etc/floci/init/{boot,start,ready,stop,
shutdown}.d, which only the image can provide. floci.init-hooks.dir
(FLOCI_INIT_HOOKS_DIR) now sets that root, defaulting to /etc/floci/init so
the image is unchanged; the LocalStack-compat tree is still read as well.

Hooks also run on Windows, where there is no /bin/sh: .ps1 with
PowerShell, .cmd and .bat with cmd, and .py with python. A .sh hook there
is skipped with a warning unless another shell is configured; on Linux and
macOS the Windows script types are ignored.

Refs #5767

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* fix(core): match Windows hook extensions in any case and warn about a skip once

Review follow-ups for the configurable hook directory:

- Windows file names are case-insensitive, so SETUP.BAT and Init.PS1 are
  now hooks there; elsewhere the extension must stay lower case, as before.
- The warning for a hook Windows cannot run is logged once per file
  instead of on every directory listing, and Windows script types are
  ignored silently on Linux and macOS.
- The environment variable reference and application.yml list shutdown.d
  with the other hook directories.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* fix(core): always resolve hook directories from the configured root

findMergedScripts called getPrimaryPaths() for the default root and
getPrimaryPaths(hooksRoot) otherwise, though both return the same
directories; the no-argument form only survived because five tests stub
it on a mocked hook. The runner now always passes its root, the overload
is gone, and those tests stub getPrimaryPaths(anyString()).

The runner tests this branch added drop @DisplayName, per AGENTS.md.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-16 19:04:48 -04:00
Kenshin Okinaka 43ad214896 fix(ses): check v2 configuration set request bodies against the service model (#5836)
* fix(ses): check v2 configuration set request bodies against the service model

CreateConfigurationSet, UpdateConfigurationSet,
PutConfigurationSetSuppressionOptions, PutConfigurationSetVdmOptions and
Create/UpdateConfigurationSetEventDestination now check their body against
the vendored SES v2 shapes before any other validation, as the send
operations do. A member of the wrong JSON type, nested ones included, is a
SerializationException with the deserializer's message, ahead of the name
validation and the configuration set lookup.

The type checks the walk makes unreachable are removed from the option
parsers and parseSuppressedReasons. requireOptionObject and coerceBoolean
build their messages through the SesV2Json helpers. A non-object event
destination is now a SerializationException instead of "EventDestination is
required.", and these operations answer a non-object body with "Request
body must be a JSON object." while a blank body still reads as {}.

* fix(ses): read the suppression-options body like the other checked operations

PutConfigurationSetSuppressionOptions inlined the blank-body, parse and
requireJsonObject steps that readOptionBody already performs, which made
its order look different from the other checked operations. It now calls
readOptionBody, so all six read the body the same way before the shape
check. Behaviour is unchanged.

* test(ses): share the SES v2 member-type test helpers

The configuration set member-type test copied the send test's request
assertion and deserializer message constants. Both now use
SesV2SerializationErrors, which takes the HTTP method, so the Contact and
metrics/import/export PRs can reuse it.
2026-10-16 18:58:12 -04:00