Commit Graph
1491 Commits
Author SHA1 Message Date
Mario Toffia 024bfa0a5c feat(docker): containers Floci launches trust the Floci CA (#3091)
* feat(tls): write a CA bundle for launched containers at boot

Containers Floci launches need to trust Floci's HTTPS endpoint from any runtime
without losing access to public HTTPS. A bundle that carries the JVM's public
roots followed by Floci's trust anchor makes that possible: the variables that
replace a runtime's trust store (SSL_CERT_FILE and friends) can then point at
it safely.

ContainerCaBundle writes {persistent-path}/tls/floci-ca-bundle.pem from the
JVM's default trust anchors plus the certificates in the anchor file: the local
CA, or the user-provided certificate file in custom-certificate mode. Only
certificates are copied out of that file, so a combined certificate-and-key
file never leaks its key into a container. The file is swapped in atomically
from a uniquely named temporary file. TlsConfigSource writes it in both
certificate modes; a failure is logged and never stops the boot.

hostPath(config) resolves the bundle in the directory the bootstrap used, so a
persistent path set only in application.yml cannot point it elsewhere, and
appendEnv(env) adds SSL_CERT_FILE, CURL_CA_BUNDLE, REQUESTS_CA_BUNDLE,
NODE_EXTRA_CA_CERTS and AWS_CA_BUNDLE without overriding a key the caller set.

The bootstrap now records its TLS directory in every TLS-on mode, not only when
it issues the leaf, so the CA producer and the bundle lookup read from the
directory the boot wrote to even when a persistent path is set in
application.yml alone. A missing bundle is reported once per process.

* feat(docker): every launched container gets the CA bundle and the trust variables

ContainerLifecycleManager.create is the single path every emulator-created
container passes through, so injecting trust there covers Lambda, ECS, MWAA,
Flink, RDS, ElastiCache, Batch and the rest at once.

With TLS on and the bundle present, create appends the five trust variables
after the spec's own environment (a value from a task or function definition
wins) and copies the bundle to /etc/floci-ca-bundle.pem in the created, not
yet started, container. A copy rather than a bind mount, because when Floci
itself runs in Docker its persistent path is not a host path the daemon can
mount. A failed copy is logged with its consequence and the container still
starts. With TLS off, or without a bundle, nothing changes.

* refactor(lambda): take container CA trust from the lifecycle manager bundle

The Lambda launcher no longer resolves, copies or announces the CA itself: the
lifecycle manager does that for every container. Its append-only policy
(NODE_EXTRA_CA_CERTS and AWS_CA_BUNDLE only, never SSL_CERT_FILE) existed
because a bare CA would have cut a function off from public HTTPS; the bundle
carries the public roots, so the policy and the test that guarded it go.

The Kubernetes launcher publishes the bundle in its ConfigMap instead of the
bare CA, mounts it at /etc/floci-ca-bundle.pem, and appends the trust
variables after the function's own environment so a function value wins, as
in the Docker launcher.

* test(docker): a launched container trusts Floci and public roots through the bundle

The unit tests pin the variables and the copy, not that a runtime reading them
actually trusts Floci and still reaches public HTTPS. A python:3.12-alpine
container launched through the lifecycle manager, with the image's own root
directory pointed away so only the bundle can supply roots, fetches
https://host.docker.internal:<port>/_floci/ca.pem and https://public.ecr.aws/
with no setup of its own. Skipped without a Docker daemon, like the other
*DockerIntegrationTest classes; the image is prefetched in CI with the
others.

* docs(tls): containers Floci launches trust the Floci CA

Describe the bundle every launched container receives, the five variables that
point at it, that a value set on the function or task definition wins, and
that the JVM ignores these variables so a Java workload still needs its own
trust store.

* fix(docker): recreate a container without the trust variables when the bundle cannot be copied

SSL_CERT_FILE, CURL_CA_BUNDLE and REQUESTS_CA_BUNDLE replace a runtime's trust
store, so a container whose bundle copy failed (an image without /etc) used to
start pointing them at a file that was not there, and lost every HTTPS
connection instead of only the ones to Floci. The lifecycle manager now removes
that container and creates it again without the variables, so it keeps the
image's own trust store. The host configuration, and with it any dynamic host
port, is built once and reused.

* fix(tls): serve only the certificate blocks of a user-provided file from ca.pem

In custom-certificate mode GET /_floci/ca.pem returned the configured
certificate file byte for byte, so a combined certificate-and-key file, the
form OpenSSL tooling produces, handed the server's private key to any caller.
The endpoint now goes through the same certificate-only parsing the container
bundle uses. TlsUserCertIntegrationTest boots on a combined file and asserts
the response holds the user certificate and the local CA and no key.

* test(cloudformation): wait for DeleteStack to finish before asserting on deleted resources

DeleteStack hands the work to an executor and answers at once. Seven tests in
CloudFormationIntegrationTest asserted on the deleted resources right after the
answer; one of them, deleteStack_ecs_leavesNoOrphans, failed shard 1 of this
pull request's CI 44 ms later with the cluster still ACTIVE, while the same
shard had passed on the previous push.

A shared awaitStackDeleted polls DescribeStacks until the stack reports
DELETE_COMPLETE or no longer exists, fails on DELETE_FAILED or after ten
seconds, and replaces the three inline copies of that loop as well.

* docs(tls): restore the learned-hostnames section and the ACM wording that #3079 dropped

#3079's docs commit (dc3e9ee6a) was written against a tls.md that predated
#3086 and, once squashed onto main, removed the "Custom Domains Learned at
Runtime" section #3086 had added and reworded the intro to place ACM
certificates "in a later release", although AcmService has issued them from
the local CA since #3086. Both are restored here, next to the new section,
because a separate PR would conflict with this one on the same lines.
2026-09-06 14:57:08 -05:00
Mario Toffia d45c64545d feat(iot): evaluate the SQL subset of topic rules (#3021)
* feat(iot): evaluate the SQL subset of topic rules

Topic rules only extracted the FROM topic filter and sent the whole
payload to every action. The SELECT list and the WHERE clause were
ignored, so a rule fired on every matching topic and its actions never
received the projected document.

Add a small hand written parser and evaluator under services/iot/rules
for the SELECT/FROM/WHERE subset AWS rules use most: '*', dotted field
paths, topic() and topic(n) with optional AS aliases, and a WHERE of
startswith, endswith, comparison operators, AND, OR, NOT and
parentheses. A missing field or a mismatched type is Undefined as in
AWS, so an undefined predicate never fires the rule.

A statement outside the subset is not rejected. It is stored as sent and
keeps its previous behaviour, firing on every matching topic with the
whole payload, and logs one WARN naming the token that could not be
parsed. floci.services.iot.rule-sql-strict, off by default, rejects it
with SqlParseException the way AWS does.

Each rule is parsed once: the result is held on the rule object as a
transient field that is never persisted and is rebuilt on the first
publish after a restart.

* fix(iot): count real tokens in the rule SQL limit and compare numbers exactly

The token limit counted the end marker, so a statement with exactly 1000
tokens was rejected and the error named the end of input. Mixing a whole
number with a decimal literal went through double, so 9007199254740993
compared equal to 9007199254740992.0.

* fix(iot): keep rule SQL decimal literals exact

Double.parseDouble rounded a decimal literal before evaluation, so
level = 9007199254740993.0 matched a payload holding 9007199254740992.

* fix(iot): treat a rule SQL number too large for a double as Undefined

Comparing an infinity, which Jackson produces for a JSON number wider than
a double, converted both operands to the same infinity and made distinct
values compare equal.

* fix(iot): follow the AWS IoT SQL operator tables and harden the rule parser

The comparison and logic semantics did not match the operator tables in
the AWS IoT SQL reference: = and <> on mismatched types are false and
true rather than Undefined, JSON null is a value that equals only NULL,
the ordering operators convert numeric strings, AND, OR and NOT accept
the strings "true" and "false" and give Undefined for anything else
instead of three valued logic, and startswith and endswith convert
non-string arguments. String literals may use double quotes, as AWS's
own examples do, and an unsupported function is named before its
arguments are parsed so the WARN reports the function rather than a
token inside it.

Add a corpus of AWS reference statements sorted into parsed and
unparsed, a deterministic mutation fuzz that requires the parser to
raise nothing but RuleSqlParseException and the evaluator nothing at
all, and tables for keyword prefixed field names, spacing, associativity,
unicode and literal forms.

* fix(iot): treat a rule SQL numeric string with an overflowing exponent as Undefined

A payload string such as "1e-2147483648" matches the numeric string form
but BigDecimal cannot hold its exponent, and the NumberFormatException
escaped the publish path. It now evaluates as Undefined, and the fuzz
payloads carry such strings.

* docs(iot): name the AWS null functions, not IS NULL, in the rule SQL limitations

* fix(iot): read rule SQL payload numbers exactly instead of through a double

Jackson read payload floats as doubles, so 9007199254740993.0 arrived
as 9007199254740992, 1e-400 as 0 and 0.30000000000000004 as 0.3 before
the evaluator compared them against an exact literal, and a predicate
could fire or stay silent for the wrong reason. The representability
guard only caught the infinity case of that loss.

Payload numbers are now read as BigDecimal, kept as written, so every
comparison is exact at any size or precision as AWS's Decimal is, a
projected number keeps its text, and the infinity handling is gone
because no double is ever produced.

* docs(iot): awsIotSqlVersion is stored and echoed, only its array semantics are not modelled
2026-09-06 14:30:36 -05:00
Allen Sanborn 94b9665c32 fix(ec2): reclaim instance containers orphaned by a hard restart (#3031)
* fix(ec2): reclaim instance containers orphaned by a hard restart

TerminateInstances flips the record to shutting-down synchronously and removes
the container on the async executor; launch persists the container id only once
Docker has created it. A process killed across either edge -- SIGKILL, OOM,
`docker kill` -- leaves a container on the daemon that no surviving record refers
to, so nothing on the next run ever collects it.

Neither existing path reaches these. `Ec2Service.stopManagedContainers` only runs
on the graceful ShutdownEvent, and the startup restore loop's
`needsMetadataRegistration` deliberately skips records in terminated or
shutting-down. Once `pruneTerminatedInstances` drops the record an hour later,
the container is unreferenced for good.

Sweep them on startup, right after the restore loop so anything legitimately
revived is already accounted for. Containers are matched on the existing
`io.floci.service=ec2` identity label and removed only when no live record claims
them. Stopped instances are explicitly not orphans -- their containers are what
StartInstances revives -- so a record in any non-terminal state keeps its
container.

The sweep is scoped by a new `floci_owner_port` label to this Floci's own API
port. Several emulators can share one Docker daemon, and an unscoped sweep would
reap a sibling's live instances; `floci_namespace` is the documented mechanism
for that but is absent unless a resource namespace is configured, so it cannot
scope the default configuration. Containers created before this label existed
carry no owner and are never swept.

Off with FLOCI_SERVICES_EC2_RECONCILE_CONTAINERS_ON_STARTUP=false.

Upstream's #2029 (createAndStartContainer/failLaunch/isLaunchCancelled)
independently landed the launch-cleanup half of the original floci-5ie fix, so
this rewrite carries only the reconciler, which upstream still lacks.

* fix(ec2): scope the orphan sweep by account and deployment, not port alone

Review on #3031 found two ways the startup sweep could delete a container that is
still in use, plus a missing config entry. All three are addressed here.

Account identity was dropped on the record lookup. reconcileOrphanedContainers runs
from @PostConstruct, outside any request, where an AccountAwareStorageBackend resolves
to the default account. A container belonging to a non-default account looked up as
absent, so the sweep classified it an orphan and removed it, leaving a live persisted
instance with no Docker runtime. findAnyInstance() now consults every account, using
the same instanceof-and-fall-back shape findAnyVpcEntry() already uses in this class.
The lookup is read-only, so a cross-account hit stays in its owner's partition.

Ownership keyed on the API port alone collided. Two independently namespaced Floci
processes sharing a Docker daemon on the same internal port stamped the same
floci_owner_port label, so starting either one reaped the other's live containers.
ownerIdentity() composes docker.resource-namespace -- the documented mechanism for
exactly this arrangement -- in front of the port. An unnamespaced single Floci keeps
the bare port it already stamped, so nothing changes for the common case.

Adds reconcile-containers-on-startup to the main application.yml, which AGENTS.md
requires for any new configuration and which the original commit omitted.

The new test fails with the old port-only ownership and passes with the fix.

* fix(ec2): put reconcile-containers-on-startup under services, not storage

The previous commit added the key to floci.storage.services.ec2. Ec2ServiceConfig
maps to floci.services.ec2, as its own env var name says
(FLOCI_SERVICES_EC2_RECONCILE_CONTAINERS_ON_STARTUP), and application.yml has an
ec2 block under each root. SmallRye rejects a key that maps to no root rather than
ignoring it, so this was not a quietly inert setting: every @QuarkusTest failed to
boot with SRCFG00050, and the native images built but could not start, which is why
the compat and sdk-test jobs timed out at exit 124.

Verified by running a @QuarkusTest rather than only compiling: Ec2ImageCatalogTest
now boots and passes, and no SRCFG00050 remains.
2026-09-06 14:28:12 -05:00
Matan Baruch 75e93e5e77 fix(cloudfront): echo TrustedSigners in cache behaviors so the AWS provider does not segfault (#3015)
Creating an aws_cloudfront_distribution against floci crashes the Terraform/
pulumi AWS provider on read-back: DefaultCacheBehavior (and CacheBehavior) omit
the TrustedSigners object, but the provider does len(dcb.TrustedSigners.Items)
with no nil guard (flattenDefaultCacheBehavior), so an omitted object is a nil
pointer dereference (SIGSEGV) that kills the apply and orphans the distribution.

Floci models only the modern TrustedKeyGroups, but real AWS always echoes a
TrustedSigners object even when unused ({Enabled:false, Quantity:0}). Emit that
disabled form in both cache-behavior writers, next to TrustedKeyGroups.

Refs #2767 (the TrustedSigners crash; the ForwardedValues/MinTTL and
AllowedMethods.CachedMethods fidelity gaps listed there are left as follow-ups).

Adds a regression test asserting getDistribution's DefaultCacheBehavior echoes a
disabled TrustedSigners; it fails (object absent) before the fix.
2026-09-06 14:26:43 -05:00
Vũ Thế Huy 7b5c6e272d fix(cloudformation): delete AWS::IAM::User on stack deletion (#3076)
* fix(cloudformation): delete AWS::IAM::User on stack deletion (#2490)

* fix(cloudformation): reconcile IAM user updates and verify user identity

* fix(cloudformation): log intentionally tolerated errors during IAM user deletion

* fix(cloudformation): use context helpers and assert Fn::GetAtt in IAM user provisioner

* test(cloudformation): add AWS SDK compatibility test for IAM user

* test(cloudformation): log tolerated exception during IAM user test cleanup

* test(cloudformation): use Logger for cleanup in IAM user SDK test

* test(cloudformation): use JBoss Logging for cleanup in IAM user SDK test

* fix(cloudformation): address review feedback on IAM user provisioner

---------

Signed-off-by: Vũ Thế Huy <31652864+vuthehuyht@users.noreply.github.com>
2026-09-06 14:13:00 -05:00
David 4ee5a528f3 fix(lambda): give each published version its own copy of the code (#3041)
A published version's metadata was immutable but the directory it named was
not. CodeStore.getCodePath has no version component, so every version shared
one directory with $LATEST and publishVersion copied only the codeLocalPath
pointer. UpdateFunctionCode replaces that directory wholesale, so a redeploy
silently rewrote what an already-published version ran: the version kept
advertising the CodeSha256 it was published with while the bytes behind it
were a different build, and ContainerLauncher tar-copies that directory at
launch, so a qualified invoke executed $LATEST's code.

publishVersion now copies the code into a directory belonging to that version.
Image-backed and hot-reload functions keep the reference they had: an image is
already immutable by digest, and a hot-reload function's bind-mounted directory
is meant to track the working tree. A copy failure falls back to the shared
path rather than failing the publish.

Version directories live under a "<function>@versions" container rather than as
"<function>.v<n>" siblings. sanitizeName maps every name into [a-zA-Z0-9_.-],
so no function can produce a directory name containing "@" and the two
namespaces cannot overlap. A prefix scan over flat siblings could not be made
correct: FunctionName has no charset validation in floci today, so a function
genuinely named "foo.v1" owns the directory "foo"'s version 1 would claim, and
deleting either corrupted the other.

DeleteFunction with a qualifier now reclaims that version's directory, inside
the per-function lock it already held, and only when the version actually owned
one. Previously nothing but whole-function delete reclaimed version code, so a
repeated publish/delete cycle grew on disk without bound.

Closes #2958
2026-09-06 14:07:43 -05:00
Abarnaa Sree N f8a1c3134a fix(dynamodb): append list values for out-of-range indexes (#3088)
* fix(dynamodb): append list values for out-of-range indexes

* fix(dynamodb): update setOrAppend comment
2026-09-06 14:02:11 -05:00
Franklin G. Mendoza 41022d09fb feat(cloudformation): support service-managed stacksets (#3055)
* feat(cloudformation): support service-managed stacksets

* fix(cloudformation): restrict service-managed account targeting

* docs(cloudformation): sync resource type table

* fix(cloudformation): align service-managed stackset contracts

* test(cloudformation): isolate stackset organization fixture

* fix(cloudformation): preserve stackset update handling after rebase

* fix(cloudformation): preserve stackset OU deletion targets

* fix(cloudformation): preserve overlapping stackset targets

* fix(cloudformation): reconcile stackset deployment targets
2026-09-06 13:59:54 -05:00
Hector Ventura 9df197f3af refactor(cloudformation): move AWS::ECS::Cluster, TaskDefinition and Service into EcsCfnProvisioner (#3114)
* refactor(cloudformation): move AWS::ECS::Cluster, TaskDefinition and Service into EcsCfnProvisioner

Three more arms leave the legacy switch, together with the ECS-only parsers
(container definitions, port mappings, environment, secrets, load balancers,
network configuration) and the three idempotent delete helpers. The monolith
no longer depends on EcsService at all; its constructor loses that parameter
and CfnProvisionerFixture passes one argument less.

Behaviour is unchanged except where the move fixes it: an unnamed cluster
keeps the name its first execution generated (ctx.stablePhysicalName), where
the switch generated a fresh name and created a second cluster on every
UpdateStack. Create-vs-update for a service branches on ctx.isUpdate() and
the stored Name attribute, since the physical id is the ARN; a renamed
service is created as a replacement, with the prior one left behind as every
replacement in the switch does today. A non-integer DesiredCount is a
ValidationError instead of an uncaught NumberFormatException. Deletes go
through CfnDeletes.safeDelete tolerating only the service's own not-found
codes, so a ClusterContainsTasksException still fails the stack delete
(#1634).

Fn::GetAtt keys are unchanged (Cluster Arn, TaskDefinition TaskDefinitionArn,
Service Name and ServiceArn), matching the registry schemas' readOnly
properties, and CloudFormationIntegrationTest keeps asserting them end to
end. EcsCfnProvisionerTest covers the three types against a mocked
EcsService. The whole CloudFormation test package passes on this tree apart
from the pre-existing ACM schema-gap row.

* refactor(cloudformation): treat an ECS service's cluster as create-only and clean up replacements

Review found that a service moved to another cluster while keeping its name
took the in-place update path: updateService was called against the new
cluster, which either fails with ServiceNotFoundException or mutates a
same-named service the new cluster already has. Cluster is create-only on
AWS::ECS::Service, so the update now compares the requested cluster (a name,
an ARN's last segment, or the default) with the one embedded in the prior
service ARN and creates a replacement when they differ.

A replacement, here and for a renamed service or a task definition's new
revision, now enters the replacement-cleanup lifecycle the engine already
runs (UPDATE_COMPLETE_CLEANUP_IN_PROGRESS, DELETE_IN_PROGRESS on the prior id,
three attempts, UpdateReplacePolicy Retain honoured) instead of leaving the
displaced entity behind. ReplacementCleanup is the plain bookkeeping for
provisioners without a rollback snapshot, beside the richer record
PipesCfnProvisioner keeps; the provisioner delegates the four interface hooks
to it and deletes through its own idempotent delete arm. Deregistering the
displaced task-definition revision after commit is what CloudFormation does
on AWS and stops revisions accumulating on every update.

* refactor(cloudformation): roll an ECS replacement back when a later resource fails

Review found that a replacement this provisioner produces (a service moved or
renamed, a task definition's new revision) could not be rolled back: when a
later resource failed the stack update, rollbackUpdate had no implementation,
so the engine reported "Rollback is not implemented", left the replacement
running and the stack in UPDATE_ROLLBACK_FAILED.

ReplacementCleanup now keeps the attributes the resource carried before the
provision alongside the prior physical id, and rollback() puts both back and
deletes the replacement through the provisioner's own delete arm; the record
is spent before the delete so a failing delete cannot put the restored prior
on the next cleanup's list, as PipesCfnProvisioner reasons for its rename.
The provisioner records once, in provision(), after the type switch, and
delegates rollbackUpdate. In-place updates owe no record and keep the
engine's existing handling.

The committed-update cleanup in CloudFormationService now walks resources in
reverse creation order, as every other teardown walk does: a displaced
service has to go before the displaced cluster it runs in, and a displaced
listener before the target group it forwards to, or that delete fails three
times and leaves the entity behind.

* refactor(cloudformation): order replacement cleanup by the template and keep an orphaned replacement owed

Two gaps in the replacement lifecycle, both found in review. The committed
cleanup walked the resource map reversed, but the map is insertion order and
a resource a later update added sits after the resources that depend on it,
so a cluster added after its service would still be deleted first. The
cleanup now walks resourcesInCreationOrder reversed, the template's
dependency order, exactly as DeleteStack does; a resource the template no
longer names sorts last.

And a rollback whose delete of the replacement failed forgot the replacement:
the record was cleared before the delete, so nothing could remove that
entity later even though UPDATE_ROLLBACK_FAILED is updatable here and both
the next committed update and DeleteStack run the cleanup first. The record
is now a list of every entity owed a delete: a replacement whose rollback
delete fails is listed in the prior's place, never retained (a failed update
created it), and the prior's own id and attributes are kept beside the list
only while this update's replacement can still be rolled back. Every listed
entity gets its attempt on every cleanup call, so one that keeps failing does
not leave the others untried.

* refactor(cloudformation): keep a displaced entity owed until its own attempts are used up

Review found that once any listed entity reached three failed deletes, the engine's give-up cleared the whole record, forgetting entities that still had attempts left. clearUpdate now drops only the entries that used up their attempts (and the rollback fields), and the cleanup result reports the lowest attempt count among what remains, naming that entity, so the engine keeps retrying until every remaining entity has had its own three attempts.
2026-09-06 13:47:45 -05:00
Olamide Kosile fa265a4a33 fix(stepfunctions): resolve the States.Format template argument like every other argument (#2963)
AslExecutor.applyIntrinsic read the format template with
unquoteString(parts.get(0)), which only stripped surrounding quotes
and otherwise took the argument literally. Every other argument goes
through resolveIntrinsicArg, which resolves $. paths and raises the
missing-argument error added in #2872. A reference path written in the
template position skipped both, so States.Format($.nope, 1) succeeded
with the literal string "$.nope" instead of resolving it.

The template argument now goes through resolveIntrinsicArg like the
rest, so a template path that matches nothing fails with
States.Runtime using the same cause format every other missing
argument already produces, and a template path that does resolve is
used as the template.

Removed the now-unused unquoteString helper.

Fixes #2927
2026-09-06 13:46:17 -05:00
Mario Toffia dec348d382 feat(iot): provision AWS::IoT::Thing, Policy and TopicRule (#3014)
* feat(iot): provision AWS::IoT::Thing, Policy and TopicRule

CloudFormation now creates, updates and deletes things, policies and
topic rules through the existing IoT operations. Ref returns the name;
Fn::GetAtt returns the thing ARN and id, the policy ARN and id (the
name, as on AWS) and the rule ARN. Attribute payloads are replaced in
place, a changed policy document becomes a new default version, a rule
is replaced in place, and a rename replaces the entity. The topic rule
payload is handed to the service in the API's own shape. A policy is
detached from its principals before it is deleted.

* test(iot): keep policy variables verbatim in a stack-created policy

* fix(iot): cap a policy at five versions and prune the oldest on a stack update

CreatePolicyVersion refuses a sixth version with VersionsLimitExceededException (HTTP 409), as AWS does, and every policy version write runs under one lock so racing creates cannot slip past the check. A stack update with a changed document now does what the AWS CloudFormation handler does when the service refuses: it deletes the oldest version, after moving the default to the newest when the oldest is the default, and creates the new version again. Before this change the versions of a policy updated by a stack piled up without limit.

* fix(iot): keep pruning when another version fills the slot before the retry

The prune and the retry are separate calls, so another client could create a version between them and the single retry failed the stack update. The provisioner now prunes and tries again, up to as many times as a policy has versions, before it gives up.

* fix(iot): delete the oldest policy version in one step under the version lock

A stack update pruning a full policy selected the oldest version, moved the default and deleted it in separate service calls, so a direct client could delete or promote that version in between and the stale delete failed the update. The selection, the default move and the delete are now one step in IotService under the version lock; the provisioner only asks for it and retries.

* fix(iot): make room for a policy version in one step and lock the policy delete

A policy persisted before the cap can hold more than five versions, and the one-version prune then needed one failed stack update per four surplus versions. The service now deletes the oldest versions until one more fits, in one step under the lock, and the provisioner asks for that. DeletePolicy takes the same lock: a version created in the middle of a delete used to put the policy back after the delete had returned. The limit error now carries the message AWS sends, and the tolerated limit error is logged at debug level.

* docs(cloudformation): regenerate the resource-type table after the rebase onto main
2026-09-06 11:06:47 -04:00
Kenshin Okinaka 8468dd1ef3 refactor(ses): move three single-owner helpers off the SesService facade (#3137) 2026-09-06 10:58:46 -04:00
Franklin G. Mendoza aebed6e15c feat(accessanalyzer): add analyzer lifecycle (#3117)
* feat(accessanalyzer): add analyzer lifecycle

* fix(accessanalyzer): complete service contracts

* test(accessanalyzer): make SDK cleanup best effort

* test(accessanalyzer): use project logging for cleanup
2026-09-06 10:55:17 -04:00
Mario Toffia 9b28388d89 fix(acm): report SUCCESS domain validation once a certificate is issued (#3112)
DescribeCertificate returned Status ISSUED together with
DomainValidationOptions[].ValidationStatus PENDING_VALIDATION for every
public certificate, forever. Clients that wait on the validation status
rather than the certificate status never finished: the AWS SDK
CertificateValidated waiter polls only ValidationStatus, and the CDK
DnsValidatedCertificate custom resource uses that waiter, so its stack
waited for the Lambda's timeout and rolled back.

The validation status now follows issuance: SUCCESS on an ISSUED
certificate, PENDING_VALIDATION while the configured validation wait is
running. A pending certificate is issued, with its validations marked
SUCCESS and the change stored, on the first read after
validation-wait-seconds has passed; before this the documented transition
never happened.
2026-09-06 10:48:30 -04:00
Mario Toffia c67e598594 feat(iot): real device certificates issued by the local CA (#3079)
* feat(iot): CreateKeysAndCertificate issues a real client certificate from the local CA

certificateId is sha256(DER) in lowercase hex as on AWS; the returned RSA 2048
key pair matches the certificate. CreateCertificateFromCsr parses the PKCS#10,
checks its self-signature and key strength (RSA 2048 or more, EC P-256/384/521),
signs the CSR's key with the same CA and returns no private key, as on AWS.

* docs(iot): describe the CA-issued device certificates

* fix(iot): accept only the NIST curves AWS IoT names and never store a device private key

The CSR key check reads the named-curve identifier instead of the field size,
so secp256k1 and explicit curve parameters are refused as on AWS. The stored
certificate record no longer carries the private key; it is returned once.

* feat(iot): device certificates expire at the end of 2049 and DescribeCertificate reports validity

AWS IoT-issued client certificates all carry notAfter 2049-12-31T23:59:59Z.
CertificateGenerator gains an overload with an explicit validity window;
DescribeCertificate adds validity.notBefore, validity.notAfter and
certificateMode DEFAULT. The Java SDK compatibility test asserts the shape.

* fix(iot): a device certificate never outlives its issuing CA

A new local CA is valid until the end of 2050, past AWS's fixed 2049 device
expiry; a CA created earlier (ten years) caps the device certificates it signs
at its own expiry, so a chain never expires before its leaf.

* fix(iot): derive CA and device expiry from creation time, never mint an expired certificate

A CA created after 2050 lives ten years from creation instead of ending on
the fixed date; after 2049 a device certificate lives a year, still capped
at its CA. The Python compatibility suite now sends a real PKCS#10 request,
since the placeholder it used is refused as on AWS.

* docs(tls): the local CA now signs IoT device certificates

* test(iot): pass the certificate authority to IotServiceTest's constructor
2026-09-06 10:39:57 -04:00
Jerald Lindberg bf517ac952 fix(elbv2): do not let a listener bind a port Floci reserves for itself (#3034)
* fix(elbv2): do not let a listener bind a port Floci reserves for itself

The ELBv2 data plane binds each listener's port for real, and the TLS proxy
binds the emulator port plus floci.tls.aws-https-port (443 by default) because
CDK's custom-resource cfn-response callback hardcodes https:// and ignores the
port in the ResponseURL. Nothing arbitrated between them, so the two raced and
whichever started first won.

That made the outcome depend on start order. On a fresh start the proxy took
443 and the load balancer logged a bind failure; on a start that restored a
persisted ALB with an HTTPS listener, the listener took 443 and answered CDK's
callback in plain HTTP, so every Custom:: resource hung until CloudFormation
timed out - with only a warning to explain it.

startPortServer now yields a reserved port, registering the listener on the
control plane but leaving it without a data plane, and says so. Load balancers
can still have 443 by setting floci.tls.aws-https-port=0 or disabling TLS.

* fix(elbv2): yield 443 only while the TLS proxy actually holds it

The reserved-port check read configuration, not state. Binding the AWS-HTTPS
port is privileged and its failure is deliberately non-fatal, so a proxy that
lost the bind still had the port marked reserved and the ELBv2 listener also
declined it. The port then went unserved by either side, which is worse than
the race the reservation exists to settle.

TlsProxyServer now records which binds failed and exposes reservesPort(), and
ElbV2DataPlane asks it instead of inferring from config. An unresolved bind
still reserves, so a listener cannot win the start-up race by arriving first.

Adds TlsProxyServerReservedPortTest for the bind-outcome half of the contract:
reserved while unresolved, released once failed, and nothing reserved when TLS
is off or aws-https-port is 0.

* fix(elbv2): tell the operator the right way to free a reserved port

The warning always suggested floci.tls.aws-https-port=0, which is not a remedy
when the reserved port is the emulator's own: that one cannot be handed over at
all. Pick the advice from which port was asked for.

* fix(elbv2): rebind a listener when the proxy gives up its port

Yielding a port whose bind had not resolved yet is the safe default, but if
that bind then failed nothing retried the listener: startPortServer had
returned null, so no server was stored and the listener stayed registered with
no data plane while the port sat free.

TlsProxyServer now notifies on a failed bind, and the data plane binds any
listener already registered on that port. Handlers registered after the fact
are replayed the ports already given up, since the data plane only wires itself
in once a listener exists.

Pinned by notifiesHandlersWhenABindFails, which resolves listen() to a failure
and asserts the port is both released and reported.

* fix(elbv2): subscribe to released ports outside the server map's mapping function

startPortServer registered the proxy's release handler on first use, from inside
servers.computeIfAbsent. onPortReleased replays the ports already given up as it
subscribes, so when the AWS-HTTPS bind had already failed before any listener
existed, that replay ran bindListenersWaitingOn for the same port, which called
servers.computeIfAbsent again for the key the outer call was still computing.
ConcurrentHashMap rejects that outright: IllegalStateException: Recursive update,
straight out of startListener.

Registration moves to the callers, after the listener is in listenersByHostAndPort
so the replay still finds it, and before the server map is touched so nothing
re-enters it. The mapping function now only builds a server.

Pinned by aListenerStartsOnAPortTheProxyGaveUpBeforeItSubscribed, which throws
Recursive update when the registration is moved back inside.
2026-09-06 10:35:16 -04:00
Niels Kootstra 0fce2d2407 fix(lambda): bound ZIP extraction resources (#3127)
* fix(lambda): bound ZIP extraction resources

Limit Lambda ZIP compressed and expanded sizes and configurable entry counts for function and layer deployments. Preserve previous extracted code when a package exceeds a resource limit.

* refactor(test): centralize ZIP fixture encoding

* docs(test): explain ZIP fixture headers
2026-09-06 10:31:50 -04:00
Vũ Thế Huy daeea78ee6 fix(rds): format unexpected query errors as XML error envelope (#3121)
* fix(rds): format unexpected query errors as XML error envelope

Unhandled runtime exceptions in RdsQueryHandler and NeptuneQueryHandler previously returned plain text Response.serverError entities, causing AWS CLI and SDK XML parsers to fail with syntax errors.

Wrap unexpected exceptions in AwsQueryResponse.error with InternalFailure and ensure 5xx status codes render with <Type>Receiver</Type> in accordance with AWS Query protocol specifications. Also add unit tests covering default platform image cache eviction and unexpected RDS handler errors.

Closes #3110

* test(neptune): add unit tests for query handler error responses

Verify NeptuneQueryHandler unexpected exceptions return an XML InternalFailure error response with HTTP 500 status and Receiver error type.
2026-09-06 10:00:05 -04:00
Aniket Shukla c0b5461f10 fix(ui): verify Floci connectivity in readiness probe (#2753)
* fix(ui): verify Floci connectivity in readiness probe

* fix(ui): log runtime probe failures
2026-09-06 01:45:37 -05:00
Franklin G. Mendoza 162211de0c feat(route53): support cross-account VPC associations (#3116)
* feat(route53): support cross-account VPC associations

* test(route53): add SDK cross-account compatibility coverage

* fix(route53): harden cross-account VPC ownership

* fix(ec2): scope default resources by account
2026-09-06 00:05:31 -04:00
Franklin G. Mendoza 3927c66040 feat(macie2): add organization administration operations (#3105)
* feat(macie2): add organization administration operations

* test(macie2): validate organization administration with sdk

* fix(macie2): harden delegated administration routing
2026-09-05 23:49:52 -04:00
Vũ Thế Huy 85180a4d88 feat(redshift): emulate Redshift COPY FROM s3 over Simple Query protocol (#3100)
* feat(redshift): parse COPY FROM s3 statements

* feat(redshift): simulate Redshift COPY FROM s3 via CopyIn

* feat(redshift): mediate the intercepting bridge pump with a backend lock

* feat(redshift): dispatch COPY FROM s3 via intercepting bridge

* test(redshift): cover COPY from S3 end to end

* docs(redshift): document COPY from S3 support

* fix(redshift): harden the S3 COPY simulator error and protocol handling

Address code review findings on the Part 4 COPY simulator:

- Guarantee exactly one client response on a mid-copy failure. The abort
  path sent CopyFail, relayed the backend's ErrorResponse/ReadyForQuery,
  then also synthesized its own, desynchronizing the client. It now emits
  one response: the backend's, or a synthesized one only when the backend
  is unreachable.
- Catch RuntimeException (AwsException) while streaming objects. A key that
  vanished between listing and reading previously propagated out of the
  bridge and closed the connection with the backend stuck in CopyIn.
- Reply to the client when the backend closes before CopyInResponse
  instead of returning silently and leaving the client blocked.
- Stop doubling backslashes when quoting DELIMITER / NULL values. Under
  standard_conforming_strings a backslash is literal, so NULL AS '\N' was
  reaching the backend as '\N' and nulls loaded as text.
- Reject COPY statements carrying an option the simulator cannot honour
  (PARQUET, JSON, MAXERROR, credentials, ...) or a trailing statement,
  so they fail open to PostgreSQL rather than loading with wrong framing.
- Scan option keywords with string literals blanked, so NULL AS 'csv' no
  longer flips the format and DELIMITER ';' no longer trips the trailing
  check.
- Report the failed-transaction status ('E') in a synthesized error when
  the client is in a transaction block; track it from the backend's
  ReadyForQuery in the bridge.
- Bound the backend read timeout during an owned exchange (60s) instead of
  blocking forever; back off between idle-wait retries.
- Relay asynchronous backend messages (NoticeResponse, ParameterStatus)
  to the client instead of dropping them; log every tolerated AwsException.
- Honour the BackendExchange return value so a future interceptor can
  decline before touching the backend.

Tests: cover the mid-copy abort (one E + one Z), backend EOF, literal
NULL AS '\N', the unsupported-clause and trailing-statement rejections,
failed-transaction status, plus a GZIP end-to-end case; the missing-object
integration test now seeds its own bucket.

* fix(redshift): address review feedback on COPY option parsing, prefix pagination, and tx state

* fix(redshift): handle backend tx abort sync failure and log socket close

* fix(redshift): verify backend transaction status 'E' after abort query
2026-09-05 23:46:49 -04:00
Vũ Thế Huy ee5c87d6d6 feat(lambda): support self-managed Apache Kafka event source mappings (#3062) (#3082)
* feat(lambda): support self-managed Apache Kafka event source mappings (#3062)

- Add SelfManagedEventSource, Topics, and SourceAccessConfigurations metadata to EventSourceMapping
- Omit EventSourceArn in REST response when null to comply with AWS wire protocol
- Support Kafka source discrimination in LambdaService and guard pollers against null EventSourceArn
- Forward Kafka ESM properties in CloudFormation provisioner
- Add serialization, service, integration, and CloudFormation tests

* fix(lambda): address review comments for self-managed Kafka ESM

* fix(lambda): handle batch size validation, function target update, and cfn access config clearing

* fix(lambda): bind qualified function targets correctly in event source mappings

* fix(cloudformation): use CfnDeletes.safeDelete in Lambda ESM provisioner

* fix(cloudformation): throw AwsException on missing FunctionName in Lambda ESM provisioner

* fix(lambda): handle create-only ESM update, allow AT_TIMESTAMP for Kafka and populate EventSourceMappingArn

* test(cloudformation): assert exact Fn::GetAtt attributes for Lambda ESM
2026-09-05 23:41:44 -04:00
Vũ Thế Huy 025ac714f6 fix(redshift): emit ClusterAvailabilityStatus and AvailabilityZoneRelocationStatus (#3109)
DescribeClusters (and every other cluster response, since they share
buildClusterXml) omitted two fields the Terraform AWS provider requires:
ClusterAvailabilityStatus and AvailabilityZoneRelocationStatus. The
create waiter polled an empty ClusterAvailabilityStatus ("unexpected
state '', wanted target 'Available'") and import/read rejected the empty
AvailabilityZoneRelocationStatus.

ClusterAvailabilityStatus is derived from clusterStatus: available maps
to Available, unavailable to Unavailable, failed to Failed, and every
transient state to Modifying. Floci has no availability-zone relocation
feature, so AvailabilityZoneRelocationStatus is the constant "disabled".

Closes #3098
2026-09-05 22:27:00 -04:00
Mario Toffia 67bbd2cf13 feat: serve custom domains over TLS as soon as they are created (#3086)
* feat(tls): record runtime-learned hostnames in the certificate metadata

* feat(tls): TlsCertificateManager.ensureHost grows the server certificate at runtime

Reissues the leaf from the local CA with the same key pair and the new SAN,
replaces certificate and metadata by atomic renames (the key file is never
rewritten), reloads the default TLS configuration and fires
CertificateUpdatedEvent so the HTTPS listener swaps immediately.
Names must be well-formed host names under a local suffix; anything else is
refused with a WARN and never throws.

* feat(tls): keep runtime-learned hostnames across a boot regeneration

* test(tls): ensureHost is visible to the next TLS handshake without a restart

* docs(tls): custom domains learned at runtime

* test(tls): pin the certificate contracts of a runtime reissue

The reissued leaf keeps the boot leaf's shape (subject, issuer, EKU, CA flag,
validity, new serial, configured names first), a wildcard covers exactly one
label, an IP allowed by the base URL becomes an iPAddress SAN, and a client
that verifies the server's identity for the new name (SNI plus RFC 6125
matching) fails before ensureHost, succeeds after it, and fails again after
reset, while the configured name keeps serving HTTPS throughout.

* fix(tls): retry a failed listener reload and keep served names across a boot

A name is known only once the HTTPS listener serves it: a reload that
returns false, a missing default TLS configuration or a failing listener
now leaves the in-memory state untouched, so the next ensureHost call for
that name writes and reloads again instead of reporting it as covered.

At boot, a SAN the served certificate carries beyond the metadata's
configured list is treated as learned, so a reissue whose metadata rename
did not complete cannot lose the name in a later regeneration.

The allow-list is checked after coverage, so a default SAN such as
host.docker.internal no longer logs a refusal on a no-op call.

Tests are split by concern: TlsCertificateManagerTest (reissue, reload,
reset, failure, races) and TlsCertificateManagerNameRulesTest over a
shared fixture; TlsConfigSourceLearnedHostnamesTest holds the boot paths.

* fix(tls): carry a name whose reload failed into later reissues and resets

The learned list now follows the files and the known set follows the
listener. A name written to disk but not yet served is kept by every
later reissue instead of being dropped when a second name is learned,
and a reset whose reload failed is retried by the next reset.

Two pre-existing em dashes in TlsConfigSource log messages replaced with
commas, as AGENTS.md asks.

* feat(acm): issue AMAZON_ISSUED and PRIVATE certificates from the local CA

RequestCertificate now returns a TLS server leaf (serverAuth and clientAuth)
signed by Floci's local root CA, and CertificateChain is that CA's PEM, the
same bytes GET /_floci/ca.pem serves. Certificate plus CertificateChain from
GetCertificate therefore build a chain that validates, as they do on AWS, for
both certificate types, and ExportCertificate returns the same chain. The
requested KeyAlgorithm is still honoured and DescribeCertificate reports the
CA as the issuer.

The bundled amazon-root-ca.pem and its startup check are gone: nothing Floci
issues chained to it, and the file was corrupt (its base64 payload could not
decode), so every GetCertificate handed out an unparsable chain.

AcmPaginationTest walks a store shared with every other ACM test class; its
page cap now leaves room for the suite to grow instead of failing once the
shared store passes fifty certificates.

* refactor(acm): drop the cosmetic Amazon issuer generator

CertificateGenerator.generateCertificate signed a leaf with its own key under a
CN=Amazon issuer DN that no client could ever verify. Its last production caller
now issues from the local CA, so the method and the DN are gone and the
self-signed builder no longer carries an issuer and CA flag that were always the
subject and true. Tests that only needed some certificate use the self-signed
generator; the ones that need a leaf that is not a CA issue it from a throwaway
CA.

* docs(acm): certificates chain to the local CA

Say that every issued certificate is signed by the local root CA, that
GetCertificate returns that CA as CertificateChain, and that trusting
/_floci/ca.pem once validates both the HTTPS endpoint and ACM certificates.

* test(acm): the SDK compatibility suite validates the certificate against its chain

GetCertificate's certificateChain() must contain the issuing CA and that CA
must verify certificate(), as on AWS. A chain that does not parse or does not
sign the leaf now fails the suite instead of passing a BEGIN CERTIFICATE check.

* docs(acm): say when the CA is created and what Issuer reports

ACM issuance now creates the local CA under {persistent-path}/tls/ on first
use, also with TLS off and in memory storage mode, and DescribeCertificate
reports the CA's name as Issuer where AWS reports Amazon. The CA javadoc no
longer calls ACM a later step.

* test(acm): pin key size, an imported chain and the persisted chain

The import fixture is now a server certificate from a throwaway CA, uploaded
with that CA as its chain, and GetCertificate must hand both back unchanged.
The RSA and EC chain tests also check the key size and curve, and the
persistence test checks the chain survives a restart.

* test(acm): the python compatibility suite verifies the certificate against its chain

The key-algorithm case checked the certificate's self-signature, which only
held while ACM certificates were signed by their own key under a cosmetic
issuer. On AWS, and now here, the signer is the issuing CA that GetCertificate
returns first in CertificateChain, so the case verifies that signature and the
issuer name instead.

* fix(acm): write EC private keys as PKCS#8 and classify keys by interface

JcaPEMWriter turned a JDK EC private key into a bare SEC1 structure with
no curve and no public half, which neither OpenSSL nor parsePrivateKey
could read, so every EC certificate stored an unusable key and
ExportCertificate on one failed. EC keys now go out as PKCS#8, RSA keys
stay PKCS#1 as AWS IoT hands them out, and a SEC1 key without a public
half parses through its private-key info.

Private keys are told apart by the ECKey interface rather than by name:
a BouncyCastle provider, when one is registered, names an EC key ECDSA.

* test(acm): AcmServiceTest pins issuance from the local CA

Service level, no Quarkus: every KeyAlgorithm yields a leaf of that key
signed by the CA with the CA PEM as chain and metadata read from the
certificate; PRIVATE is issued at once; a pending certificate already
holds its leaf and chain; an idempotent replay mints nothing; imports
keep their own chain; exports return the stored chain, also for EC
keys; sixteen concurrent requests each get their own valid certificate.

* feat(apigateway): serve a custom domain over TLS as soon as it is created

CreateDomainName hands the domain name to TlsCertificateManager.ensureHost
after the domain is stored, outside the uniqueness lock. The certificate
manager never throws, so the API response is unchanged.

* feat(iot): serve a customer-managed domain over TLS as soon as it is configured

CreateDomainConfiguration hands a customer-managed domain name to
TlsCertificateManager.ensureHost after the configuration is stored. A
configuration without a domain name describes the default endpoint and
registers nothing.

* feat(cognito): serve a custom domain over TLS as soon as it is created

CreateUserPoolDomain hands a custom domain to TlsCertificateManager.ensureHost
after the domain is stored. A prefix domain lives under amazoncognito.com on
AWS, a name Floci does not serve, and is left alone.

* docs: custom domains are served over TLS on creation

One sentence each in the API Gateway, IoT Core and Cognito pages, and the
TLS page now names the operations that add hostnames to the server
certificate.

* test(compat): custom domain reachable over TLS trusting only the ACM chain

RequestCertificate, CreateDomainName with regionalCertificateArn, then a TLS
handshake with SNI that trusts only the returned CertificateChain and
verifies the hostname. Probes for TLS on the endpoint host and port, because
the workflow hands the tests an http:// URL while Floci serves both, and
skips when the probe fails.

* docs(tls): say which ensureHost outcomes are logged as warnings

* test: pin the custom domain TLS hooks against the service contracts

Service tests for API Gateway, IoT Core and Cognito: the exact name is
handed over once, after the record is stored, with no service lock held
(a concurrent create must not wait for the TLS reload), and never for a
rejected request, an ENDPOINT configuration, an AWS-managed configuration,
a prefix domain or a later update or delete. A CloudFormation stack with
the three types registers every domain and a replacement, not an in-place
update or the delete. With TLS on, a client trusting only the ACM chain
reaches all three names by SNI with hostname verification, and a reset
takes them back.

* test(acm): build the InUseBy test service with the local CA

AcmInUseByTest landed on main with #3035 using the constructor that
predates the local CA; AcmService now takes the certificate authority
it issues from, so the test loads a throwaway CA in its temp directory
like AcmServiceTest does.

* test(cognito): request an issued ACM certificate in the custom domain TLS tests

Since #3035 a custom domain needs an issued ACM certificate, so the wire
test requests one and the service test stubs AcmService. Two new cases pin
that a certificate ACM does not know, or has not issued, is refused before
the hostname is registered.

* test(cognito): a concurrent create does not wait for the TLS reload

The custom domain hook sits after the domain lock #3095 introduced, so a
second create is not queued behind the HTTPS listener switch; pinned the
same way as for API Gateway and IoT Core. The routing test #3095 added
constructs the service with the certificate manager as well.
2026-09-05 22:05:40 -04:00
Franklin G. Mendoza 1bf7494e99 feat(ssoadmin): add permission sets and assignments (#3103)
* feat(ssoadmin): add permission sets and assignments

* test(ssoadmin): validate account assignments with sdk

* fix(ssoadmin): complete pagination and lifecycle contracts
2026-09-05 21:46:20 -04:00
Matheus Oliveira c22ded931a fix(rds): run IAM PostgreSQL sessions as the role named in the token (#3106)
* fix(rds): run IAM PostgreSQL sessions as the role named in the token

The proxy validated the token and then connected as master. It now hands
the session over with SET SESSION AUTHORIZATION, so the role's own
privileges apply and an unknown role is refused.

Closes #3087

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* fix(rds): keep IAM PostgreSQL sessions from switching back to master

The backend connection is master underneath, so RESET SESSION AUTHORIZATION
regained superuser. The proxy now watches PostgreSQL's own
session_authorization report and terminates the session when it changes.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

---------

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-05 21:24:39 -04:00
David LopesandPriamo 5719e65c3c fix(rds): preserve aurora engine identity in parameter group names and managed secrets (#1920)
Aurora instances already round-trip their engine string correctly in
DescribeDBInstances/DescribeDBClusters via the existing engineIdentifier
field (#1829), but two other places still derived the engine string from
the DatabaseEngine enum (which only distinguishes postgres/mysql/mariadb,
not their Aurora variants): the default DBParameterGroupName and the
managed master-user secret's "engine" field. Both now prefer
engineIdentifier, matching the pattern already used for the Engine XML
element.

Also fixes the default DBParameterGroupName's version suffix to use
major.minor for the MySQL family (default.aurora-mysql8.0) instead of
always truncating to the major version alone (which is only correct for
the Postgres family, e.g. default.aurora-postgresql16) - a pre-existing
bug newly reachable now that Aurora MySQL instances get a distinct,
correctly-hyphenated prefix.

Rejects the bare legacy "aurora" engine identifier instead of silently
mapping it to aurora-mysql: AWS retired that identifier in Feb 2023 and
now rejects it with InvalidParameterValue for new instances/clusters.

Fixes #1918.

Co-authored-by: Priamo <pgermosen@gmail.com>
2026-09-05 21:23:27 -04:00
Guilherme Scaranse a9df872956 fix(dynamodb): route Kinesis CDC to the table owner's account and retry failed forwards (#3063)
* fix(dynamodb): resolve Kinesis CDC forwards against the table owner's account

DynamoDB->Kinesis CDC forwarding resolved the target stream against the ambient
account. Out of request scope -- notably the TTL sweep, which forwards a REMOVE per
expired item after the request completes -- the ambient account falls back to the
default, so CDC records could be written into the default account's same-named stream
(a cross-tenant leak) or dropped as ResourceNotFound. This was a live bug on the TTL
path.

- Add KinesisService.putRecordForAccount: resolve, append and persist against a
  specified account (a null account preserves the ambient behavior). It keeps the
  per-stream append lock keyed on region+stream (not account) so explicit-account
  appends stay serialized with request-path producers, preserving the concurrent-
  append fix; and it migrates a legacy unprefixed stream into the account partition on
  write (ownership validated by the stream's ARN/account) so installs upgraded from
  pre-multi-account storage keep forwarding.
- KinesisStreamingForwarder.forward now takes the table owner account and forwards via
  putRecordForAccount.
- DynamoDbService passes the owner account at every forward site: the request paths use
  the request account; the TTL sweep uses the account it derives from the storage key.

AWS Compatibility: CDC records land in the table owner's stream, matching AWS
per-account isolation. Known residual: the DynamoDB Streams subsystem
(DynamoDbStreamsService) has the same ambient-account exposure and is not addressed
here.

* fix(dynamodb): retry and park failed Kinesis CDC forwards instead of dropping them

Change data capture forwarding to a Kinesis streaming destination dropped the
change event whenever putRecord threw, so a transient Kinesis error silently
lost DynamoDB INSERT/MODIFY/REMOVE (and TTL) events.

Forwarding is now a bounded best-effort, in-process retry queue. The write path
only enqueues (it never blocks or throws), and a per-destination single-flight
background drain performs the send outside the lock:

- transient/unknown failures retry with capped exponential backoff (250ms->8s,
  up to 10 attempts) instead of dropping on the first exception;
- deterministic terminal failures (Validation/InvalidArgument) drop only the
  poison record without wedging the queue behind it;
- per-destination FIFO is preserved across retries;
- the buffer is bounded (1000 records per destination, oldest evicted on
  overflow);
- after the retry budget is exhausted the episode gives up, and a later event
  starts a fresh episode that self-heals once the stream recovers.

Disabling a destination or deleting the table discards its buffered records and
stops all future sends for it (a send already in flight may still complete).
Dropped records are counted and per-destination delivery health
(forwarded/retried/dropped, queue depth, last error) is tracked for inspection.
Buffered records are in memory only and are not durable across restarts.

* style(dynamodb): remove em dashes from lines this branch adds

AGENTS.md requires colons, commas or periods instead of em dashes. Comment,
javadoc and docs prose only; no code or string literals change.

* fix(kinesis): resolve the stream inside the append lock, not before it

putRecordInternal resolved the stream before taking the per-stream monitor. That
resolve is not a read: for a legacy unprefixed stream it migrates the entry, and
the two migration paths disagree. The explicit-account path moves it into the
account partition behind an ownership predicate and is synchronized on the
backend, while AccountAwareStorageBackend.get adopts it into the request account
with no ownership check and no synchronization. Racing outside the monitor, an
ambient producer and the owner's CDC producer could migrate the same stream
concurrently, forking it across partitions or adopting it into the default
account, which is the cross-account leak this branch set out to close.

Resolve and validate inside the monitor instead. The separate pre-lock resolve is
gone, so there is one resolve rather than two, and deleteStream holding the same
monitor still makes a concurrently deleted stream fail cleanly.

Residual, pre-existing and not addressed here: AccountAwareStorageBackend.get
still adopts an unprefixed entry into the request account unchecked and
unsynchronized for callers that do not hold a per-resource lock.

* fix(storage): migrate a legacy unprefixed entry under the account monitor

AccountAwareStorageBackend has two migrate-on-read paths that disagree.
getForAccountMigratingLegacy is synchronized and ownership-gated; get is neither.
Because get does not take the monitor the migrating variants hold, two readers
resolving the same pre-multi-account key from different account contexts can each
copy it into their own partition, and the two copies then diverge independently.

The migration branch now runs under that same monitor and re-checks the prefixed
key inside it, so a reader that lost the race returns the winner's entry instead
of migrating again. The hit path stays outside the monitor, so only a miss pays
for it.

This closes the fork for every caller rather than one at a time. The preceding
commit fixed it for KinesisService.putRecordInternal by resolving inside the
append lock, but the Kinesis batch PutRecords handler and roughly twenty read
paths (DescribeStream, GetRecords, GetShardIterator, tag reads) resolve without
any per-resource lock and were still exposed.

Not addressed here: get still adopts an unprefixed entry into whatever account
the request context resolves to, with no ownership check. get is generic over the
stored type and has no notion of an owner, which is why getForAccountMigratingLegacy
takes the predicate from its caller. Gating it generically needs a per-resource-type
predicate and is filed separately.
2026-09-05 21:20:44 -04:00
Niels Kootstra 148ea6f3db fix(rds): bound PostgreSQL handshake packet lengths (#3102) 2026-09-05 21:12:30 -04:00
Franklin G. Mendoza 6a728f1b9f feat(cloudwatchlogs): add cross-account policy operations (#3089)
* feat(cloudwatchlogs): add cross-account policy operations

* fix(cloudwatchlogs): align cross-account policy contracts

* fix(cloudwatchlogs): enforce account policy quotas

* fix(cloudwatchlogs): validate field index policy scopes

* fix(cloudwatchlogs): parse field index criteria safely

* fix(cloudwatchlogs): align field index quota parsing
2026-09-05 21:08:07 -04:00
lex00 1aa981fef2 fix(ec2,ecr,eks,elasticache,msk,opensearch): degrade gracefully with no Docker daemon (#2975)
* fix(ec2,ecr,eks,elasticache,msk,opensearch): degrade gracefully with no Docker daemon

Extends the daemonless degradation pattern #2386 established for MemoryDB,
Neptune and DocDB to the remaining container-backed services. Create paths
probe the daemon on failure, keep serving metadata, and log the outage once;
a failure with a reachable daemon still propagates.

* fix(opensearch,msk): keep the readiness pollers when the daemon is reachable

Create set the terminal state before the container started, which orphaned the readiness pollers. The terminal state is now set only in mock mode or when the daemon is unreachable, matching EKS. ElastiCache stops a partially created container before degrading to metadata.

* fix(elasticache): fail the create when a container was already started

Degrading to metadata now happens only when no container was created. A failure after creation runs the cleanup and rethrows. The service rollback then runs and no available group is persisted without a container.

* test(elasticache): stub tryStart in the parameter group reservation tests

The three tests from #3023 stubbed start, which createReplicationGroup no longer calls on this branch.
2026-09-05 21:01:38 -04:00
Ammar 43e2a48263 fix(lambda): deliver extension INVOKE when the runtime receives the invocation (#3070)
* fix(lambda): deliver extension INVOKE when the runtime receives the invocation

* test(lambda): cover extension INVOKE delivery at runtime dispatch time

Migrates the two existing extension-event tests to poll
/runtime/invocation/next before asserting delivery, since
notifyExtensionsOfInvoke() now fires from sendInvocation() rather than
enqueue(). Adds coverage for the remaining #2573 cases: a not-yet-polling
extension still receiving its queued event, the warm dispatch path, no
duplicate INVOKE on write-failure requeue, the stopped guard racing
quiesce()'s SHUTDOWN fan-out, and pinning that a runtime which never polls
never triggers the extension event.

* fix(lambda): remove em-dashes from new test comments

Greptile flagged four comments added in the previous test commit for
using em-dashes, which AGENTS.md's documentation style rule prohibits
repo-wide. Rewords each to use a comma or period instead; no behavior
or assertion changes.
2026-09-05 20:54:14 -04:00
Franklin G. Mendoza b199894e19 feat(controltower): add enabled control operations (#3056)
* feat(controltower): add enabled control operations

* fix(controltower): harden baseline state and pagination

* fix(controltower): register persisted control model
2026-09-05 20:19:56 -04:00
Mario Toffia 615056999e feat(acm): map CertificateExport and CertificateTransparencyLoggingPreference onto the certificate options (#3111)
The AWS::CertificateManager::Certificate provisioner accepted both properties
and ignored them, so every certificate a stack created carried the ACM
defaults. Both now become the certificate's Options, with the CloudFormation
defaults (export DISABLED, transparency logging ENABLED) when absent, and a
value other than ENABLED or DISABLED fails the resource before any ACM call.

Updates follow the registry schema: CertificateExport is createOnly, so a
change replaces the certificate through the existing delete-or-unwind path,
while a changed CertificateTransparencyLoggingPreference calls
UpdateCertificateOptions on the existing certificate and keeps its ARN.
Export is never sent to UpdateCertificateOptions, since ACM does not allow
changing it once the certificate exists.

CertificateAuthorityArn stays ignored; private CA is not emulated.
2026-09-05 18:42:39 -05:00
Matheus Oliveira d2d7eb4131 fix(cloudformation): refuse UpdateStack on a ROLLBACK_COMPLETE stack (#3104)
AWS treats a stack that rolled back after a failed create as terminal, so UpdateStack and an UPDATE change set are now refused with the ValidationError real CloudFormation emits.

Closes #3097

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-05 17:37:29 -05:00
soreavis fcb5bd02c0 fix(kinesis): reject non-string tag members instead of coercing them (#3099)
CreateStream, AddTagsToStream and RemoveTagsFromStream read tag
values and TagKeys entries with asText(), so a number, boolean or
null member was stored as its text ("5", "true", "null") and an
object or array member as the empty string, rather than rejected.
AWS models Tags as a map of string values and TagKeys as a list of
strings, so none of those shapes is a valid request. The CreateStream
tag change (#2494) named this as the separate fix to land on its own,
and the SES tag parser already answers the same shapes with
SerializationException (#2512).

Reject a present-but-non-string tag value or TagKeys entry, a Tags
member that is not an object, and a TagKeys member that is not a
list, with a 400 SerializationException; a missing or null member
still yields no tags, as before. The tags are parsed before the
stream is created or looked up: CreateStream would otherwise leave
an untagged stream behind on a rejected Tags member, and a malformed
member is answered ahead of the not-found or in-use error a bad
stream raises.
2026-09-05 17:09:15 -04:00
Niels Kootstra 43cdbe234f fix(ec2): honor AMI architecture for containers (#3096)
* fix(ec2): honor AMI architecture for containers

* fix(ec2): preserve created AMI architecture
2026-09-05 17:04:41 -04:00
Mario Toffia b4d80a5596 feat(cognito): route custom domains by Host (#3095)
* feat(cognito): route /oauth2 requests on a custom domain by Host

CognitoCustomDomainFilter (PreMatching, priority 12) resolves the request
Host against the domain store and rewrites /oauth2/token and
/oauth2/userInfo onto the /cognito-idp/oauth2 handlers. The pool the domain
belongs to travels in a request property, so the controllers pin exactly the
pool the filter matched and a caller cannot supply it. The token endpoint
refuses a client of another pool with invalid_client and userInfo refuses a
token of another pool with invalid_token, as AWS does. The lookups scan
every account because an OAuth call carries no SigV4 account.

The discovery document advertises https://<domain>/oauth2/... for a pool
with a custom domain. S3VirtualHostFilter skips a request the Cognito
filter routed, the way it already skips CloudFront ones, since a custom
domain under a Floci suffix looks like a bucket host.

* docs(cognito): custom domain routing

* fix(cognito): run custom domain requests in the domain's account and keep domain names unique

A request on a custom domain carries no AWS credential, so AccountContextFilter
put it in the default account and the client, pool and user lookups missed a
domain created under another account. The Cognito filter now pins the domain's
account in a request property that AccountContextFilter honours before header
resolution. Domain creation checks the name across every account, as AWS's
single domain namespace does, and a name two accounts already hold from older
data is not routed.

Also adds the OAuth contract tests for the routed endpoints (client_secret_post,
error codes, token claims, userInfo refusals, unserved paths, prefix domains,
interleaved requests on several threads) in a second integration class.

* fix(cognito): make the domain uniqueness check and write one step

Two accounts creating the same custom domain at once both passed the
cross-account scan and wrote under their own account-prefixed keys, leaving a
name that routing then refused as ambiguous. The check and the write now run
under one lock, the way identity-provider mutations already do. A 16-thread
unit race and a two-account integration race pin exactly one owner.
2026-09-05 16:56:01 -04:00
Niels Kootstra 8686651de1 fix(appconfigdata): honor requested poll interval (#3092) 2026-09-05 15:53:16 -04:00
Kenshin Okinaka 15b401032d refactor(ses): move the tag dispatch helpers into their domain services (#3090)
* refactor(ses): move the tag dispatch helpers into their domain services

* docs(ses): move the stranded tenant-ARN comment onto ResourceRef
2026-09-05 15:41:46 -04:00
Mario Toffia 3c6c005ff1 feat(tls): a local root CA that signs Floci's server certificate (#3078)
* refactor(acm): one issuer-signing primitive in CertificateGenerator

buildCertificate always signed with the subject's own key. signCertificate now
takes the issuer DN and key explicitly; generateCaCertificate and
generateIssuedCertificate sit on top of it, with serverAuth or clientAuth EKU on
leaves. Existing public methods keep their signatures and output; metadata now
follows ACM: colon-separated hex serial and the certificate's real signature
algorithm in upper case.

* refactor(cloudhsmv2): sign emulated hardware certificates through CertificateGenerator

Deletes the private generateCert copy; the shared primitive also marks the two
CA levels of the chain as CAs, which the old code did not.

* refactor(acm): normalize imported certificate metadata and check issued key relationships

ImportCertificate now stores the serial as colon-separated hex and the
signature algorithm in upper case, the same shape generated certificates
report. generateIssuedCertificate verifies the leaf against the issuer's
certificate and refuses a supplied key pair whose halves do not match.

* refactor(acm): refuse a supplied key pair that is not of the requested algorithm

* refactor(acm): match a supplied EC key pair by named curve, not field size

* feat(tls): FlociCertificateAuthority, a persistent local root CA

Loads or creates {persistent-path}/tls/floci-root-ca.{crt,key} with an
owner-only key, signs serverAuth and clientAuth leaves through
CertificateGenerator, and regenerates with a WARN when the pair is corrupt,
expired, not a CA, or the key does not match the certificate. A CDI producer
exposes the same pair to beans, using the directory the config bootstrap used.

* feat(tls): issue the HTTPS server certificate from the local CA

The leaf is floci-server.{crt,key}, signed by floci-root-ca; a pre-CA
self-signed leaf, a leaf from a regenerated CA and an expired leaf are replaced
on boot. Published through quarkus.tls.key-store.pem.0.* so the TLS registry
owns it and can reload it. The server key is written owner-only.

* feat: serve the local CA at GET /_floci/ca.pem

TlsLocalCaIntegrationTest boots the HTTP server on the TLS registry keys and
completes a handshake trusting only the PEM this endpoint serves.

* fix(lambda): inject the local root CA into containers instead of the server leaf

The leaf will be reissued as SANs grow; pinning it would break after the first
reissue. The CA is stable.

* docs(tls): trust the local CA once instead of disabling verification

* feat(tls): create private key files owner-only and log why a CA was regenerated

* feat(tls): serve the user certificate from ca.pem in custom-cert mode, log the CA fingerprint

With floci.tls.cert-path set, GET /_floci/ca.pem returns that file, the same
file the Lambda launcher mounts, and creates no local CA. The CA's SHA-256
fingerprint is logged at startup so an out-of-band copy can be checked, and a
file system without POSIX permissions gets a WARN instead of a silent default.

* feat(tls): ca.pem is a bundle in custom-cert mode; clear the bootstrap directory on every boot

With a user-provided certificate the endpoint returns that file followed by
the local CA, so both the HTTPS endpoint and anything Floci issues validate
from one file. TlsConfigSource resets its resolved directory on construction
so a later boot in the same JVM with TLS off or a user certificate never
reuses a stale value.

* docs(lambda): drop two em-dashes from the CA trust javadoc

* test(tls): cover an expired leaf, an expired CA, a missing CA key and the producer's directory choice

* docs(tls): describe IoT device certificates as a follow-up of the local CA
2026-09-05 15:35:30 -04:00
Mario Toffia 4e05fdf582 refactor(acm): one issuer-signing primitive in CertificateGenerator (#3077)
* refactor(acm): one issuer-signing primitive in CertificateGenerator

buildCertificate always signed with the subject's own key. signCertificate now
takes the issuer DN and key explicitly; generateCaCertificate and
generateIssuedCertificate sit on top of it, with serverAuth or clientAuth EKU on
leaves. Existing public methods keep their signatures and output; metadata now
follows ACM: colon-separated hex serial and the certificate's real signature
algorithm in upper case.

* refactor(cloudhsmv2): sign emulated hardware certificates through CertificateGenerator

Deletes the private generateCert copy; the shared primitive also marks the two
CA levels of the chain as CAs, which the old code did not.

* refactor(acm): normalize imported certificate metadata and check issued key relationships

ImportCertificate now stores the serial as colon-separated hex and the
signature algorithm in upper case, the same shape generated certificates
report. generateIssuedCertificate verifies the leaf against the issuer's
certificate and refuses a supplied key pair whose halves do not match.

* refactor(acm): refuse a supplied key pair that is not of the requested algorithm

* refactor(acm): match a supplied EC key pair by named curve, not field size
2026-09-05 15:27:17 -04:00
Scott Steen 0471d6f488 feat(bedrock-runtime): stream ConverseStream incrementally (#3043)
ConverseStream previously buffered the whole proxied response, translated it in
one shot, and returned it as a single byte[]. Both backends now write frames
through a JAX-RS StreamingOutput as they're known, and the proxy backend reads
the upstream SSE response via HttpResponse.BodyHandlers.ofLines() instead of
ofString() - text deltas reach SDK clients as the model generates them instead
of landing all at once when the response finishes.

Once the StreamingOutput starts writing, JAX-RS has already committed the 200
response, so a failure discovered only after streaming begins - a stream that
never reaches a finish_reason or "[DONE]" (upstream connection dropped
mid-generation) - can no longer become an HTTP error status. It's now reported
as a modelStreamErrorException event, the same wire shape (:message-type:
exception, :exception-type: <name>) and modeled exception real Bedrock uses
for a mid-stream failure, verified to decode correctly through
BedrockRuntimeAsyncClient's generated ConverseStreamResponseHandler. A stream
that completes normally (finish_reason or "[DONE]" seen) with no content is
now treated as a legitimate empty completion rather than an error, matching
real Bedrock.

Added a compatibility-tests/sdk-test-java case exercising
BedrockRuntimeAsyncClient.converseStream end to end, proving the emitted
event-stream frames decode correctly through the real AWS SDK rather than
only Floci's own byte-level assertions.
2026-09-05 15:17:39 -04:00
Mihai BlidaruandMihai Blidaru 724be0a6a7 fix(s3): return composite multipart checksums and match S3 on UploadPart, GetObjectAttributes and CopyObject responses (#3093)
* fix(s3): return composite checksums for multipart uploads

CompleteMultipartUpload stored the checksum of the whole object but labelled
it COMPOSITE, so clients that recompute the composite value from the part
checksums, as the AWS documentation describes, never matched it.

Follow the AWS checksum type rules, verified against real S3:

- SHA1/SHA256 are always COMPOSITE, CRC32/CRC32C default to COMPOSITE and
  CRC64NVME is always FULL_OBJECT. x-amz-checksum-type on CreateMultipartUpload
  selects FULL_OBJECT for CRC32/CRC32C; incompatible combinations fail with
  InvalidRequest, and the response echoes x-amz-checksum-algorithm/-type.
- The composite value is the algorithm applied to the concatenated binary part
  checksums, Base64 encoded, with a "-<part count>" suffix. It is returned by
  CompleteMultipartUpload, HeadObject and GetObject (with x-amz-checksum-type),
  while GetObjectAttributes omits the suffix, as AWS does.
- A checksum sent on CompleteMultipartUpload is validated against the stored
  type: a mismatching value is a BadDigest (the composite is accepted with or
  without its suffix), a checksum type different from the one the upload was
  created with is an InvalidRequest, per-part checksums in the request body
  that do not match the uploaded parts are an InvalidPart, and a COMPOSITE
  upload completed without the checksum of every part is an InvalidRequest
  (FULL_OBJECT uploads need none, as on S3). A non-numeric
  PartNumber is a MalformedXML instead of a 500.
- UploadPart echoes the part checksum (x-amz-checksum-<algorithm>) when the
  upload declared an algorithm, as S3 does; without one no header is returned.
- CopyObject writes a single object without a part manifest; a composite source
  gets a full-object checksum recomputed with its algorithm, and CopyObjectResult
  carries the checksum elements, matching AWS.
- GetObjectAttributes lists part-level checksums only for COMPOSITE objects: a
  FULL_OBJECT multipart object reports its PartsCount alone and a single-part
  object has no ObjectParts element.

The algorithm and type rules live in two new enums, ChecksumAlgorithm and
ChecksumType, parsed once from the request headers; S3Checksum builds the
full-object, composite and GetObjectAttributes views of a checksum.

The boto3 compatibility suite gains multipart upload_file cases for SHA256 and
for the SDK's default CRC32, asserting the composite value and the part list.

The S3 docs drop the stale note that checksum responses focus on SHA-1 and
SHA-256 (CRC32, CRC32C and CRC64NVME have been supported since #877) and list
the AWS algorithms Floci rejects.

* fix(s3): return the GetObjectAttributes ETag without quotes

S3 returns the ETag element of GetObjectAttributes without the surrounding
quotes that HeadObject, ListParts and CompleteMultipartUpload keep. Verified
against real S3 with the same object: head_object gives "af3c...-3" while
get_object_attributes gives af3c...-3, and the AWS CLI reference shows the same
in its get-object-attributes example. Floci echoed the quoted value, so a client
comparing both saw different strings on Floci and equal ones nowhere.

* fix(s3): give a copied object its own ETag

CopyObject kept the ETag of the source, so the copy of a multipart object
carried the "<md5-of-md5s>-N" value of its parts. S3 writes a copy as a single
object and returns the MD5 of the whole content as its ETag, in CopyObjectResult
and HeadObject alike (verified against real S3: source "af3c...-3", copy
"a5f04f..."). The copy now keeps the ETag storeObject computes.

* fix(s3): send CopyObjectResult as application/xml

The CopyObject response carried Content-Type: text/plain;charset=UTF-8 for an
XML body. S3 labels it application/xml like every other XML response.

* test(s3): cover multipart checksums in every SDK compatibility suite

Each SDK implements flexible checksums differently, so the multipart flows are
exercised per client rather than once: the Go transfer manager (what
terraform-provider-aws uses), @aws-sdk/lib-storage for Node, the Java SDK v2 both
low-level and through S3TransferManager on the multipart-enabled async client, the
AWS CLI (s3api, aws s3 cp --checksum-algorithm and a plain aws s3 cp that goes
multipart on its own) and boto3. Every case asserts the composite or full-object value computed in the
test itself, the UploadPart echo, the suffix-less GetObjectAttributes checksum
and unquoted ETag, the rejected Complete without part checksums, and the copy
of a multipart object as a single full object with its own ETag. The default
algorithm cases accept whatever the SDK version declares (CRC32 composite or
full object, or none) and check the stored value against it.

* test(terraform): upload a large aws_s3_object with Terraform and OpenTofu

The IaC suites created buckets but never an object, so the code path that
surfaced the composite checksum bug, an aws_s3_object above the provider's part
size uploaded through the SDK transfer manager, was not covered. Both suites now
upload a 12 MiB file generated by the test setup with checksum_algorithm SHA256
and check that HeadObject reports a COMPOSITE checksum equal to the composite
computed locally over the part sizes GetObjectAttributes lists, that the state
attribute holds the same value, and that re-planning the object shows no drift.

compat-opentofu moves to the same aws-cli image as compat-terraform (2.34.32):
2.15 predates the S3 checksum type and cannot show ChecksumType in its output.

* fix(s3): reject x-amz-checksum-type without a checksum algorithm

CreateMultipartUpload only parsed x-amz-checksum-type when an algorithm was
declared, so a type sent on its own, valid or not, was silently ignored. S3
validates the header regardless: an unknown value is InvalidRequest "Value for
x-amz-checksum-type header is invalid." and a valid one without an algorithm is
InvalidRequest "The x-amz-checksum-type header can only be used with the
x-amz-checksum-algorithm header." (both verified against real S3).

* test(s3): log cleanup failures in the multipart checksum compat tests

The Java, Node and Go cases swallowed errors while deleting their objects and
bucket. They now report what could not be deleted and why, so a leftover is
diagnosable instead of silent.

---------

Co-authored-by: Mihai Blidaru <mihai.blidaru@lynxfctech.com>
2026-09-05 15:12:13 -04:00
Mario Toffia ebdf092cce feat(iot): firehose and cloudwatchLogs rule actions (#3013)
* feat(iot): firehose and cloudwatchLogs rule actions

A topic rule can now deliver to a Kinesis Data Firehose delivery stream
(separator appended to each record, batchMode splitting a JSON array
into one record per element) and to CloudWatch Logs (one log event per
publish, or per array element with batchMode, in a stream named after
the rule that is created in the log group on first use).

* fix(iot): take timestamp and message from each batched cloudwatchLogs element and check the firehose separator

With batchMode the cloudwatchLogs action wrote every array element as one
log event whose message was the element's JSON text and whose timestamp was
the publish time. AWS requires a batched payload to be an array of
{"timestamp": <epoch ms>, "message": "<text>"} objects and takes both from
each element. The action now does the same; an element without a numeric
timestamp is stamped with the publish time and one without a message is
logged as its JSON text, so a batch that ignores the format still lands.

CreateTopicRule and ReplaceTopicRule reject a firehose separator that is
not a newline, tab, Windows newline or comma, the FirehoseSeparator pattern
of the IoT API model, with InvalidRequestException.
2026-09-05 14:02:24 -05:00
Vũ Thế Huy 173ff45b12 fix(elasticache): resolve order-dependent crossGroupAuthIsRejected test failure (#1991) (#3074)
* fix(elasticache): fix order-dependent crossGroupAuthIsRejected failure and handle proxy socket closing cleanly

* fix(elasticache): address review feedback on socket cleanup logging and test isolation

* fix(elasticache): use JBoss Logger and verify cleanup status in integration test
2026-09-05 14:04:43 -04:00
Matheus Oliveira 37faaa8abe feat(kms): support ImportKeyMaterial for Origin=EXTERNAL keys (#3068)
CreateKey accepts Origin=EXTERNAL, GetParametersForImport issues a real RSA
wrapping key, and ImportKeyMaterial unwraps and installs the material.
Expiry and DeleteImportedKeyMaterial return the key to PendingImport.

Fixes #1916

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-05 14:00:44 -04:00
Franklin G. Mendoza 532e27986e feat(servicequotas): add quota request history lookup (#3054)
* feat(servicequotas): add quota request history lookup

* fix(servicequotas): validate history tokens and quota scope
2026-09-05 13:52:22 -04:00
Facundo ParedesandFacundo Paredes a31a9599fd fix(cloudformation): reconcile AWS::Pipes::Pipe on UpdateStack (#2970)
* test(cloudformation): pin UpdateStack over AWS::Pipes::Pipe

An unchanged pipe name must update the pipe instead of calling createPipe
again, a changed Source is refused as replacement worthy, and a rename
creates the replacement before deleting the original. The three existing
PipesCfnProvisioner cases move out of LeafCfnProvisionerTest so the class
has one test file.

* fix(cloudformation): reconcile AWS::Pipes::Pipe on UpdateStack

provision() re-runs for every resource on every UpdateStack, so a pipe
already on file under the same name went back through createPipe and the
stack rolled back with ConflictException. It is now updated in place from
the prior physical id. A changed Source is create-only on the resource and
is refused with a ValidationError instead of replacing the pipe, and a
rename creates the replacement before deleting the original.

* test(cloudformation): delete the pipe update stack at the end of its case

The pipe survived the case in the shared emulator, and PipesIntegrationTest
listPipes counts pipes globally, so it saw three where it expects two. The
case now deletes its stack and asserts the pipe is gone.

* test(cloudformation): pin the pipe update path on tags, Source and failed lookups

A rename whose deletePipe throws still completes, a describePipe error that
is not the not-found one propagates unchanged, an absent or blank Source
reports the required property fault the create path reports, and the tags
the template declares reach the pipe on a same name update.

* fix(cloudformation): reconcile pipe tags and report the real fault on update

Four defects on the pipe update path. A rename whose deletePipe failed
propagated after the replacement was already created, orphaning it with no
stack resource pointing at it; that cleanup is now best effort and logged,
as it is for AWS::Kinesis::Stream. A describePipe failure that was not the
not-found one fell into the create arm and surfaced as ConflictException,
hiding the real error. A template with no Source was diagnosed as a
replacement worthy Source change instead of the missing required property
the create path reports. Tags declared in the template went stale, since
nothing reconciled them; they now travel through the TagHandler calls
PipesService already exposes.

* fix(cloudformation): restore the pipe when a failed update rolls back

updatePipe lands before the tag calls it cannot carry, so a listTags,
untagResource or tagResource that failed left the pipe holding the new
configuration under tags that were neither the old nor the new set, and the
stack rolled back without putting it back. CloudFormation restores every
resource an update touched, so the pipe now snapshots what it carries before
its first mutating call and restores from that snapshot.

The snapshot holds the properties updatePipe accepts plus the tags and the
region; Name, Source and Arn are create-only or derived. It describes the
update in flight: provision drops the one an earlier update left behind
before it decides whether it mutates the pipe at all.

CfnResourceProvisioner gains a rollbackUpdate hook that answers false by
default, and CloudFormationResourceProvisioner delegates to the provisioner
registered for the resource type before its own Step Functions arm, so a pipe
owns its rollback instead of adding a branch to that class.

* test(cloudformation): pin the pipe rollback on the properties the failed update added

* fix(pipes): clear the properties a failed update added when the pipe is restored

The rollback path now writes the snapshotted configuration in full through restorePipe,
while updatePipe keeps the UpdatePipe contract of leaving an unset property alone.

* test(pipes): pin both meanings an unset property carries on the pipe writers

* test(cloudformation): pin the pipe rename cleanup on the committed update cleanup path

* fix(cloudformation): delete the pipe a rename displaces on the committed update cleanup

The pipe left under the prior name was deleted inside provision, with any failure
swallowed at warn. It now travels the same update cleanup path every replaced
resource takes: three attempts after the stack update commits, DELETE_IN_PROGRESS
then DELETE_COMPLETE or DELETE_FAILED, and an orphan named in the stack's
UPDATE_COMPLETE status reason.

CfnResourceProvisioner gains the updateCleanupPhysicalId, completeUpdate,
hasReplacementUpdate and clearUpdate hooks beside rollbackUpdate, and the four
methods on CloudFormationResourceProvisioner ask the registry before falling
through to the Step Functions arm. UpdateCleanupResult moves to the provisioners
package so an extracted provisioner can return one.

* test(cloudformation): pin the cleanup-in-progress status a pipe rename puts the stack in

* test(cloudformation): pin the pipe rename rollback of a failed stack update

An update that renames a pipe and fails at a later resource must end with the
stack resource pointing at the prior pipe, the replacement gone and no resource
reported as UPDATE_FAILED. The guard case pins the refusal: a pipe standing under
the replacement's name that this update did not create is not deleted.

* fix(cloudformation): roll back a pipe rename to the pipe it displaced

A rename replaces the pipe, and an update that fails at a later resource never
commits that replacement. The prior pipe is still on file, since the rename only
records it for the committed cleanup, so rollbackUpdate points the stack resource
and its Arn attribute back at it, deletes the replacement, and spends the rename
record: a rollback owes no committed cleanup, and a stale record would delete the
pipe the rollback just restored.

The pipe about to be deleted is identified by the creation time recorded when this
update created it, which the rename record now carries beside the displaced name.
Any other pipe standing under that name belongs to somebody else, so the rollback
refuses and leaves both pipes in place rather than guess.

UpdateReplacePolicy Retain does not reach that delete: it governs the pipe a
committed replacement displaces, which this path keeps by making it the resource's
physical id again, while the replacement is a resource this update created.

* test(cloudformation): pin the pipe restore a failed tag reconciliation owes

A tag call that fails after updatePipe has written the pipe leaves it carrying
the update the stack disowns. One test pins the pipe coming back to its prior
description and tags with the stack reporting UPDATE_ROLLBACK_COMPLETE, the
other pins UPDATE_ROLLBACK_FAILED naming the pipe when the restore fails too.

* fix(cloudformation): restore a pipe eagerly when its own update fails

updateExistingPipe writes the pipe through updatePipe and then through the tag
calls, so a failure among them left the pipe carrying the update the stack was
about to disown: the snapshot that would undo it rides on the provisioner's own
copy of the resource, which the service discards when it puts the previous
resource back, and the restored marker it then sets short-circuits the rollback
hook. The reconcile-in-place path now honours the contract the rename path
already did and restores from that snapshot inside provision, spending it there,
while the failure that interrupted the update is what reaches the caller.

A restore that fails leaves the pipe in a configuration nobody recorded, so its
reason goes on the resource under the rollback-failure marker and the stack
lands on UPDATE_ROLLBACK_FAILED naming the pipe instead of reporting a clean
rollback; the restore failure travels with the original as suppressed.

The rollback hook keeps the case it was written for, a failure at a later
resource, where this pipe's update committed and its snapshot is still unspent.

* test(cloudformation): pin the displaced pipe an interrupted rename cleanup leaves behind

A cleanup phase that stops before it deletes the pipe a rename displaced leaves
the stack in UPDATE_COMPLETE_CLEANUP_IN_PROGRESS with the pipe alive. The next
update owes that deletion, and the pipe is gone by the time the stack reports
UPDATE_COMPLETE.

* fix(cloudformation): finish an interrupted cleanup before the next update runs

The cleanup phase of a committed update marks the stack
UPDATE_COMPLETE_CLEANUP_IN_PROGRESS and persists it before any delete runs, so a
phase that stops halfway leaves the marker on the resource with the displaced
entity still alive. Provisioning drops that marker as its first act, and neither
the update nor a later DeleteStack names the displaced entity again, so it
leaks.

An update now finishes that pending cleanup before it parses the template: a
marker present at entry belongs to a phase that never ended, since a phase that
finishes clears it and so does a rollback. Whatever the resumed cleanup cannot
delete joins this update's own cleanup failures in the UPDATE_COMPLETE status
reason.

* test(cloudformation): pin the orphan a resumed cleanup gives up on

The update that resumes an interrupted cleanup reports what that cleanup could
not delete. A resumed deletion that fails all three attempts leaves the stack
UPDATE_COMPLETE naming the pipe in the status reason, with a DELETE_FAILED event
carrying the failure.

* test(cloudformation): pin the prior pipe a rollback keeps when the replacement delete fails

* fix(cloudformation): keep the prior pipe when a rename rollback cannot delete the replacement

The rollback pointed the resource at the prior pipe only after deleting the
replacement, so a delete that failed left the resource naming the replacement
with the rename cleanup still recorded. The next update read that cleanup and
deleted the prior pipe, which is the pipe the rollback existed to preserve, and
reported UPDATE_COMPLETE with no status reason.

The resource now names the prior pipe and spends the cleanup before the delete
is attempted, and the replacement name travels into the delete as a parameter
rather than being read off the resource. The failure still propagates and the
stack still lands UPDATE_ROLLBACK_FAILED naming the resource; what is left
orphaned is the replacement the failed update created.

* test(cloudformation): pin the refusal of an update while an interrupted cleanup owns the stack

A status ending in _IN_PROGRESS says an operation owns the stack, so UpdateStack and
CreateChangeSet are refused with a ValidationError naming the stack and that status,
and DeleteStack is the escape that removes the displaced pipe as well as the current
one.

* fix(cloudformation): refuse an update while an operation owns the stack

An update no longer picks up the cleanup phase an earlier update abandoned. That phase
ran inside the new update's transaction, so every non-happy exit of the new update had to
account for a failure it did not cause.

A status ending in _IN_PROGRESS is a precondition instead: it says an operation owns the
stack, and UpdateStack and CreateChangeSet are refused with a ValidationError naming the
stack and that status. Nothing finishes an abandoned phase.

DeleteStack stays allowed in every status, since it is now the only way out of one, and it
deletes whatever the resource's pending cleanup names as well as the physical id the
resource carries. That reaches every resource type, not just the one that surfaced it.

* test(cloudformation): pin the refusal message CloudFormation itself emits

The refusal was asserted in this project's own bracket wording, which no real client ever
receives. An emulator is matched against by tooling that reads the message, so the
assertion now carries the string CloudFormation emits verbatim: the stack id in
Stack:<arn> form, the status, and 'state and can not be updated.' with its own spelling
and trailing period.

* fix(cloudformation): emit the refusal in CloudFormation's own wording

The refusal named the stack in this project's bracket idiom. Real CloudFormation names it
as Stack:<stack id arn> and ends the sentence with 'state and can not be updated.', which
is what a client matching on the message expects to read, so the emulator emits that.

---------

Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com>
2026-09-05 12:41:58 -05:00