* 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(ec2): publish security-group TCP ingress ports on the host
For each TCP port opened to a CIDR source by an instance's security
groups, start an alpine/socat sidecar that binds an allocated host port
(default 30000-30999) and forwards to the instance container's IP, so
the app is reachable from localhost. Forwards reconcile at launch, on
authorize/revoke-security-group-ingress, and on ModifyInstanceAttribute
group reassignment (previously ignored). Mappings persist and are
restored across restarts. SSH is never re-forwarded; wide rules and
per-instance totals are capped; disable with
publish-security-group-ports=false.
* fix(ec2): drop stale port mapping when sidecar recreation fails
On restore, a failed socat recreation released the host port but left
the appPort->hostPort entry in publishedPorts, so later reconciles saw
the port as already published and never re-published it, and a later
unpublish could double-release the host port. Remove the entry and
persist on failure. Also null-guard portForwardManager.restore() for
consistency with the setPersister guard. Adds a regression test.
* fix(ec2): skip port-forward reconcile on non-running instances
A reconcile queued by authorize-security-group-ingress could run after
a concurrent stop/terminate had already cleared publishedPorts and
removed the container; it then republished via the stale bridge IP,
leaking an orphaned socat sidecar and a host port that nothing would
release. Stop/terminate flip the instance state before their async
unpublishAll, so guarding reconcileNow on the running state under the
instance lock closes every window. Adds regression tests.
* feat(stepfunctions): add state machine version APIs
Add PublishStateMachineVersion, ListStateMachineVersions, and
DeleteStateMachineVersion, plus publish-on-create support (publish=true). The
Terraform AWS provider calls ListStateMachineVersions after creating an
aws_sfn_state_machine; Floci previously returned UnsupportedOperation, failing
both apply and destroy. Versions are tracked per state machine
(<arn>:<n>). Integration-tested; verified end-to-end with terraform apply +
destroy of an aws_sfn_state_machine against Floci.
* fix(stepfunctions): return a defensive copy from listStateMachineVersions
Greptile review on #1562: listStateMachineVersions returned the StateMachine's
internal list directly, exposing it to external mutation and concurrent-modification
hazards. Return List.copyOf(...) instead.
* fix(stepfunctions): ListStateMachineVersions newest-first and InvalidArn for missing SM
AWS lists state machine versions newest first (descending by creationDate, tie-broken on
the version number since creationDate is only second-resolution); returning insertion order
made the Terraform provider latch onto the wrong version ARN once more than one version
existed. Listing versions for a non-existent state machine now returns InvalidArn rather
than StateMachineDoesNotExist, which is not a declared error for this operation. Adds a
two-version ordering test and a missing-state-machine InvalidArn test.
* feat(lambda): trust Floci's TLS cert and serve HTTPS on 443 for CDK callbacks
CDK/CloudFormation custom resources (LogRetention, the provider framework,
AwsCustomResource, ...) PUT their result to the cfn-response ResponseURL using
aws-cdk-lib's bundled cfn-response code. That code parses only the URL's hostname
and path and then calls require("https").request(...) — it ignores the scheme and
port. So even though Floci hands the resource an http://...:4566 ResponseURL, the
callback always goes to https://<host>:443. Against Floci that fails — so every
custom resource rolls back, even though its own AWS SDK calls (on 4566) succeed.
This makes Floci reachable, and trusted, where the callback actually connects,
without touching the CDK-owned handler:
- TlsProxyServer binds the same protocol-detecting handler on a configurable
floci.tls.aws-https-port (default 443, 0 to disable, deduped against the public
port) in addition to the public Floci port. The first byte still selects the
HTTP (4510) or HTTPS (4511) backend, so 443 serves both like the main port.
- CertificateGenerator gains generateSelfSignedCertificate(): a genuinely
self-signed cert (issuer == subject, CA:true, keyCertSign) that can be a trust
anchor. The existing generateCertificate() is unchanged — it still stamps the
cosmetic Amazon issuer DN for ACM realism, which is NOT verifiable as an anchor.
TlsConfigSource now uses the self-signed variant for Floci's HTTPS cert and
regenerates legacy non-self-signed certs on upgrade.
- ContainerLauncher, when TLS is enabled, copies Floci's CA certificate into each
Lambda container at /etc/floci-ca.crt and sets NODE_EXTRA_CA_CERTS, AWS_CA_BUNDLE,
SSL_CERT_FILE and REQUESTS_CA_BUNDLE so the container trusts Floci's HTTPS
endpoint. NODE_EXTRA_CA_CERTS adds to Node's built-in CAs, so public TLS still
works.
All behaviors are gated on floci.tls.enabled (default false); non-TLS setups are
unchanged.
* fix(tls): guard TlsConfig access in launcher tests and soften 443 bind log
CI surfaced 18 NPEs in the existing ContainerLauncherTest and LambdaImageConfigTest:
ContainerLauncher.launch() now reads config.tls().enabled(), but those tests mock
EmulatorConfig without stubbing tls() (returns null). Fixes:
- launch() short-circuits so cert-path/storage config is only read when TLS is enabled.
- Both tests stub config.tls() with a TlsConfig whose enabled() is false.
- TlsProxyServer logs a failed bind of the extra AWS-HTTPS port (443, privileged) at
WARN instead of ERROR — it is expected and non-fatal in unprivileged envs (CI/test);
the public port still errors loudly.
* fix(tls): don't replace the Lambda's CA bundle; warn on a non-CA cert
flociCaEnv set SSL_CERT_FILE and REQUESTS_CA_BUNDLE to Floci's cert, which
REPLACE the OpenSSL / Python-requests trust store with only that cert — so a
Lambda's external HTTPS calls (curl, openssl, requests/botocore) to anything but
Floci failed certificate verification. Inject only the appending/AWS-scoped vars:
NODE_EXTRA_CA_CERTS (adds to Node's CAs) and AWS_CA_BUNDLE (AWS-SDK traffic is
redirected to Floci via AWS_ENDPOINT_URL anyway).
resolveFlociCaCertPath injects the resolved cert into containers as a trust
anchor (CA). A user-supplied floci.tls.cert-path pointing at a leaf/server cert
only pins that exact certificate; document that and log a warning when the
configured cert is not a self-signed CA (issuer != subject or no BasicConstraints
CA:true), via the new isSelfSignedCaCertificate helper.
Updates ContainerLauncherCaTrustTest for the trimmed env set and adds coverage
for self-signed-CA vs leaf-cert detection.
The v2 PutConfigurationSetSendingOptions required SendingEnabled and returned
400 when it was absent, which is stricter than AWS. Reuse the AWS-aligned
SendingEnabled deserialization shared with CreateConfigurationSet (parsed via
the shared readOptionBody helper): an empty body / {} disables sending (200),
a string coerces to true, and an explicit null/number raises
SerializationException — all verified against real AWS.
* fix(cloudwatch-logs): preserve ingestion order for same-timestamp events
GetLogEvents and FilterLogEvents sorted events by timestamp only, so
events sharing the same millisecond came back in arbitrary store order.
Add a monotonic ingestion sequence to LogEvent and use it as a sort
tie-breaker, matching CloudWatch Logs which returns same-timestamp
events in ingestion order. The counter is seeded from the highest
stored sequence so ordering survives persistence reloads.
Closes#1584
* fix(cloudwatch-logs): add eventId as final ordering tie-breaker
Legacy events created before the sequence field default to sequence 0,
so timestamp+sequence alone left their relative order to arbitrary scan
order. Fall back to eventId to keep ordering deterministic.
* test(cloudwatch-logs): import ArrayList instead of inline FQN
Add an import for java.util.ArrayList and use the short name across the
test, replacing inline new java.util.ArrayList<>() usages.
* feat(stepfunctions): run executions under the execution's account
AslExecutor runs each execution on a worker-thread pool with no active CDI
request scope, so service integrations (Lambda, DynamoDB, SQS, …) and the
execution-store writes fell back to the configured default account. An
execution started under account B therefore had its integrations run
against account A's resources — e.g. a dynamodb:putItem targeting a table
that exists only in account B would fail with ResourceNotFound.
Wrap doExecute in a synthetic request scope whose account is the one
encoded in the state machine ARN (mirroring CurEmissionScheduler's
runUnderAccount), so integrations and store writes resolve to the
execution's own account. Falls back to running directly when Arc is not
running (plain unit tests that construct AslExecutor without a container).
Test: an execution started under a non-default account writes to a table
that exists only in that account; the execution succeeds, the item is
readable in that account, and a different account has no such table.
* fix(stepfunctions): restore previous account after runUnderExecutionAccount
Greptile review on #1566: when execution ran inside an already-active request
scope, runUnderExecutionAccount overwrote the account ID without restoring it.
Save and restore the previous account in finally so a reused thread isn't left
with the execution's account. (Executions run on background workers with no
active scope, so this hardens the already-active path.)
* fix(stepfunctions): run Parallel branches under the execution's account
executeParallelState submitted each branch to the executor pool without
re-establishing the execution's CDI request scope. RequestContext is
@RequestScoped (thread-bound), so a branch running on a worker thread had no
active scope: its Task integrations resolved via RegionResolver.getAccountId(),
which falls back to the default account on ContextNotActiveException. Branch
Task states therefore ran against the default account's resources instead of
the execution's.
Extract the scope-activation logic into a Callable-returning
callUnderExecutionAccount (runUnderExecutionAccount now delegates to it) and wrap
each branch submission with it, so every branch worker thread activates its own
request scope for the execution's account — mirroring how executeAsync/executeSync
wrap doExecute. Map states already run executeBranch synchronously on the parent
thread, so they were unaffected.
Adds a Parallel-branch case to StepFunctionsAccountContextIntegrationTest whose
branches dynamodb:putItem into a table that exists only in the execution's
account; it FAILs without per-branch propagation and SUCCEEDs with it.
* feat(iam): enforce AssumeRole trust policies when enforcement is enabled
When floci.iam.enforcement-enabled is true, STS AssumeRole now evaluates the
target role's trust policy (AssumeRolePolicyDocument) against the caller and
returns AccessDenied if it is not permitted. Enforcement is off by default,
so existing behavior is unchanged.
Trust policies are principal-centric and carry no Resource element, so the
identity/resource-oriented IamPolicyEvaluator cannot evaluate them. A focused
AssumeRolePolicyEvaluator matches each statement's Action (sts:AssumeRole) and
AWS Principal (account id, account-root ARN, exact principal ARN, or "*")
against the caller, with explicit Deny taking precedence. The role is resolved
in its own account (from the role ARN) via a new IamService.findRole overload,
since roles are account-namespaced. Roles unknown to Floci stay permissive to
preserve backward compatibility.
Tests: unit coverage for the evaluator across principal/action/deny/malformed
cases, plus an enforcement-enabled integration test asserting a permitted
caller succeeds, an unauthorized caller is denied, and an unknown role stays
permissive.
* docs(sts): restore Configuration section and note NotAction limitation
Greptile review on #1552:
- Restore the FLOCI_SERVICES_STS_ENABLED Configuration section that was dropped
when the Trust Policy Enforcement section was added.
- Document that NotAction is not evaluated (a Deny with NotAction won't block).
* fix(iam): honor NotAction in AssumeRole trust statements
evaluateStatement only inspected the Action key, so a trust statement using
NotAction returned NO_MATCH and was skipped entirely. A Deny that should block
sts:AssumeRole (NotAction excluding some other action) was therefore ignored,
over-permitting AssumeRole when IAM enforcement is enabled. Add actionApplies()
mirroring IamPolicyEvaluator's Action/NotAction semantics: Action applies when
any pattern matches, NotAction applies when none match. Covered by three new
AssumeRolePolicyEvaluatorTest cases.
* fix(iam): match an assumed-role caller against a role-ARN trust principal
When a caller uses assumed-role temporary credentials, resolveCallerArn (rightly,
for GetCallerIdentity) yields the STS assumed-role ARN
(arn:aws:sts::ACCT:assumed-role/Role/session). enforceTrustPolicy passes that to
the trust-policy evaluator, but role trust policies name the role's IAM principal
ARN (arn:aws:iam::ACCT:role/Role) — the canonical form AWS resolves the session
back to. So a legitimate role-to-role AssumeRole was denied.
matchesAwsPrincipal now also normalizes an assumed-role caller ARN to its
underlying IAM role ARN and matches the principal against that, while still
matching an exact session-ARN principal. resolveCallerArn is unchanged, so
GetCallerIdentity keeps returning the assumed-role ARN.
Adds AssumeRolePolicyEvaluatorTest cases for role-ARN match, differing-role
denial, and exact session-ARN match.
Deleting a stack that tracked an AWS::ECS::TaskDefinition (or Cluster) failed
with DELETE_FAILED after a persistent restore when ECS no longer had the record.
Treat an already-missing task definition, cluster, or service as delete-complete,
matching how AWS tolerates absent resources during stack deletion.
Also hardens ECS persistence so records survive a native-image restore: register
the NetworkMode and LaunchType enums for reflection, and quarantine an unreadable
persisted file instead of silently starting empty.
Closes#1634
The v2 SendEmail handler required FromEmailAddress for every content type,
diverging from AWS where it is marked Required: No. Match the AWS behavior,
verified against real AWS via probes (including the raw HTTP error bodies):
- Raw content takes its sender from the MIME From header; FromEmailAddress may
be omitted. When neither is present the send fails. The check lives in the
shared SesService.sendRawEmail and throws the v1-native InvalidParameterValue
"Missing required header 'From'." — the v2 controller's remapV1Exception turns
it into BadRequestException, so v1 Query keeps InvalidParameterValue and v2
REST returns BadRequestException, both matching real AWS. This also fixes the
v1 SendRawEmail path, which previously accepted a From-less raw message.
- Simple content with no FromEmailAddress returns BadRequestException with a
null message body ({"message":null}), exactly as AWS does.
- Templated content with no FromEmailAddress returns BadRequestException
"Source cannot be empty".
Tests: v2 cases folded into SesV2IntegrationTest (Raw-with-MIME-From success,
Simple null-message, Templated "Source cannot be empty") and a v1 case in
SesIntegrationTest pinning the Query wire shape.
* feat(iam): add AmazonRDSEnhancedMonitoringRole managed policy
Seeds the AmazonRDSEnhancedMonitoringRole service-role policy at
startup so callers can attach it to IAM roles without a NotFound error.
* test(iam): cover AmazonRDSEnhancedMonitoringRole seeding and attachment
Adds an assertion in seedAwsManagedPolicies(), a unit test that attaches
the policy to a role, and an integration test that retrieves it via
GetPolicy.
Step Functions could only invoke a few optimized/aws-sdk integrations
(Lambda, DynamoDB, SQS, nested state machines); any other resource failed
with 'Unsupported resource'. Provisioning state machines that drive
CloudFormation (StackSets), look up regions, or stage templates in S3 could
not run.
Add:
- a generic query-protocol bridge for arn:aws:states:::aws-sdk:cloudformation:*
that flattens the task input to Query parameters, dispatches to the
CloudFormation handler, and converts the XML response to the JSON shape the
aws-sdk integration returns (member lists unwrapped to arrays);
- arn:aws:states:::aws-sdk:ec2:describeRegions;
- arn:aws:states:::s3:putObject (optimized and aws-sdk forms).
Tests: a unit test for the XML->JSON converter (scalars, nested objects,
member lists) and an integration test exercising ec2:describeRegions,
cloudformation:validateTemplate, and s3:putObject through Step Functions.
* feat(floci-core): implement state reset and nuke endpoints
* feat(floci-core): implement core interface to handle service wide state clearing when the emulator's state is reset
* feat(floci-core): genericize state reset via Resettable interface
* feat(iam): route assumed-role credentials to the target account
Assumed-role temporary credentials (ASIA… keys) collapsed to the default
account: account resolution only recognised 12-digit access key IDs and had
no link to the STS session store. Cross-account "assume a role in account B,
then provision" flows therefore landed resources in account 000000000000
instead of B.
Add a SessionAccountLookup port in core.common, implemented by IamService,
mapping a temporary access key to its account — the account in the session's
role (or federated-user) ARN, or the caller account captured at mint time for
role-less GetSessionToken credentials. AccountContextFilter now resolves with
the precedence 12-digit AKID → session lookup → default, for both the
Authorization header and the presigned X-Amz-Credential parameter.
STS handlers record the caller account on every minted session, and
SessionCredential gains an originAccountId field. The session lookup is
account-independent, since sessions are keyed by a globally unique access key.
IamService is now @Startup so AWS-managed policies seed under the default
account at boot. Seeding is account-namespaced and AccountContextFilter now
instantiates IamService to resolve the request account, so lazy seeding would
otherwise bind managed policies to whichever account made the first request.
Tests: unit coverage for resolver/filter precedence and session lookup, plus
an integration test proving a table created with role-B credentials
materialises in account B and is invisible to account A.
* perf(iam): skip session-store scan for non-ASIA access keys
Account resolution runs on every request. Gating the session lookup on the
ASIA temporary-credential prefix keeps the common case (e.g. the 'test'
default credential) off the session-store scan, which would otherwise grow
with every issued session.
* chore: re-trigger CI
Unrelated flaky CodeBuildTest.batchGetBuilds_eventuallySucceeds; root-cause
fix in floci-io/floci#1577.
* feat(appsync): add VTL engine core infrastructure
Add ReturnSignal exception for #return directive, AppSyncVtlResult record
for evaluation results, and ReturnDirective custom Velocity directive.
* feat(appsync): wire AppSyncUtil to VTL context
Add errorList and authTypeValue fields with setters. Change authType()
to return configured value. Change appendError() overloads to accumulate
errors in internal list. Add toJson() exclusion for selectionSetList and
selectionSetGraphQL. Add base64Encode(String) overload.
* feat(appsync): add VTL engine context and evaluator
AppSyncVtlContext builds the map with all aliases (, ,
, , , , ). AppSyncVtlEngine evaluates VTL
templates using Apache Velocity with AppSync-specific context variables,
custom #return directive, and VtlErrorSignal/ReturnSignal handling.
* chore(appsync): add GraalVM reflection config for VTL engine classes
Register AppSyncVtlEngine, AppSyncVtlContext, ReturnDirective, and
all Phase 3 util classes for native image reflection.
* test(appsync): add VTL engine unit tests
89 tests across categories A-J covering context variables, util methods,
error handling, appendError accumulation, #return directive, authType,
velocity directives, pipeline simulation, and edge cases. Validates
AWS AppSync behavior: null references render as literal text, #return
clears buffer, .error() clears output, var silent references.
* fix(appsync): set $context.prev to null for unit resolvers
AWS AppSync does not initialize $context.prev in unit (non-pipeline)
resolvers. It is null, not an empty map. Accessing $ctx.prev in a unit
resolver renders the literal text (e.g. "$ctx.prev") in non-strict
Velocity mode, matching AWS behavior.
* fix(appsync): accept Object in $util.qr() and $util.quiet()
AWS AppSync defines qr/quiet as accepting any Object, not just String.
The previous String signature caused method resolution failures in
Velocity when non-String values (Integer, Boolean, List, Map, or method
return values like Map.put) were passed. Changed to Object to match AWS.
* fix(appsync): remove dead exception handling in VTL engine
Velocity wraps exceptions thrown by method calls inside a generic
Exception, but exceptions thrown by custom directives (ReturnSignal)
propagate directly. The catch(VtlErrorSignal) and ReturnSignal unwrap
branches were dead code. Simplified to only unwrap VtlErrorSignal from
wrapped method exceptions.
* test(appsync): update and add tests for AWS parity and full coverage
Updates:
- j11: $context.prev default is now null (not empty map)
- j11b/j11c: undefined prev renders as literal text
- qr/quiet: expanded with Integer, Boolean, List, Map arguments
New tests for 100% coverage:
- c21: $util.transform accessible from VTL
- e6: appendError with errorInfo (4-arg overload)
- getTransform_returnsInstance: getter coverage
- escapeJavaScript_controlCharDefault: control char <0x20 branch
- toJson_mapWithFieldNameOnlyDoesNotFilter: fieldName-only branch
- toJson_serializationFailureReturnsNull: JsonProcessingException catch
- appendError_withErrorInfo: errorInfo non-null branch
ECS task definitions can declare portMappings with an explicit hostPort,
which AWS bridge mode publishes so the app is reachable on the host at
localhost:<hostPort>. Floci parsed the value but discarded it at launch:
EcsContainerManager.startTask always called withDynamicPort() (random
host port) in native mode, and withExposedPort() (no host binding at all,
docker inspect shows "<port>/tcp": null) when Floci runs inside Docker.
Either way the requested hostPort was never applied, so containers ran
but were unreachable from the host.
Honor an explicit hostPort by binding it as a fixed host port via
withPortBinding(containerPort, hostPort), publishing in both native and
in-container modes (mirroring the ECR registry's fixed-port publishing).
A hostPort of 0/unset keeps the prior behavior: dynamic host port in
native mode, exposed-only when running inside Docker.
Adds EcsContainerManagerPortMappingsTest (mocked builder, no Docker
daemon required) covering all three branches.
Fixes#1270
Back the Transcribe vocabulary store with StorageFactory (constructor-injected) and add a transcribe storage mode + flush-interval config, so custom vocabularies survive a restart instead of being held only in memory. Adds a persistence test covering the reload round-trip.
* feat(cognito): add cognito overrides for client-id and secret. some boy-scouting
* feat(cognito): update docs, clarify reserved tags and possible values. Throws exception when unknown reserved tags are used.
* feat(cognito): reverted pom changes, align errorCode, use cleaned tag value
* feat(cognito): fix region resolver initialization
onStop() flushed storage last, after the slow proxy/container teardown, so a graceful shutdown could be cut off by the SIGTERM grace window before buffered hybrid data was written (e.g. ECS clusters lost across a restart). Flush first; keep shutdownAll() at the end. Adds an EmulatorLifecycle ordering-guard test. Refs #1521.
The ECS model records PortMapping, KeyValuePair, MountPoint, Volume, EfsVolumeConfiguration and NetworkBinding lacked @RegisterForReflection, so the native image could not Jackson-serialize task definitions to persistent storage ("No serializer found ... no properties discovered") when flushing ecs-task-definitions.json. The persisted ECS classes were already registered; these nested records were missed. Works under the JVM; fails only in the native image.
* 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.
DeleteStack swallowed every resource-deletion failure and always reported
DELETE_COMPLETE. Deleting a stack that owned a non-empty AWS::S3::Bucket
therefore "succeeded" while the bucket and its objects were left behind,
which diverges from AWS (S3 refuses to delete a non-empty bucket, so the
stack must end in DELETE_FAILED).
- CloudFormationResourceProvisioner#delete no longer wraps resource deletion
in a catch-all; failures propagate to the stack-level handler. The lenient
*Safe helpers and the intentional KMS key no-op are preserved.
- CloudFormationService#deleteStackResources now records per-resource
failures: the resource is marked DELETE_FAILED with a reason and event,
remaining resources are still attempted, and the stack settles into
DELETE_FAILED (retaining the stack and its exports) instead of being
reported as deleted. Resources left in DELETE_FAILED are re-attempted on a
subsequent delete, matching AWS retry behavior.
This corrects the same silent-success deviation for every managed resource
type, not just S3 buckets.
Adds a Java integration regression test and AWS CLI compatibility tests
covering both the non-empty (DELETE_FAILED) and empty (DELETE_COMPLETE)
bucket cases.
Fixes#1539
* feat(ecs): mount efsVolumeConfiguration task volumes as shared local volumes
ECS task definitions can declare EFS-backed volumes via
`efsVolumeConfiguration`, but Floci modelled only `host` volumes — an EFS
volume's mountPoint resolved to no source path and was skipped, so the
container launched without the mount. Terraform/ECS workloads that rely on
a shared EFS working directory (e.g. provisioner tasks reading/writing
/mnt/efs) had no filesystem at the mount path.
Parse and round-trip `efsVolumeConfiguration` (fileSystemId, rootDirectory,
transitEncryption, transitEncryptionPort, authorizationConfig) in
Register/DescribeTaskDefinition, and materialise an EFS volume as a shared
local Docker named volume `floci-efs-<fileSystemId>` mounted at the
container path (read-only/read-write per the mountPoint). Containers that
mount the same file system share persistent storage that survives task
restarts — the local stand-in for an EFS mount, since Docker cannot mount a
real EFS file system. This mirrors the documented LocalStack EFS-simulation
pattern at the ECS layer.
Tests cover the volume->named-volume resolution by access mode and the
efsVolumeConfiguration JSON round-trip.
* chore: re-trigger CI
Unrelated flaky CodeBuildTest.batchGetBuilds_eventuallySucceeds; root-cause
fix in floci-io/floci#1577.
* fix(iam): resolve AWS-managed policies from any account context
AWS-managed policies (arn:aws:iam::aws:policy/...) are global — not owned by
any account — but they were seeded into the account-partitioned policy store at
startup under the default account only. A caller in any other account (e.g. an
assumed-role / 12-digit access-key credential) got NoSuchEntity from GetPolicy,
breaking Terraform's `data "aws_iam_policy"` lookups of managed policies such as
AWSLambdaBasicExecutionRole and AmazonECSTaskExecutionRolePolicy.
Serve managed policies from a global in-memory catalog keyed by ARN, built once
from AwsManagedPolicies, so getPolicy (and the version/tag reads that route
through it) resolve them for any caller regardless of account. The catalog is
still mirrored into the default-account store so ListPolicies(Scope=AWS) keeps
listing them.
Also add three commonly-attached managed policies: AWSCloudFormationFullAccess,
AWSXRayDaemonWriteAccess, AmazonElasticFileSystemClientFullAccess.
* fix(iam): list AWS-managed policies from the global catalog for any account
ListPolicies(Scope=AWS) and Scope=All scanned only the request account's
partition, so AWS-managed policies (mirrored into the default account at seed
time) were invisible to callers in any other account — the same account-scoping
bug already fixed for GetPolicy in this PR. It also broke name lookup, since
data.aws_iam_policy resolves through ListPolicies plus a name filter.
Serve managed policies from the global awsManagedPolicies catalog for the AWS
and All scopes, and exclude managed ARNs from the account scan so the default
account does not list them twice. GetPolicy and ListPolicies now line up.
CodeDeploy held applications, deployment groups, deployment configs, on-premises
instances and resource tags in plain in-memory maps, so all of them were lost on
restart while every other persistent service survived. Back these stores with
StorageFactory (region descriptor + flush interval wired through EmulatorConfig and
application.yml), re-wrap loaded inner maps as ConcurrentHashMap for thread-safe
per-key mutation, write inner-map mutations back so StorageBackedMap flushes them,
and reconcile built-in deployment configs on load. Deployments and other runtime
state remain in memory by design.
Redpanda embeds broker addresses in Kafka protocol responses (Metadata,
FindCoordinator, ...) and clients reconnect directly to whatever address
it advertises. Without --advertise-kafka-addr, Redpanda advertised its
self-perceived loopback (127.0.0.1:9092), which is unreachable from any
external client — host-side or sibling container.
Resolve and pass the externally reachable address explicitly: a
pre-allocated localhost:<port> in native mode (the host port must be
known before the container starts), or <containerName>:9092 — resolved
via Docker's embedded DNS — in container mode.
* feat(pipes): support Kafka pipe sources and polling
Add EventBridge Pipes support for Amazon MSK and self-managed Kafka sources exposed via `smk://`.
Introduce Kafka consumer management for bootstrap resolution, consumer group selection, topic validation, and safe reuse across poll cycles.
Extend the Pipes poller and tests to filter decoded Kafka payloads, deliver the expected record shape, and commit offsets only after successful delivery.
* fix(pipes): tighten Kafka validation and commit handling
Clarify Kafka validation errors, avoid duplicate Kafka record transformation, commit delivered Kafka offsets per partition for non-Lambda targets, and remove reflective poller test access.
* fix(pipes): stabilise Kafka poller event handling
Use a consistent Kafka partition type, narrow JSON decode error handling, remove reflection from manager tests, and tighten no-commit assertions for failed Kafka delivery paths.
* fix(pipes): preserve Kafka nulls and commit progress
Preserve null Kafka key and value fields, encode Kafka headers consistently, and commit Lambda Kafka progress per partition so successfully processed records are not replayed after later failures.
* fix(msk): align broker metadata and Kafka event payloads
* fix: implement read APIs required by Steampipe resource collection
IAM ListMFADevices, ECR BatchGetRepositoryScanningConfiguration, and CloudWatch Logs GetDataProtectionPolicy returned UnsupportedOperation (400). Each is invoked per-item by the Steampipe AWS plugin to enrich aws_iam_user, aws_ecr_repository, and aws_cloudwatch_log_group; the 400 aborted the whole table hydration, so those tables collected zero rows against Floci.
Implement minimal, wire-accurate responses:
- IAM ListMFADevices -> empty MFADevices list (IsTruncated=false)
- ECR BatchGetRepositoryScanningConfiguration -> reuse describeRepositories, return MANUAL scan config
- CloudWatch Logs GetDataProtectionPolicy -> empty policy at HTTP 200 (the steampipe aws plugin hydrate does not tolerate ResourceNotFound, so 200 is required for collection to succeed)
Adds focused tests for each handler.
* docs: ground read-API handler comments in AWS wire behavior
Rewrite the ListMFADevices, BatchGetRepositoryScanningConfiguration, and
GetDataProtectionPolicy handler comments to describe real AWS response shapes,
enum values, and error semantics (NoSuchEntity 404, scanFrequency enum,
ResourceNotFoundException 400) instead of referencing a specific consumer.
Note the known deviations (200-empty vs error, batch-fail vs failures[]).
* 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
* fix(lambda): use persisted firstReceiveTimestamp in SQS ESM and Pipes event payloads
Both SqsEventSourcePoller.buildSqsEvent() and PipesPoller.buildSqsRecordNodes()
were using System.currentTimeMillis() for ApproximateFirstReceiveTimestamp,
causing the value to change on every poll cycle. AWS SQS defines this as the
epoch time when the message was first received from the queue, and it must
remain constant across retries.
The SQS service layer already tracks this correctly via
Message.firstReceiveTimestamp (set once in GuardedMessageQueue.tryClaim()),
but both pollers bypassed the stored value.
Changes:
- SqsEventSourcePoller: read msg.getFirstReceiveTimestamp() with null fallback
- PipesPoller: same fix for the identical code path
- SqsEventSourcePollerTest: set firstReceiveTimestamp on test messages and
assert the output matches the stored value; add a regression test proving
the timestamp remains stable across simulated retries
Closes#1497
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Co-authored-by: Hector Ventura <hectorvent@gmail.com>
The build container was started with a fire-and-forget entrypoint
("mkdir -p /codebuild/output/src/src && tail -f /dev/null"). createAndStart
returns as soon as the container is running, which can be before that mkdir
completes. The runner then immediately execs the build phases (which chdir
into the directory) and copies artifacts out of it, so on a slow container
start the directory does not exist yet: the BUILD exec fails and the artifact
copy 404s, and the build is reported as FAILED.
Drop the mkdir from the entrypoint and create the working directory with an
explicit, awaited "mkdir -p" exec (run from "/", which always exists) before
the source copy and the phases. This removes the race.
This was surfacing as the intermittent failure of
CodeBuildTest.batchGetBuilds_eventuallySucceeds in the sdk-test-java
compatibility suite.
When an SQS event source mapping invokes a Lambda from a FIFO queue,
copy MessageGroupId, SequenceNumber, and MessageDeduplicationId into
each record's attributes map, matching the values ReceiveMessage
already returns. Standard-queue messages are unaffected.
Closes#1526
A Node/file-based handler can be given with a leading "./" — e.g.
"./v1/lambda-handlers/entry.handler", as the terraform-aws-modules/lambda module
(and DPS) emit. resolveHandlerFilePath stripped only the ".handler" export
suffix, leaving "./v1/lambda-handlers/entry", which never matched the
deployment-package entry "v1/lambda-handlers/entry.js" (stored without the
"./"). CreateFunction then rejected the function with
"Handler file '...' not found in deployment package".
Normalize a leading "./" away before matching the handler against the package.
* 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
The storage backend hands every caller the same entity instance, and
IamService mutates that entity's collections in place before storing it
back (getInlinePolicies().put(...), getAttachedPolicyArns().add(...), etc.)
with no synchronization. When two requests touch the same entity at once -
e.g. Terraform applying many aws_iam_role_policy resources under
-parallelism - the plain HashMap/ArrayList lose entries and corrupt their
internal tables. PutRolePolicy returns success but the immediate
GetRolePolicy then reports NoSuchEntity (so the provider's create-waiter
exhausts and the apply fails), and listRolePolicies can throw
ArrayIndexOutOfBoundsException off the corrupted map.
Make the shared collections concurrency-safe across all IAM entities:
ConcurrentHashMap for tag and inline-policy maps, CopyOnWriteArrayList for
the user/group/role/instance-profile lists, with defensive setters so a
Jackson rehydrate from disk can't swap a plain collection back in.
Policy versions keep insertion order via a synchronized LinkedHashMap, and
the compound check-then-act paths that a thread-safe collection alone can't
make atomic are guarded explicitly: createPolicyVersion (version id derived
from size()+1), delete/setDefaultPolicyVersion, listPolicyVersions, and the
single-role cap in addRoleToInstanceProfile.
Add concurrency tests that drive each collection from many threads and
assert no entry is lost or corrupted; they fail reliably before the fix.
* fix(s3): serve custom error document for missing keys in static website hosting
When a bucket has a website configuration with an ErrorDocument, requests
to missing keys now return the error document with a 404 status instead
of the default XML NoSuchKey error.
* fix(test): handle null output in waitForExecution to prevent flaky CI failures
* fix(s3): address review feedback on static website hosting
* fix(s3): recognize s3-website hostnames in virtual host filter
* fix(s3): gate website error document on website endpoint host
* fix(s3): restore validateRawUri inside try block after rebase