Commit Graph
686 Commits
Author SHA1 Message Date
Abhigya f7565dff3e feat(apigateway): honour the remaining REST integration settings (#3434)
* 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.
2026-09-17 00:18:49 -04:00
Vũ Thế Huy d624988ff8 feat(appconfig): implement ListDeployments (#3749)
* feat(appconfig): add deployment listing service

* feat(appconfig): expose ListDeployments

* docs(appconfig): document ListDeployments

* chore(appconfig): clean controller imports

* fix(appconfig): make deployment pagination cursor-based
2026-09-16 22:31:48 -04:00
Priamo Germosen 66bcdaf675 feat(codeartifact): add CodeArtifact control-plane support (#3713)
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.
2026-09-16 22:01:34 -04:00
Vũ Thế Huy d9abefb83f feat(redshift): seed catalog and system views (#3552)
* 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
2026-09-16 21:39:50 -04:00
Hector Ventura 996a680cdc fix(ec2): reject key pair requests without KeyName (#3727)
* 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.
2026-09-16 19:06:32 -04:00
luiseterc 98c47c4347 feat(eks): implement access-entry management (#3745)
* feat(eks): implement access-entry management

* test(eks): wait for cluster activation in access-entry compatibility test

* fix(eks): validate access-entry maxResults with shared parser
2026-09-16 18:50:39 -04:00
luiseterc 03603aeacd fix(ec2): stage user data outside guest temporary mounts (#3736)
* fix(ec2): stage user data outside guest temporary mounts

* docs(ec2): correct user-data script staging path
2026-09-16 18:34:54 -04:00
luiseterc d4a96913df fix(ec2): issue instance-profile role credentials through IMDS (#3742)
* fix(ec2): issue instance-profile role credentials through IMDS

* test(ec2): cover null IMDS unregister and shutdown revocation
2026-09-16 18:23:51 -04:00
Niels Kootstra ef03c59864 fix(apigateway): prevent JWT issuer and JWKS SSRF (#3743)
* fix(apigateway): prevent JWT issuer and JWKS SSRF

* fix(apigateway): import verifier types
2026-09-16 18:00:01 -04:00
Abhigya 33d17c0146 feat(secretsmanager): add the five missing actions and correct response fidelity (#3711)
* 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.
2026-09-16 15:13:57 -04:00
Niels Kootstra 1831f10105 fix(config): enforce safe default network binding (#3684)
* 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
2026-09-16 14:46:09 -04:00
Simone Primarosa a2fddaf08d feat(eks): expose IMDS on 169.254.169.254 inside cluster containers (#3693)
* 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
2026-09-16 11:33:39 -04:00
Ovidiu (Ovi) f99e507916 feat(apigateway): implement GetUsage (#3561)
* 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.
2026-09-16 09:20:30 -04:00
Ovidiu (Ovi) ef341e1c01 feat(sfn): support ItemReader InputType JSONL (#3602)
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.
2026-09-16 09:13:51 -04:00
Niels Kootstra 682989288a fix: add Scheduler retry backoff and DLQ handling (#3687) 2026-09-16 08:58:51 -04:00
Marcus Bergo e2aefa654b feat(sagemaker): add SageMaker emulation with Docker-backed training (#1949)
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
2026-09-15 22:31:05 -05:00
Franklin G. Mendoza 801edd863d feat(macie2): add member administration (#3488)
* feat(macie2): add member administration

* fix(macie2): align member account fidelity

* fix(macie2): align member pagination limit
2026-09-15 22:27:31 -05:00
TATSUNO “Taz” Yasuhiro 5db516d9d5 feat(sfn): Map ItemReader with s3:listObjectsV2 (#3460)
* 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.
2026-09-15 21:48:54 -04:00
Chris Jovanovski 86072aaa84 fix(lambda): back off DynamoDB Streams retries and expire aged records (#3613)
* 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.
2026-09-15 21:46:27 -04:00
Hector Ventura 265344e304 feat(docs): add a service inventory reconciler and fix what it found (#3656)
* feat(docs): add a service inventory reconciler and fix what it found

"How many AWS services does Floci support?" had no answer anyone could defend.
Every source in the repo gave a different number, and two of them were written
down and contradicted each other: docker/localstack-parity.sh said Floci starts
"all 41 services" while migrate-from-localstack.md said "all 58". Neither is
close: the catalog registers 124 descriptors today.

tools/docs/service_inventory.py reconciles the five keyspaces that each answer a
slightly different question, and explains every delta rather than picking a
number: catalog descriptors, the config plane (EmulatorConfig accessors against
application.yml keys), Java packages under services/, the docs pages, and the
service matrix. It reports 119 documented services, 127 distinct API surfaces and
124 signing endpoints, and says which to quote for which question. 27 tests cover
the normalisation and the delta arithmetic.

It also enforces the rule that made this necessary: never write a count into
README.md or docs/, link to the Service Matrix instead. So the two stale counts
are removed rather than corrected, and the parity script and migration guide now
say "every service".

Three services the README's category table omitted are added: Lambda MicroVMs,
Cognito Identity and Bedrock AgentCore Control, each backed by a descriptor or a
docs page.

Two service-matrix corrections the reconciler surfaced:

- The sso alias pointed at iam, so the matrix resolved Identity Center's admin
  API to the IAM page's facet. ResolvedServiceCatalog registers
  descriptor("sso", "ssoadmin", ...) and docs/services/ssoadmin.md is its own
  page, so the alias now points there.
- Both bedrock-agentcore deferrals are retired. bedrock-agentcore.md exists now,
  so that entry has served its purpose; bedrock-agentcore-control has no page and
  never needed one, because the control plane owns the shared page, so it becomes
  an alias instead of a deferral that would expire and need renewing. The
  deferred list is now empty.

check_service_matrix.py --strict passes before and after, so the matrix changes
are tidy-up rather than a fix for a failing gate.

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

* docs: add the STS README row the inventory tool still reported

The tool's own output at the previous head listed STS as the one service
with a Service Matrix row but no README category-table entry, the same
gap this branch closed for Lambda MicroVMs, Cognito Identity and Bedrock
AgentCore Control. Add it next to IAM, so section 5 of the report now
shows zero missing rows.

Also drop the unused pathlib import from the inventory test.

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-09-15 20:36:53 -05:00
Hector Ventura a1eb65debd docs(testcontainers): add the .NET module page (#3655)
* docs(testcontainers): add the .NET module page

Testcontainers.Floci exists and is published, but nothing in the docs pointed at
it: no page, no mkdocs nav entry, no line in the language guide, and no row in
either module table. The module table listed Java, Node.js, Python and Go, so a
reader had no way to discover the .NET one.

Adds docs/testcontainers/dotnet.md in the shape of the Java and Node pages, and
wires it into the nav, the language list, and the tables in
docs/testcontainers/index.md and README.md.

Two things the other pages never have to explain are called out. The package is
served from GitHub Packages rather than nuget.org, so it needs a nuget.config and
a token with the read:packages scope. And the container-backed services carry the
macOS caveats: the default RDS ProxyBasePort of 7000 collides with AirPlay
Receiver, clients should use 127.0.0.1 rather than localhost to avoid IPv6, and
the RDS proxy does not negotiate TLS. A Colima note covers the Ryuk socket path.

The table row reads "see releases" rather than a version number. .NET releases on
every push to main, so a number written here is stale on arrival; the other rows
carry a version because their registries publish discrete releases.

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

* docs(testcontainers): require package source mapping on the .NET page

The nuget.config snippet added only the floci-io feed as a source, but
Testcontainers.Floci is also published on nuget.org by the Testcontainers
project, so a consumer with both sources configured could resolve that
package instead of this module. Mirror the module README: keep both
sources, add the credentials block, and route exactly Testcontainers.Floci
to the floci-io feed through packageSourceMapping with everything else on
nuget.org.

Drop the dotnet nuget add source command, which registers the feed under
a different name and cannot create the mapping, and link the feed to the
package page.

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-09-15 20:36:27 -05:00
Ovidiu (Ovi) 1319ed19bc feat(sfn): honour ToleratedFailureCount and ToleratedFailurePercentage (#3605)
* feat(sfn): apply ItemBatcher to distributed Map children

ItemBatcher was parsed and then ignored: every child execution received one
item regardless of MaxItemsPerBatch, so a state machine that batches ran with a
different payload shape locally than on AWS, silently.

Items are now grouped into batches and each child execution receives
{"BatchInput": ..., "Items": [...]}. A batch closes on MaxItemsPerBatch or
MaxInputBytesPerBatch, in their literal, Path and JSONata expression forms, and
with neither set every item lands in one batch. ItemSelector still runs per item
before grouping, so the transform sees $$.Map.Item as it did before.

MaxConcurrency now bounds concurrent batches, and DescribeMapRun separates the
two counters it used to share: itemCounts counts items, executionCounts counts
child executions.

* fix(sfn): cap a batch at the 256 KiB child-input ceiling

MaxInputBytesPerBatch being optional let MaxItemsPerBatch alone build a child
input larger than Step Functions would ever start, and the byte count measured
the items alone, so a declared cap could still be exceeded by the envelope,
BatchInput and separators.

Batching now measures the serialized child payload and closes a batch at the
declared limit or at 256 KiB, whichever is smaller.

* fix(sfn): fail an item too large to start a child execution

An item whose serialized batch input already exceeded 256 KiB was added anyway,
because the split branch is skipped while the batch is empty, producing a child
input AWS would refuse to start.

Such an item now fails the state with States.DataLimitExceeded, naming its size
and pointing at ItemSelector as the way to reduce it.

* feat(sfn): honour ToleratedFailureCount and ToleratedFailurePercentage

Both fields were accepted and ignored: any failed item failed the Map run, and
DescribeMapRun reported a hardcoded zero for each, so a state machine that
relies on a failure budget behaved differently here than on AWS.

A declared tolerance now absorbs failed items while the run stays within it. An
absorbed failure contributes no result, so the Map output and any ResultWriter
export cover the successful children only. Exceeding the budget fails the state
with States.ExceedToleratedFailureThreshold. Both fields accept their literal,
Path and JSONata expression forms, the percentage is taken over the item count,
and declaring both applies the stricter of the two.

DescribeMapRun now reports the declared values. A Map that declares neither is
unchanged: the first failed item still fails the state with its own error.

* fix(sfn): export tolerated failures to FAILED_0.json

Filtering the ResultWriter input down to the successful children dropped every
absorbed failure from the export, which is exactly what the tolerance is meant
to keep observable.

Failed children now keep their input, timings and error, and are written to
FAILED_0.json with Status FAILED and the child's Error and Cause, listed under
ResultFiles.FAILED in the manifest.

* refactor(sfn): resolve every integer Map field through one helper

MaxConcurrency and the ItemBatcher limits read the same three forms, literal,
Path and JSONata expression, through two near-identical methods. The batcher one
already parameterized the field name, so the pair collapses into a single
resolver with a minimum: 0 for MaxConcurrency, where it means the service
ceiling, and 1 for a batch limit, where it is meaningless.

The shared resolver also clamps an oversized value to Integer.MAX_VALUE, which
only the MaxConcurrency copy did before.
2026-09-15 16:44:41 -04:00
Allen Sanborn 97cbce205b feat(config): add aggregation authorization CRUD (#3627)
* feat(config): add aggregation authorization CRUD

PutAggregationAuthorization, DescribeAggregationAuthorizations and
DeleteAggregationAuthorization were unrouted, so the JSON handler answered
InvalidAction and aws_config_aggregate_authorization could not be created.

Authorizations are keyed by (AuthorizedAccountId, AuthorizedAwsRegion) within
the request region, persisted through StorageFactory like the other durable
Config resources. Put is an upsert that preserves the ARN and creation time of
an existing authorization, and accepts Tags, which land in the same tag store
that ListTagsForResource reads. Delete of an absent authorization succeeds: the
Config model declares no not-found error for that operation.

* fix(config): remove aggregation-authorization tags on every delete attempt

Tag cleanup ran only when the delete found an entry to remove. A delete that
removed the authorization but did not reach the tags left them behind, and the
retry that should have cleaned them up skipped the cleanup because the entry
was already gone. Put reuses a deterministic ARN, so those tags reappeared on
the next authorization for the same account and region.

The ARN is now derived from the key instead of read off the removed entry, and
its tags are dropped on every attempt. The authorization map is still persisted
only when an entry was actually removed.

* fix(config): apply PutAggregationAuthorization tags at creation only

PutAggregationAuthorization is idempotent, and AWS applies request tags at
creation only: a later Put that finds the authorization already there ignores
its Tags and leaves the existing ones alone. Tagging the existing ARN on every
Put let a local test retag by re-putting, which production would silently
refuse.

Return the existing authorization untouched and tag only the one just created.
Tags still change through TagResource/UntagResource, which is the only way AWS
offers.

* fix(config): make aggregation authorization put/delete atomic

putAggregationAuthorization did a get-then-put on the region map with nothing
holding the two together, and deleteAggregationAuthorization removed-then-
persisted the same way. Two concurrent Puts for one (AuthorizedAccountId,
AuthorizedAwsRegion) could both find nothing and both create: the second
overwrote the first's CreationTime and re-applied creation tags over a set
TagResource may already have changed, so the documented idempotency held only
probabilistically.

Both now take the same per-key lock putConfigRule/deleteConfigRule already use
for rules. The lock keys are namespaced apart from the rule keys in the shared
map rather than relying on rule names never containing '|'.

The regression runs many short rounds rather than one wide one, because the
unlocked window is a few instructions: repeated fresh starts land the race,
more threads on one start do not. It asserts reference identity, which is what
distinguishes the two cases -- the store is keyed on the pair so its size is 1
either way, the ARN is derived from the key so it is equal either way, and
CreationTime is epoch seconds so a racing pair created inside one second is
indistinguishable by timestamp. Verified to fail with the lock removed
(17 mismatches) and pass with it, five runs.
2026-09-15 14:48:11 -04:00
Alexy GrabovandAlexy Grabov 7813d14ee4 feat(network): add opt-in security group enforcement (#3681)
* feat(network): add opt-in security group enforcement

* fix(ec2): make security group tests order independent

* fix(network): emit valid ICMP nft rules and restart protected instances

Three review findings on the opt-in security-group enforcement foundation:

- SecurityGroupNftCompiler built "icmp type 8 code 0 accept" for an AWS
  ICMP rule carrying both FromPort (type) and ToPort (code). nftables
  header fields are separate expressions, so nft rejected the whole
  compiled policy and the manager then quarantined every endpoint. Each
  field now repeats the protocol keyword, and a protocol rule with no
  type or code becomes "meta l4proto icmp accept", which was equally
  invalid as a bare "icmp accept".
- StartInstances followed the legacy restart path for a protected
  workload and waited for a Docker bridge IP on a container that shares
  the helper's network namespace and so has no attachment of its own.
  The helper survives the workload's stop, so start now reuses its
  transport address exactly as launch does, and skips the reachable
  private address rewrite the same way.
- Replaced the newly introduced var declarations with explicit types and
  imported the inline java.util/model FQCNs, per AGENTS.md.

* fix(network): scope the firewall helper to CAP_NET_ADMIN

The helper only has to program nftables inside the namespace Docker already
gave it, so full --privileged granted far more than the feature needs.
ContainerLifecycleManager now adds CAP_NET_ADMIN for the container carrying
the floci.security-group-helper label, mirroring the capability drop already
applied to protected workloads at the same choke point, and the helper spec
no longer asks for privileged mode.

Also replaces the inline java.util FQCNs the previous commit missed in
Ec2Service with imports, per AGENTS.md.

---------

Co-authored-by: Alexy Grabov <Alexy.Grabov@cyberark.com>
2026-09-15 14:30:49 -04:00
Ovidiu (Ovi) d3bfe2609c feat(redshift): implement zero-ETL integrations (#3559)
* feat(redshift): implement zero-ETL integrations

DescribeIntegrations had no implementation, so an application that
discovers its zero-ETL integration at runtime could not run against the
emulator.

Implementing that action alone would have been worse than leaving it out.
A caller matches its integration by SourceArn and treats "no match" as a
hard error, so an action that always answered with an empty list would turn
a clean "unsupported" into a confusing "no integration whose source is the
X table". CreateIntegration and DeleteIntegration come with it, so an
integration can exist and the empty list means what it says.

Shape captured from a live integration in us-west-2:

  - Status is lower case ("active"), not ACTIVE
  - Errors is present but empty on a healthy integration
  - the record carries IntegrationArn, IntegrationName, SourceArn,
    TargetArn, Status, CreateTime, KMSKeyId, Tags and
    AdditionalEncryptionContext
  - describing with an unknown IntegrationArn is IntegrationNotFoundFault,
    "The requested integration doesn't exist."
  - an account with no integrations answers with an empty list, not an
    error
  - no Marker element is emitted when there is no further page, which is
    what stops a caller's pagination loop

This is metadata only: nothing replicates from the source, and the
integration settles as active immediately rather than passing through
creating, because there is no work for it to do.

* fix(redshift): correct the integration Query contract

Three gaps against the modelled Query API, each confirmed in the bundled
botocore service model rather than taken on trust.

Tags arrive under TagList, not Tags. The shape is a list whose member
carries locationName Tag, so a real client sends TagList.Tag.N.Key and
.Value. Reading Tags.Tag.N meant every tag an SDK sent was silently
dropped, which a hand written form-encoded test did not catch because it
used the wrong name too.

DescribeIntegrations is paginated and filterable. MaxRecords, Marker and
Filters.DescribeIntegrationsFilter.N were all ignored, so the operation
only worked while every record fitted in one response and a caller using
filters got unrelated integrations back. MaxRecords honours the documented
20 to 100 range, the marker is the last ARN already returned rather than an
offset, and no Marker is emitted on the terminal page. The four modelled
filter names are implemented: integration-arn, source-arn, source-types and
status. An unrecognised name is rejected rather than ignored.

CreateIntegration advertises Description and AdditionalEncryptionContext.
Both are now parsed, stored and rendered, with the documented rule that the
encryption context is only valid alongside a KMSKeyId, and Description
capped at the modelled 1000 characters.

* test(redshift): cross a real page boundary in the marker regression

The previous test created three integrations and asked for twenty, so it
only proved the terminal case: no Marker when everything fits. It never
forced a second page, never asserted a non-terminal page carries a Marker,
and never sent one back.

It now creates twenty-one records against the smallest legal page size and
walks every page, asserting that a full page carries exactly MaxRecords
records and a Marker, that no record appears on two pages, that the final
page omits the Marker, and that the traversal returns the same set as a
single large page. Other tests in this class share the store, so the
assertions are about the traversal rather than absolute counts.

* feat(redshift): validate IntegrationName against the modelled pattern

CreateIntegration only checked IntegrationName for non-blank, so a name
real AWS refuses was accepted: the member is modelled min 1, max 63,
pattern ^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9]+)*$. A leading digit or
hyphen, an underscore, a doubled hyphen and a trailing hyphen all got
through, as did a name over 63 characters.

Validate both constraints in createIntegration, alongside the existing
Description length and encryption-context rules.

Three regressions cover the rejected shapes, the over-length case and
acceptance at the 63 character boundary.
2026-09-15 13:36:10 -04:00
Simone Primarosa 3c23784ca7 feat(s3): evaluate bucket policies for authenticated callers (#3632) 2026-09-15 13:09:26 -04:00
Niels Kootstra 144b90e6fa fix(apigateway,appsync): sandbox VTL rendering with SecureUberspector and execution limits (#3542)
* fix(apigateway,appsync): sandbox VTL rendering with SecureUberspector and execution limits

VtlTemplateEngine and AppSyncVtlEngine rendered templates with Velocity's
default UberspectImpl introspector, which allows arbitrary reflection
through any context object (e.g. $util.getClass().forName('java.lang.Runtime')),
and had no cap on #foreach iterations, output size, or execution time,
making them vulnerable to both sandbox escapes and denial of service via
runaway loops or #set string doubling.

Add a shared VtlSandbox helper that both engines call to switch to
SecureUberspector and restrict introspection on java.lang.Class,
ClassLoader, Runtime, ProcessBuilder, System, Thread, java.io.File and
related reflection/scripting/process packages, plus three independent
limit layers: a native #foreach loop cap that truncates the loop without
failing the template, a cooperative execution deadline checked from a new
SandboxedForeach directive before each loop iteration, and a BoundedWriter
output-size cap. The latter two throw the new VtlLimitExceededException,
an unchecked RuntimeException that flows through each engine's existing
error handling exactly like any other Velocity evaluation failure, with
no new error shape. Limits are configurable via EmulatorConfig
(vtlMaxLoops, vtlMaxOutputChars, vtlTimeoutMillis; application.yml keys
vtl-max-loops, vtl-max-output-chars, vtl-timeout-millis), mirroring the
project's existing per-service numeric-tunable config pattern, and
documented in api-gateway.md and appsync.md.

The classpath-shadowed velocity.properties resource is kept for any
embedding that resolves it normally, but is not the actual enforcement
point: under this project's test/runtime classloader, Velocity's own
getResourceAsStream lookup for that exact resource path can resolve to
the copy bundled inside the velocity-engine-core jar instead of this
project's shadowed copy, silently leaving the insecure UberspectImpl
active even with a correct properties file on disk. VtlSandbox configures
SecureUberspector and swaps in SandboxedForeach directly via the
VelocityEngine Java API instead, which is unaffected by that ambiguity.

* docs(apigateway): correct foreach registration documentation
2026-09-15 13:03:51 -04:00
Matheus André 2ee3aa67c0 feat(apigateway): support Gateway Responses on REST APIs (#3326) (#3585)
Add the PutGatewayResponse / GetGatewayResponse / GetGatewayResponses /
UpdateGatewayResponse / DeleteGatewayResponse family, keyed per REST API by
responseType across the 21 AWS types. Uncustomised types are reported with
defaultResponse=true, their AWS default statusCode and the default
{"message":$context.error.messageString} template; UpdateGatewayResponse
patches /statusCode, /responseParameters/<name> and
/responseTemplates/<content-type>, and DeleteGatewayResponse restores the
default.

ImportRestApi and PutRestApi read the x-amazon-apigateway-gateway-responses
extension, and AWS::ApiGateway::GatewayResponse is provisioned by a new
CloudFormation provisioner whose Ref / Fn::GetAtt Id is
<restApiId>-<responseType>.

On the execute plane every gateway-generated answer (unmatched path or
method, AWS_IAM and Lambda authorizer rejections, missing API key, request
validation, unsupported media type, integration configuration errors and
Lambda proxy failures) resolves the customisation for its type, then
DEFAULT_4XX / DEFAULT_5XX, and applies the configured statusCode, the
gatewayresponse.header.* parameters (static, method.request.*, context.*,
stageVariables.*) and the response templates, with $context.error.* exposed
to VTL. An expired SigV4 signature selects EXPIRED_TOKEN and a malformed or
mismatching one INVALID_SIGNATURE, as AWS keeps those two contracts apart.
This is what puts Access-Control-Allow-Origin on a browser-visible
401/403/400 so the frontend can read the real status instead of a CORS
failure. Without a customisation every answer is unchanged.

Closes #3326
2026-09-15 07:44:45 -04:00
Ovidiu (Ovi) 6f05442218 feat(bedrock-agentcore): implement InvokeHarness (#3557)
* feat(bedrock-agentcore): implement InvokeHarness

InvokeHarness was the last gap keeping an application's agent chat on real
AWS. #3556 added the Memory event data plane, so conversation history works
locally, but the invoke call itself had nothing to answer it.

There is no agent loop here and no model. What is emulated is the wire
contract an application integrates against: POST /harnesses/invoke returns
an application/vnd.amazon.eventstream response carrying messageStart,
contentBlockStart, one contentBlockDelta per chunk, contentBlockStop,
messageStop and metadata, in that order. The reply echoes the caller's last
user message, which makes a chat client visibly work end to end and leaves
a request that failed to parse obvious rather than hidden behind a fixed
string.

The wire bindings are the part worth knowing, and they are not what the
request model suggests. harnessArn and qualifier are query parameters,
runtimeSessionId and runtimeUserId are headers
(X-Amzn-Bedrock-AgentCore-Runtime-Session-Id / -User-Id), and only
messages, model and tools travel in the JSON body. Reading them from the
body compiles, passes a hand-written test, and then fails against the real
SDK with "harnessArn is required".

A request carrying no user message is legitimate rather than an error: a
caller whose memory already holds the current turn sends none, so that case
answers with a canned line. harnessArn is not resolved, because the
emulator models no harness resource; InvokeAgentRuntime is permissive for
the same reason.

BedrockStreamEncoder moves to core/common as AwsEventStreamWriter and
becomes public, next to the AwsEventStreamEncoder it already delegates to.
Both services now share one frame writer rather than duplicating the
header-map wrapper. bedrock-runtime keeps its behaviour and its streaming
tests are the regression guard.

Tool execution, skills and multi-turn iteration are not emulated, so no
tool-use block is produced even when a request supplies tools.

* fix(bedrock-agentcore): validate the InvokeHarness request contract

messages is a required member. Treating a missing or non-array field the
same as an empty array made an omitted required member indistinguishable
from a legitimate empty one, so the two are now separated: an empty array
still gets the canned reply, an absent member is a ValidationException.

harnessArn and runtimeSessionId were only checked for being non-blank.
Both carry modelled constraints, taken from the bundled botocore service
model rather than guessed:

  harnessArn        arn:...:bedrock-agentcore:<region>:<account>:harness/
                    <name>-<10 alphanumerics>
  runtimeSessionId  33 to 100 characters, [a-zA-Z0-9][a-zA-Z0-9-_]*

Real AgentCore enforces the ARN shape before anything else: an ARN of
harness/h-1 comes back as "Invalid harness ARN format" even when the rest
of the request is wrong too, which is why the test values in this branch
had to change.

The ARN's shape is checked but the harness is still not resolved, because
the emulator models no harness resource. A well formed ARN naming nothing
is accepted, and has a test saying so.

* fix(bedrock-agentcore): report a malformed harness ARN before a missing session id

The ARN shape was checked after both presence checks, so a request carrying a
malformed ARN and no runtimeSessionId header came back as "runtimeSessionId is
required" rather than the ARN error AWS returns. No test exercised two bad
fields at once.

The ARN is now validated whole, presence and shape together, before
runtimeSessionId is read.
2026-09-15 07:44:22 -04:00
Ovidiu (Ovi) 917e94914f feat(sfn): apply ItemBatcher to distributed Map children (#3604)
* feat(sfn): apply ItemBatcher to distributed Map children

ItemBatcher was parsed and then ignored: every child execution received one
item regardless of MaxItemsPerBatch, so a state machine that batches ran with a
different payload shape locally than on AWS, silently.

Items are now grouped into batches and each child execution receives
{"BatchInput": ..., "Items": [...]}. A batch closes on MaxItemsPerBatch or
MaxInputBytesPerBatch, in their literal, Path and JSONata expression forms, and
with neither set every item lands in one batch. ItemSelector still runs per item
before grouping, so the transform sees $$.Map.Item as it did before.

MaxConcurrency now bounds concurrent batches, and DescribeMapRun separates the
two counters it used to share: itemCounts counts items, executionCounts counts
child executions.

* fix(sfn): cap a batch at the 256 KiB child-input ceiling

MaxInputBytesPerBatch being optional let MaxItemsPerBatch alone build a child
input larger than Step Functions would ever start, and the byte count measured
the items alone, so a declared cap could still be exceeded by the envelope,
BatchInput and separators.

Batching now measures the serialized child payload and closes a batch at the
declared limit or at 256 KiB, whichever is smaller.

* fix(sfn): fail an item too large to start a child execution

An item whose serialized batch input already exceeded 256 KiB was added anyway,
because the split branch is skipped while the batch is empty, producing a child
input AWS would refuse to start.

Such an item now fails the state with States.DataLimitExceeded, naming its size
and pointing at ItemSelector as the way to reduce it.

* refactor(sfn): resolve every integer Map field through one helper

MaxConcurrency and the ItemBatcher limits read the same three forms, literal,
Path and JSONata expression, through two near-identical methods. The batcher one
already parameterized the field name, so the pair collapses into a single
resolver with a minimum: 0 for MaxConcurrency, where it means the service
ceiling, and 1 for a batch limit, where it is meaningless.

The shared resolver also clamps an oversized value to Integer.MAX_VALUE, which
only the MaxConcurrency copy did before.
2026-09-15 07:43:59 -04:00
Ovidiu (Ovi) 38d1d0a8e4 feat(glue): implement partition indexes (#3551)
* feat(glue): implement partition indexes

CreatePartitionIndex and DeletePartitionIndex were missing, and
GetPartitionIndexes was a stub that resolved the table and then always
returned an empty list. A client could create an index and read back
nothing, and Terraform's aws_glue_partition_index could not apply at all.

Behaviour captured against real Glue in us-west-2, on a table partitioned
by tenant/year/month/day:

  - an index key must name a partition column, else InvalidInputException
    "IndexKeys not a part of PartitionColumns. Verify the indexKeys : [x]"
  - keys need not be a prefix of the partition keys, and need not be in
    partition order: [year] and [month, tenant] are both accepted
  - a repeated index name gives AlreadyExistsException "... already exists
    with the same name."
  - a repeated key list under a new name is refused too: "... already
    exists with the same keys." The comparison is order sensitive, so
    [year, month] and [month, year] are distinct indexes
  - a fourth index gives ResourceNumberLimitExceededException "Partition
    index limit exceeded. Maximum: 3", and the cap is evaluated before the
    duplicate checks
  - deleting an unknown index gives EntityNotFoundException "Index with the
    given indexName : x does not exist."
  - a read resolves each key to its name and type from the table's
    partition keys, while a create carries names only

Indexes live in their own store keyed by the table key, so the existing
deleteTable cascade sweeps them and a recreated table starts clean.

One deliberate divergence: an index is stored ACTIVE immediately. Real
Glue creates asynchronously, reports CREATING while it backfills, and
refuses a concurrent create on the same table. Settling immediately keeps
tests free of polling, and a client that waits for ACTIVE (the Terraform
provider does) completes on its first read.

Verified end to end against a local floci: the SDK round-trips create,
read and delete, every error above matches the capture, and a real
aws_glue_partition_index applies and destroys cleanly.

* feat(glue): expose the partition index lifecycle

The first cut stored an index ACTIVE on create and removed it on delete,
treating the lifecycle as an internal detail. It is not: a caller reads
IndexStatus from GetPartitionIndexes and can branch on it, so collapsing
the states changed an AWS-visible contract.

Captured against real Glue in us-west-2:

  - a new index reports CREATING for roughly 12 seconds, then ACTIVE
  - a deleted index reports DELETING before it disappears
  - while either is in progress, another create on the same table gives
    ResourceNumberLimitExceededException "Index <name> is in <STATE>
    state. Only 1 index can be created or deleted simultaneously per
    table."
  - an index that is still CREATING cannot be deleted: Glue reports
    EntityNotFoundException "Index with the given indexName : <name> does
    not exist." even while a read lists it as CREATING. Measured in
    isolation, with nothing else in flight

The transitions are driven by reads rather than wall-clock time, so they
stay deterministic and tests need no sleeps: each GetPartitionIndexes
reports the current state and settles it, so the next read sees the
outcome. A client that polls converges on its second call.

FAILED is not emulated; it only arises from a backfill failure.

Verified with a real aws_glue_partition_index against a local floci:
apply polls CREATING to ACTIVE and completes, a refresh reports no drift,
and destroy passes through DELETING.

Also replaces var with explicit types and drops inline fully-qualified
names in the tests, per the AGENTS.md rule.

* docs(glue): correct two javadocs left behind by the index lifecycle

Both still said an index is stored ACTIVE immediately, which stopped being
true when createPartitionIndex started storing CREATING and letting
GetPartitionIndexes settle it.

* fix(glue): serialize partition index writes against their own reads

createPartitionIndex reads the stored indexes, checks the cap and the duplicate
rules, then writes, with nothing holding that together. Two concurrent creates
on a table at two indexes both saw room under the cap of three and both wrote,
leaving four. Nothing repairs that afterwards.

create, delete and the settling loop in getPartitionIndexes now carry the same
synchronized treatment updateTable already uses for its own check-then-write.
2026-09-15 07:43:35 -04:00
TATSUNO “Taz” Yasuhiro 43a0d737e9 perf(iam): cache parsed policy and lowercase patterns once (#3635)
* perf(iam): cache parsed policy documents in IamPolicyEvaluator

Every evaluate call parsed each policy document with Jackson again. A caller
with a large managed policy such as ReadOnlyAccess (94 KB) paid that parse
on every request under IAM enforcement.

The evaluator now keeps the parsed statements per document text in a
ConcurrentHashMap. Parsing is a pure function of the text, so entries never
go stale. The map is bounded at 2048 entries and cleared when the bound is
reached, which only matters for many distinct session policies. A document
that fails to parse is cached as failed, so the warning is logged once
instead of on every request.

AWS managed policy catalog has 1566 documents. All 1566 parsed take about
9.5 MB of heap, and AWS caps a customer managed policy at 6144 characters
and a session policy at 2048, so 2048 entries stay within tens of MBs in
the worst case.

* perf(iam): store policy patterns lowercased in the parsed statement cache

Action and Resource matching is case-insensitive. globMatches lowercased
both the pattern and the request value on every comparison, which for a
policy like ReadOnlyAccess meant about 5800 new strings per request.

The patterns are now lowercased once when the document is parsed and
cached, and the request action and resource are lowercased once per
evaluation. The public globMatches helper used by the trust policy and S3
public access evaluators is unchanged.

* fix(iam): compare resource ARNs case-sensitively

AWS documents the Action element as case-insensitive, but the Resource
element is not: the IAM user name in a Resource ARN is case sensitive, and
so are S3 object keys. The evaluator lowercased both sides of every
Resource and NotResource comparison, so a grant on user/Bob also matched
user/bob and a grant on bucket/Private/* also matched bucket/private/*.

Resource and NotResource patterns are now kept as written in the parsed
statement cache and the request resource is compared as is. Action and
NotAction patterns stay lowercased once at parse time.
2026-09-15 07:42:56 -04:00
Priamo Germosen c7b4a393d9 fix(rds): support IPV6 and DUAL network types on RDS Proxy (#3639)
CreateDBProxy/AWS::RDS::DBProxy rejected EndpointNetworkType/TargetConnectionNetworkType
outright for anything other than IPV4 ("Floci currently exposes IPv4 proxy networking only").
Both fields are now accepted and stored on the DbProxy record:

- EndpointNetworkType: IPV4, IPV6, or DUAL
- TargetConnectionNetworkType: IPV4 or IPV6 (no DUAL, matching AWS's own constraint)

They round-trip through DescribeDBProxies and CloudFormation the same way the proxy's other
control-plane settings (pool sizing, TLS, idle timeout) already did.

AWS's RDS Proxy network prerequisites require both the VPC and every selected subnet to carry
an associated IPv6 CIDR block for IPV6/DUAL. floci already modeled VPC-level IPv6 CIDR
associations; subnet-level association is now modeled too (Subnet.ipv6CidrBlockAssociationSet,
CreateSubnet's Ipv6CidrBlock parameter, and the DescribeSubnets/CreateSubnet response), and
createDbProxy validates both the VPC and every VpcSubnetIds entry before accepting a non-IPV4
network type, rejecting with InvalidParameterValue otherwise. Genuinely invalid enum values are
still rejected at both the RDS Query API and CloudFormation provisioner layers.

The CloudFormation update path now also refuses a changed EndpointNetworkType or
TargetConnectionNetworkType the same way it already refused a changed DBProxyName, EngineFamily,
or VpcSubnetIds: both are createOnlyProperties in the AWS::RDS::DBProxy registry schema, and
ModifyDBProxy has no such parameters, so silently accepting a changed value on UpdateStack would
report UPDATE_COMPLETE while the proxy's actual network type stayed put.

Added a Terraform compatibility scenario (rds-proxy-network-type-tf) with a genuinely
dual-stack VPC and subnets, plus negative cases for an IPv4-only VPC and for a dual-stack VPC
whose subnets lack an IPv6 CIDR block.
2026-09-15 07:35:11 -04:00
Priamo Germosen 315dfe69f0 fix(rds): support tagging DB snapshots (#3649)
TagResource/UntagResource/ListTagsForResource rejected a snapshot ARN
outright ("not yet implemented by Floci"), and CreateDBSnapshot
silently dropped its Tags parameter even though DbSnapshot already had
a tags field. Both are now wired up: CreateDBSnapshot stores Tags, the
generic tag-resource dispatch resolves a "snapshot" ARN type against
the snapshot store, and DescribeDBSnapshots echoes DBSnapshotArn and
TagList like the other tagged resource types already do.

Snapshots are now region-scoped the same way DB instances and clusters
already are: CreateDBSnapshot/DescribeDBSnapshots/DescribeDBSnapshot-
Attributes/ModifyDBSnapshotAttribute/RestoreDBInstanceFromDBSnapshot
all thread the request's signed region through to snapshot storage and
lookup (via the same dbResourceKey/hasRdsResourceIdentity scoping the
instance/cluster stores use), so DBSnapshotArn reflects the request's
actual region and a snapshot created in one region is not visible to
Describe/Tag calls signed for another.

Verifying this live against a real floci instance via Terraform
surfaced two more gaps blocking any use of aws_db_snapshot at all,
regardless of tagging: DescribeDBSnapshotAttributes (called on every
read of the resource) and ModifyDBSnapshotAttribute were both
completely unimplemented. Added minimal support for both (the
"restore" attribute, i.e. cross-account copy/restore authorization,
modeled as plain in-memory state, no real cross-account sharing).

DeleteDBSnapshot is also unimplemented and was not added here — a
snapshot can be created and tagged but not destroyed via Terraform.
Noted in docs/services/rds.md as a follow-up, along with the other
resource types the original gap report mentioned (Aurora cluster
snapshots, reserved instances) that aren't modeled in Floci at all, so
tagging doesn't apply to them either.

Added a Terraform compatibility scenario (aws_db_snapshot with tags,
verifying create, tag read-back, a clean second plan, and an in-place
tag update) and ran it against a live floci instance before
committing, including a re-run after the region-scoping fix.
2026-09-15 07:34:42 -04:00
Priamo Germosen 74d4782b51 feat(batch): support array and multi-node parallel jobs (#3595)
SubmitJob previously rejected arrayProperties/nodeProperties/nodeOverrides
outright. Array jobs now fan out real child jobs (<parentId>:<index>) that
run through the existing single-job pipeline; the parent's status and
arrayProperties.statusSummary are computed live from its children on every
DescribeJobs/ListJobs call instead of being stored and incrementally
updated, which avoids a race between concurrently finishing children.

Multi-node parallel jobs are supported via a new "multinode" job
definition type (numNodes/mainNode/nodeRangeProperties, validated for full
node coverage). SubmitJob runs one Docker container per node concurrently;
per AWS's documented MNP semantics, the job's status, retry decision, and
started/stoppedAt/statusReason are all determined solely by the main node,
not by any node that happens to fail. nodeOverrides.numNodes is supported
with AWS's real validation (requires an open-ended node range).

ListJobs gains arrayJobId and multiNodeJobId support.

dependsOn (job dependencies), CancelJob/TerminateJob (not implemented at
all, pre-existing), EventBridge forwarding of these new fields, and
CloudFormation-provisioned multinode job definitions remain out of scope
and are noted in docs/services/batch.md.
2026-09-14 23:02:04 -04:00
Hector Ventura a5ebda01fb feat(ui): publish a console contract so any web console can be the sidecar (#3641)
Floci could run exactly one web console, the image it ships. This publishes the contract
between Floci and a console so any image can take that slot, and an operator gets there by
setting one image name rather than by configuring seven fields.

Three things make a console a Floci console: it listens on the port in PORT, it serves
GET /api/health, and it talks to Floci at AWS_ENDPOINT_URL. Everything else is detail the
contract spells out, including the AWS baseline every launched container already receives,
so a console built on any AWS SDK is configured by that SDK's ordinary endpoint and
credential discovery.

Floci learns a console's shape from three sources, in order. The image's own
io.floci.console.* labels come first, so a console describes itself and needs no operator
input at all. A built-in profile covers the consoles Floci already knows. The contract
defaults (/api/health, port 4500, status: ok) cover the rest. Configuration overrides all
three, for a console that describes itself neither way.

That ladder is why the new config keys ship commented out in application.yml. They exist for
the console that fits none of the three sources, and setting one silently disables the
discovery that would otherwise just work. Every accessor is Optional or OptionalInt, so
nothing is required and the test configuration needs no entry.

A malformed label is ignored rather than fatal: a console that declares port="banana" starts
on the default instead of failing the emulator, and the reason is logged.

Docs: docs/ui/console-contract.md is the contract itself, written for console authors, and
docs/ui/index.md is the operator's page. Both are in the mkdocs nav.

Tests: 608 lines. ConsoleProfileResolverTest covers the resolution ladder including the
precedence between its three sources; ContainerLifecycleManagerImageLabelsTest covers reading
labels off an image; FlociUiManagerTest grows to cover the manager against the contract.
Neutralising the label arm fails 5 of the 13 resolver tests, so the ladder is genuinely
exercised rather than the tests only asserting defaults.
2026-09-14 21:53:59 -05:00
Chris Jovanovski 6ce3fbbd2e fix(cloudwatchlogs): bound stored events and enforce retention (#3611)
* fix(cloudwatchlogs): cap stored log events and enforce retention on ingest

* docs(cloudwatchlogs): document max-stored-events and the slower log flush interval

* fix(cloudwatchlogs): scope eviction to the ingesting account

Use explicit account storage operations for retention and capacity eviction.

* docs(cloudwatchlogs): note the stored-event ceiling applies per account

* docs(cloudwatchlogs): document that the stored-event ceiling is best-effort under concurrent ingest
2026-09-14 16:18:45 -04:00
Allen Sanborn 1482d45b6e fix(sqs): match AWS queue attribute defaults and MaximumMessageSize range (#3626)
* fix(sqs): match AWS queue attribute defaults and MaximumMessageSize range

A new queue reported MaximumMessageSize 1048576, four times the AWS default
and above the AWS maximum, and nothing rejected an out-of-range value on
CreateQueue or SetQueueAttributes. GetQueueAttributes with All also omitted
SqsManagedSseEnabled, which AWS returns for every standard queue.

Default max-message-size is now 262144, values outside 1024 to 262144 are
rejected with InvalidAttributeValue, and All returns the AWS attribute set
including SqsManagedSseEnabled (true unless KmsMasterKeyId is set). Raising
FLOCI_SERVICES_SQS_MAX_MESSAGE_SIZE above the AWS maximum widens the accepted
range with it, so the configured default stays settable explicitly.

* fix(sqs): address review findings

Cover the shipped default itself: ApplicationDefaultsTest now reads
src/main/resources/application.yml and the EmulatorConfig @WithDefault, so
reverting either one fails a test rather than passing on the explicit value in
src/test/resources/application.yml.

Report the MaximumMessageSize that SendMessage enforces. A queue persisted by a
build that allowed 1 MB advertised a payload the send path would then reject;
GetQueueAttributes and the size check now share parseMaxMessageSize, which also
trims like the validation path does.

Pin the SNS fan-out size boundary. SNS accepts a publish up to 262144 bytes and
SQS accepts a message up to the same 262144, so a non-raw sqs subscriber whose
notification envelope pushes the body past the limit is dropped with a warn.
That mirrors AWS, and SnsSqsFanoutMessageSizeTest now holds it in place from
both sides.

Trim the InvalidAttributeValue message to the bare AWS form used elsewhere in
the file.

* fix(sqs): keep SqsManagedSseEnabled consistent when KmsMasterKeyId changes

Creating a queue with a KmsMasterKeyId stored SqsManagedSseEnabled=false. That
value outlived the key: clearing KmsMasterKeyId left the stored false behind,
and the read path, which only fills the attribute in when absent, kept
reporting managed SSE as disabled for a queue that no longer had a KMS key.

Stop storing the derived value at all. CreateQueue no longer writes
SqsManagedSseEnabled, so anything stored under that name is a value the user
set, and it survives. GetQueueAttributes derives the answer on every read: a
KMS key wins, an explicit setting stands, and a queue with neither reports the
AWS default of true. There is no derived state left to go stale.

AWS does not document crisply what happens to SSE-SQS when a KMS key is
cleared, so returning to the default is a deliberate choice; the code and
docs both say so rather than implying it is copied behaviour.

* fix(sqs): raise MaximumMessageSize bounds to the AWS value of 1 MiB

The previous commits on this branch set MaximumMessageSize to a default and
maximum of 262144 bytes. That was wrong: it is SNS's Publish limit, not SQS's.
AWS raised both the SQS maximum and the SQS default from 262144 to 1048576
bytes in August 2025, so the valid range is 1024 to 1048576 with a default of
1048576.

Corrected AWS_MAXIMUM_MESSAGE_SIZE, the EmulatorConfig fallback, both
application.yml files and the docs. The reject-out-of-range path in
validateMaximumMessageSize is unchanged apart from its bounds, as are the
SqsManagedSseEnabled derive-on-read behaviour and the DelaySeconds,
ReceiveMessageWaitTimeSeconds, MessageRetentionPeriod and VisibilityTimeout
backfills.

Several tests had been shrunk to fit the wrong ceiling and are restored to the
payload sizes they had before this branch. getQueueAttributes now stores an
above-ceiling 2097152 so the clamp path stays covered, and a new test pins the
ceiling itself: with a lowered configured maximum, a queue may still be set to
1048576, which the old constant rejected.

Deleted SnsSqsFanoutMessageSizeTest. Its premise was that an SNS notification
envelope reliably pushes a body past the queue's MaximumMessageSize, which no
longer holds for the ordinary text it published: SNS caps a publish at 262144
bytes and SQS now accepts 1048576, so the envelope overhead alone does not
cross the limit. The boundary has not disappeared, it has moved somewhere the
test did not look. Because the envelope is serialized as JSON, escaping expands
every control character below 0x20 to six bytes, and publish validates size
without inspecting character classes, so a publish made largely of control
characters can still overflow a 1 MiB queue. That case is untested; covering it
needs a test built around the expansion rather than around envelope overhead.

The SNS comment that asserted SQS shared the 262144 ceiling is corrected, and
states the escaping caveat rather than claiming the envelope can never cross
the queue limit.
2026-09-14 15:57:18 -04:00
Niels Kootstra 494bab4b30 fix(kms): protect ciphertext blobs with an AES-GCM envelope (#3544)
* fix(kms): protect ciphertext blobs with an AES-GCM envelope

Symmetric CMK ciphertext was base64(plaintext) dressed up with a
cosmetic nonce and context fingerprint: anyone holding a CiphertextBlob
could read the plaintext, and any bit flip still "decrypted" to the
same value. Encrypt now builds a versioned AES-256-GCM envelope backed
by real per-CMK key material, binding the key id, backing key id and
canonicalized EncryptionContext as GCM additional authenticated data.
Decrypting with the wrong key, the wrong context, or any tampered byte
in the header, IV, ciphertext or tag now fails as
InvalidCiphertextException instead of leaking or silently accepting
corrupted ciphertext.

RotateKeyOnDemand mints a new backing key rather than replacing the
old one, so ciphertext encrypted before a rotation keeps decrypting
after it, matching AWS KMS's own retention of prior backing keys.
Legacy v1/v2 blobs already persisted keep decrypting read-only for
back-compat; Encrypt never produces them again. Keys persisted before
this change generate their backing key material lazily on first use
and persist it from then on.

Only SYMMETRIC_DEFAULT keys reach this path: SM2 Encrypt/Decrypt is
already unreachable via the existing key-usage/algorithm validation,
and RSA keeps its existing, already-real RSAES-OAEP handling untouched.

* fix(kms): serialize legacy backing key generation under a lock

Two concurrent first uses of a key persisted before the AES-GCM
envelope existed could each generate a different backing key and both
call keyStore.put; the loser's backing key, and any ciphertext already
encrypted under it, would become unreachable. Guard the generate-and-persist
step with a dedicated lock that re-reads and re-checks the key before
minting one, so only one backing key is ever created for a given legacy
key, and return the resolved instance so callers use the persisted
object. The unsynchronized fast path for already-healed keys is
unchanged.

Add a test that resolves a legacy key concurrently from a dozen
threads and asserts they converge on one backing key whose ciphertexts
all still decrypt.

* fix(kms): back EXTERNAL symmetric keys with their imported material

The envelope resolved every SYMMETRIC_DEFAULT key through the lazy backing
key generator, including Origin=EXTERNAL keys. A PendingImport key was
given random material before ImportKeyMaterial ran, Encrypt then used that
material instead of the imported one, and deleting or expiring the import
left the generated key able to open ciphertext.

EXTERNAL keys now skip generation, ImportKeyMaterial installs the imported
material as the backing key under its KeyMaterialId, and delete or expiry
removes it. Decrypt of such ciphertext answers with the key's PendingImport
state, and re-importing the same material reinstates the backing key id
that earlier ciphertext names.

* fix(kms): synchronize backing material access
2026-09-14 14:04:58 -04:00
Aniket Shukla e82836348b fix(stepfunctions): resolve state machine alias ARNs (#3607)
* fix(stepfunctions): resolve state machine alias arns

* docs(stepfunctions): list alias actions

* fix(stepfunctions): paginate state machine aliases

* ci: rerun compatibility checks
2026-09-14 12:42:56 -04:00
Simone Primarosa 95079965a8 fix(ecr): enforce immutable image tags (#3009)
Route Docker Distribution traffic through Floci so repository mutability applies to manifest writes. Keep legacy registry storage reachable while moving public ECR endpoints to the guarded listener.
2026-09-14 12:07:40 -04:00
Daniel ZwickerandPriamo Germosen a03c4d6160 feat(cognito): support pending user attribute verification (#2531)
* feat(cognito): support pending attribute verification

* fix(cognito): omit UserAttributeUpdateSettings when a pool never configured it

DescribeUserPool/CreateUserPool/UpdateUserPool always serialized
UserAttributeUpdateSettings as an empty object for pools that never set it,
where AWS omits absent optional members entirely. UserPoolAddOns right above
it already handles this correctly (an unconfigured pool omits the key rather
than returning {} or null, confirmed by Terraform re-planning the block into
and out of existence); UserAttributeUpdateSettings now follows the same
pattern.

* test(cognito): replace var with explicit AWS SDK response types

AGENTS.md's Types and names rule bans var in local declarations; the compat
test used it for four locals whose concrete AWS SDK type is the thing under
review here (CodeDeliveryDetailsType, UpdateUserAttributesResponse).

---------

Co-authored-by: Priamo Germosen <6233424+pgermosen@users.noreply.github.com>
2026-09-14 11:50:16 -04:00
Daniel ZwickerandPriamo Germosen 36c3ee4e22 feat(cognito): implement VerifyUserAttribute (#2018)
* feat(cognito): implement VerifyUserAttribute

* fix(cognito): align attribute verification with AWS

* fix(cognito): require access-token scope on VerifyUserAttribute

verifyUserAttribute() extracted username/pool/jti from the caller's token
but never checked token_use or scope, so a valid ID token could reach the
same code-consuming, attribute-mutating path as an access token. AWS
requires an access token carrying the aws.cognito.signin.user.admin scope
for this operation (API_VerifyUserAttribute.html).

Adds a token_use check (unconditional) and a scope check that only rejects
a token when it explicitly carries a scope list missing the required
scope. Most access tokens this simulator issues carry no scope claim at
all (scopes are only modeled through the V2 Pre-Token-Generation Lambda
override), so treating an absent claim as unrestricted keeps every normal
login flow working, while an access token with an explicit, non-conforming
scope list is now rejected.

Adds unit coverage for all three cases (ID token rejected, access token
missing the scope rejected, access token with the scope accepted) plus a
wire-level regression for the ID-token case.

* fix(cognito): scope consumed-code tombstone to attribute verification

VerificationCodeService.consume() retained a consumed-code tombstone for
every purpose, so a reused code answers ExpiredCodeException instead of
the original CodeMismatchException. That behavior was validated against a
real Cognito pool for VerifyUserAttribute, but the service is shared with
ConfirmSignUp (SIGNUP_CONFIRMATION) and ConfirmForgotPassword
(PASSWORD_RESET), so the same change silently altered their reused-code
error too, without the same validation.

Scopes the tombstone to EMAIL_ATTRIBUTE_VERIFICATION and
PHONE_ATTRIBUTE_VERIFICATION only. SIGNUP_CONFIRMATION and PASSWORD_RESET
go back to deleting on consume, restoring their original, previously
validated NOT_FOUND/CodeMismatchException behavior on reuse.

---------

Co-authored-by: Priamo Germosen <6233424+pgermosen@users.noreply.github.com>
2026-09-14 11:05:25 -04:00
Niels Kootstra 1987bf0c96 fix(rds): bound RDS/Redshift auth proxy connections and handshakes (#3545)
Cap concurrent proxy connections with a per-proxy semaphore, apply
configurable handshake and backend-connect timeouts to both the
client and backend sockets, and defer backend PostgreSQL connects
until after client auth completes. Close leaked backend sockets
defensively on every exit path, including a RuntimeException thrown
between authenticate() returning a session and the bridge finishing
its own cleanup, and bound backend-side reads during the handshake
so a silent backend that accepts TCP but never answers cannot pin a
handler thread and its connection permit forever.

New EmulatorConfig keys under services.rds and services.redshift:
proxy-handshake-timeout-millis (default 10000),
proxy-backend-connect-timeout-millis (default 5000),
proxy-max-connections (default 100).
2026-09-14 10:48:48 -04:00
Franklin G. Mendoza ffd2488f02 fix(codepipeline): poll S3 source changes (#3525)
* fix(codepipeline): poll S3 source changes

* fix(codepipeline): serialize source polling baselines
2026-09-14 10:11:15 -04:00
Ovidiu (Ovi) 3003f05953 feat(bedrock-agentcore): implement AgentCore Memory events (#3556)
* feat(bedrock-agentcore): implement AgentCore Memory events

The Memory control plane was emulated but the event data plane was not:
CreateEvent, ListEvents, GetEvent and DeleteEvent were all absent, so an
application that reads a conversation's history had nothing to call.

Rather than answer ListEvents with a fixed empty list, the events are
stored, so a read returns what was written. An empty session is then empty
because nothing wrote to it, not because the answer is hardcoded.

Behaviour captured against real AgentCore in us-west-2:

  - events are returned newest first, and the event id is a zero-padded
    epoch-millisecond prefix plus a random suffix, so ids sort
    chronologically as plain strings
  - includePayloads=false omits the payload key rather than emptying it
  - maxResults accepts 1 to 100; 101 is a ValidationException quoting the
    constraint
  - a malformed memory id is a ValidationException ("Invalid memoryId: not
    a valid memory ID or ARN") while a well-formed but unknown one is a
    ResourceNotFoundException ("Memory not found: <id>"). A memory id is a
    name followed by exactly ten alphanumerics: a nine or eleven character
    suffix is rejected as malformed before any lookup
  - an unknown actor or session is an empty list, not an error
  - sessionId is optional on create, and AgentCore assigns a UUID when it
    is omitted
  - an empty payload is accepted, and a new event lands on the main branch
  - DeleteEvent echoes the deleted id rather than returning an empty body

The endpoints live on the memory controller rather than the data-plane one
because a JAX-RS request is matched against a single root resource class:
the class rooted at "/memories" owns that subtree, and a class rooted at
"/" never gets a look in. The behaviour stays in the data-plane service.

Verified with the same AWS SDK an application would use, pointed at a local
floci: create, list, get and delete round-trip, eventTimestamp parses back
to the exact Date, and each error above arrives as its typed exception.

Memory records (extraction and retrieval) remain unimplemented; they need
an extraction engine rather than stored events.

* fix(bedrock-agentcore): satisfy the docs and native-image CI gates

Three CI failures on this branch, all mine.

The action tables under docs/services are generated, not hand written. I
edited bedrock-agentcore.md directly and put the new event rows in the
wrong position, so `make docs-check` reported the table stale. Regenerated
with `make docs-sync`, which orders actions by registration and therefore
keeps ListMemories ahead of the event family.

BedrockAgentCoreEventService holds a static SecureRandom for event ids.
GraalVM captures such an instance in the image heap unless the class is
initialized at run time, so NativeImageRuntimeInitializationTest failed and
took both native image builds with it. Registered the class under
--initialize-at-run-time alongside the other services that hold one.

* fix(bedrock-agentcore): correct the event wire contract

Three gaps against the modelled contract, all confirmed in the bundled
botocore service model rather than taken on trust.

CreateEvent answers 201, not 200. The operation's HTTP trait says so, and
the test was pinning the wrong status.

payload is a required member of CreateEvent whose valid values include the
empty list. Turning a null into an empty list made an omitted member
indistinguishable from a valid empty array, so presence now travels
separately from the value and an omitted payload is a ValidationException.
The model also caps the list at 100 items, which is now enforced.

ListEvents is paginated. The default page size is 20 rather than the 100
this used, and the request and response carry a nextToken. The token is the
last event id of the previous page rather than an offset: ids sort with
time and the order is stable, so resuming cannot be shifted by a concurrent
write. No token is emitted on the final page, which is what ends a caller's
loop.

Verified with the real SDK against a local floci: five events traverse in
three pages of two, two and one with the token absent on the last, and an
omitted payload comes back as ValidationException.

* fix(bedrock-agentcore): match AWS wording for the maxResults range error

AWS quotes the submitted value and cites only the bound that was breached.
The message always cited the upper bound and dropped the value, so
maxResults=0 reported "less than or equal to 100". Add a test for the
lower bound, which had none.
2026-09-14 00:01:40 -04:00
Alexy Grabov d8e7382d5b fix(docker): allow explicit root for restricted sockets (#3558) 2026-09-13 19:35:01 -05:00
TATSUNO “Taz” Yasuhiro 569f9f55e4 perf(build): replace quarkus-jdbc extensions with plain JDBC drivers (#3465)
* perf(build): replace quarkus-jdbc extensions with plain JDBC drivers

The RDS Data API and Redshift Data API open connections with
DriverManager. They never used Agroal, Narayana or the datasource
layer that quarkus-jdbc-mysql and quarkus-jdbc-postgresql pull in.
Depend on mysql-connector-j and postgresql directly and hand-supply
the native image config the extensions provided.

* perf(build): cut unused JDBC driver paths from the native image

Substitute driver code that cannot be reached against the databases
Floci provisions, mirroring what quarkus-jdbc-mysql did for JMX and
going a step further for authentication and multi-host URLs.

* perf(build): keep the MySQL cleanup thread disabled in JVM mode

quarkus-jdbc-mysql set com.mysql.cj.disableAbandonedConnectionCleanup
at startup in JVM mode as well as at native build time. The first
commit carried only the native build argument and a surefire copy, so
quarkus:dev and the JVM Docker image started Connector/J's abandoned
connection cleanup thread on the first MySQL Data API call. In dev mode
that thread is recreated with every restart and pins the old
classloader.

* fix(rdsdata): reject PostgreSQL result types the Data API does not support

Aurora PostgreSQL answers a result set that holds a point, interval,
money, box, circle, line, lseg, path or polygon column with
UnsupportedResultException and the message "The result contains the
unsupported data type POINT." Floci returned the driver's toString of
the value instead. Check the column type names before reading the rows
and raise the same error. json and jsonb stay supported, and a column
cast to text still reads as a string, which is the workaround AWS
documents.

* perf(build): drop the PGobject reflection entries

pgjdbc builds point, interval, money and the geometric types through
reflection only when a result set holds such a column. The Data API now
rejects those columns before reading a row, and json and jsonb values
are plain PGobject instances the driver creates directly, so none of
the ten entries can be reached.

* chore(rdsdata): name the tolerated ClassNotFoundException in OpenTelemetryUnavailable

* perf(build): keep PGInterval registered for the Redshift Data API

Redshift tables can hold INTERVAL YEAR TO MONTH and INTERVAL DAY TO
SECOND columns and the Redshift Data API returns them as strings. Floci
serves that path from a PostgreSQL container through pgjdbc, which
builds an interval value by reflection, so the entry stays. The Redshift
Data compat test now reads two interval columns on the native image.

* perf(build): keep the geometric reflection entries for the Redshift Data API

Redshift refuses point, box, circle, lseg, path and polygon as column
types but evaluates them in a select, and its Data API returns the
values as strings, checked on a real ra3.large cluster. Floci serves
that path through pgjdbc, which builds those values by reflection, so
the six entries stay. line stays out because Redshift rejects it, and
money never reaches PGmoney because pgjdbc reads it as a double.

The Redshift Data compat test selects those expressions and expects
the strings Redshift returned. JdbcDriverNativeSupportTest resolves
every registered class name.

* fix(redshiftdata): fail statements that produce line, json or jsonb like Redshift

Redshift has none of these types. A select that names one fails with
"ERROR: type "line" not yet implemented" or "ERROR: type "json" does
not exist", checked on a real cluster. The PostgreSQL container behind
Floci's Redshift evaluates them, so the Data API now checks the result
column types and fails the statement with the same text.
2026-09-13 20:08:25 -04:00
Vũ Thế Huy e5bd8be405 feat(redshift): provision AWS::Redshift::Cluster through CloudFormation (#3427)
* feat(cloudformation): provision AWS::Redshift::Cluster (create path)

* feat(cloudformation): AWS::Redshift::Cluster update and replacement

* feat(cloudformation): force replacement on Redshift cluster createOnly property change

* feat(cloudformation): force replacement on Redshift cluster DBName change

* feat(cloudformation): provision Redshift parameter, subnet and security groups

* chore(cloudformation): register Redshift provisioner in inventory and docs

* test(cloudformation): end-to-end AWS::Redshift::Cluster stack

* docs(redshift): document CloudFormation cluster provisioning

* test(cloudformation): assert ClusterSubnetGroupNotFound error code on subnet group deletion

* fix(cloudformation): correct attribute handling for Redshift security group provisioning

* fix(cloudformation): apply Redshift parameter group Parameters and fix docs

ClusterParameterGroup silently dropped Properties.Parameters on both
create and update instead of calling ModifyClusterParameterGroup, and
did not replace the entity when Description or ParameterGroupFamily
changed, even though AWS marks both as replacement properties.

Also remove the Id GetAtt claim from the Cluster docs: neither the
provisioner nor AWS's own schema expose it for AWS::Redshift::Cluster.
2026-09-13 18:45:40 -05:00
Anders Wasen 55ada9b8a3 feat(cloudformation): provision the AppSync resource types (#3424)
Adds AppSyncCfnProvisioner, serving AWS::AppSync::GraphQLApi, GraphQLSchema, DataSource,
FunctionConfiguration, Resolver and ApiKey. Without it a template's AppSync resources fall
to the dispatcher's stub arm, which reports CREATE_COMPLETE while creating nothing and
resolves Fn::GetAtt to the literal "LogicalId.Attr".

Two things are not simple property mapping. The AppSync control plane is REST-JSON with
camelCase members, so every property is lower-camelised on the way in, with DynamoDBConfig
as the one member that does not follow the rule (it is dynamodbConfig). And schema creation
is asynchronous: while it is PROCESSING every other call for that API is refused with a 409,
so the GraphQLSchema resource waits for a terminal status before completing, as CloudFormation
does.

Also carries the service-layer changes the provisioner needs: a PIPELINE resolver reaches its
data through pipelineConfig and names no data source, which createResolver refused outright;
CreateFunction and UpdateFunction now keep the runtime a JS resolver declares; and
UpdateFunction applies a new name, which a CloudFormation rename goes through.
2026-09-13 18:45:32 -05:00