Commit Graph
504 Commits
Author SHA1 Message Date
Kenshin Okinaka 8a122d2b8c feat(firehose): validate and persist DataFormatConversionConfiguration (#3236)
* feat(firehose): validate and persist DataFormatConversionConfiguration

Accept, validate, store, and echo the extended S3 destination's
DataFormatConversionConfiguration instead of silently ignoring it.
Validation messages and precedence follow probed AWS behavior: Smithy
ParquetSerDe bounds first, then compression, buffering floor, and
member checks in AWS order, identical on CreateDeliveryStream and
UpdateDestination, which now merges the configuration member-wise and
validates the merged effective state. OrcSerDe is rejected as a
documented deviation (the planned DuckDB engine cannot write ORC).
Conversion itself is not applied yet: delivery logs a warning and
ships records unconverted.

* docs(firehose): match the conversion helpers' wording to what they do

The legacy-shape helper clears DataFormatConversionConfiguration alone, not
every extended-only member, and the create/update warning fires on each call
that leaves conversion enabled rather than once. Rename the first and reword
both so the contract a reader infers is the one the code keeps.
2026-09-08 09:01:31 -04:00
Mario Toffia af42564cb3 feat(lambda): provision AWS::Lambda::EventInvokeConfig (#3230)
* feat(lambda): provision AWS::Lambda::EventInvokeConfig

The physical id is the registry schema's composite FunctionName|Qualifier
identifier. A create puts the configuration, an update with the same identity
applies the template's settings through the merge-style update call, and a
changed function or qualifier is a replacement whose displaced configuration
the ReplacementCleanup record deletes once the update commits or restores on
rollback. The schema's MaximumRetryAttempts and MaximumEventAgeInSeconds
bounds are checked before any call, as CloudFormation validates them before
the handler runs.

The Lambda docs now list the five event invoke config operations, which the
page wrongly called not implemented, and say that asynchronous invocations do
not yet apply the settings.

* fix(lambda): update the event invoke config in place for equivalent names and roll back in-place changes

A short name and the function's ARN address one configuration, so an update
that changes between them updates in place under the prior physical id
instead of recording a replacement whose cleanup would delete that one
configuration. An in-place update keeps the settings it replaces on the
resource, and a failed stack update puts them back in full. DestinationConfig
is resolved before it is looked at, so a conditional that resolves to
AWS::NoValue is omitted rather than sent as an empty destination set. The
integration test reads stack events with XmlParser.

* fix(lambda): keep the event invoke config rollback snapshot until the restore succeeds

A restore that throws left no snapshot behind, so the next rollback attempt
reported success without restoring anything. The snapshot is now spent only
after the settings are back.
2026-09-08 07:34:52 -04:00
Franklin G. Mendoza 4944764fa3 feat(inspector2): add organization configuration operations (#3162)
* feat(inspector2): add organization configuration operations

* fix(inspector2): complete organization contracts

* fix(inspector2): scope organization account state

* test(inspector2): log tolerated organization state

* test(inspector2): isolate organization cleanup
2026-09-07 22:54:52 -05:00
TATSUNO “Taz” Yasuhiro cbec02df04 feat(dynamodb): import tables from S3 and report new exports as IN_PROGRESS (#3138)
* feat(dynamodb): import tables from S3 and report new exports as IN_PROGRESS

ExportTableToPointInTime handed its worker the same description object it
returned, so a small export could already read COMPLETED in the initial
response. The worker now mutates a copy and runs under the request account.

ImportTable creates the table in CREATING, loads DynamoDB JSON lines from
every object under the S3 prefix on a virtual thread, and flips the table
to ACTIVE when done. DescribeImport and ListImports report it. DYNAMODB_JSON
with NONE or GZIP compression is accepted. CSV, ION and ZSTD are rejected
with a ValidationException.

* fix(dynamodb): item calls on a CREATING table return ResourceNotFoundException

* fix(dynamodb): concurrent ImportTable calls with one ClientToken share one import

* fix(dynamodb): import reads S3 as the caller and denies another account's bucket
2026-09-07 22:25:24 -05:00
TATSUNO “Taz” Yasuhiro fd21ac9a6d feat(sfn): publish history events for Parallel branches and Map iterations (#3167)
* feat(sfn): publish Parallel branch and Map iteration history events

The states inside a Parallel branch or an inline Map iteration now publish
their events into the execution history.

The cause of a failure the interpreter raises now carries the AWS prefix
"An error occurred while executing the state '<name>' (entered at the event
id #<n>). ". It is written once, at the innermost state.

Every shape was verified against real Step Functions in us-east-1.

* feat(sfn): record EvaluationFailed for JSONata failures

A JSONata expression that fails now leaves the EvaluationFailed event AWS
records, with error, the attributed cause, location and state. The location
names the field the way the cause does. The event is recorded once per
attempt when the state retries, and before the Failed event and the Catch.
A Catch clause whose own expression fails records it from where the state
stood before its first Failed event, then fails the state again.

Verified against real Step Functions in us-east-1

* fix(sfn): record every Distributed Map run so DescribeMapRun resolves its ARN

* fix(sfn): stop counting history events once the execution has ended
2026-09-07 23:18:05 -04:00
lex00 5eacd01636 fix(ec2): store instance metadata options and add ModifyInstanceMetadataOptions (#3215)
RunInstances stores the MetadataOptions it is given, with AWS's launch
defaults for anything left out, and DescribeInstances reads the stored
values back instead of a hardcoded block. A launch template's metadata
options seed the launch and explicit request fields override them.
ModifyInstanceMetadataOptions changes only the fields it names and
returns the instanceMetadataOptions shape. Values outside the AWS
enumerations and a hop limit outside 1 to 64 are InvalidParameterValue.

Ported from lex00/floci#116, whose SSM half is floci-io/floci#3173.
2026-09-07 21:50:06 -05:00
Franklin G. Mendoza d99675a512 feat(controlcatalog): add control lookup operations (#3130)
* feat(controlcatalog): add control lookup operations

* fix(controlcatalog): complete control lookup contracts

* test(controlcatalog): verify pagination continuation

* fix(controlcatalog): move control model to package

* fix(controlcatalog): integrate service storage lifecycle
2026-09-07 21:49:39 -05:00
Mario Toffia b88034cd1d feat(iot): rule SQL message functions, isNull, isUndefined, IN and array literals (#3036)
Add clientid(), timestamp(), accountid() and newuuid(), the isNull() and
isUndefined() functions, the IN operator against a payload array or an
array literal, and array literals such as [lat, long], each following
the tables in the AWS IoT SQL reference. Equality extends to arrays
(element by element, in order) and objects (by key, in any order).

clientid() needs the MQTT client that published, so publish and
handlePublish carry the client id: the broker passes its session's
client id and an IoT Data Publish over HTTP passes none, which the
function reports as n/a as AWS does.

principal() stays unparsed: it returns the certificate a device
authenticated with, and the broker does not verify one yet.
2026-09-07 21:49:18 -05:00
BingEdward 90fa707145 fix(sts): return ExpiredTokenException for an expired web identity token (#3210)
* fix(sts): return ExpiredTokenException for an expired web identity token

AssumeRoleWithWebIdentity mapped every WebIdentityTokenVerifier failure to
InvalidIdentityToken, so an expired but otherwise valid IRSA token got the
same wire error as a bad signature or wrong issuer. Real STS reports the
expiry case as ExpiredTokenException so callers can refresh and retry.

Fixes #3205

* test(eks): inject EksOidcService through the test constructor
2026-09-07 21:43:46 -05:00
lex00 703744c9fb feat(s3): support bucket analytics and inventory configurations (#3213)
PutBucketAnalyticsConfiguration, GetBucketAnalyticsConfiguration,
ListBucketAnalyticsConfigurations and DeleteBucketAnalyticsConfiguration,
plus the four inventory counterparts, follow the shape the metrics and
intelligent-tiering configurations already use. Each body is validated
against the published schema and re-serialized in the AWS element
order, stored on the bucket record under its id, and returned from the
single and list reads. The PUT and DELETE forms are routed ahead of the
unqualified CreateBucket and DeleteBucket so they cannot fall through.
2026-09-07 21:43:19 -05:00
Vũ Thế Huy ec2d678e6d fix(lambda): honor MaximumBatchingWindowInSeconds on SQS event source mappings (#3203)
* fix(lambda): honor MaximumBatchingWindowInSeconds on SQS event source mappings

CreateEventSourceMapping, GetEventSourceMapping and UpdateEventSourceMapping now
parse, validate (0 to 300), persist and return MaximumBatchingWindowInSeconds
instead of silently dropping it.

When the window is greater than 0 the SQS poller holds an underfilled batch open,
accumulating messages across polls, and invokes the function once the batch
reaches BatchSize or the window elapses since the first buffered message. A window
of 0 or unset keeps the previous invoke-on-first-receive behavior.

Closes #3155

* fix(lambda): cover the batching window in SQS message visibility and window-off transitions

Address review feedback on the batching-window poller:

- Visibility timeout is now fn.timeout + window + 30 instead of the max of the two,
  so a message buffered for the full window and then processed for the full
  function timeout stays invisible for the whole span. Otherwise a long invoke
  could outlive the visibility and another consumer would receive a duplicate
  with a stale receipt handle.
- When the window is changed from positive to zero (or unset) on a live mapping,
  the poller now drains and delivers any already-buffered batch on the next tick
  instead of ignoring it, so those messages are not stranded until their
  visibility expires and cannot be replayed alongside fresh copies if a positive
  window is later restored.
2026-09-07 21:43:06 -05:00
Mario Toffia 53a84c8890 feat(iot): configurable DescribeEndpoint address for published AWS IoT ports (#3202)
* feat(iot): configurable DescribeEndpoint address for published AWS IoT ports

AWS IoT's DescribeEndpoint returns a bare hostname and each client adds its
own port (8883, 443 or 8443). Floci returns host:4566 because its HTTP data
plane lives there and IoT Data clients build https://<endpoint> from it. Both
are right for their callers, and Floci inside a container cannot tell whether
the operator published the AWS ports.

floci.services.iot.endpoint-address (FLOCI_SERVICES_IOT_ENDPOINT_ADDRESS)
is returned as is for every endpoint type when set; unset or blank keeps the
host and port of the base URL. EmulatorConfig.iotEndpointAddress() resolves
it once for DescribeEndpoint and for the AWS-managed domain configurations,
which now follow a changed address instead of keeping the value they were
seeded with. The name joins the generated server certificate's SANs the way
FLOCI_HOSTNAME does, so devices verify it on 8883 and 443.

* docs(iot): DescribeEndpoint address when the AWS IoT ports are published

Describe FLOCI_SERVICES_IOT_ENDPOINT_ADDRESS on the IoT page with the
compose port layout it is meant for, note it on the TLS page next to the
other names the server certificate covers, and list the IoT Core variables
in the environment variable reference.

* fix(tls): accept only host or host:port as the IoT endpoint certificate name

A value with a query or fragment, such as host?x=1, still parsed to a host
and was added to the server certificate. The name now has to be exactly the
authority java.net.URI reads back, so anything beyond host[:port] is skipped
with the same warning as a URL or a path.

* test(iot): pin the address the concurrent seeding test asserts at the end

Every caller had already been joined, so the final describe could not race,
but setting the address explicitly before it makes that plain to read.
2026-09-07 21:42:38 -05:00
Matheus André 991470e7c4 fix(cloudtrail): implement CreateTrail with tagging support and add integration tests (#3206)
Signed-off-by: Matheus André <matheusandr2@gmail.com>
2026-09-07 21:46:14 -04:00
Vũ Thế Huy b9039fef1d feat(redshift-data): emulate the Amazon Redshift Data API (#3186)
* feat(redshift-data): resource resolver, connection factory, statement store, service registration

* feat(redshift-data): field mapper, column metadata, SQL parameter binding

* feat(redshift-data): execute, describe, and paged result retrieval

* feat(redshift-data): batch execution, list statements, cancel

* feat(redshift-data): schema introspection operations

* test(redshift-data): end-to-end Data API over a real cluster plus SDK compatibility test

* docs(redshift-data): document the Redshift Data API surface

* fix(redshift-data): address code review findings

- rejectMultiStatement now reuses the SQL tokenizer so a semicolon inside a
  comment, string literal, or dollar-quoted block no longer rejects a valid
  single statement
- GetStatementResultV2 gains unit coverage for the typed and CSV envelopes
- CSV output is RFC 4180 quoted (embedded comma, quote, CR, LF)
- batch rollback is asserted transactionally in the integration test
- RedshiftDataFieldMapper logs a swallowed blob-read SQLException
- RedshiftPid/RedshiftQueryId use a non-negative hash
- NextToken that decodes to a negative offset is rejected
- CancelStatement leaves a FAILED statement FAILED
- DescribeTable paginates ColumnList and emits NextToken
- DbUser is echoed on the SecretArn path
- the statement store no longer builds its sweeper executor in the test constructor

* fix(redshift-data): address PR #3186 review findings

- SQL scanner handles PostgreSQL escape strings (E'...'): a backslash-escaped
  quote no longer ends the literal and mis-detects a following :name as a bind
  marker; plain '...' literals still treat backslash as an ordinary character
- ListStatements clamps MaxResults to 1..100 so MaxResults=0 no longer emits the
  same NextToken forever
- DescribeTable matches Table / Schema exactly (=) instead of LIKE, so a name
  containing _ or % cannot merge other tables' columns into ColumnList
- register the service in the README category table
- drop a stray em dash from the neighbouring services.yaml comment

* fix(redshift-data): bind string parameters untyped so real PostgreSQL infers the column type

CI ran the integration test against a real Redshift (PostgreSQL 15) cluster and
parameterisedStatement failed: a string bound to an int column via setString
raised "operator does not exist: integer = character varying". H2 in PostgreSQL
mode coerces it, so the unit test missed it.

- RedshiftDataConnectionFactory adds stringtype=unspecified to the JDBC URL, so
  setString sends the value untyped and the server infers the target type,
  matching how AWS binds Redshift Data API parameters
- ListStatements now rejects MaxResults above 100 with ValidationException
  instead of silently clamping (PR #3186 re-review)
- RedshiftDataOperationsTest uses JBoss Logging, not java.util.logging (PR #3186 re-review)

* fix(redshift-data): back the statement store with StorageFactory

The store held a bare ConcurrentHashMap outside the configured storage and
lifecycle model. It now obtains an account-aware backend through StorageFactory
("redshift-data", statements.json), the same as Athena's query store, resolved to
the global storage mode via the catalog descriptor. Default mode stays memory, so
statements are still lost on restart as documented; the 24h TTL sweep now walks
every account partition and deletes per account since the sweep thread has no
request context. StoredStatement is annotated for reflection and field-visible
serialization so persistent modes round-trip it.

* test(redshift-data): cover StoredStatement serialization round-trip and values()

The StorageFactory-backed store serializes StoredStatement in persistent modes.
Adds a round-trip test through the exact mapper PersistentStorage builds,
covering the ArrayNode, enum, Instant, and nested sub-statement fields plus the
field-visibility annotation, and a values() test.

* fix(redshift-data): register the nested Status enum for reflection

PersistedModelReflectionTest walks every type reachable from a StorageFactory
persistence root; StoredStatement.status pointed at an unregistered enum, so
native-image deserialization of a persisted statement would fail on restart.
2026-09-07 20:18:22 -04:00
Danny 5fd89e27bc feat(pipes): validate ParallelizationFactor on Kinesis and DynamoDB sources (#3192)
* feat(pipes): validate ParallelizationFactor on Kinesis and DynamoDB sources

SourceParameters is stored as an opaque JsonNode, so ParallelizationFactor
already round-tripped through CreatePipe, UpdatePipe and DescribePipe with no
bounds applied at all. Apply the AWS constraints in validateSourceConfiguration,
which both the create and update paths already run:

- reject the field on a source its parameter block does not describe, for
  example KinesisStreamParameters.ParallelizationFactor on an SQS source
- require a numeric, then an integral value
- require a value in [1, 10], reported with the offending value

The tiering and message shape follow LambdaService.parseScalingConfig, which
applies the equivalent MaximumConcurrency bounds for SQS event source mappings.

The value is persisted and returned on the wire but not yet enforced: the poller
opens an iterator on a single hardcoded shard and delivers one batch at a time,
so there is no per-shard concurrency to scale. Record that on both iterator
initializers and in an enforcement-status note in the docs, matching how
ScalingConfig documents the same gap for Lambda.

* fix(pipes): reject a ParallelizationFactor wider than an int

asLong hands back the low 64 bits of a BigInteger, so a value such as
2^64 + 5 read as 5 and passed the [1, 10] bounds check: CreatePipe accepted
it over raw HTTP and persisted the original digits. Gate the bounds on
canConvertToInt and report the value with asText, so an oversized literal is
rejected and named in full. Real AWS rejects it too, the field being an int32.

Also correct the docs: ListPipes returns pipe summaries and omits
SourceParameters entirely, so only DescribePipe echoes the factor back.
2026-09-07 18:39:32 -04:00
Franklin G. Mendoza 5864b013d2 feat(detective): add organization member operations (#3190)
* feat(detective): add organization member operations

* fix(detective): align organization operations with AWS

* docs(detective): clarify member listing

* fix(detective): enforce organization administration contracts
2026-09-07 18:31:48 -04:00
Prakhar Kapoor 2869502e7c feat(rds): implement CreateDBSnapshot and RestoreDBInstanceFromDBSnap… (#1894)
* feat(rds): implement CreateDBSnapshot and RestoreDBInstanceFromDBSnapshot for postgres (#1817)

* feat(rds): implement CreateDBSnapshot and RestoreDBInstanceFromDBSnapshot for postgres (#1817)

* feat(rds): generated docs

* fix(rds): preserve master password across DbSnapshot restore

* fix(rds): preserve thread interrupt flag in restorePostgresSnapshot

* fix(rds): handle duplicate RDS snapshots and mock mode operations

* fix(rds): separate stdout and stderr in container exec to prevent snapshot corruption

* fix(rds): add missing stderr argument to ContainerExecResult on timeout

* fix(rds): cleanup RDS instance on snapshot restore failure

* fix(rds): return structured AWS error when RDS snapshot restore fails

* fix(rds): address PR #1894 snapshot and restore review comments
- Wire handleDescribeDbSnapshots to use the new snapshots storage backend
- Change engine validation error from UnsupportedOperation to InvalidDBInstanceState
- Change restore failure error from InvalidDBSnapshotStateFault to InvalidDBSnapshotState
- Add corresponding unit and query handler tests

* fix(rds): address PR #1894 review feedback and restore process issues

- Wire DescribeDBSnapshots to the snapshots storage backend with filtering support
- Align CreateDBSnapshot engine error code to InvalidDBInstanceState
- Align restore snapshot failure error code to InvalidDBSnapshotState
- Carry over dbName from DbSnapshot to the restored DBInstance
- Connect to template1 during psql restore to prevent active postgres connection drop failures
- Remove unused AwsNamespaces import in RdsService
- Add corresponding unit and query handler tests

* fix(rds): address PR #1894 review feedback and snapshot error handling

* fix(rds): add --if-exists to pg_dumpall snapshot command

- Appends the --if-exists flag to pg_dumpall commands during database snapshot creation. This ensures DROP DATABASE statements are emitted conditionally, preventing restore failures on fresh container instances where user databases do not yet exist.

* fix(rds): added real docker test

* docs(rds): add descriptions for snapshot actions
Added concise, handwritten descriptions for the `CreateDBSnapshot` and
`RestoreDBInstanceFromDBSnapshot` actions in the RDS documentation
action table to comply with the contributing guidelines.

* feat(rds): improve RDS snapshot restore reliability and API coverage

- Update `postgresRestoreScript` to explicitly filter out the master user `CREATE ROLE` statement, preventing restore failures when `ON_ERROR_STOP=1` is enabled.
- Add strict validation for `masterUsername` in `CreateDBInstance` to adhere to AWS requirements (only alphanumeric chars starting with a letter, max 16 chars).
- Ensure `dbInstanceClass` is accurately preserved in the `DbSnapshot` model so it can be restored to the same hardware class automatically.
- Fix missing Windows absolute path detection in `ContainerStorageHelper`, resolving test-environment `NoSuchElement` errors on Windows.
- Make `RdsAwsIntegrationTest` gracefully skip on agents without a Docker daemon, matching test suite expectations.
- Update `rds.md` to include concise handwritten descriptions for all remaining placeholder actions.
- Improve exception logging inside container execution wrappers.
2026-09-07 18:27:54 -04:00
Niels Kootstra 1de6b80035 fix(sts): reject unverified web identity tokens (#3151)
* fix(sts): reject unverified web identity tokens

* test(sts): expect invalid web identity tokens to fail

* fix(sts): make unknown issuer rejection opt in
2026-09-07 18:07:35 -04:00
lex00 8142457f9b feat(ssm): answer the public Amazon Linux AMI parameters (#3173)
* feat(ssm): answer AWS's public Amazon Linux AMI parameters

GetParameter, GetParameters and GetParametersByPath resolve the
documented /aws/service/ami-amazon-linux-latest/ names from the EC2
image catalog, the way AWS seeds them in every account. They are
read-only and belong to no account, so DescribeParameters and the
parameter history leave them out.

Ported from the SSM half of lex00/floci#116.

* fix(ssm): reject reserved parameter names and list public ones under ancestors

PutParameter refuses names prefixed with aws or ssm, with or without a
leading slash and in any case, with the ValidationException AWS
returns. That closes the gap where a stored value could shadow a
public AMI parameter. GetParametersByPath applies the same path and
Recursive rules to public names as to stored ones, so a recursive
query on /aws or /aws/service lists them.

* fix(ssm): reserve only the aws and ssm path segments

The reserved-name check keyed on a bare prefix, which also refused the
names CloudFormation generates for an AWS::SSM::Parameter in a stack
whose name starts with aws or ssm. It now rejects a name whose first
path segment is aws or ssm, with or without a leading slash and in any
case, and accepts names such as ssm-auto-stack-Param-ABC.
2026-09-07 17:05:19 -04:00
lex00 49dfd1b18a fix(rds): keep the control plane working with no Docker daemon (#3170)
* fix(rds): keep the control plane working with no Docker daemon

CreateDBInstance and CreateDBCluster write the record and reach
available when no Docker daemon is reachable, instead of failing with
a raw socket error. The backing container is retried by reboot and the
RDS Data API, so it starts once a daemon appears. Delete no longer
touches Docker for a record that never had a container, and restore
keeps such records available on their recorded proxy ports.

Ported from lex00/floci#38, the RDS half left out of #2975.

* fix(rds): keep created-container identities and roll back a failed proxy start on retry

The retry updated the record before the auth proxy was up, so a proxy
failure left it pointing at a container nothing listened on and later
retries returned early. The proxy now starts from the handle first and
the record is written only after both halves are up. A proxy failure
stops the container.

tryStart no longer drops a retained cleanup identity that names a
created container. The next retry cleans it up before starting once the
daemon is back. Only an identity carrying the fixed container name,
from a start that failed before Docker created anything, is dropped
while the daemon is unreachable.

* fix(rds): retry a container cleanup that failed before the runtime starts again

A stop that failed after the auth proxy did not start left the live
handle and the runtime claim retained, and nothing retried that
cleanup, so the next start for the runtime failed on the claim. The
container manager now remembers a runtime whose cleanup failed, from a
failed start or a failed stop alike, and cleans it up before that
runtime starts again. A live handle with no pending cleanup is left
alone, so a concurrent duplicate start is still rejected.
2026-09-07 13:14:01 -04:00
Mario Toffia 19a85360e1 feat(iot): verify device certificates on the MQTT TLS listener (#3180)
* feat(iot): registered-certificate lookup and iot:Connect evaluation

* feat(iot): verify device certificates and iot:Connect on the MQTT TLS listener

* docs(iot): device verification on the MQTT TLS listener

* test(iot): device evaluation over plain stores and under racing policy and thing changes

* fix(iot): remember where a device certificate was found and log refusals at debug

* fix(iot): treat any address literal in SNI as no domain name
2026-09-07 13:08:39 -04:00
lyrray a1d0597ffe fix(sns): honor FifoThroughputScope=MessageGroup on FIFO topics (#3181)
* fix(sns): honor FifoThroughputScope=MessageGroup on FIFO topics

A FIFO topic accepted FifoThroughputScope and echoed it back from
GetTopicAttributes, but deduplication stayed topic-wide, so the same
MessageDeduplicationId published under two different MessageGroupIds
delivered only the first message. A fan-out that reuses one dedup id per
group silently lost every message after the first.

Scope the deduplication cache key to the message group when the topic
sets FifoThroughputScope=MessageGroup, on both Publish and PublishBatch,
mirroring how SQS handles DeduplicationScope=messageGroup. Topic remains
the default and keeps the existing topic-wide behavior.

* fix(cloudformation): forward SNS FifoThroughputScope from AWS::SNS::Topic

SnsCfnProvisioner only forwarded ContentBasedDeduplication, so a topic
provisioned from a template kept the default topic-wide deduplication
even with FifoThroughputScope set, and a FIFO topic left unnamed got a
generated name without the .fifo suffix SnsService recognizes.

Forward FifoThroughputScope, suffix a generated FIFO topic name with
.fifo as CloudFormation does, treat a prior name whose suffix no longer
matches the createOnly FifoTopic flag as a replacing update, and rewrite
the mutable attributes on UpdateStack, which createTopic leaves untouched
when the topic already exists.

* fix(cloudformation): reset dropped SNS topic attributes on update

An UpdateStack that dropped FifoThroughputScope or
ContentBasedDeduplication kept the old value while reporting success.
Write the create-time default instead, for FIFO topics only: real SNS
rejects both on a standard topic.

A FifoTopic flip now fails rather than replacing the topic under a new
generated name, which would orphan it and its subscriptions. An
explicitly named .fifo topic counts as FIFO without the flag.

* fix(sns): make the group-scoped FIFO dedup key unambiguous

Nothing validates the characters in either id, so the NUL delimiter
could arrive inside one and make two different group and dedup pairs
share a cache key. Length-prefix the group instead.

* fix(sns): keep FIFO dedup scopes in separate cache namespaces

A topic-scoped dedup id shaped like the group-scoped key, "1#ab" for
group "a" with id "b", hit the same cache entry once the scope changed
inside the deduplication window. Mark each key with its scope so the
two formats cannot collide.
2026-09-07 11:52:20 -05:00
lex00 4cc850e8df fix(autoscaling): round-trip launch configuration InstanceMonitoring and BlockDeviceMappings (#3174)
CreateLaunchConfiguration stores InstanceMonitoring.Enabled and
BlockDeviceMappings, and DescribeLaunchConfigurations returns both
structures the way AWS does, with monitoring defaulting to enabled and
mappings to an empty list. The Terraform provider read the missing
elements as disabled monitoring and no root device, which forced a
replacement on every plan.

Ported from lex00/floci#132.
2026-09-07 11:25:40 -04:00
Kenshin Okinaka f485122ffc feat(ses): implement v1 ReorderReceiptRuleSet and CloneReceiptRuleSet (#3176)
* feat(ses): implement v1 ReorderReceiptRuleSet and CloneReceiptRuleSet

Completes the SES v1 receipt management surface with the two remaining
rule-set actions, both reproducing wire behavior probed against real AWS
(us-east-1, 2026-09).

ReorderReceiptRuleSet demands an exact permutation of the set's rules,
with the probed error precedence: rule-set existence first, then a
duplicate request name (InvalidParameterValue "Multiple positions found
for rule", even when the duplicated name is not in the set), then set
rules absent from the request (listed in set order), then request names
not in the set (RuleDoesNotExist, first in request order). RuleNames
members validate at the Smithy layer under the bare 'ruleNames' path
with a nested list-member constraint whose length cap is 100; there is
no service-level "Not a valid ruleName" stage, so a 65-char name lands
on RuleDoesNotExist. A failed reorder leaves the order unchanged.

CloneReceiptRuleSet deep-copies the source's rules under a new creation
timestamp; the active flag stays behind. Name validation is two-layer
for both members: the Smithy pattern combines violations with
originalRuleSetName listed first, and the service-level 64-char check
reports the target before the source. An existing target wins over a
missing source (AlreadyExists before RuleSetDoesNotExist).

Covered by unit tests, Query-protocol integration tests, and AWS SDK
compatibility tests run against a live local instance.

* fix(ses): parse ReorderReceiptRuleSet RuleNames with the probed AWS index grammar

Review flagged that a sparse Query list (RuleNames.member.1 plus member.3)
was silently truncated at the first missing index. Probing real SES with
raw signed Query requests showed the string-list grammar differs from the
receipt-action struct-list grammar: a gap is padded with empty members
(which then fail the ruleNames Smithy constraint, so nothing is ever
truncated) up to a skip of 10, counted from the previous index or from 1
for a leading gap; a larger gap is MalformedInput "Excessively sparse
input would skip N list elements" with a comma-grouped count; an index
above 214748369 (exact boundary, found by bisection) is MalformedInput
"Index N is illegal"; index 0, a leading-zero spelling, and a non-numeric
token are each their own probed MalformedInput; and a repeated index
keeps its first value.

The same probing showed the ruleNames Smithy violation carries no member
index and appears at most once however many members are malformed, so the
service now emits it once instead of per member.

Covered by wire-level integration tests for each grammar case and a unit
test for the single-violation behavior.
2026-09-07 11:22:23 -04:00
BingEdward e7256f5556 fix(transfer): allow DeleteServer regardless of server state (#2897)
* fix(transfer): allow DeleteServer regardless of server state

AWS's DeleteServer API has no state precondition: its error list has no
ConflictException, and terraform-provider-aws's resourceServerDelete
calls DeleteServer directly without stopping the server first. The
OFFLINE-only guard made every terraform destroy of a running
aws_transfer_server fail with a 409 that real AWS never returns.

CreateServer's ONLINE default is left as is: it matches real AWS, where
a new server transitions STARTING -> ONLINE automatically without a
StartServer call, and terraform's waitServerCreated treats OFFLINE as
an unexpected state that fails apply immediately. Added an integration
test locking in both behaviors.

Fixes #2802

* fix(transfer): return Domain from DescribeServer and ListServers

Real AWS always reports a server's Domain (default S3). Floci dropped
the field on CreateServer and never echoed it, so terraform-provider-aws
read back "" into its ForceNew domain attribute (default "S3") and every
re-plan of an aws_transfer_server proposed a replacement:

  + domain = "S3" # forces replacement

Store Domain on create, defaulting to S3 like AWS, and include it in
DescribeServer and ListServers. Needed for the resource to survive the
whole-config re-plan assertion in the terraform compat suite.

* test(compat): add aws_transfer_server to the terraform and opentofu suites

The resource was pulled from both fixtures while #1834 iterated because
DeleteServer 409'd on a running server (#2802). With that fixed, put it
back: the server is never stopped, so terraform destroy hits DeleteServer
while it is ONLINE, and the existing whole-config re-plan test guards the
DescribeServer round trip.

* docs(transfer): drop the OFFLINE precondition from DeleteServer
2026-09-07 08:54:03 -04:00
Franklin G. Mendoza 7a5ae965e5 feat(budgets): add full service emulation (#3165)
* feat(budgets): add budget and notification operations

* feat(budgets): complete service emulation

* fix(budgets): enforce account and action contracts
2026-09-06 23:54:37 -04:00
Hector Ventura 0321ae0ac8 refactor(cloudformation): move Cognito UserPool and UserPoolClient to CognitoCfnProvisioner (#3164)
* refactor(cloudformation): move Cognito UserPool and UserPoolClient to CognitoCfnProvisioner

Batch 3 of the CloudFormationResourceProvisioner split. AWS::Cognito::UserPool and
AWS::Cognito::UserPoolClient join the provisioner that already owns UserPoolDomain;
the two arms, their switch cases, the type-list entries, the Cognito-only
resolveStringMapOrNull helper and the CognitoService dependency leave the monolith.

Behaviour is preserved except for what the split's conventions require:

- the create/update branch reads ctx.isUpdate() instead of the resource's physical
  id, which provision overwrites as it runs
- deletes go through CfnDeletes.safeDelete tolerating only ResourceNotFoundException;
  a pool that still has a domain keeps failing the stack delete with
  InvalidParameterException, as on AWS
- the client also exposes Name, the read-only attribute the registry schema declares
  (ClientName stays for now), so CfnSchemaCoverageTest needs no gaps row
- the ReplacementCleanup hooks are wired for both types; nothing replaces yet, so
  they are inert until create-only properties are honoured

The unit test covers both types with a mocked service: request map and generated
names, update carrying the prior id, the exact attribute sets, positional client
arguments, and delete tolerance. The domain delete path now branches on type first,
since a pool resource also carries a UserPoolId attribute.

* fix(cloudformation): replace a Cognito user pool client when its create-only properties change

UserPoolId and GenerateSecret are createOnlyProperties in the AWS::Cognito::UserPoolClient
registry schema: on AWS a change to either creates a new client and deletes the old one
after the update commits. The provisioner passed the new pool id to UpdateUserPoolClient,
which fails with ResourceNotFoundException because a client is only found through the
pool that owns it, and a changed GenerateSecret was silently ignored since the update
call has no such parameter.

The provisioner now looks the prior client up by id, updates in place only when both
create-only properties are unchanged, and otherwise creates the replacement; the
ReplacementCleanup record deletes the displaced client once the update completes or
restores it on rollback. A prior client that is already gone is created anew. The by-id
describeUserPoolClient overload is new on CognitoService, mirroring its delete pair.

* fix(cloudformation): resolve Cognito UserPoolTags as the map the schema declares

AWS::Cognito::UserPool.UserPoolTags is an object (the type's tagProperty), not the
[{Key, Value}] list most types carry. The provisioner parsed it with the list helper,
which yields nothing for a map, so the tags only reached the service through the raw
property map, where a non-string tag value arrives as a number. The tags are now
resolved as a string map and put explicitly, on create and on update.

* fix(cloudformation): give Fn::GetAtt ProviderName on a Cognito user pool AWS's shape

The attribute returned the pool name. On AWS it is cognito-idp.<region>.amazonaws.com/<pool id>,
the value templates feed into an identity pool's CognitoIdentityProviders (CDK derives the
same string in UserPool.fromUserPoolArn). ProviderURL deliberately stays Floci's local
issuer, <base-url>/<pool id>, since that is the iss of the tokens Floci mints and a template
wiring it into a JWT authorizer must validate locally; the generated resource-type table
now says so.

* fix(cognito): apply PoolName on UpdateUserPool so a CloudFormation rename takes effect

UpdateUserPoolRequest carries PoolName in the service model and AWS::Cognito::UserPool
lists UserPoolName as updatable in place, but updateUserPool only ran populateUserPool,
which never sets the name, so a renamed pool kept its old name through both the API and
a stack update. The service now applies a non-blank PoolName.

The provisioner sends PoolName on update only when the template names the pool: an
unnamed pool keeps the name its first execution generated instead of being renamed to a
freshly generated one on every update.

* fix(cloudformation): expose only the schema's attributes on a Cognito user pool client

The AWS::Cognito::UserPoolClient registry schema declares ClientId, Name and ClientSecret
as its read-only properties. ClientName is a request property, not an attribute; on AWS
Fn::GetAtt Client.ClientName fails template validation, so no working template depends on
it. It is dropped in favour of Name.

* fix(cloudformation): validate Cognito user pool client properties instead of dropping them

A non-integer AccessTokenValidity, IdTokenValidity or RefreshTokenValidity was parsed to
null and silently ignored, so the template's intent was lost without a word. The
provisioner now fails the resource with ValidationError "Value of property X must be an
integer.", as the ECS provisioner does for DesiredCount. UserPoolId, the schema's one
required property, is likewise rejected when missing rather than passed through as null.

* test(cloudformation): cover Cognito user pool client replacement end to end

Through the CloudFormation API: a client moved to another pool and one whose
GenerateSecret flips are each replaced, with the displaced client gone once the update
completes; a rename updates the client in place; Fn::GetAtt Name and the pool's
ProviderName carry their AWS shapes; deleting the stack removes client and pools.

* fix(cloudformation): drop a stale ClientSecret attribute when a replacement client has none

The engine hands an update the prior attributes, and the provisioner only wrote
ClientSecret when the new client had one, so replacing a secret-bearing client with
GenerateSecret: false left the displaced client's secret readable through Fn::GetAtt.
The attribute is now removed when the client has no secret; rollback still restores it
from the cleanup record's snapshot.

* fix(cloudformation): refuse a Cognito client replacement that would reuse the prior client id

AWS client ids are random, so a replacement never collides with the client it replaces.
Under Floci's floci:override-cognito-client-id tag the id follows the client name, and a
replacement that kept the name (a GenerateSecret flip, or a move to a pool with the same
override) was created under the prior id: the store overwrote the prior client, the cleanup
record saw an unchanged id and recorded nothing, and the update could not be rolled back.
Neither overwriting nor delete-then-create can preserve the prior client, so the update is
now refused with ValidationError before anything changes and the stack rolls back intact.

CognitoService gains deterministicClientIdFor(userPoolId, clientName), sharing the id rule
with createUserPoolClient; the provisioner compares it with the prior id in the replacement
branch only.

* fix(cloudformation): refuse a Cognito client whose derived id another client already holds

The round-1 guard compared the derived id only with the client being replaced. Under
floci:override-cognito-client-id the store is keyed by client id alone, so a name whose
derived id belongs to any other client, in this pool or another, would overwrite that client
on create, and neither the cleanup record nor rollback knows about it. The guard now refuses
whenever an existing client holds the derived id, on a fresh create as well as a replacement.

* fix(cloudformation): make the deterministic Cognito client-id guard atomic and ignore orphaned records

Two gaps in the round-2 guard. CloudFormationService runs stack operations on a cached
thread pool and CognitoService's client store write is unconditional, so two stacks could
both find a derived id free and the later create overwrote the earlier stack's client; the
existence check and the create now run under one lock whenever the id is derived from the
name. And deleting a user pool does not remove its clients yet (#2949 adds that), so a client
of a deleted pool kept its derived id and the guard refused a legitimate create in another
pool; a holder whose pool no longer exists is now treated as a stale record the create may
take over. Random ids take neither path.
2026-09-06 22:51:50 -05:00
Priamo Germosen cd2847dba0 fix(pipes): replace kafka-clients with a Kafka REST Proxy client (#3160)
kafka-clients (plus the zstd-jni and lz4-java it pulls in transitively)
was an always-on dependency for Kafka-sourced Pipes, reachable in every
build regardless of whether a Pipe ever used a Kafka source: MSK-backed
or self-managed. This drops the dependency entirely rather than gating
it, so it is no longer reachable in either a native or a JVM build.

PipesKafkaConsumerManager and PipesPoller's Kafka poll/deliver path now
talk to a Karapace REST Proxy sidecar (KarapaceManager starts one on
demand per distinct bootstrap.servers target, shared by every pipe that
reads the same cluster) instead of embedding a native Kafka consumer.
PipesKafkaRestClient speaks Karapace's REST API with the JDK HttpClient,
the same approach already used elsewhere in this codebase for other
REST-shaped backends. Kafka record fidelity (topic, partition, offset,
timestamp, key, value, headers) is preserved; timestampType is always
reported as CreateTime since the REST Proxy does not expose the real
value, which only diverges from a topic explicitly configured for
LogAppendTime.

Validated locally against a real Redpanda + Karapace pair in Docker.
2026-09-06 23:36:49 -04:00
BingEdward db6c419459 fix(acm): reject RequestCertificate key algorithms real ACM does not support (#3044)
* fix(acm): reject RequestCertificate key algorithms real ACM does not support

Real ACM only issues certificates for RSA_2048, EC_prime256v1, and
EC_secp384r1 on RequestCertificate. RSA_1024, RSA_3072, RSA_4096, and
EC_secp521r1 are rejected with a ValidationException, and the RSA_4096
message carries the account id where the region goes (an AWS quirk,
replicated verbatim). The wider algorithm list remains valid for
ImportCertificate.

Closes #3027

* style(acm): drop em-dash from RSA_4096 test comment

* test(acm): issue leaf certificates only for requestable key algorithms

AcmServiceTest.issuesALeafOfTheRequestedAlgorithmSignedByTheLocalCa
drove every KeyAlgorithm through RequestCertificate. RSA_1024, RSA_3072,
RSA_4096, and EC_secp521r1 are now rejected there, matching real ACM,
and their ValidationException is asserted in AcmEdgeCaseTest.
2026-09-06 23:33:21 -04:00
lex00 631df1dc01 feat(cloudformation): provision AWS::Backup::BackupVault (#3125)
Per-service provisioner over BackupService. Ref and Fn::GetAtt
BackupVaultName are the vault name and Fn::GetAtt BackupVaultArn its ARN. The
name is the physical id and createOnly, so an unnamed vault keeps its
generated name across updates instead of getting a second vault, and a rename
is refused as a replacement. EncryptionKeyArn is createOnly as well.
BackupVaultTags are driven to the template's set on update, untagging dropped
keys since TagResource only adds. Stack deletion deletes the vault and leaves
the non-empty-vault refusal to surface as on AWS.

The docs generator gains a label and row position for the new AWS::Backup
namespace.

Ported from lex00/floci#118. Tracked in lex00/floci#192.
2026-09-06 22:18:18 -05:00
lex00 3a4982c294 feat(cloudformation): provision AWS::ApiGateway::UsagePlan and UsagePlanKey (#3123)
* feat(cloudformation): provision AWS::ApiGateway::UsagePlan and UsagePlanKey

Per-service provisioner over ApiGatewayService. A plan's Ref and Fn::GetAtt
Id are the plan id. Every plan property is mutable, so an update patches name
and description in place and adds or removes API stages as the template moves
them. Tags are driven to the template's desired state through the new
replaceUsagePlanTags.

A key's Ref and Fn::GetAtt Id are <keyId>:<usagePlanId>, as on AWS. All three
of its properties are createOnly, so a change to any of them is refused as a
replacement rather than re-associating a different key under the old id. The
composite id is what lets delete find the association without scanning every
plan.

Stack deletion removes the plan and the association and tolerates either
being gone already.

Ported from lex00/floci#118. Tracked in lex00/floci#192.

* fix(cloudformation): validate usage plan key properties and survive a recreated plan

An association only counts as still there while its plan does. deleteUsagePlan
leaves associations behind, and a plan recreated after an out-of-band delete has
a new id, so the stale association no longer reads the new UsagePlanId as a
rename. KeyType must be API_KEY and both ids must be present, per the registry
schema, and a non-list ApiStages is refused instead of read as empty.
replaceUsagePlanTags strips the reserved id-override tags the way createUsagePlan
does rather than refusing them.

* fix(cloudformation): check a usage plan key's KeyId even while recovering drift

The createOnly checks sat behind the association lookup, so a template that
changed KeyId while its plan was missing created an association for the new key
instead of refusing the change. KeyId is checked against the prior composite id
either way now. UsagePlanId stays conditional, since a plan recreated after an
out-of-band delete legitimately has a new id.
2026-09-06 22:09:54 -05:00
Kenshin Okinaka 2c6a92c07d feat(ses): implement v1 receipt filters (CreateReceiptFilter, ListReceiptFilters, DeleteReceiptFilter) (#3163)
Adds the three v1 receipt-filter actions as a stored-but-inert IP filter
store alongside the receipt-rule-set domain: filters round-trip through the
management API but never filter an inbound connection, since Floci accepts
none.

Validation follows real AWS as probed: the filter name is a single
service-level layer (no Smithy pattern, unlike rule and rule-set names) with
"Not a valid filterName" for every malformed shape and its own message for
an empty name; IpFilter members are Smithy-enforced (not-null paths and the
[Allow, Block] policy enum); the Cidr member accepts a single IPv4 or IPv6
address or an in-range CIDR block and rejects everything else with
"Invalid CIDR block"; duplicates are AlreadyExists with the original kept;
deletes are idempotent with only an absent FilterName rejected; and the
101st filter in a region is rejected with LimitExceeded "Too many filters".
List responses are name-sorted for determinism since the probe could not
pin the wire ordering.

Covered by unit tests, Query-protocol integration tests, an AWS SDK
compatibility test, and Terraform/OpenTofu compat coverage for
aws_ses_receipt_filter.
2026-09-06 21:00:42 -05:00
Franklin G. Mendoza 6264b09a28 feat(identitystore): add full service emulation (#3159)
* feat(identitystore): add groups users and memberships

* feat(identitystore): add full service emulation

* fix(identitystore): validate update attribute paths
2026-09-06 21:51:19 -04:00
Max Freedom Pollard 60a8a9d252 fix(eventbridge,scheduler): read cron day-of-week as AWS 1-7 SUN-SAT (#3147)
Both schedule parsers built their cron definition with cron-utils' default
day-of-week field, which is Unix numbering: 0-6 for SUN-SAT. AWS numbers that
field 1-7 for SUN-SAT, so every numeric day was read one day late and Saturday
could not be expressed at all.

cron(0 12 ? * 2 *) is Monday to AWS and fired on Tuesday. AWS's own documented
example cron(15 10 ? * 6L 2022-2023), the last Friday of the month, fired on the
last Saturday. cron(0 12 ? * 7 *) did not parse at all, failing with "Value 7 not
in range [0, 6]". Day names were always correct, because cron-utils resolves them
against its own numbering, so only expressions written with numbers were wrong.

The definitions are at ScheduleExpressionParser.java:32 (eventbridge) and
SchedulerExpressionParser.java:55 (scheduler). Both now pin the field with
withValidRange(1, 7) and withMondayDoWValue(2), the same shape cron-utils uses
for Quartz, whose day-of-week dialect AWS follows. 7 parses as Saturday, and 0 is
rejected in line with AWS's documented 1-7 range.

The existing eventbridge test getNextFireTimeFirstMondayOfMonth encoded the old
behavior: it parsed cron(30 2 ? * 2#1 *), named itself for the first Monday, then
asserted the fire day was a Tuesday. It now asserts 2026-03-02, which is the
first Monday of that month.
2026-09-06 18:41:17 -04:00
Kenshin OkinakaandPriamo fd665a08cc feat(ses): implement v1 receipt rules with locally validated action targets (#3119)
* feat(ses): implement v1 receipt rules with locally validated action targets

Adds the five v1 receipt-rule actions (CreateReceiptRule, DescribeReceiptRule,
UpdateReceiptRule, DeleteReceiptRule, SetReceiptRulePosition) on top of the
stored-but-inert receipt-rule-set domain. Rules route no mail, but ordering
semantics follow real AWS as probed: a rule created without After is inserted
at the front, SetReceiptRulePosition without After moves a rule to the front,
update replaces the whole rule in place, and rule delete is idempotent while
rule-set delete cascades.

Action targets are validated against the local emulator the way real SES
validates them against the account: any TopicArn must be an existing SNS
topic, an S3 BucketName an existing bucket, a Lambda FunctionArn an existing
function, and a BounceAction Sender a verified identity, using the probed
error codes (InvalidSnsTopic, InvalidS3Configuration, InvalidLambdaFunction,
InvalidParameterValue). Smithy-layer validation reproduces the probed member
paths and combined violation messages; only the members real SES enforces are
required (S3 BucketName, SNS TopicArn, and Stop Scope may be absent).

Covered by unit tests with mocked resource services, Query-protocol
integration tests, an AWS SDK compatibility test, and Terraform/OpenTofu
compat coverage for aws_ses_receipt_rule.

* fix(ses): match probed AWS semantics for action-list gaps and present-struct required members

Probing triggered by the upstream review corrected two earlier conclusions.
A gap in the action list (an empty struct serializes to no Query keys) is
not compacted by AWS: the gap is padded into an empty action slot and
rejected with InvalidParameterValue "Exactly one action type must be
specified for each ReceiptAction", with Smithy paths keeping the wire
index. member.0 is rejected outright with MalformedInput
"0 is not a valid index".

The earlier "optional" verdict for S3Action.BucketName, SNSAction.TopicArn,
and StopAction.Scope was an artifact of empty structs never reaching the
wire: once an action carries any member, the type's required members are
enforced as Smithy violations. BounceAction violations are reported in the
probed smtpReplyCode, sender, message order, and SNSAction reports a bad
Encoding enum before the missing TopicArn.

* fix(ses): honor original receipt-action index spellings and require stop actions last

Probing the leading-zero report pinned AWS's index semantics exactly: index
tokens are grouped by numeric value, ordered by length then lexicographically,
and the i-th token must parse to i, or the padded empty slot is rejected with
the exactly-one-action-type error. member.01 alone is therefore a valid slot 1
whose action must be parsed under its original spelling instead of a rebuilt
canonical one, while mixed spellings such as member.01 plus member.2 are
rejected because the one-digit token sorts first.

The same probes surfaced an unrelated service-level rule now reproduced too:
a stop action anywhere but the last position is rejected with
"Stop action, if any, must be placed at the end of the actions list".

* chore(ses): log best-effort compat-test cleanup failures with resource context

The three cleanup catches in the receipt-rule compatibility suite swallowed
failures silently. They now report the failed step and resource on stderr,
the form the other suites in this module already use, so leaked test
resources stay diagnosable.

* chore(lambda): log functionExists resolution failures at debug level

The catch converts a resolution failure into the predicate's negative
answer; the debug line keeps a surprising false diagnosable (which
reference was rejected, and why) without turning ordinary existence
misses on a query path into log noise.

* fix(ses): restrict receipt-action index tokens to ASCII digits

Character.isDigit also accepts non-ASCII Unicode digits, so a key such as
Rule.Actions.member.<fullwidth 1> parsed as a real index. No AWS Query
index grammar recognizes those spellings; the key is now skipped like any
other unmodeled parameter, pinned by an integration test.

---------

Co-authored-by: Priamo <pgermosen@gmail.com>
2026-09-06 18:01:33 -04:00
Vũ Thế Huy 4570bf62c5 feat(redshift): emulate Redshift UNLOAD TO s3 over Simple Query protocol (#3129)
* feat(redshift): parse UNLOAD TO s3 statements

* feat(redshift): add S3Service.authorizeAnonymousPutObject for the UNLOAD writer

* feat(redshift): simulate Redshift UNLOAD TO s3 via CopyOut

* feat(redshift): dispatch UNLOAD via the intercepting bridge

* test(redshift): cover UNLOAD to S3 end to end

* docs(redshift): document UNLOAD to S3 support

* fix(redshift): drain backend on UNLOAD streaming failure and handle final slice error

* refactor(redshift): clean up inline FQCN imports across main and test sources

* fix(redshift): address review feedback on UNLOAD to S3 simulator

* fix(redshift): authorize ListBucket on UNLOAD prefix probe and clean up manifest on backend EOF

* fix(redshift): authorize UNLOAD cleanup deletes and skip them under ALLOWOVERWRITE

* fix(redshift): fail open on UNLOAD MAXFILESIZE above the buffering ceiling

* feat(redshift): repeat the UNLOAD header row at the start of every slice

* test(redshift): cover UNLOAD to S3 over JDBC in the SDK compatibility suite

* docs(redshift): document UNLOAD per-file header, MAXFILESIZE bytes, and over-cap fail-open

* fix(redshift): clean up new UNLOAD slice objects even under ALLOWOVERWRITE

deleteWritten previously bailed entirely when ALLOWOVERWRITE was set, to avoid
destroying a pre-existing object a slice key had overwritten. That also left
genuinely new slice keys behind on a MANIFEST failure, exposing a partial result
with no manifest. Track which slice keys existed before the write and skip only
those on cleanup.

* fix(redshift): never delete UNLOAD output under ALLOWOVERWRITE

The preExistingKeys heuristic could not distinguish an overwrite from a fresh
write atomically: two concurrent UNLOADs to the same prefix could both classify a
key as new, and one operation's cleanup could then delete the other's output.
Drop the heuristic and simply never delete under ALLOWOVERWRITE. Non-overwrite
runs verified the prefix was empty, so their cleanup is still safe. A failed
MANIFEST + ALLOWOVERWRITE UNLOAD may leave data objects without a manifest, which
is now documented.

* fix(redshift): read UNLOAD objects via getObject in the integration test

listObjects returns metadata-only S3Object entries whose getData() is null, so
unloadToS3PrefixWritesRowsAsObjects and unloadGzipWritesCompressedObject threw
NullPointerException in CI. Fetch each body with getObject, as the MANIFEST test
already does.
2026-09-06 15:58:37 -05:00
Mario Toffia ee2f55b784 feat(iot): MQTT over TLS listener on 8883 (#3142)
* feat(iot): floci.services.iot.mqtt.tls-port (default 8883)

* feat(iot): key manager that follows the TLS registry's current default certificate

* feat(iot): MQTT over TLS listener on 8883

Second MqttServer sharing the plaintext handlers, opened when floci.tls.enabled
is true. Its key material is the TLS registry's default configuration through a
reloading key manager, so a server certificate reissued for a learned hostname
is presented on the next handshake without rebuilding the listener. Client
certificates are requested and carried through the handshake, not yet verified.

* docs(iot): MQTT over TLS on 8883

* feat(iot): keep retired server key material readable for the life of a handshake

A retired generation of ReloadingKeyManager stays readable for 60 seconds after
its replacement, longer than Vert.x's 10 second handshake timeout, and is dropped
on the next reload after that. Any number of reloads between JSSE choosing an
alias and reading its key and chain now resolve to matching material.

* fix(iot): wait for a failed MQTT listener to close before reporting the start failure
2026-09-06 15:55:19 -05:00
Facundo ParedesandFacundo Paredes e3230a74ab fix(stepfunctions): reject the QueryLanguage definitions AWS rejects (#2972)
* test(stepfunctions): pin that JSONata-only fields are rejected on a JSONPath state

Output, Arguments and Items exist only in JSONata. AWS rejects each on a
JSONPath state and locates the diagnostic at the state, not at the field.
A Map's own QueryLanguage is inert for the states inside its ItemProcessor:
the two definitions of the first test fail identically on AWS, so the
equality of their diagnostic lists is what is asserted.

* test(stepfunctions): locate QueryLanguage field errors at the state, as AWS does

Two assertions expected /States/<state>/<field>. Measured on AWS, this
message family carries no field suffix: /States/X for a JSONata Pass with
InputPath, /States/M for a MaxConcurrencyPath on a JSONata Map. Both turn
red until the diagnostic moves.

* fix(stepfunctions): reject JSONata-only fields on a JSONPath state

Output, Arguments and Items are refused on a JSONPath state, the mirror of
the JSONPath-only list already refused on a JSONata state. Assign stays off
the list: AWS accepts it under both query languages.

This family of diagnostics is located at the state itself rather than at the
offending field, so both directions now travel through the marker that
already carried Field 'X' is not supported past the generic converter.

* test(stepfunctions): pin the JSONPath downgrade and QueryLanguage on a sub-workflow

A JSONata state machine cannot be reverted state by state to JSONPath, and
the ItemProcessor or branch object carries no QueryLanguage of its own: it
is not a state. Both messages and both locations are as AWS returns them.
The two accepting cases keep the guard reading the machine's language rather
than the presence of the field.

* fix(stepfunctions): refuse a JSONPath state under a JSONata machine and QueryLanguage on a sub-workflow

A state declaring JSONPath under a JSONata state machine is rejected at the
state's path; the upgrade in the other direction stays legal, so the guard
reads the machine's language rather than the presence of the field.

The ItemProcessor, Iterator and branch objects are key-checked for
QueryLanguage, which they cannot carry: they are sub-workflows, not states.
validateNestedStates becomes validateSubWorkflow and takes the sub-workflow
object, so the check and the paths derived from it live in one place.

* test(stepfunctions): pin that an ItemProcessor state runs as the machine's query language

A JSONata Map evaluates its own Items expression while the bare Pass inside
its ItemProcessor still resolves Parameters with .$, which exists only in
JSONPath. Both halves land in one execution, and the outputs are the
literals the real service returned. Propagating the Map's language into the
ItemProcessor makes two of the three cases produce the raw item instead.

* docs(stepfunctions): record why the sub-workflow gets the machine's query language

The three call sites that hand a nested sub-workflow the state machine's
query language now say so, citing the ASL specification clause that calls
the enclosing Map's or Parallel's declaration independent of it.

* test(stepfunctions): pin the downgrade diagnostic alone and a QueryLanguage outside the enum

* fix(stepfunctions): report the QueryLanguage downgrade alone and the enum value at its field

* test(stepfunctions): pin the diagnostic order, the legacy Iterator and a bare ItemProcessor Pass

* fix(stepfunctions): emit QueryLanguage field diagnostics in a fixed order

* test(stepfunctions): pin that only the exact string JSONPath makes a state JSONPath

* fix(stepfunctions): resolve a QueryLanguage to JSONPath only on the exact string

* test(stepfunctions): name the Map fixtures after the repo's state naming

The nested Map fixtures used SCREAMING_SNAKE state names, which no other
fixture in this repo does. ItemsMap and SubItemsMap sit next to the
HelloWorld pass they enclose.

---------

Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com>
2026-09-06 15:53:47 -05:00
Priamo Germosen 81b8127de0 feat(ram): support resource-share invitation accept/reject (#3120)
Closes the last open piece of #2313. Resource shares and associations
already existed; GetResourceShareInvitations was hardcoded to return
empty and there was no Accept/RejectResourceShareInvitation at all, so
aws_ram_resource_share_accepter had nothing to work against.

Adds real invitation records for bare AWS account-id principals added
while organization sharing is off (an organization/OU principal never
gets one, matching real AWS's own auto-accept behavior for org-based
sharing, and neither does an account principal once organization
sharing is enabled). Accept/reject are receiver-only and terminal once
resolved, matching the modeled error shapes
(OperationNotPermittedException,
ResourceShareInvitationAlready{Accepted,Rejected}Exception,
ResourceShareInvitationArnNotFoundException, MalformedArnException).
GetResourceShareInvitations only returns invitations the caller
received, not ones it sent, matching the API reference ("invitations
that you have received").

Deliberately not a visibility gate: GetResourceShares/ListResources
under OTHER-ACCOUNTS keep showing every non-owned share regardless of
invitation status, same as before this change, since floci's launched-
container credentials all resolve to one default account and gating on
acceptance would hide shares from the very consumers real AWS invited.

Invitation creation and accept/reject are each serialized behind a
synchronized(this) scoped to just this new code, closing two TOCTOU
races (duplicate invitations from concurrent associates on the same
principal; a double-accept both succeeding) without touching the
pre-existing, already-unsynchronized share-mutation paths.
2026-09-06 15:51:49 -05:00
Franklin G. Mendoza d80734e6de feat(account): add alternate contact operations (#3118)
* feat(account): add alternate contact operations

* fix(account): complete alternate contact contracts
2026-09-06 15:49:12 -05:00
Facundo ParedesandFacundo Paredes 504203f8e8 fix(stepfunctions): abort executions abandoned by a restart (#2969)
* test(stepfunctions): cover executions abandoned by a restart

* fix(stepfunctions): abort executions abandoned by a restart

An execution runs inside the Floci process, so a restart leaves it stored as
RUNNING with no worker behind it: DescribeExecution reported RUNNING forever
and GetExecutionHistory reported nothing, so a caller waiting for a final
status hung until its own timeout with no diagnosis.

EmulatorLifecycle.onStart now calls StepFunctionsService.abortAbandonedExecutions
after storageFactory.loadAll(), which retires every still-RUNNING execution with
status ABORTED, a stopDate, error ExecutionAbandoned and a cause naming the
restart, and seals its history with a single ExecutionAborted event. ABORTED is
the status AWS gives an execution ended from outside its own definition, and it
is the only terminal status that keeps the execution inside RedriveExecution's
reach.

The sweep runs with no request context, so it scans every account and writes
each execution back under the account that owns it. The terminal write is shared
with StopExecution, which handled the same window for its own half already.

* fix(stepfunctions): file the abort history under the storage key

markAborted read the history key off the stored value. An execution whose
executionArn field is null made computeIfAbsent throw out of the startup sweep,
which EmulatorLifecycle.onStart calls unguarded, so the process did not boot and
the sweep stopped mid list with earlier entries flipped in memory and never
written back. A field that disagreed with the storage key filed the
ExecutionAborted event where GetExecutionHistory does not look. The key is now a
parameter: StopExecution passes the ARN it was called with, the sweep passes the
key the entry came under.

The tests bound the stopDate between two literal epoch-second instants instead of
asserting it is non-null, so a wrong unit fails; assert the sweep stays silent
when nothing is RUNNING, which is what the count guard is for; and pin the WARN
record by level and count rather than by its whole sentence. The lifecycle test
whose plain verify was subsumed by the ordered one is gone.

The documentation no longer claims the ExecutionAborted event survives a further
restart: histories live in memory, so the event is written on the boot that
aborts the execution, while the status, error and cause persist.

* test(stepfunctions): require the AWS shape of an abort with no reason

The startup sweep is measured against us-east-1 with StopExecution called
without --error and --cause: status ABORTED, DescribeExecution omitting both
keys, and executionAbortedEventDetails present and empty. The persistence test
pins the sweep, and the integration test pins the wire shape, where an omitted
key is distinguishable from a null one.

* fix(stepfunctions): abort abandoned executions the way AWS aborts

ExecutionAbandoned is a code AWS never emits, and the sweep was the only
producer of it. Measured against us-east-1 with StopExecution called without
--error and --cause, the abort reports status ABORTED, DescribeExecution omits
the error and cause keys, and the terminal event carries an empty
executionAbortedEventDetails. The sweep now takes that same path; the WARN line
with the count is where the reason lives.

markAborted keeps both parameters: StopExecution passes the caller's error and
cause through them.

---------

Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com>
2026-09-06 15:44:31 -05:00
Matheus Oliveira 5cf10ece18 fix(cloudcontrol): reject ListResources for unsupported resource types instead of returning empty (#3141)
Unsupported TypeName values now fail with UnsupportedActionException
(HTTP 400) instead of an empty ResourceDescriptions, which was
indistinguishable from a genuinely empty result. Documents the
supported type list and the new error behavior.

Closes #2043

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-09-06 15:28:43 -05:00
lex00 17af9590c7 feat(cloudformation): provision AWS::AutoScaling::ScalingPolicy (#3124)
* feat(cloudformation): provision AWS::AutoScaling::ScalingPolicy

Per-service provisioner over AutoScalingService. Ref and Fn::GetAtt Arn are
the policy ARN and Fn::GetAtt PolicyName the generated name, since the type
has no PolicyName property. PutScalingPolicy is an upsert keyed by group and
name, so an update reuses the name recorded at create time and rewrites the
policy in place. AutoScalingGroupName is createOnly, so moving the policy to
another group is refused as a replacement rather than left behind on the old
group. Omitted ScalingAdjustment and Cooldown take the Query handler's
defaults.

Ported from lex00/floci#118. Tracked in lex00/floci#192.

* fix(cloudformation): scope the scaling policy lookup to its group

Policy names are unique only within a group. The update path now looks for the
recorded name on the template's group first and treats a same-named policy on
another group as a move only when it is not there, so an unrelated group's
policy cannot block a valid update.

* fix(cloudformation): take a scaling policy's identity from its recorded group

Finding the recorded name on the group the template asks for read the
destination group's own same-named policy as this resource, so a move
overwrote that policy and orphaned the original. The group is recorded on the
resource at create time and compared directly instead, which drops both
DescribePolicies lookups. A resource provisioned before the attribute existed
has no prior group and keeps the previous behaviour.
2026-09-06 15:13:58 -05:00
lex00 cbde58f238 feat(cloudformation): provision AWS::ApiGateway::ApiKey (#3122)
* feat(cloudformation): provision AWS::ApiGateway::ApiKey

Per-service provisioner over ApiGatewayService. Ref and Fn::GetAtt APIKeyId
both yield the key id. Description, Enabled and Tags update in place. Name,
Value and GenerateDistinctId are createOnly, so a change to any of them is
refused as a replacement rather than applied to the existing key. A template
that omits Name keeps its generated name across updates instead of minting a
second key. Stack deletion deletes the key and tolerates one already gone.

ApiGatewayService gains replaceApiKeyTags so an update can drop a tag the
template no longer declares.

Ported from lex00/floci#118. Tracked in lex00/floci#192.

* fix(cloudformation): keep an API key's create-time reserved tags across updates

replaceApiKeyTags checked the whole desired map against the reserved list,
so a key created with a reserved floci tag could never change an ordinary tag
afterwards. Only a reserved tag that is new or changed is an update-time
override attempt and is refused now. Adds a test that dropping Description
from the template clears it on the key.
2026-09-06 15:12:50 -05:00
lex00 ba3dd657b6 feat(cloudformation): provision AWS::SNS::TopicPolicy (#3126)
Adds the type to SnsCfnProvisioner beside Topic and Subscription. A topic
policy is not an entity of its own: it writes the Policy attribute of every
topic the template lists, so re-applying on UpdateStack is what an update
means. The document goes through resolveJsonAttribute like FilterPolicy, so a
Ref to a topic inside Resource resolves to the ARN. The physical id is
synthetic and stays put across updates, as AWS::SQS::QueuePolicy does, and Ref
and Fn::GetAtt Id both return it. An empty Topics list or a missing
PolicyDocument is refused. Delete touches nothing, as with QueuePolicy.

Ported from lex00/floci#118. Tracked in lex00/floci#192.
2026-09-06 15:11:42 -05:00
Mario Toffia 024bfa0a5c feat(docker): containers Floci launches trust the Floci CA (#3091)
* feat(tls): write a CA bundle for launched containers at boot

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Off with FLOCI_SERVICES_EC2_RECONCILE_CONTAINERS_ON_STARTUP=false.

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

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

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

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

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

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

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

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

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

Verified by running a @QuarkusTest rather than only compiling: Ec2ImageCatalogTest
now boots and passes, and no SRCFG00050 remains.
2026-09-06 14:28:12 -05:00
Franklin G. Mendoza 41022d09fb feat(cloudformation): support service-managed stacksets (#3055)
* feat(cloudformation): support service-managed stacksets

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

* docs(cloudformation): sync resource type table

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

* test(cloudformation): isolate stackset organization fixture

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

* fix(cloudformation): preserve stackset OU deletion targets

* fix(cloudformation): preserve overlapping stackset targets

* fix(cloudformation): reconcile stackset deployment targets
2026-09-06 13:59:54 -05:00
Mario Toffia dec348d382 feat(iot): provision AWS::IoT::Thing, Policy and TopicRule (#3014)
* feat(iot): provision AWS::IoT::Thing, Policy and TopicRule

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

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

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

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

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

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

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

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

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

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

* docs(cloudformation): regenerate the resource-type table after the rebase onto main
2026-09-06 11:06:47 -04:00