* refactor(cloudformation): move AWS::Route53::RecordSet into Route53CfnProvisioner
The record set leaves CloudFormationResourceProvisioner for the provisioner that
already owns AWS::Route53::HostedZone, which gains a type switch in provision and
delete; the hosted-zone path is untouched. The record-set arm keeps the legacy
behaviour exactly, a name-only resource whose Ref is the resolved Name or a
generated record- id, and now also publishes Id, the registry schema's only
read-only property, which Fn::GetAtt could never resolve before. Its delete logs
the same warning the legacy default arm did, since nothing was ever written for
the record. Writing the record through ChangeResourceRecordSets and enforcing the
schema's required Type and Name are follow-ups, not part of the move.
The legacy switch goes from 24 to 23 types and the monolith loses its last
Route53 reference.
* refactor(cloudformation): keep AWS::Route53::RecordSet free of GetAtt attributes
The move published Id because the schema coverage gate asks for every
read-only property in the registry schema. That schema has no handlers:
RecordSet is a legacy type, and the CloudFormation resource specification
gives it no attributes, so Ref stays its only reference, as it was in the
legacy provisioner. Id is recorded in getatt-attribute-gaps.tsv instead.
* feat(apigateway): honour the remaining REST integration settings
PutIntegration persisted 6 of the 16 fields AWS documents. The rest were
accepted without error and silently dropped, so an integration could be created
exactly as intended and then behave as though the configuration were absent.
- timeoutInMillis is applied to the backend call and defaults to AWS's 29,000ms
rather than the previously hardcoded 30s. Values below AWS's 50ms floor are
rejected; the 29s ceiling is an edge-optimized limit, so Regional APIs may
exceed it.
- tlsConfig.insecureSkipVerification skips backend certificate and hostname
verification. Without it an HTTPS backend behind a private CA or a self-signed
certificate was unreachable with no way to opt out.
- contentHandling converts payloads in both directions: CONVERT_TO_TEXT
base64-encodes a binary request for mapping templates, CONVERT_TO_BINARY
decodes a base64 text request before it is sent. Integration responses accept
it too, applied as an output conversion after response templates.
- binaryMediaTypes on the RestApi marks content types as binary. A binary body
now reaches an AWS_PROXY integration base64-encoded with isBase64Encoded set;
previously it was read as a UTF-8 string, which corrupted it.
- connectionType VPC_LINK requires connectionId to name a link that exists and
is available. The five REST VPC Link operations are implemented at /vpclinks.
Floci has no real VPC, so a valid link routes straight to the integration URI;
what is enforced is the misconfiguration AWS also rejects.
- cacheNamespace and cacheKeyParameters drive response caching, gated on both
switches AWS requires: cacheClusterEnabled on the stage and caching/enabled on
the method. Only successful responses are cached, expiring after the method's
ttlInSeconds.
- credentials is persisted and returned. Floci does not enforce IAM, so the role
is not actually assumed.
The same fields are now carried through an OpenAPI import, which previously
dropped them from x-amazon-apigateway-integration.
* fix(apigateway): align TLS, cache keys and VPC link patches with AWS
Three review findings on the REST integration settings, all cases where the
local behaviour was looser than the contract AWS documents.
tlsConfig.insecureSkipVerification installed a trust-all X509TrustManager, so an
expired certificate, a broken chain or a chain with no root reached the backend
happily. AWS skips only the check that the certificate was issued by a supported
certificate authority; it still performs basic validation of the expiration
date, the hostname and the presence of a root certificate authority. A backend
that would fail in AWS therefore worked here, which is the direction that hides
a production TLS misconfiguration. The trust manager now verifies validity,
checks that the chain holds together and terminates in a self-signed root, and
requires cA=true on that root when it actually issued a leaf. Hostname
verification is now requested explicitly rather than being switched off: note
that java.net.http.HttpClient always applies HTTPS endpoint identification and
ignored the previous null algorithm, so the hostname was in fact still checked,
but the code and its documentation both claimed otherwise.
The response cache key appended the method and request path to cacheNamespace.
AWS allows one cacheNamespace across several resources exactly so those
resources return the same cached data, and no two resources share a path, so the
setting could never do what it exists for. The key is now the namespace plus the
declared cacheKeyParameters. The namespace still defaults to the resource id, so
resources that did not opt into sharing stay separate.
UpdateVpcLink never looked at op. Any operation on /name or /description was
applied, so op=remove,path=/name set the name instead of being rejected, and
every other path was silently ignored and reported as success. AWS's patch table
supports only replace on those two paths; anything else is now a
BadRequestException.
Also removes the em dashes AGENTS.md disallows from the test files this branch
adds, which the Documentation Style check flagged.
* fix(apigateway): enforce keyCertSign and name constraints under insecureSkipVerification
The comment on CaIssuanceSkippingTrustManager claimed the root check matched
AWS's two requirements on a private root, cA=true together with a keyUsage
including keyCertSign, but only getBasicConstraints() was ever consulted. A root
with CA:TRUE and no keyCertSign was accepted here and rejected by real API
Gateway, which is the direction that hides a broken certificate authority until
deployment. The keyUsage bit is now checked alongside basicConstraints. An
absent keyUsage extension is still accepted: RFC 5280 leaves the key
unrestricted when it is missing, and PKIX reads it the same way.
The rest of the chain walk is now the platform's PKIX validator, anchored on the
chain's own root, which is exactly the "stop checking that the root is one we
trust, keep checking everything else" semantic this setting has in AWS. That
brings X509v3 name constraints with it, which the hand-rolled walk did not
implement at all, along with basicConstraints and keyCertSign on intermediates
and pathLenConstraint. The anchor's own extensions are not examined by PKIX, so
the root's checks stay explicit, and its NameConstraints extension is passed
through to the TrustAnchor. Expiration stays explicit too, because PKIX exempts
a trust anchor from it and AWS does not.
A lone self-signed certificate keeps its own path: it is its own root and is the
plain self-signed-server case the setting exists to enable, so CA extensions are
not demanded of it.
Three tests against real HTTPS backends: a well-formed private CA chain is
reached, a root declaring CA:TRUE without keyCertSign is rejected, and a root
that permits itself only internal.example while issuing for localhost is
rejected. The latter two return 200 without this change.
* fix(apigateway): require keyUsage on a private root and evaluate name constraints properly
Two corrections to the previous round's TLS work.
AWS states the root constraint as "x509 extension keyUsage must have
keyCertSign", which a root carrying no keyUsage extension at all does not
satisfy. The previous commit read a missing extension as leaving the key
unrestricted, which is generic RFC 5280 semantics but not this API
Gateway-specific requirement, and so accepted a certificate authority real API
Gateway turns away. A root without the extension is now rejected.
The name constraints handling was also wrong, in a way its own test hid.
Constraints were unwrapped from the root and handed to the TrustAnchor, but the
platform validator refuses to process anchor-supplied constraints and fails with
"name constraints in trust anchor not supported". So a root carrying the
extension was rejected blindly, never evaluated, and the test asserting a
violated constraint passed on that unrelated error.
Root-level constraints are now rejected deliberately, with an error that says
so, rather than as a side effect of a validator limitation. That is also the
documented behaviour: AWS tells operators hitting validation errors under
insecureSkipVerification to check their CA certificates for Name Constraints
extensions and reissue without them. Constraints on an intermediate sit inside
the certification path, where the validator does read them, and those are
enforced for real: the log now shows "name constraints check failed" rather than
"not supported".
Tests follow the same split. A three-certificate chain whose intermediate
permits only internal.example while issuing for localhost is rejected, a chain
whose intermediate permits localhost is reached, so the first is failing on the
constraint rather than on chain length, and a root carrying constraints is
rejected as its own documented case. Plus a root with CA:TRUE and no keyUsage
extension, which returns 200 without this change.
* fix(apigateway): match binaryMediaTypes literally apart from the catch-all
The matcher expanded a subtype wildcard, so an image/* entry covered
image/png. Nothing in the AWS documentation establishes that as a
pattern: */* is documented concretely ("To support all binary media
types, specify */*"), while every other example names one exact media
type at a time, and the browser walkthrough tells you to register the
concrete image/webp even though the request's Accept header carries
image/*. Expanding it made Floci treat a payload as binary where AWS
would compare the entry as a literal string and treat it as text.
Entries are now compared literally, ignoring the charset parameter,
with */* as the one wildcard. The wildcard branch keeps its coverage
through a */* test, and a second test pins the subtype wildcard as
not expanded so the behaviour cannot drift back silently.
A state reset and nuke run every container teardown (#3718), a hook written
for process shutdown. The SageMaker training runner and endpoint manager shut
their worker pools down there and never created new ones, so after one reset
every CreateTrainingJob, CreateEndpoint and UpdateEndpoint returned 500 with
RejectedExecutionException until Floci restarted. The ECS service stopped its
reconciler the same way, so services were never reconciled again.
The three services now implement Resettable and restore the pool or the
reconciler in clear(), which a reset runs after the teardown and the storage
wipe and shutdown never runs. Teardown itself is unchanged, so the ECS
reconciler still stops before the final flush on shutdown.
A reset also interrupts in-flight training runs, and an interrupted run wrote
its failure back unconditionally, which could bring a wiped job back.
updateTrainingJob now writes only while the stored job is the same one, by
ARN and creation time, as finalizeEndpointStart already does for endpoints.
CI only showed this when EmulatorInfoControllerIntegrationTest and
SageMakerDockerIntegrationTest shared a shard, which the deterministic
partitioner does for some class lists, so it failed every rerun on those PRs.
The nine /v2/email/tenants, /v2/email/tenant and /v2/email/resources
endpoints and their JSON helper move byte-for-byte out of SesController
into SesTenantController. Creating, reading and listing tenants and
setting their suppression attributes call SesTenantService directly, so
SesService drops those four delegations; the resource associations stay
on the facade because they check that the associated identity,
configuration set or template exists, and the tenant delete stays for
its suppression cascade. The new class is registered on the SES
descriptor. No wire behavior changes.
Floci had zero CodeArtifact support: no service package, no docs, nothing.
Any terraform apply touching aws_codeartifact_domain, aws_codeartifact_repository,
or either permissions-policy resource failed outright. This adds the full
CodeArtifact control plane: domain and repository CRUD, resource policies with
optimistic-locking revisions, tags, and the fixed set of real AWS-hosted
external (upstream) connections (public:npmjs, public:pypi, public:maven-central,
etc.).
Package publish/fetch endpoints per format (npm, PyPI, Maven, NuGet, generic)
are intentionally out of scope here: this closes the terraform apply gap, not
real package serving.
ListTagsForResource (POST /v1/tags?resourceArn=) is CodeArtifact's one tag
operation that addresses the resource with a query parameter on the bare path
rather than a path segment, unlike every other V1TagsController/SharedTagsController
handler. That method lives on V1TagsController itself rather than the shared
AbstractTagsController base: SharedTagsController (mounted at /tags) already
declares its own bare POST (tagResourceByBody, for TagResource), so a bare POST
on the shared base collides with it and Quarkus refuses to start. CodeArtifact's
handler is @V1Tags-qualified and only ever registered against V1TagsController,
so the method belongs there. core/common stays service-free: CodeArtifactTagHandler
registers itself as a bean the same way MskTagHandler does, and TagHandler gained
a default for the lowercase key/value entry names CodeArtifact uses instead of
AWS's usual capitalized Key/Value.
Known, documented limitations (see docs/services/codeartifact.md): no cycle
detection across upstream chains, no referential-integrity check when deleting
a repository other repositories reference as an upstream, and no authorization
check on cross-account domainOwner addressing (consistent with Floci's opt-in
IAM enforcement elsewhere).
Verified against the real botocore codeartifact service-2.json (protocol, exact
querystring vs. body placement per operation, exact ARN format, epoch-seconds
timestamps, real error shapes) and the live AWS API docs for behavioral rules
not in the wire model (DeleteDomain blocked while repositories exist, the real
fixed external-connection name/format list, PutDomainPermissionsPolicy's
all-body field placement vs. the sibling repository operation's querystring
placement).
Live-verified three ways:
- Unit tests including a concurrent-create race test proving the synchronized
guard actually holds under contention, plus full-stack QuarkusTest/RestAssured
integration tests.
- A real terraform init/apply/plan/destroy cycle against a running Floci
instance, independently confirming destroy actually tore the domain down via
a follow-up describe-domain call.
- A live AWS SDK v2 Java test exercising the real CodeartifactClient against a
live instance.
The four /v2/email/suppression/addresses endpoints move byte-for-byte
into SesSuppressionController and the three /v2/email/tags endpoints
into SesTagController. Both keep calling the SesService facade: an
optional TenantName routes each suppression operation to that tenant's
own list across the suppression and tenant domains, and tagging parses
the resource ARN and dispatches to whichever of the seven taggable
domains owns it, so the facade loses nothing and both moves are pure
size splits in the shape of LambdaTagController. Both classes are
registered on the SES descriptor. No wire behavior changes.
* feat(redshift): seed catalog and system views on cluster startup
Seed Amazon Redshift catalog and system views on container startup into both template1 and dev databases so BI, ORM, and migration tools (Tableau, Looker, DBeaver, Flyway, Liquibase, dbt) can introspect database schema metadata without missing-relation errors.
* feat(redshift): record COPY failures in stl_load_errors and dynamicize query logs
Record failed S3 COPY attempts into pg_catalog.stl_load_errors via LoadErrorRecorder across simple and extended query flows. Convert stl_query and svl_qlog into dynamic views backed by pg_stat_activity, and add stv_wlm_query_state and svv_diskusage catalog views.
* fix(redshift): align catalog views with documented Redshift column schema
* fix(redshift): separate catalog seeding from copy error recording
* test(redshift): preserve container manager coverage
EmulatorLifecycle.onStop and EmulatorInfoController's /state/reset and
/state/nuke each independently ran an identical loop over every
ContainerTeardown implementation, log text included (flagged on #3718).
Extracted the loop into ContainerTeardowns.stopAll(), following the same
pattern as the recent cron/SigV4/SSRF dedupes. Callers keep passing their
own LOG so the log category stays tied to the calling class instead of
shifting to ContainerTeardowns.
Also fixed a stale comment in EmulatorInfoController: "Storage first" sat
under a "Containers first" comment that now runs before it; it means
"Storage before resettables" today.
No behavior change, so no new tests: EmulatorInfoControllerTest already
covers the ordering and per-teardown failure tolerance this loop provides.
* fix(ec2): reject key pair requests without KeyName
CreateKeyPair accepted a request with no KeyName and stored a nameless key
pair; the duplicate check then dereferenced that name on every later
CreateKeyPair, and the Query catch-all reported it as
"Unexpected error: null". CreateKeyPair and ImportKeyPair now answer
MissingParameter, ImportKeyPair answers InvalidKeyPair.Format instead of an
InternalFailure for material that is not base64, DeleteKeyPair requires a
name or an id and returns the deleted keyPairId, and the name comparisons
tolerate a nameless record already sitting in a persistent store. The EC2
docs still described the placeholder key material that #3307 replaced.
Closes#3356
* fix(ec2): return InvalidKey.Format for malformed key material on ImportKeyPair
The EC2 API error reference lists InvalidKey.Format as the key pair not being in a valid OpenSSH public key format, which is the message this branch sends. InvalidKeyPair.Format is a separate documented code for a different failure.
* fix(sqs): reflect CancelMessageMoveTask at once instead of after the rate interval
A throttled message move task slept 1000 / MaxNumberOfMessagesPerSecond ms
between moves and checked its cancel flag only afterwards, and
CancelMessageMoveTask set the flag without waking the worker. At rate 1 a
cancel therefore took up to a second to be reflected and the task kept
reporting RUNNING meanwhile. AWS reports CANCELLING as soon as the cancel is
accepted and CANCELLED once the in-flight message is done. The latency is
what made cancelledMessageMoveTasks_areBoundedAndAllowTheNextTask flaky:
eleven rate-1 cancels each waiting about a second on a loaded shard.
Replace the flag with a one-shot latch the worker waits on as its throttle,
so a cancel wakes it and its finally block writes CANCELLED at once. Mark
the task CANCELLING when the cancel is accepted, with a compare-and-set so a
task that already completed is left alone, and classify CANCELLING as
active so it neither starts the terminal TTL nor counts against the
terminal history cap, and still blocks a second task on the same source.
Closes#3756
* fix(sqs): record move task progress under the store lock
cancelMessageMoveTask now writes a task's status from a second thread, and
updateMoveTaskCounter's get-then-put outside the store's lock was only safe
while the worker was the sole writer: a cancel landing between the get and
the put could be stomped back to RUNNING until the loop resolved to
CANCELLED. Move the counter update into a synchronized store method that
reads the current status and writes back under the same lock transition
uses. Import CountDownLatch and TimeUnit and make the two touched
declarations explicit.
Raised in review on #3757.
* fix(sqs): resolve a move task's terminal status under the store lock
The worker's finally block read the task, decided COMPLETED or CANCELLED
from its own cancellation signal, and only then wrote, all outside the
store's lock. A cancel accepted between the decision and the write, which
had already moved the task to CANCELLING, was overwritten with COMPLETED.
Resolve the outcome in a synchronized store method that reads the status
at that moment: a task already CANCELLING ends CANCELLED whatever the
worker concluded, otherwise the worker's view stands. A package-private
finishMoveTask lets the regression replay the worker's terminal write with
a stale decision after a cancel has been accepted.
Raised in review on #3757.
An unhandled exception with no message, such as a NullPointerException on
the native image, rendered as "Unexpected error: null" on the Query wire,
which is what the reporter of #3356 saw. The Query controller and the SQS,
RDS and Neptune handlers now fall back to the exception's class name.
Refs #3356
The six /v2/email/account endpoints and their FeatureStatus helpers move
out of SesController into SesAccountController, which injects
SesAccountService, SesSuppressionService and SesSentEmailService and
composes GetAccount from their reads without the facade. The send
endpoints in SesController and the v1 handler read the account sending
switch and the sent-mail count from those services directly too, so
SesService drops its eleven account-level delegations. The
SuppressedReasons and SendingEnabled parsers turn out to be shared with
the configuration-set endpoints and move into SesV2Json with unit tests.
The new class is registered on the SES descriptor. No wire behavior
changes.
* fix(lifecycle): stop managed containers on state reset, not just shutdown
/state/reset and /state/nuke clear StorageBackend and every Resettable
bean, but ContainerTeardown was only invoked from EmulatorLifecycle.onStop.
A reset left Batch, CodeBuild, and now SageMaker training/endpoint
containers running with no record of them left in the store to reconcile
against. EmulatorInfoController now runs the same teardown loop before
wiping storage, tolerating individual failures the same way shutdown does.
* fix(lifecycle): use explicit InOrder type instead of var in test
AGENTS.md disallows var for local declarations; the concrete Mockito
type at a call site is the thing worth seeing in a review.
RotateSecret stages the new version from the rotation executor while a
request thread answering DescribeSecret, GetSecretValue or
ListSecretVersionIds iterates the same Secret.versions map. The map was a
plain HashMap, so a put landing during that iteration failed the request
with a ConcurrentModificationException. It surfaced as a flaky
SecretsManagerJsonHandlerTest.rotateSecretParsesRotationRules on main, and
any client polling a secret during its rotation could hit it, where AWS
always answers with a consistent version set.
The writes already run under the per-secret lock from #3247; the reads
deliberately do not, because a describe never waits on a rotation, as on
AWS. A fail-fast map cannot support that contract. Secret.setVersions now
copies a plain map into a ConcurrentHashMap and installs a ConcurrentMap
as given, which covers createSecret, the rotation lifecycle and Jackson on
reload from persistence. Iteration is weakly consistent: no exception, and
a reader sees the version set as of before or after the staging put.
A deterministic regression parks the handler's DescribeSecret one entry
into its iteration, stages a version, and resumes it; it throws on main and
passes here. The existing BlockingVersions test helper extends
ConcurrentHashMap so the setter installs it unchanged.
Closes#3753
A subscription filter policy compared a String.Array message attribute against its
serialized JSON array as a single opaque string, so a policy rule of "Name" never
matched an attribute of ["Name","stringName"]. Any subscription filtering on a
multi-valued header silently matched nothing. AWS treats each element as a separate
string: a positive rule matches when any element matches, while anything-but matches
only when no element is listed, and exists asks about the attribute rather than its
elements.
$or was not recognised at all. The key was looked up as a message attribute literally
named "$or", which never exists, so the subscription went silent with no warning. It
is now honoured in both MessageAttributes and MessageBody scope under the conditions
AWS requires -- an array of at least two objects, none using a reserved operator name
as a field name -- and otherwise falls back to being an ordinary key, as AWS does.
EventBridge already had $or; SNS never got it.
Parsing the array value uses FAIL_ON_TRAILING_TOKENS, so a value like "[\"a\"] junk"
is treated as malformed and matched whole rather than element-matching as ["a"].
* feat(secretsmanager): add the five missing actions and correct response fidelity
Secrets Manager implemented 18 of the 23 actions in the API reference. This
adds the remaining five and corrects a number of response and validation
divergences found by working through each operation's reference page.
New actions:
- CancelRotateSecret turns rotation off and reports the half-built AWSPENDING
version an interrupted rotation left behind. The staging labels are left
alone, as AWS leaves them, because that version id is the only handle on a
stale AWSPENDING - and a stale AWSPENDING that is not also AWSCURRENT makes
every later RotateSecret fail with "a previous rotation isn't complete".
- ValidateResourcePolicy reports wildcard principals under the same
REFLEXIVE_PRINCIPAL_CHECK name AWS uses. BlockPublicPolicy on
PutResourcePolicy now enforces the same check.
- ReplicateSecretToRegions, RemoveRegionsFromReplication and
StopReplicationToReplica, backed by a replication model on Secret. Replicas
carry the primary's ARN with the Region swapped, track later writes to the
primary, and are read-only; a primary that still has replicas cannot be
deleted.
Scheduled rotation now fires. RotationRules were stored and echoed back but
never acted on, so AutomaticallyAfterDays and ScheduleExpression described a
schedule that could not happen. A background sweep rotates secrets whose
NextRotationDate has passed, reusing the EventBridge Scheduler expression
parser for rate() and cron(). The schedule advances when a rotation is
dispatched rather than when it succeeds, so a failing rotation cannot pin the
sweep on one secret forever.
Response fidelity:
- ListSecrets honours SortBy, SortOrder and IncludePlannedDeletion, and its
entries carry SecretVersionsToStages, the rotation fields, DeletedDate and
PrimaryRegion.
- PrimaryRegion and ReplicationStatus appear only on multi-Region secrets,
matching AWS's "only returns fields that have a value" rule.
- Versions with no staging labels are deprecated: DescribeSecret and
ListSecretVersionIds omit them unless IncludeDeprecated is set, and an empty
VersionStages array is omitted rather than sent.
- ListSecretVersionIds gained IncludeDeprecated, LastAccessedDate and paging.
Validation, all previously accepted silently:
- DeleteSecret rejects a recovery window outside 7-30 and the
ForceDeleteWithoutRecovery/RecoveryWindowInDays combination. A window of 0
used to fall through to force-delete, turning a request for no recovery
window into an unrecoverable delete.
- CreateSecret uses ClientRequestToken as the version id and is idempotent on
retry; UpdateSecret, which AWS documents as not idempotent, rejects a token
that already names a version.
- RotationRules bounds, secret name charset, SecretString/SecretBinary
exclusivity, KMS key existence and state, and the documented caps on
BatchGetSecretValue, Filters, ExcludeCharacters and ResourcePolicy.
Secret values remain stored in the clear; encrypting them with the emulator's
own KMS would protect nothing while making the store unreadable. KmsKeyId is
validated instead, which is the part a caller can observe.
Two deviations are deliberate and recorded in docs/services/secrets-manager.md:
LastRotatedDate is retained after CancelRotateSecret, and RotateSecret with
RotateImmediately=false does not create the throwaway AWSPENDING version.
* test(secretsmanager): create a real KMS key in the sdk-test-java compat test
kmsKeyIdPreservation asserted that floci round-trips whatever KmsKeyId it is
handed, using an ARN that was never created. That passed only because floci
did not check the key; real AWS rejects a key it cannot access, and so does
the new validation.
The test now creates a key through the emulated KMS and round-trips that ARN,
so it still covers KmsKeyId preservation without depending on the missing
check. A second case pins the rejection itself.
* refactor(secretsmanager): import types instead of qualifying them inline
AGENTS.md asks for imports unless a name collision forces qualification.
AwsException and UUID had neither.
* fix(secretsmanager): hold the rotation lock while promoting a replica
StopReplicationToReplica wrote the promoted replica outside the per-secret
lock every other mutation in this file takes. The promotion races the
primary's replica sync, and losing that race writes the replica back over the
copy the call just promoted.
Also imports KmsKey, ConcurrentHashMap and HashMap rather than qualifying
them inline, per the same AGENTS.md rule.
* test(secretsmanager): assert the KMS rejection by exception type, not message text
createSecretWithAnUnknownKmsKeyIsRejected matched "InvalidParameterException"
against the message, but that is the exception type; the message itself reads
"You can't access the KMS key ... in this Region". The assertion now checks
the typed InvalidParameterException and the text it actually carries.
* test(secretsmanager): give the new KMS compat test its own order
createSecretWithAnUnknownKmsKeyIsRejected inherited @Order(13) from the test
it was added next to, so two cases shared a position. JUnit breaks the tie
deterministically, but the duplicate made the sequence misleading; the tail is
renumbered so each case keeps a distinct order.
Also sorts the new KMS imports, which landed between the lambda ones.
* fix(secretsmanager): guard every write to a secret with its owning monitor
UpdateSecret read, mutated and persisted without taking the secret's lock,
unlike every other mutator in the class, so two concurrent calls could drop
one another's field.
StopReplicationToReplica locked the replica's own ARN, but persist() writes a
primary's replica slots while holding only the primary's lock: two monitors
guarding one store slot, so a sync landing after the promotion could overwrite
the promoted copy. The promotion now runs under the primary's monitor, and its
two halves run in one critical section so nothing lands between them.
SecretsManagerWriteLockTest parks a write mid-flight and asserts the second
caller waits; both cases fail without the fixes.
* fix: enforce safe default network binding
* fix(config): keep signed test authority stable
Pin the integration-test listener to the existing all-interface test bind and
opt into that bind only in the test profile. This preserves localhost-based
SigV4 fixtures while production keeps the loopback default.
* fix(config): keep compat image backward compatible
* chore: retrigger CI
* fix(config): mirror JVM image network binding
The five /v2/email/custom-verification-email-templates endpoints and
their two helpers move out of SesController into SesCvetController. Get,
list and delete call SesCvetService directly, and SesQueryHandler's v1
actions do the same; create and update stay on the SesService facade
because their validation checks the From address against the identity
domain. SesService drops the three pure delegations, and sending a
custom verification email stays with the send endpoints. The new class
is registered on the SES descriptor. No wire behavior changes.
* chore(cloudformation): sweep the dead code out of the legacy resource provisioner
Eleven batches have moved types out of CloudFormationResourceProvisioner and each
left something behind: a constructor parameter that is injected but never assigned,
a helper whose last caller moved, an import for a model type nothing here touches, a
section header with no code under it. None of it is reachable, so none of it needs a
test to remove.
Gone: eight constructor parameters (22 to 14, every remaining one is assigned and
used), eleven private methods with no caller but their own declaration (the nine
JSON put and parse helpers plus resolveOptionalWithoutDynamicReferences and
parseCfnTags, whose last callers left with RDS and DynamoDB), twenty-six imports
with no remaining use, and seven empty section headers. The test fixture drops the
same eight positional arguments; its builder keeps the fields because the inferred
provisioners still take those services. 3,638 lines to 3,430, no behaviour change.
* chore(cloudformation): drop the orphaned CORS Javadoc and reattach the legacy-set Javadoc
Two comment-only leftovers of earlier batches, both found while checking a review
comment on the sweep. The Javadoc for the S3 CorsConfiguration method stayed behind
when #2754 moved the method to S3CfnProvisioner; it goes. The Javadoc describing
LEGACY_SWITCH_TYPES was stacked directly above the DELETE_NEEDS_STACK_RESOURCE one,
so the compiler attached it to nothing and the set it describes had no doc; it now
sits above its own declaration, text unchanged.
* feat(eks): expose IMDS on 169.254.169.254 inside cluster containers
When applications or agents run on Kubernetes nodes or use hostNetwork: true, they expect the AWS Instance Metadata Service (IMDS) at the standard link-local address 169.254.169.254:80. In Floci, EKS k3s cluster containers lacked access to IMDS at this link-local address, preventing workloads from discovering instance identities, node IAM roles, or dynamic cluster credentials without custom endpoint overrides.
This change exposes IMDS on 169.254.169.254:80 inside EKS cluster containers when floci.services.eks.imds is enabled. It configures a background TCP relay via socat pointing to the host's EC2 metadata port, registers a synthesized EC2 node instance with the cluster's IAM role and container IP in Ec2MetadataServer, extracts reusable metadata proxy logic into Ec2MetadataProxy, and documents node network namespace reachability and hop limit handling.
* fix(eks): address review feedback on lifecycle check, default flag, and instance seed
* fix(eks): synthesize distinct node instance profile and import CompletableFuture
* test(eks): enable IMDS profile and provide curl in docker test fixture
The 16 character cap was applied to every engine, but RDS accepts 63 on
PostgreSQL and 32 on MySQL, so an instance whose master username is longer
could not be created at all. The bound now comes from DatabaseEngine, using
the engine createDbInstance already resolves; the character rule and the
error message are unchanged.
Closes#3729
* feat(apigateway): implement GetUsage
GetUsage had no implementation, so a caller asking a usage plan what it
had consumed hit an unsupported action.
This returns the real envelope with zeroed numbers rather than metering
anything. Shape captured from real API Gateway: an items map of API key id
to one pair per day of the inclusive range, alongside usagePlanId,
startDate and endDate, and no position element when there is no further
page.
The pair is [used, remaining], not [used, quota]. Measured on a live usage
plan, the second element is the quota limit minus cumulative use in the
period: a plan with a 1,000,000 limit reported 999863 after 137 calls, then
999740 after 123 more. Anything reading that element as a quota is reading
it wrong.
Both elements are zero here, deliberately. Nothing counts requests per API
key, and a usage plan carries no quota to subtract from, so there is no
limit to report against. Throttle settings are already accepted and stored
without being enforced, so this is consistent with how the service treats
the rest of that surface. Storing a quota on the usage plan and counting on
the execute path are the two pieces still missing, and both the javadoc and
the service docs say so.
A caller that sums the used counts therefore gets zero, which is what it
already got when the action did not exist, without having to special-case a
missing endpoint.
Validation follows the captured errors: an unknown plan is NotFoundException
and an end date before the start date is BadRequestException, "Usage end
date must be after start date".
* fix(apigateway): paginate GetUsage
GetUsage takes limit and position, which this did not accept at all: every
attached key came back in one response, so the implementation only matched
the single-page case the original capture happened to exercise.
Pagination now runs over the API key entries, defaulting to 25 a page. The
token is the last key id already returned rather than a positional offset,
so a page resumes after a known key and a concurrent key attachment cannot
shift it. No position is emitted on the terminal page, matching the shape
captured from real AWS.
Two edges deliberately differ from real API Gateway, because it is not a
good guide there. It answers limit=0 with an InternalFailure, which is a
fault rather than a contract, so a page size below one is a
BadRequestException here. It also accepts a limit past the documented
maximum of 500, so anything larger is clamped rather than refused. Both
choices are written down in the service docs.
An unrecognised position is a BadRequestException, "Invalid position
parameter", which is the message real API Gateway returns.
The existing tests looked keys up with a dotted GPath. API key ids are
random and can begin with a digit, which Groovy then parses as a number, so
every lookup into items now uses bracket notation. That was luck rather
than correctness before.
* fix(apigateway): stop inventing a GetUsage limit ceiling
The previous head clamped any limit above 500 to 500, extrapolated from a
single observation that 501 was accepted. One accepted value does not
establish a rule.
Probed properly against real API Gateway: 500, 501, 1000, 5000, 100000 and
2147483647 are all accepted without error. The documented maximum is not a
rejection boundary, so no ceiling is imposed here either and the regression
asserts the observed rule across that ladder rather than an emulator
specific clamp.
Whether the service caps the page it actually returns above 500 is not
observable without a usage plan holding more than 500 keys, so nothing is
assumed about it and the docs say as much.
The lower bound stays a deliberate divergence, now with both values
measured: limit=0 and limit=-1 both answer InternalFailure on real API
Gateway. That is a fault rather than a contract, so a page size below one
is a bad request here instead of a reproduced 500.
* fix(apigateway): cap the GetUsage page at 500 while still accepting more
Removing the ceiling entirely went too far the other way. The probe shows
real API Gateway accepts a limit above 500, so rejecting one would be
wrong, but it never showed the service returning more than 500 entries in a
single page, and the documented contract caps a page at 500. Returning more
than 500 was therefore as unevidenced as rejecting the request.
Request acceptance and response page size are now separate: a larger limit
is honoured as a request, and the page stays capped at 500 until a real
result with more than 500 keys shows otherwise.
resolveUsageLimit becomes package-private so the distinction can be
asserted directly rather than needing a usage plan with 500 keys behind it.
* fix(apigateway): return GetUsage key usage under the values wire key
The response serialised the per-key usage map as "items", which is the
SDK-side member name, not the wire key. The Usage shape models that
member with locationName "values", so a real client parsing a body keyed
"items" finds the field absent and reads no usage at all.
Verified with botocore's own rest-json parser against the apigateway
service model: a body keyed "values" populates the member, a body keyed
"items" leaves it None.
Assertions and the service docs move with it. Only GetUsage is affected;
the sibling list actions are a different shape and are untouched.
A Distributed Map could only read a JSON dataset: every other InputType failed
the state with "not yet implemented". JSONL now reads one item per line,
skipping blank lines, so a trailing newline is not an item.
ReaderConfig.ItemsPointer stays JSON only, as on AWS, and MaxItems truncates a
JSONL dataset the same way it truncates a JSON one.
A table without an explicit TableName got a fresh generated name on every
UpdateStack, which created a second table and re-pointed Ref at it. TableName is
create-only, so the provisioner now resolves the name through
ProvisionContext.stablePhysicalName: the template's name, else the name the
resource already has, and only failing both a generated one. This is the same fix
earlier batches applied to other types, split out of #3699 at the reviewers'
request so that refactor stayed behaviour-preserving.
CloudFrontServingController (via CloudFrontOriginHttpClient) and
VerifiedPermissionsOidcSignatureVerifier each independently
implemented the same SSRF-protection check rejecting private/
link-local/reserved IPv4 and IPv6 ranges before a server-side fetch,
found via CPD as an 18-line block (#3715). The two files actually
duplicated three methods end to end, differently named
(isBlockedOriginAddress/isBlockedPublicAddress,
isIpv4MappedAddress/ipv4Mapped, isBlockedIpv4Address/blockedIpv4), not
just the one CPD's threshold happened to flag.
Extracted the full check into SsrfProtection.isBlockedAddress in
core.common, and pointed both call sites (plus their tests) at it,
removing all three duplicated methods from both files rather than
leaving a thin wrapper behind.
No behavior change: the blocked ranges and precedence are identical
to both copies before this, only their location changed.
ExecuteApiSigV4Authorizer (API Gateway) and IamAuthValidator (AppSync)
each carried an identical 15-line block splitting Credential=/
SignedHeaders=/Signature= out of a raw AWS4-HMAC-SHA256 Authorization
header value, found via CPD (#3714). Neither #3657 (closing #3650) nor
#3706 (closing #3700), which already deduplicated related SigV4 logic
between these same two files, touched this specific block.
Extracted it into SigV4AuthorizationHeader in core.common.auth,
alongside CredentialScope and SigV4RequestValidator from #3657, and
pointed both call sites at it.
No behavior change: the parsing is identical, only its location
changed. Both files' existing test suites pass unchanged.
* refactor(cloudformation): move the DynamoDB types into DynamoDbCfnProvisioner
AWS::DynamoDB::Table, AWS::DynamoDB::GlobalTable and Custom::DynamoDBReplica leave
CloudFormationResourceProvisioner for a per-service provisioner that owns create,
update and delete for all three. The monolith drops 246 lines, its last DynamoDB
reference and the injected DynamoDbService (24 to 23 constructor parameters), and
its legacy switch goes from 27 to 24 types.
Two behaviour changes ride along, both covered by the new tests. A GlobalTable is
now deleted on stack delete: it had no delete arm and the table leaked.
Fn::GetAtt TableId resolves for both table types, from the same value
DescribeTable reports, which closes the registry schema's read-only attribute the
old arm never set. Replicas on a GlobalTable stays ignored as before.
parseCfnTags is copied rather than moved because the monolith's unused
putTagsObject still references it.
* refactor(cloudformation): publish TableId only for global tables and let a failed replica delete surface
The registry schema declares TableId read-only on AWS::DynamoDB::GlobalTable only; a
plain AWS::DynamoDB::Table exposes Arn and StreamArn, so publishing TableId there
accepted a Fn::GetAtt that CloudFormation rejects. The replica delete tolerated every
exception, which reported a clean delete over a real failure; it now goes through
CfnDeletes.safeDelete and treats only a missing table as already gone, since the
service already ignores removing an absent replica. The unused snsService constructor
parameter on the line this change touches is dropped as well.
Implement the SageMaker control plane over the AWS JSON 1.1 protocol
(X-Amz-Target: SageMaker.*) plus the runtime invocation path:
- Models, endpoint configs, endpoints, training jobs, and tags with
AWS-shaped validation errors (ValidationException / ResourceInUse)
- CreateTrainingJob runs the training image as a real Docker container
using the /opt/ml contract: hyperparameters, resourceconfig and
inputdataconfig under /opt/ml/input/config, S3 channel data under
/opt/ml/input/data/<channel>, and /opt/ml/model uploaded back to S3
as model.tar.gz under the configured S3OutputPath
- CreateEndpoint hosts the model image as a long-lived container with
the serve command, /ping health checks, and ModelDataUrl artifacts
extracted into /opt/ml/model
- POST /endpoints/{name}/invocations proxies to the container and maps
model 5xx responses to ModelError (HTTP 424) like SageMaker Runtime
- Training container logs stream to CloudWatch Logs under
/aws/sagemaker/TrainingJobs
- Storage wired through StorageFactory with memory/persistent modes,
config in EmulatorConfig and both application.yml files
- Unit, integration, and Docker-gated integration tests plus a boto3
compatibility test; service and docs registered in the catalog
BedrockAgentCoreCredentialProviderService and BedrockAgentCoreToolsService
each carried an identical 22-line validateTags method (AgentCore's tag
key/value character-set and length constraints), found via CPD (#3704).
This is distinct from the controller-layer duplication already fixed
in #3592/#3637 (BedrockAgentCoreControllerSupport); this one was at
the service layer.
Extracted it into BedrockAgentCoreTagValidation, package-private in
bedrockagentcorecontrol, following the same convention as
BedrockAgentCoreControllerSupport, and pointed both services at it.
No behavior change: the validation rules and error messages are
identical, only their location changed. BedrockAgentCoreToolsIntegrationTest
already asserts on the exact shared error messages
("tag value does not satisfy AgentCore constraints"), so that path is
directly covered. BedrockAgentCoreCredentialProviderService has no
dedicated test in src/test today (a pre-existing gap, not introduced
here); only compatibility-tests/sdk-test-java exercises it.
handleTerminateInstances, handleStartInstances, and handleStopInstances
in Ec2QueryHandler each hand-wrote the same instancesSet/item/
currentState/previousState response shape, a 17-line block repeated
three times, found via CPD (#3703). Extracted it into
buildInstanceStateChangeXml(responseElementName, changes), used by
all three handlers.
No behavior change: the XML shape is identical, only its construction
is now shared. All three response shapes already have direct
RestAssured coverage in Ec2IntegrationTest.
ElastiCacheContainerManager and MemoryDbContainerManager each carried
an identical 21-line readAsciiLineCrLf helper used while probing a
backend container for readiness, found via CPD (#3702). Extracted it
into RespLineReader in elasticache.container, and pointed
MemoryDbContainerManager at it, the same "MemoryDB depends on
ElastiCache's shared Redis-wire-protocol logic" shape
AbstractRedisAuthProxy already follows for the auth-proxy path (#3568).
No behavior change: the logic is identical, only its location
changed. Both container managers already have tests exercising the
PING/PONG readiness probe against a fake socket server.
ScheduleExpressionParser (EventBridge) and SchedulerExpressionParser
(Scheduler) each independently built an identical cron-utils
CronDefinition, a 20-line block duplicated verbatim, found via CPD
(#3701). This included a non-obvious AWS-specific correction (AWS
numbers day-of-week 1-7 as SUN-SAT, not the Unix 0-6 that cron-utils
defaults to, so Monday is 2) that was only explained in one of the
two copies.
Extracted the construction into AwsCronDefinitions.newParser() in
core.common, and pointed both parsers at it. No behavior change: the
definition is identical, only its location changed. Both parsers
already have direct test coverage of the day-of-week quirk
(dayOfWeekOneIsSunday, dayOfWeekTwoIsMonday,
dayOfWeekSevenIsSaturdayAndIsAccepted), so no new tests were needed.
ExecuteApiSigV4Authorizer (API Gateway) and S3HeaderSignatureFilter
(S3) each carried their own copy of containsHeader/isSha256Hex, a
20-line block found duplicated verbatim via CPD (#3700). Moved both
into SigV4RequestValidator in core.common.auth, alongside the other
shared SigV4 primitives (sha256Hex, hmacSha256, deriveSigningKey)
that both callers already use from there, and pointed both call sites
at the shared version. Added direct unit coverage for the two moved
methods, matching this class's existing pattern of pinning shared
primitives independently of any one caller's request flow.
No behavior change: the moved logic is identical, only its location
and visibility changed.
DefaultCacheBehavior and CacheBehavior each had their own ~250-line
hand-written XML-parsing state machine for the same element shape,
found via a CPD pass (#3652). Extracted the shared logic into one
parseCacheBehaviorScope helper, used by both parsing call sites, with
a small CacheBehaviorSettings interface so the helper can populate
either model type.
The duplication had already caused the exact bug it risked: the
CacheBehavior copy never parsed RealtimeLogConfigArn, even though the
field exists on both types in AWS's real CloudFront wire model and on
the CacheBehavior model class itself. The response XML builders for
both types also never emitted it. Fixed both and added a regression
test.
* feat(sfn): support the s3:listObjectsV2 Distributed Map ItemReader
The Map state listed the resource as accepted at CreateStateMachine
but failed every execution with States.ItemReaderFailed. It now calls
the S3 service in process, reads every page under Prefix, and gives
each child the AWS item shape: Etag, Key, LastModified, Size and
StorageClass. Bucket and Prefix come from Parameters or JSONata
Arguments. An empty prefix succeeds with zero iterations and
ReaderConfig.MaxItems trims the list.
LastModified is epoch seconds. Real AWS renders it as a double in
JSONPath state machines and as an integer in JSONata ones, and the
emulator does the same.
Fixes#3409
* fix(sfn): evaluate ItemSelector in JSONata Map states
A JSONata Map state passed ItemSelector through the JSONPath resolver,
so every {% %} expression reached the child as a literal string. The
Map state now resolves ItemSelector as a JSONata template with
$states.input bound to the Map input and $states.context.Map.Item
carrying Value and Index, as on AWS.
Real AWS evaluates ItemSelector before it records MapIterationStarted.
A failing expression therefore fails the Map state without any event
for that iteration, in both query languages. The evaluation moved
ahead of the iteration event to match.
Verified against real Step Functions in us-east-1 on 2026-09-12.
* chore(sfn): simplify the listObjectsV2 reader and the ItemSelector failure path
The reader listed the bucket page by page although the S3 service
returns the whole sorted listing in one call. The Map state kept two
copies of the iteration failure handling. The tests reuse the shared
mapper and one JSONata Map definition.
* perf(sfn): cap the listObjectsV2 listing at MaxItems
ReaderConfig.MaxItems keeps the first keys in key order on AWS, which
is what the S3 service returns for maxKeys. The reader now passes
MaxItems to the listing instead of building every item and trimming
afterwards.
* chore(sfn): declare local types in the listObjectsV2 reader
Replace var with explicit types in the production code this branch added.
* chore(sfn): declare local types in the listObjectsV2 reader tests
Replace var with explicit types in the test code this branch added.
* fix(sfn): list every object when MaxItems is absent
S3Service now treats max keys 0 as a request for an empty page, as AWS
does for max-keys=0. The listObjectsV2 reader passed 0 when
ReaderConfig.MaxItems was not set, so the Map got no items. It now asks
for Integer.MAX_VALUE in that case, like the DynamoDB import path.
* fix(lambda): back off DynamoDB Streams ESM retries and enforce MaximumRecordAgeInSeconds
* fix(lambda): treat unset MaximumRecordAgeInSeconds as no age cutoff
Keep expired records retrying when no finite Lambda age limit is configured.