IAM policy evaluation already supported condition keys, but request-time enforcement did not provide S3 list request parameters to the evaluator. As a result, assumed-role session policies that allowed s3:ListBucket only for a matching s3:prefix were denied because the condition context was empty.
Add an application-scoped IamConditionContextResolver and have IamEnforcementFilter pass resolved condition context into IamPolicyEvaluator. The resolver currently maps S3 ListBucket query parameters to s3:prefix, s3:delimiter, and s3:max-keys, keeping action-specific condition extraction out of the filter.
Add regression coverage for prefix-restricted STS session policies through direct integration tests and the Java SDK compatibility suite. The SDK test also uses a trust policy matching the root/test principal that performs AssumeRole when IAM enforcement is enabled.
Tests:
- ./mvnw test -Dtest=IamConditionContextResolverTest,IamEnforcementFilterTest,IamEnforcementIntegrationTest,StsSessionPolicyS3EnforcementIntegrationTest
- compatibility-tests/sdk-test-java: mvn -q -DskipTests test-compile
* feat(ses): implement Contact CRUD for SES v2
Add the SES v2 Contact APIs under /v2/email/contact-lists/{name}/contacts:
CreateContact, GetContact, ListContacts (POST .../contacts/list),
UpdateContact, DeleteContact. Contacts carry per-topic subscription
preferences, an unsubscribe-all flag, and free-form attributes;
TopicDefaultPreferences is derived at read time from the list's topics.
Behaviour is verified against real AWS: validation order (Smithy enum ->
EmailAddress format -> list existence -> topic existence), AlreadyExists /
NotFound / invalid-topic / invalid-email error shapes, and the UpdateContact
semantics (TopicPreferences merge by topic name; AttributesData and
UnsubscribeAll replaced). Covered by a RestAssured integration test and an
AWS Java SDK v2 compatibility test.
* refactor(ses): resolve contact list once for reads and delete under lock
Address review consistency findings on the Contact CRUD read/delete paths:
- getContact/listContacts returned only the contact(s), so the controller
fetched the ContactList a second time to render TopicDefaultPreferences.
Between the two calls a concurrent delete could turn a successful read into a
misleading "List not found". The service now returns the resolved list
alongside the contact(s) (ContactWithList / ContactsWithList), so the read is
a single, consistent lookup.
- deleteContact re-checked list existence before acquiring contactMutationLock,
unlike createContact/updateContact which re-check inside it. Move the
getContactList check inside the lock so a concurrent deleteContactList
surfaces "list not found" rather than "contact not found".
* test(appsync): strengthen existing integration error tests with __type and message assertions
All 30 existing error assertions (400/404) previously checked only the HTTP
status code. Each now also verifies the AWS error body shape:
{"__type":"<ExceptionClass>","message":"<...>"}
This locks in the __type field that the AWS SDK v2 uses to instantiate the
typed exception (NotFoundException, BadRequestException, etc.) and guards
against accidental changes to error codes and messages.
* test(appsync): add 409 conflict and 429 limit tests
Add 7 new integration tests covering previously untested error paths:
ConflictException (409):
- createDataSourceDuplicateReturns409
- createResolverDuplicateReturns409
- createTypeDuplicateReturns409
- createDomainNameDuplicateReturns409
- createChannelNamespaceDuplicateReturns409
- associateApiDuplicateReturns409 (domain already associated)
LimitExceededException (429):
- createApiKeyExceedsLimitReturns429 (3rd key exceeds max 2 per API)
All tests are self-contained: create resources, assert the error, then
clean up. Each asserts statusCode + __type + message substring.
* test(appsync): add 404 tests for update/delete and cross-resource create
Add 11 new integration tests covering previously untested 404 paths:
Update/delete of non-existent resources (8):
- updateResolverNonExistentReturns404
- deleteResolverNonExistentReturns404
- updateFunctionNonExistentReturns404
- deleteFunctionNonExistentReturns404
- updateApiKeyNonExistentReturns404
- deleteApiKeyNonExistentReturns404
- updateDomainNameNonExistentReturns404
- updateChannelNamespaceNonExistentReturns404
Cross-resource 404 on create (3) — missing referenced resource:
- createResolverMissingDataSourceReturns404
- createFunctionMissingDataSourceReturns404
- associateApiMissingDomainReturns404
Each asserts statusCode + __type=NotFoundException + message substring.
* test(appsync): add pagination, edge case, and updateChannelNamespace tests
Add 7 new integration tests:
Pagination for previously untested list operations (3):
- listDomainNamesWithMaxResults
- listChannelNamespacesWithMaxResults
- listSourceApiAssociationsWithMaxResults
Each creates >=2 items, verifies page size + nextToken, follows token,
and cleans up.
Pagination edge cases (3):
- listWithMaxResultsZero (empty page + nextToken present)
- listWithNegativeMaxResultsReturns400
- listWithInvalidNextTokenNonApiReturns400 (data sources path)
Update channel namespace (1):
- updateChannelNamespace (verify description field change)
* test(appsync): upgrade SDK error tests to typed exceptions
Upgrade 4 existing SDK error tests from the generic AppSyncException to
the typed exception classes that the AWS SDK v2 maps from the __type
response field:
- getNonExistentApiThrowsException -> NotFoundException
- getNonExistentDataSourceThrowsException -> NotFoundException
- getNonExistentTypeThrowsException -> NotFoundException
- startSchemaCreation_invalidSchema -> BadRequestException
Each now also asserts hasMessageContaining with the expected message
substring. This aligns AppSyncTest with the repo convention used by
ApiGatewayV2ManagementTest, SchedulerTest, and ElbV2Test.
Also strengthen two existing update tests with field assertions:
- updateChannelNamespace: now sets codeHandlers and verifies the response
- updateDomainName: now asserts description field equals updated value
* fix: correct environment variables API path case for SDK compatibility
The AppSync controller used lowercase /v1/apis/{apiId}/environmentvariables
but the AWS SDK v2 sends to /v1/apis/{apiId}/environmentVariables (capital V).
This broke both getGraphqlApiEnvironmentVariables and
putGraphqlApiEnvironmentVariables for all SDK clients.
Fix the @Path annotations in the controller and update integration test
paths to match the SDK-expected casing.
* fix(appsync): align error codes and messages with AWS AppSync behavior
- DataSource duplicate: ConflictException 409 → BadRequestException 400
- Resolver duplicate: ConflictException 409 → BadRequestException 400
- Type duplicate: ConflictException 409 → BadRequestException 400
- DomainName duplicate: ConflictException 409 → BadRequestException 400
- Domain association duplicate: ConflictException 409 → BadRequestException 400
- API key limit: LimitExceededException 429 → ApiKeyLimitExceededException 400
- Add duplicate validation for Source API associations
- Add checkDuplicateSourceApiAssociation helper method
- Update all integration and SDK test assertions to match AWS exact messages
* feat(core): add extended data support to AwsException for AWS error parity
Add optional extended data to AwsException so the exception mapper can
emit structured error payloads matching the AWS error contract (e.g.
AppSync BadRequestException with reason=CODE_ERROR and detail.codeErrors).
The mapper auto-detects extended data and serializes it as additional
JSON fields alongside __type and message. When extended data is null
the previous simple AwsErrorResponse is returned, preserving behavior
for every existing error site.
* fix(appsync): return ConcurrentModificationException for duplicate source API association
AWS AppSync's AssociateSourceGraphqlApi returns ConcurrentModificationException
(HTTP 409) when an association already exists for the same source and merged
API pair. Floci was returning BadRequestException (400) with an association
ID in the message that did not match AWS.
Also filter out associations in DELETION_SCHEDULED status so a new
association can be created after the previous one has been removed, matching
AWS behavior where the previous association is no longer 'live'.
Message format now mirrors AWS: 'Source API association already exists
for Source API ID: <id> and Merged API ID: <id>.'
* refactor(appsync): remove non-AWS endpoints getApiKey and listAllResolvers
AWS AppSync does not expose:
- GetApiKey: there is no GetApiKey operation in the AppSync API
Reference. API keys can be listed, created, updated, and deleted
but not retrieved by id.
- ListAllResolvers: ListResolvers requires typeName. There is no
endpoint that lists resolvers across all types for an API.
Both endpoints were Floci-only and violated the 'no custom endpoint
shapes' rule. The associated service method (listResolvers) is also
removed. The corresponding integration tests are dropped in a
follow-up commit.
The getApiKey service helper stays because it is still used
internally by updateApiKey and deleteApiKey flows.
* feat(appsync): emit AWS-compatible BadRequestException extended format for SDL errors
AWS AppSync's StartSchemaCreation returns 400 BadRequestException with a
reason=CODE_ERROR field and a detail.codeErrors array. Each code error
carries errorType, value, and location{line, column, span}.
This commit:
- Catches SchemaProblem and InvalidSyntaxException from the parser and
throws BadRequestException with extended data built from
graphql-java's GraphQLError locations.
- Catches SchemaProblem from makeExecutableSchema for validation errors
(unknown types, missing fields) with errorType=VALIDATION_ERROR.
- Catches generic RuntimeException without extended data so flow
exceptions (NPE, OOM) do not produce a misleading codeErrors array.
- Validates unknown AppSync directives with errorType=VALIDATION_ERROR
and line/column/span from the SDL.
The errorType values follow the AWS Javadoc (PARSER_ERROR, VALIDATION_ERROR)
and span defaults to -1 when unknown, matching CodeErrorLocation.span()
in the AWS SDK.
* test(appsync): cover AWS-aligned error format, dead-code cleanup
- Add Order 157: createSourceApiAssociationDuplicateReturns409 asserts
ConcurrentModificationException 409 with the AWS message format.
- Add Order 158: createSourceApiAssociationReplacesDeletionScheduled
covers the new DELETION_SCHEDULED filter (a new association can
replace a previously deleted one).
- Add Orders 700, 701, 702: extended BadRequestException format for
PARSER_ERROR (syntax), VALIDATION_ERROR (semantic), and unknown
directive cases. Each asserts reason=CODE_ERROR, detail.codeErrors,
and the location{line, column, span=-1} shape.
- Update Order 124 (deleteApiKeyStandalone): the verification step
used the removed getApiKey endpoint, replace it with listApiKeys
asserting the deleted key is no longer present.
- Update Orders 600 and 607 to assert the new extended format for
generic SDL validation and unknown directive cases.
- Drop Order 32 (getApiKey) and Order 62 (listAllResolvers): the
underlying endpoints no longer exist.
- Drop encodeArn helper and the URLEncoder / StandardCharsets
imports that were no longer used by any test.
* test(sdk-java): cover AssociateSourceGraphqlApi 409 and extended schema error body
- Add Order 137 (createSourceApiAssociationDuplicateThrowsConcurrentModificationException):
use the typed AWS SDK exception ConcurrentModificationException instead
of the generic AppSyncException, validating the message format that
AWS returns.
- Add Order 200 (startSchemaCreation_syntaxError_throwsBadRequestWithExtendedBody):
send a raw HTTP POST with an invalid schema, then inspect the JSON body
to assert the AWS-compatible shape (__type, reason, detail.codeErrors[],
errorType=PARSER_ERROR, location{line, column, span=-1}). Uses a
jackson mapper rather than the SDK to read the response body directly.
- Import java.util.List to support the new deserialization in Order 200.
* feat(appsync): async schema creation with 409 in-progress gates
StartSchemaCreation is asynchronous in AWS: the request returns 200 +
PROCESSING, and the schema compiles in a background thread, transitioning
to ACTIVE (success) or FAILED (error) with the extended error format in
the polled GetSchemaCreationStatus response.
This commit:
- Adds SchemaCreationWorker, a singleton executor with configurable
thread count and graceful shutdown, that transitions the schema
status asynchronously and serializes the AwsException extended data
into the FAILED details string.
- Adds SchemaStatusStoreProducer so AppSyncService and the worker see
the same in-memory state for the schema status store (otherwise
two StorageFactory.create() calls would create independent maps).
- Refactors startSchemaCreation to set PROCESSING synchronously and
hand off compilation to the worker.
- Removes the synchronous ACTIVE override from the controller.
- Gates 27 per-API mutations and 2 account-wide operations
(CreateGraphqlApi, CreateApi) plus self-blocking on second
StartSchemaCreation with ConcurrentModificationException 409,
matching the AWS behavior documented in the AppSync API Reference
and service-2.json.
- Adds recoverOrphans() to EmulatorLifecycle.onStart so schemas left
in PROCESSING by a previous emulator run are marked FAILED instead
of permanently blocking the API.
- Adds schemaWorkerThreads and schemaWorkerShutdownTimeoutSeconds
to EmulatorConfig (FLOCI_SERVICES_APPSYNC_SCHEMA_WORKER_THREADS,
FLOCI_SERVICES_APPSYNC_SCHEMA_WORKER_SHUTDOWN_TIMEOUT_SECONDS).
* test(appsync): cover async schema polling, FAILED state, and 409 gates
- Adapts the 7 existing schema creation tests to the async pattern:
the post returns PROCESSING, tests poll for the terminal status with
Awaitility, and the extended format body is now read from the
polled FAILED details.
- Adds 9 new tests (Orders 703-711) covering the 409 in-progress gates
for createDataSource, createResolver, createFunction, createType,
putEnvironmentVariables, startSchemaCreation, createGraphqlApi,
updateGraphqlApi, and deleteGraphqlApi. The gates are exercised by
setting the status to PROCESSING directly via the shared store
backend, which is deterministic and avoids the race window of
waiting for the worker.
- Updates the EmulatorLifecycleTest constructor for the new
SchemaCreationWorker dependency.
* test(sdk-java): cover async schema with typed SDK polling
- Adds awaitility 4.2.2 to pom.xml (test scope) so the SDK test for
the polled status can use the same Awaitility DSL the integration
tests use.
- Updates the existing getSchemaCreationStatus test (Order 11) to
poll via the typed SDK call until the terminal status is reached
(ACTIVE in this case) instead of a single request. Without this,
the gate added in the previous commit would 409 every subsequent
SDK test that runs while the schema is still PROCESSING.
* fix(build): remove duplicate awaitility declaration in pom.xml
The pre-existing version-less awaitility declaration (BOM-managed by
Quarkus) was shadowed by the pinned 4.2.2 declaration added in this PR.
Maven resolves the first declaration it encounters, silently ignoring
the BOM version. Removed the version-less dup so the pinned 4.2.2
takes effect.
Addresses P1 from Greptile review.
* fix(appsync): add missing 409 gates and synchronize startSchemaCreation
Validating all 43 ConcurrentModificationException operations from
service-2.json against the code surfaced 5 operations missing the
PROCESSING gate (Greptile caught 1, 4 more were found during review):
- getChannelNamespace: added assertSchemaNotBusy (protects both get
and deleteChannelNamespace, matching getResolver/getFunction/getType)
- deleteDomainName: resolves the associated apiId from the domain
association store and gates on it (no-op if no association exists)
- disassociateApi: same pattern as deleteDomainName
- deleteMergedApiAssociation: gate on sourceApiIdentifier
- updateDomainName: resolves the associated apiId and gates on it
Also wraps the startSchemaCreation check-and-set in synchronized(this)
to close the TOCTOU race window between assertSchemaNotBusy and the
PROCESSING put. The async submitSchemaCreation call stays outside the
lock to avoid blocking the worker thread.
Addresses P1 and P2 from Greptile review.
* chore(appsync): document schema worker config in application.yml
Adds the appsync section under storage.services in both main and test
application.yml, documenting the three AppSyncStorageConfig keys:
- flush-interval-ms (5000 main / 60000 test, matching other services)
- schema-worker-threads (4)
- schema-worker-shutdown-timeout-seconds (30)
These already had @WithDefault fallbacks so the code worked without
the YAML entries, but the repository convention (AGENTS.md) requires
storage config to be documented in application.yml as the source of
truth for operators.
Addresses P2 from Greptile review.
* test(appsync): cover additional 409 gates for domain and merged operations
Adds 5 new integration tests (Orders 712-716) covering the PROCESSING
409 gates added in the previous commit:
- 712: deleteChannelNamespace_busy_returns409
- 713: deleteDomainName_busy_returns409
- 714: disassociateApi_busy_returns409
- 715: disassociateMergedGraphqlApi_busy_returns409
- 716: updateDomainName_busy_returns409
Each test creates the necessary resources (temp API, channel namespace,
domain name + association, or merged API association) before setting
the schema status to PROCESSING directly via the shared store, then
asserts the gated operation returns 409 ConcurrentModificationException
with the AWS-style message.
Integration test count: 154 -> 159.
* fix(appsync): remove incorrect CME gate from getChannelNamespace, add to deleteChannelNamespace
GetChannelNamespace does not declare ConcurrentModificationException in
service-2.json or the AWS Java SDK v2. Only BadRequestException,
NotFoundException, UnauthorizedException, InternalFailureException, and
AccessDeniedException are declared. The gate was incorrectly returning
409 during PROCESSING for an undeclared error code.
DeleteChannelNamespace does declare CME, so the gate is now applied
directly in deleteChannelNamespace instead of being inherited from
getChannelNamespace.
* fix(appsync): account-aware schema creation and worker store isolation
Scope schema creation status to the requesting account so concurrent
accounts cannot interfere with each other's in-flight schema operations.
- Add accountId field to SchemaCreationStatus
- Worker uses AccountAwareStorageBackend (putForAccount/getForAccount)
- SchemaStatusStoreProducer now produces AccountAwareStorageBackend
- SchemaStoreProducer CDI bean shares schemaStore between service and worker
- schemaStore.put moved to worker success path only
- assertSchemaNotBusy scoped to current account via getForAccount
- assertNoSchemaBusyAnywhere scoped to keysForAccount
- currentAccountId() helper reads RequestContext
- Worker config moved from AppSyncStorageConfig to AppSyncServiceConfig
* fix(appsync): ACTIVE→SUCCESS terminal schema status
Match AWS behavior: a successfully compiled schema is SUCCESS, not
ACTIVE. ACTIVE is not a valid terminal status in real AppSync.
- Worker marks SUCCESS on successful compilation
- Integration tests assert SUCCESS
- SDK compatibility test asserts SUCCESS
* refactor(appsync): remove circular dependency between SchemaRegistry and SchemaCreationWorker
SchemaRegistry depended on SchemaCreationWorker solely to delegate
submitSchemaCreation calls, creating a circular dependency. AppSyncService
now calls the worker directly, making the delegation unnecessary.
- Remove SchemaCreationWorker dependency from SchemaRegistry
- Remove submitSchemaCreation method
* fix(appsync): add assertSchemaNotBusy to deleteResolver, deleteFunction, deleteType
These three delete operations mutate the schema and should be blocked
while a schema creation is in PROCESSING state, matching the 409 gates
on the other schema-mutating operations.
* fix(appsync): return PROCESSING status synchronously from StartSchemaCreation
The controller was re-reading the status from the store after submitting
to the worker pool. In fast environments the worker could complete
(fail) before the read, causing the POST response to return FAILED
instead of PROCESSING — breaking the SDK compatibility test.
startSchemaCreation now returns the PROCESSING status it just set, and
the controller uses it directly instead of re-reading.
* fix(secrets-manager): return partial result for missing secrets in batch
* fix(secrets-manager): remove hardcoded errorCode mapping
* fix(secrets-manager): report deleted and missing current version secrets in BatchGetSecretValue errors
RegisterTaskDefinition now parses and stores containerDefinitions[].secrets
(name + valueFrom) and round-trips them on register/describe as references,
matching AWS (the resolved values are never returned).
At RunTask launch, EcsContainerManager resolves each secret to an environment
variable through the in-process SsmService / SecretsManagerService (the same
local resolution CodeBuildRunner already uses, no extra HTTP hops):
- SSM parameter by name or full ARN -> Parameter.value
- Secrets Manager full ARN -> SecretString
- a full ARN's own region is used, so cross-region references resolve correctly
- env precedence: task-def environment < resolved secrets < RunTask container
override environment (override still wins on a name collision)
When a referenced secret/parameter cannot be resolved the launch fails the way
AWS does: no container is started and the task goes STOPPED with a
ResourceInitializationError stoppedReason, rather than silently starting the
container without the variable.
Deferred (noted in floci-io/floci#1624): the Secrets Manager valueFrom selector
suffix (:json-key:version-stage:version-id) is not yet parsed; such a valueFrom
is resolved as the plain secret.
Adds handler round-trip tests, container-manager resolution / override /
cross-region unit tests, a stopped-task failure test, and Java SDK
compatibility coverage.
* fix(ses): populate VerificationStatus in v2 ListEmailIdentities
ListEmailIdentities built each item with only IdentityType / IdentityName /
SendingEnabled, so VerificationStatus always serialized as null and clients had
to call GetEmailIdentity per identity. Populate it from the identity's stored
status (mapped to the v2 enum via toV2Status), and refresh each identity's
state the same way GetEmailIdentity does so the list stays consistent (e.g. a
domain that transitioned to SUCCESS via its DKIM records).
* fix(ses): derive SendingEnabled from verification status in v2 ListEmailIdentities
SendingEnabled was hard-coded to true, so a not-yet-verified identity was
reported as sendable, which is inconsistent now that VerificationStatus is
populated. AWS returns SendingEnabled=true only when the identity is verified
(VerificationStatus SUCCESS) and false otherwise (PENDING/FAILED), matching the
VerifiedForSendingStatus logic already used by GetEmailIdentity. Derive it the
same way here.
* feat(ses): implement PutEmailIdentityConfigurationSetAttributes for SES v2
Add the v2 PutEmailIdentityConfigurationSetAttributes API and wire an email
identity's default configuration set into the send path so its event
destinations fire. This includes Raw sends with no explicit FromEmailAddress:
the configuration set is re-resolved from the MIME "From" header once parsed,
so an omitted-sender Raw send still routes through the identity default.
Unknown identities surface the AWS-matched error message.
* test(ses): log instead of swallowing cleanup failures in the identity config-set compat test
* docs(ses): clarify default config-set precedence and clear-on-null semantics
* fix(ses): fail send when an identity's default configuration set was deleted
Per the SES Developer Guide, sending through an identity whose default
configuration set has been deleted fails with a bad-request error. The default
resolution was silently dropping the stale association; make it throw
BadRequestException ("Configuration set <name> does not exist.") to match AWS.
* feat(cloudwatch): add Logs Insights query support
Implement StartQuery/GetQueryResults/StopQuery for CloudWatch Logs so
clients using Logs Insights (e.g. boto3 start_query + get_query_results)
work against Floci instead of receiving UnsupportedOperation.
LogsInsightsQuery is a minimal engine covering the common subset: fields,
filter (= / !=), sort, dedup, limit; it resolves @timestamp/@message and
dotted JSON paths (e.g. params.job_id, level). StartQuery times are epoch
seconds while event timestamps are millis, scaled accordingly.
Queries follow a time-driven lifecycle: results are computed eagerly, but
a query reports Running until a configurable completion delay elapses
(FLOCI_SERVICES_CLOUDWATCHLOGS_QUERY_COMPLETION_DELAY_MS, default 0 =
instant for local dev), then Complete; StopQuery cancels a running query
and otherwise returns AWS-faithful errors (InvalidParameterException when
already ended, ResourceNotFoundException for an unknown id). Status is
computed on read from an injectable clock, with no background threads.
GetQueryResults returns ResourceNotFoundException for unknown ids,
reports recordsMatched independent of the Running/Cancelled row masking,
hands out a defensive copy of result rows, and drops rows once cancelled.
Results are cached by queryId with LRU eviction.
Covered by unit tests and an AWS SDK v2 compatibility test exercising the
full StartQuery/GetQueryResults/StopQuery lifecycle (stable against both
instant and delayed completion).
* test(cloudwatch): cover Logs Insights search across multiple log groups
Verify a single StartQuery spanning several log groups finds the same
params.id wherever it was logged (results merged and globally sorted by
@timestamp), and that a matching event in an un-queried group is excluded.
* test(cloudwatch): cover Logs Insights query-language edge cases
Add unit tests for limit (applied after sort), ascending sort on a nested
JSON field, the default @timestamp/@message projection, missing-field
handling (empty projection plus null-safe inequality filtering), graceful
ignoring of unsupported commands (parse/stats), and the recordsScanned vs
recordsMatched statistics.
* fix(cloudwatch): deterministic Logs Insights ordering for same-ms events and dedup
Tie-break the @timestamp/@ingestionTime sort comparators by ingestion sequence
then eventId (matching the event store's EVENT_ORDER), and apply the AWS-documented
default @timestamp desc sort when a dedup stage has no preceding sort — so the
surviving duplicate is the newest, deterministically, rather than depending on
storage-scan order.
* fix(cloudwatch): validate log groups and harden Logs Insights query parsing
StartQuery now de-duplicates the requested log groups (the same group can
arrive via multiple selectors) so it is scanned and counted once, and it
returns ResourceNotFoundException for a log group that does not exist
instead of a successful empty query — matching real AWS. The stage parser
splits on pipes only outside quotes, so a filter value containing '|'
(e.g. filter x = 'a|b') is no longer broken into fragments.
StartQuery still accepts multiple selectors and de-duplicates group names
service-side; strict AWS mutual-exclusivity rejection (InvalidParameterException
for more than one of logGroupName/logGroupNames/logGroupIdentifiers) is deferred
to a handler-side follow-up, since the handler collapses all three selectors
into one service argument.
* fix(cloudwatch): reject empty StartQuery selectors and parse quoted filter operators
StartQuery now rejects a request with no usable log-group selector
(InvalidParameterException) instead of returning a successful empty query.
parseFilter finds the equality/inequality operator outside quoted values,
so a value that itself contains '=' / '==' / '!=' (e.g. filter x = 'a==b')
is no longer misparsed.
* fix(cloudwatch): reject StartQuery requests with more than one log-group selector
AWS requires exactly one of logGroupName, logGroupNames, or logGroupIdentifiers.
The handler now rejects a request that provides more than one selector type with
InvalidParameterException, instead of silently querying the union. The
zero-selector case is already rejected by the service.
* fix(cloudwatch): count serialized StartQuery selector fields, not just non-empty ones
The mutual-exclusivity guard counted a selector only when its value was non-blank,
but the merge path added any present field — so a blank logGroupName alongside a
real logGroupNames slipped past the guard. Count serialized fields uniformly (has),
so a blank or empty selector field can't bypass the check; a lone empty selector
still yields no groups and is rejected by the service.
---------
Co-authored-by: Beytullah Gunduz <beytullah-gunduz@users.noreply.github.com>
* feat(amazonmq): add Amazon MQ broker control plane for RabbitMQ
* feat(amazonmq): provision RabbitMQ container with rollback
Back a broker with a real rabbitmq:3-management container, following the
MSK/ElastiCache container-manager pattern.
- RabbitMqManager starts the container, publishes AMQP (5672) and
management (15672) ports, and resolves the broker endpoints
- Service branches on the mock flag; real brokers stay
CREATION_IN_PROGRESS until a readiness poller observes the management
API answering, then flip to RUNNING
- Rollback on failed provisioning: the manager removes the half-built
container and the broker is persisted as CREATION_FAILED
- @PreDestroy stops containers on shutdown; DeleteBroker stops and
removes the container and its storage
Readiness probes the management UI root (no auth) to avoid RabbitMQ's
loopback-only guest user over Docker port mapping.
* feat(amazonmq): seed broker admin user and reject ActiveMQ-only User API
Amazon MQ's standalone User API (CreateUser/DescribeUser/ListUsers/
DeleteUser) applies only to ActiveMQ brokers; AWS rejects it for RabbitMQ
and directs callers to the RabbitMQ web console. CreateBroker now requires
exactly one broker user (validated against AWS password rules) which is
seeded into the container via RABBITMQ_DEFAULT_USER/PASS, sidestepping
RabbitMQ's loopback-only guest restriction.
* test(amazonmq): SDK compatibility test against live RabbitMQ broker
Adds AmazonMqTest exercising the real container path via the AWS SDK MqClient:
CreateBroker provisions a rabbitmq:3-management container, the broker
transitions to RUNNING once its management API answers, endpoints are
published, the ActiveMQ-only User API is rejected, and DeleteBroker tears the
container down. Uses JUnit Assumptions to skip cleanly when Docker is absent.
* fix(amazonmq): harden error handling, persistence, and shutdown teardown
- Redact the provisioning failure 500: log the cause, return a generic AWS
error envelope instead of leaking e.getMessage() (which can be null).
- Add @JsonIgnoreProperties(ignoreUnknown = true) to Broker, MqUser, and
BrokerInstance so old persisted snapshots survive field changes.
- Wire RabbitMQ container teardown into EmulatorLifecycle.onStop() via
RabbitMqManager.stopAll(), alongside the other container managers; the
service @PreDestroy now only stops the readiness poller.
* docs(amazonmq): add Amazon MQ service page and bump service count to 66
Adds docs/services/amazonmq.md, lists Amazon MQ in the services overview and
README service tables, and updates the "65 -> 66 AWS services" count across
docs/index.md, docs/services/index.md, and README.md.
* fix(amazonmq): reject RebootBroker unless the broker is RUNNING
RebootBroker unconditionally set the broker to RUNNING, so a non-RUNNING
broker (e.g. CREATION_FAILED, which has no backing container) was silently
promoted to RUNNING and never reconciled by the readiness poller. AWS allows
RebootBroker only on a broker in the RUNNING state; guard it and return a 400
otherwise, matching the Amazon MQ API ("You can reboot only a broker with the
RUNNING status").
* fix(amazonmq): close readiness-probe connection and log tolerated failures
isReady() opened an HttpURLConnection but never disconnected it; since the
probe runs every 2s per pending broker this leaked sockets. Disconnect in a
finally block, and log the tolerated failure at debug with broker/URL context
(AGENTS.md: no empty catch; avoid noise in hot paths) instead of swallowing it.
* fix(amazonmq): tear down broker container by deterministic name after restart
containerId is in-memory bookkeeping (intentionally not persisted, since the
Broker model is serialized straight to DescribeBroker and must not leak it).
After an emulator restart it is null, so stopContainer() previously returned
early and left the container running. It now falls back to the deterministic
container name (floci-amazonmq-{brokerId}) so an explicit DeleteBroker still
removes a container left over from a previous run. Documented the field and
added RabbitMqManagerTest covering both the id and name-fallback paths.
* fix(amazonmq): keep admin password in-memory only and fail loudly if absent
The admin password is a secret used solely to seed the RabbitMQ container at
create time. Persisting it (to make it survive a restart) would write the
credential in cleartext to amazonmq-brokers.json, which the project's security
rule prohibits. It stays in-memory only via @JsonIgnore; startContainer (the
only consumer, called from CreateBroker) now throws if the password is absent
rather than seeding a null credential. Added MqUserTest asserting the password
is never serialized and round-trips to null.
* fix(amazonmq): persist broker volumeId/accountId/containerId without leaking them
These internal fields were @JsonIgnore'd, so they were absent from
amazonmq-brokers.json. After a restart in persistent mode volumeId was null
(removeBrokerStorage could not locate the named volume, leaking it) and
accountId was null (the readiness poller wrote brokers via the non-account-aware
path). Unlike the admin password, these are not secrets, so they should persist.
Remove @JsonIgnore so they round-trip through storage, and build the
DescribeBroker response explicitly in the controller so they are still never
exposed to clients (matches MskCluster, which persists volumeId/containerId).
Adds BrokerTest (round-trip) and asserts the describe response omits them.
* feat(firehose): return ExtendedS3DestinationDescription and support UpdateDestination
The Terraform/Pulumi provider creates delivery streams with
ExtendedS3DestinationConfiguration and reads ExtendedS3DestinationDescription
back after create; Floci parsed the config lossily and only ever emitted
S3DestinationDescription, breaking the provider read. Store the full config
(RoleARN, ErrorOutputPrefix, CompressionFormat, EncryptionConfiguration),
emit it under both wire keys like real AWS, add the required output members
(VersionId, DeliveryStreamType, HasMoreDestinations, DestinationId), and
implement UpdateDestination with version checking.
Refs #1043
* fix(firehose): reject empty destination updates and guard version parse
* fix(firehose): reject partial BufferingHints instead of absorbing defaults
AWS requires SizeInMBs and IntervalInSeconds to be specified together
(firehose service-2.json: "if you specify a value for it, you must also
specify a value for IntervalInSeconds, and vice versa"). The primitive
fields with initializers made a partial payload indistinguishable from a
full one, silently persisting a default over an existing value. Members
are now null-honest boxed Integers, create and update reject one-sided
hints with the declared InvalidArgumentException before any mutation,
and defaults apply only when the whole object is absent.
* test(iam): expose STS session policy S3 deny gap
* fix(iam): enforce STS session policies
## Summary
STS session policies were recorded on temporary credentials but IAM enforcement evaluated only the caller's identity policies. As a result, an assumed role with broad role permissions could still perform an action even when the inline `AssumeRole` session policy should have denied or narrowed it.
This changes enforcement to evaluate the full caller context, including identity policies, session policies, and permission boundaries. It also keeps temporary-credential lookup account-independent so assumed-role sessions can be resolved after account routing moves the request into the role account, and it uses the resolved request account when building resource ARNs for policy evaluation.
## Type of change
- [x] Bug fix (`fix:`)
## AWS Compatibility
Incorrect behavior: STS `AssumeRole` accepted the standard inline `Policy` parameter, but later requests signed with those temporary credentials did not have that session policy applied by IAM enforcement.
The fix matches AWS policy evaluation semantics: explicit denies in session policies participate in the deny pass, and a present session policy must also explicitly allow the request for the role's permissions to be effective. This preserves the existing Floci bypass behavior for unknown local credentials and the `test` root credential.
## What changed
- `IamEnforcementFilter` resolves a `CallerContext` and evaluates the complete IAM context instead of identity-policy documents only.
- `IamService` resolves STS sessions across account namespaces for caller context, caller ARN, account routing, and temporary secret lookup.
- Enforcement resource ARN construction uses the request account already resolved by `AccountContextFilter`, so assumed-role credentials evaluate account-scoped resources against the role account.
- IAM and multi-account docs now describe session-policy intersection and temporary-credential resolution accurately.
- Java SDK compatibility coverage now checks that an assumed-role session policy deny overrides a role allow.
## Checklist
- [x] `./mvnw test` passes locally - attempted; only failures were unrelated LambdaReactiveSyncIntegrationTest container startup Broken pipe errors
- [x] Selected Java SDK compatibility tests pass locally - in `compatibility-tests/sdk-test-java`: `mvn -q -Dtest=IamEnforcementTest,IamTest,StsTest,S3Test test`
- [x] New or updated integration test added
- [x] Commit messages follow Conventional Commits
* fix(iam): tighten cross-account session lookup
Add the SES v2 contact list management APIs (CreateContactList, GetContactList,
ListContactLists, UpdateContactList, DeleteContactList) under
/v2/email/contact-lists. A contact list holds subscription topics with
OPT_IN/OPT_OUT defaults. Matching real AWS, an account may hold at most one
contact list per region; a second create is rejected with BadRequestException
("A maximum of 1 Lists allowed per account."), a duplicate name with
AlreadyExistsException, and unknown lists with NotFoundException.
Covered by a RestAssured integration test and an AWS Java SDK v2 compatibility
test.
* fix(ec2): return groupSet from DescribeInstanceAttribute
Ansible's amazon.aws ec2_instance module reads value['Groups'] from
DescribeInstanceAttribute(Attribute=groupSet) in diff_instance_and_params;
Floci returned only instanceId for that attribute, producing the reported
KeyError. DescribeInstances group shapes were already correct.
Refs #1644
* test(ec2): give describeInstanceAttributeGroupSet a unique order slot
* fix(cognito): do not return optional blocks in CreateUserPoolClient when they are not set
* fix(cognito): fix test order in file
* fix(cognito): improve bats assertions
* feat(cloudformation): add StackSets with account-aware provisioning
Implement CloudFormation StackSets so a template can be deployed across
target accounts and regions, and make CloudFormation provisioning land
resources in the correct account.
Provisioning previously ran on a background executor thread with no request
scope, so the downstream service calls fell back to the default account — a
stack created by account B materialised its resources under 000000000000.
executeChangeSet/deleteStack now run the provisioning under a synthetic
request scope bound to the deploying account (the caller's account for a
single stack, the target account for a StackSet instance), mirroring the
pattern other background workers already use. Single-stack resources now
land in the caller's account.
StackSet actions are wired through CloudFormationQueryHandler and
AwsQueryController: CreateStackSet, DescribeStackSet, ListStackSets,
UpdateStackSet, DeleteStackSet, CreateStackInstances, ListStackInstances,
DeleteStackInstances, ListStackSetOperations. CreateStackInstances drives
the existing single-stack engine once per target (account, region),
provisioning each instance into that account's namespace; the stack set,
its instances and its operation history live in the administration account.
Tests: an integration test deploying a StackSet from an admin account into
accounts B and C asserts the resources materialise in B and C and are
invisible to the admin/default account, exercises describe/list/operations
and instance deletion, and covers the not-found / already-exists /
not-empty error paths. A single-stack test asserts resources now land in
the caller's account.
Design aligned with maintainers in floci-io/floci#1550.
* fix(cloudformation): await StackSet instance deletion; test UpdateStackSet
Make the account-scoped deleteStack overload return its Future so
DeleteStackInstances completes synchronously before the operation returns,
rather than racing the async resource removal. Add integration coverage for
UpdateStackSet re-applying the template to existing instances.
* test(cloudformation): add SDK compatibility test for StackSets
Adds an sdk-test-java compatibility test exercising StackSets through the real
AWS SDK CloudFormationClient (CreateStackSet, CreateStackInstances,
DescribeStackSet, ListStackInstances, ListStackSetOperations,
DeleteStackInstances, DeleteStackSet). It asserts the management responses
unmarshal cleanly and that instances provision into each target account's
namespace (verified via per-account SQS clients), per the project's policy of
validating management APIs with AWS SDK clients. Runs in the compatibility CI
on pull requests.
* feat(cloudformation): add DescribeStackInstance and DescribeStackSetOperation
Complete the StackSets API surface with the singular describe operations:
DescribeStackInstance (used by orchestration that polls a single instance's
status) and DescribeStackSetOperation (companion to ListStackSetOperations).
Covered by the integration test and the SDK compatibility test, which confirm
the StackInstance / StackSetOperation response shapes unmarshal through the
real AWS SDK.
* feat(cloudformation): resolve TemplateURL and report StackInstanceStatus.DetailedStatus for StackSets
StackSet create/update now resolve a TemplateURL (fetched from S3) in addition
to an inline TemplateBody, matching how orchestration tools reference templates
staged in S3. DescribeStackInstance and ListStackInstances now also report the
nested StackInstanceStatus.DetailedStatus that AWS returns and that pollers read
to determine when an instance operation has completed.
* feat(cloudformation): derive StackSet operation status and honor RetainStacks
Address review feedback on #1551:
- Operation status is now derived from instance outcomes: CreateStackInstances
and UpdateStackSet report FAILED if any instance fails to deploy, instead of
always SUCCEEDED. deployInstance also recognizes a rolled-back create
(ROLLBACK_COMPLETE, not *_FAILED) as a failed/INOPERABLE instance, which was
previously mis-reported as SUCCEEDED.
- DeleteStackInstances honors RetainStacks: when true, the instance is detached
from the stack set but its underlying stack and resources are left in place.
- UpdateStackSet now persists the refreshed instance records.
Tests: RetainStacks retention and the FAILED-operation path; docs updated.
* fix(cloudformation): restore account on active scope; log StackSets test teardown
Greptile review on #1551:
- runUnderAccount now saves and restores the previous account ID when it runs
inside an already-active request scope, so it can't leave the overridden
account behind on a reused thread. (Background workers normally have no active
scope, so this only hardens the synchronous-caller path.)
- CloudFormationStackSetsTest teardown no longer swallows exceptions silently;
it logs them, per the AGENTS.md no-empty-catch rule.
* fix(cloudformation): report a failed StackSet instance delete as FAILED
deleteStackInstances awaited the underlying deleteStack via a helper that
swallows the failure, then removed the instance record unconditionally and
hardcoded the operation status to SUCCEEDED. A failed non-retained delete was
therefore reported as a success with the instance silently dropped.
await() now returns whether the future completed cleanly. On a non-retained
delete failure the instance record is retained (marked INOPERABLE/FAILED) and
the operation status is derived via deriveOperationStatus, so it reports FAILED
— matching AWS, which does not detach an instance whose stack delete failed.
Adds StackSetServiceDeleteFailureTest covering the failure, success, and
RetainStacks paths.
* fix(cloudformation): reject templateless CreateStackSet and restore interrupt in await
CreateStackSet now rejects a request with neither TemplateBody nor TemplateURL (ValidationError,
matching AWS) instead of storing a null template — which would otherwise make a later
CreateStackInstances deploy empty stacks into every target account. Also handle
InterruptedException separately in await(Future) and restore the thread's interrupt flag, so a
shutdown signal to the backing ExecutorService propagates instead of being swallowed. Adds a
CreateStackSet-without-template integration test.
* feat(ses): implement PutConfigurationSetDeliveryOptions for SES v1
The classic SES Query API action was unhandled — only the v2 REST path
reached the existing setConfigurationSetDeliveryOptions service logic.
Route the v1 action through SesQueryHandler and register it in the
AwsQueryController SES action set.
The v1 DeliveryOptions structure carries only TlsPolicy (Require/Optional);
Floci stores the v2 canonical REQUIRE/OPTIONAL, so the handler normalizes
the value before delegating to the shared, already-validated service. An
all-null payload passes null to clear the block, mirroring the v2 path
rather than persisting an empty object.
Tests: v1 Query integration coverage (success, unknown set, invalid TLS
policy) and an AWS Java SDK v1 compatibility test that writes Require via
the v1 SesClient and reads it back as the canonical REQUIRE through v2
GetConfigurationSet, asserts an empty put clears the block, and asserts
the modeled ConfigurationSetDoesNotExistException for an unknown set.
* fix(ses): return v1 ValidationError for an invalid delivery-options TlsPolicy
The v1 PutConfigurationSetDeliveryOptions surfaced the shared service's
v2-style BadRequestException for an invalid TlsPolicy, so a v1 SDK could only
map it to a generic exception. Validate Require/Optional (case-sensitive) in
the v1 handler and throw the Smithy enum ValidationError AWS actually returns.
Verified against real AWS: an invalid or wrong-case TlsPolicy returns
ValidationError "1 validation error detected: Value at
'deliveryOptions.tlsPolicy' failed to satisfy constraint: Member must satisfy
enum value set: [Optional, Require]". The v1 integration test now asserts that
shape; valid Require/Optional still normalize to the canonical value for the
shared service.
* fix(rds): align subnet group placement handling with AWS behavior
* fix(rds): align DB subnet group wire responses with AWS model
* fix(rds): align subnet group placement validation with AWS
* fix(rds): tighten subnet group placement validation
* chore: rerun ci
* fix: return XML error for missing action and add volume action fallbacks
* fix(eventbridge): sync EventBridge tags to ResourceGroupsTaggingService
EventBridge stored tags on rules, buses, and archives in its own stores but never propagated them to the central ResourceGroupsTaggingService. This caused GetResources with --resource-type-filters events:rule to return an empty list.
Inject ResourceGroupsTaggingService into EventBridgeService (following the existing GlueService pattern) and sync tags during putRule, tagResource, untagResource, and deleteRule operations.
Closes#1343
* feat(secretsmanager): implement automatic secret rotation lifecycle
* fix(secretsmanager): correct RotationLambdaARN validation in tests and rotation rules parsing
* fix(secretsmanager): avoid implicit unboxing NPE when parsing rotation rules
* fix: remove debug print, drop camelCase rotation parameters fallback, and revert unrelated eventbridge changes
* fix: align PutSecretValue error code and resolve NPE in JSON handler tests
* fix(test): create Lambda function before rotateSecret to fix ResourceNotFoundException
rotateSecretStub failed because SecretsManagerService validates the
rotation Lambda exists synchronously. The test was passing an ARN for a
function that had never been created in the emulator.
Create a real Lambda function via LambdaClient before calling
rotateSecret, and clean it up afterwards. Uses
Runtime.fromValue(nodejs20.x) for SDK compatibility.
* fix: non-immediate rotation runs testSecret only
Per AWS RotateSecret docs, when RotateImmediately is false Secrets
Manager tests the rotation configuration by running only the testSecret
step. Remove the createSecret invocation from the non-immediate path.
* fix(test): align rotateSecretNotImmediate with non-immediate rotation path
The non-immediate rotation path only invokes testSecret (not createSecret),
so the test should expect 1 lambda invocation instead of 2.
* feat(ses): support v1 ConfigurationSet tracking and reputation-metrics options
Implement the SES v1 (Query) ConfigurationSet option operations that previously
returned UnsupportedOperation: CreateConfigurationSetTrackingOptions,
UpdateConfigurationSetTrackingOptions, DeleteConfigurationSetTrackingOptions, and
UpdateConfigurationSetReputationMetricsEnabled.
Tracking options require a verified domain identity, matching real AWS: an
unverified CustomRedirectDomain yields InvalidTrackingOptions, checked before
configuration-set existence. The domain-verification check is shared with the v2
PutConfigurationSetTrackingOptions path so the two surfaces stay aligned. Lifecycle
conflicts surface as TrackingOptionsAlreadyExistsException /
TrackingOptionsDoesNotExistException, matching the AWS SDK error mapping.
A v1-created configuration set now defaults reputation metrics to disabled, matching
real AWS (the v2 create path leaves them enabled). DescribeConfigurationSet now
returns ReputationMetricsEnabled and the trackingOptions block.
Add integration and AWS SDK v2 compatibility tests.
* fix(ses): match AWS errors for missing/blank tracking-options redirect domain
CreateConfigurationSetTrackingOptions / UpdateConfigurationSetTrackingOptions now
distinguish the two AWS validation outcomes instead of returning a single
InvalidParameterValue: an absent CustomRedirectDomain (no TrackingOptions member on
the wire) yields a framework ValidationError ("Member must not be null"), while a
present-but-empty CustomRedirectDomain yields InvalidTrackingOptions ("At least one
field of TrackingOptions must contain a value."). The Smithy member is optional, so
the previous required-field rejection was incorrect.
Add integration coverage for both cases.
* test(ses): renumber tracking-options test order to match source order
Align the @Order values so file order equals execution order (the missing/blank
domain validation cases now run at 11-12, the reputation-metrics cases at 13-14),
making the intended sequence easier to follow.
* refactor(kms) use enums for type-safety. add algorithms to keymetadata
Signed-off-by: Mark Hayen <mark.hayen@edsn.nl>
* refactor(kms): use enums for type-safety. add algorithms to keymetadata
Signed-off-by: Mark Hayen <mark.hayen@edsn.nl>
* refactor(kms): update missing algorithms handling and add tests to cover all combinations of keySpec,KeyUsage
Signed-off-by: Mark Hayen <mark.hayen@edsn.nl>
---------
Signed-off-by: Mark Hayen <mark.hayen@edsn.nl>
Co-authored-by: Mark Hayen <mark.hayen@edsn.nl>
* feat(s3-vector-store): add S3Vectors service support with storage configuration and integration testing
* feat(s3-vector-store): implement S3 Vectors service API with controller, service, and integration tests
* feat(ses): support v2 dedicated IP pool APIs
Add SES v2 dedicated IP pool management — CreateDedicatedIpPool,
GetDedicatedIpPool, ListDedicatedIpPools and DeleteDedicatedIpPool — backed by
a per-region store.
Validation matches real AWS SES V2 (verified 2026-06-18): ScalingMode defaults
to STANDARD and must be STANDARD or MANAGED; a duplicate pool returns
AlreadyExistsException; an unknown pool returns NotFoundException.
Add integration tests, an AWS SDK v2 compatibility test, and document the
endpoints.
* feat(ses): support v2 configuration-set option groups
Add SES v2 ConfigurationSet support for the ReputationOptions, TrackingOptions,
DeliveryOptions, ArchivingOptions, and VdmOptions option groups. Each group can
be set through its dedicated Put...Options endpoint or supplied inline to
CreateConfigurationSet (validated before the set is stored), and is read back
through GetConfigurationSet.
Validation matches real AWS SES V2:
- TrackingOptions: HttpsPolicy enum; a present CustomRedirectDomain must be
non-blank and a verified domain identity, is required when HttpsPolicy is set,
and is checked before the enum.
- DeliveryOptions: TlsPolicy enum; MaxDeliverySeconds must be an integer in
[300, 50400]; any SendingPoolName is rejected since Floci models no
dedicated-IP pools, with distinct blank vs non-existent messages.
- ArchivingOptions: ArchiveArn must match the Mail Manager archive ARN pattern
(existence/ownership not modelled).
- ReputationOptions: always returned by GetConfigurationSet (enabled by
default); an empty-body PUT disables it.
- VdmOptions: nested DashboardOptions/GuardianOptions [ENABLED, DISABLED] enums;
accepted independently of account-level VDM.
Option members are type-checked, an all-null block clears the options, and the
response blocks are shaped via Jackson. Add integration tests and an AWS SDK v2
compatibility test, and document the endpoints.
* feat(ses): validate SendingPoolName against dedicated IP pools
Now that dedicated IP pool management is available, DeliveryOptions
SendingPoolName is validated against the pool store instead of being rejected
unconditionally: a pool created via CreateDedicatedIpPool is accepted (and
echoed by GetConfigurationSet), while an unknown pool still returns
'SendingPool <name> doesn't exist' and a blank one 'sendingPoolName can't be
blank.' (verified against real AWS).
Add integration and SDK compatibility tests for referencing an existing pool.
* fix(ses): stop validating ArchiveArn format
Floci does not model Mail Manager archives, so the ArchiveArn format is not
validated — any provided value is stored and echoed (matching the store-only
behaviour of other local AWS emulators). The JSON-string type check is kept.
Replace the malformed-ARN rejection test with one asserting an arbitrary
ArchiveArn round-trips.
* fix(core): use self-closing tags for empty XmlBuilder values
XmlBuilder.elem(name, "") produced <name></name> for empty string values, which caused some XML consumers (e.g. Terraform AWS provider) to crash with nil pointer dereference.
Now empty string values render as self-closing <name/> instead, which is semantically identical but avoids the parser crash. Null values remain skipped entirely.
* fix(ec2): conditionally omit stateReason instead of self-closing empty tags
The previous approach (self-closing tags for empty XmlBuilder values)
was wrong for two reasons:
1. AWS emits <tag></tag> (paired tags), not <tag/> — verified against
botocore rest-xml protocol fixtures (XmlEmptyStrings, XmlEmptyBlobs).
2. Go's encoding/xml tokenizes both forms identically (StartElement +
EndElement, no CharData), so the Terraform crash persisted either way.
Real fix: stop hardcoding <stateReason><code></code><message></message>
in Ec2QueryHandler for every instance. AWS omits stateReason entirely
when there is none (e.g. a running instance). Now it is only emitted
when stateReasonCode or stateReasonMessage is present.
XmlBuilder.elem() reverted to its original paired-tag behavior.
Added Instance.stateReasonCode/stateReasonMessage model fields.
Updated Ec2InstanceResponseShapeTest to assert null for running
instances (matching real AWS behavior).