Commit Graph
278 Commits
Author SHA1 Message Date
Kurt McAlpineandkurtmc a7be2dd299 feat(neptune): support the Terraform aws_neptune_cluster read-back contract (#3017)
* feat(neptune): support the Terraform aws_neptune_cluster read-back contract

The Terraform AWS provider's aws_neptune_cluster resource reads back every
DBCluster field after create and update, and treats a mismatch on a ForceNew
attribute as a replacement. Against Floci the resource could not converge:
StorageEncrypted was hardcoded to true against the provider's default of
false, AvailabilityZones was emitted as a singular element that SDK parsers
drop, BackupRetentionPeriod and the other settings were never stored, and
tag calls on a Neptune ARN never reached the Neptune store.

CreateDBCluster and ModifyDBCluster now store the settings a request carries
(NeptuneClusterSettings, modelled on DocDbClusterSettings) and
DescribeDBClusters reads them back with the AWS defaults otherwise:
AvailabilityZones, BackupRetentionPeriod, PreferredBackupWindow,
PreferredMaintenanceWindow, DBSubnetGroup, DBClusterParameterGroup,
VpcSecurityGroups, StorageEncrypted, KmsKeyId, StorageType,
DeletionProtection, CopyTagsToSnapshot, EnabledCloudwatchLogsExports,
ReplicationSourceIdentifier, ServerlessV2ScalingConfiguration,
AssociatedRoles and ClusterCreateTime. StorageEncrypted defaults to false
as on AWS.

Also:
- A requested Port is honoured when it is free inside the proxy range, so
  Terraform's default port of 8182 matches the first cluster.
- DeleteDBCluster refuses a cluster with DeletionProtection enabled with
  InvalidParameterCombination, as on AWS.
- DBClusterMembers uses the DBClusterMember element the Neptune API model
  declares; the previous member element was dropped by SDK parsers.
- New actions: AddRoleToDBCluster, RemoveRoleFromDBCluster,
  DescribeGlobalClusters (empty list), ListTagsForResource,
  AddTagsToResource and RemoveTagsFromResource. Tags are accepted on
  CreateDBCluster and CreateDBInstance, and the rds credential scope routes
  a Neptune ARN ResourceName to the Neptune handler.

Verified against hashicorp/aws 6.62.0 with terraform apply, a clean
re-plan, an update covering retention, protection, log exports, security
groups, iam_roles and tags, a destroy blocked by deletion protection, and a
destroy after disabling it.

* test(compat): cover aws_neptune_cluster in the Terraform and Java SDK suites

Adds a dedicated Terraform fixture and bats test that applies an
aws_neptune_cluster, checks the read-back through terraform output and the
AWS CLI, checks tags through ListTagsForResource, and asserts a clean
re-plan. Extends the Java SDK NeptuneTest with tags, IAM roles, modify
settings, deletion protection and cluster members, so a real SDK parser
covers the new DBCluster fields.

* fix(neptune): infer the rds service for the DBCluster role actions

Unsigned Query requests resolve their service from the action name, and
AddRoleToDBCluster and RemoveRoleFromDBCluster were missing from the RDS
action set, so they fell through to the SQS default instead of reaching
the Neptune handler.

* feat(neptune): read back the settings Terraform's aws_neptune_cluster_instance manages

DescribeDBInstances omitted AutoMinorVersionUpgrade, PromotionTier,
PubliclyAccessible, the parameter and subnet groups and the windows,
ModifyDBInstance ignored them, StorageEncrypted was hardcoded to true,
and every cluster member was reported as the writer, so the provider
issued a ModifyDBInstance on every apply.

NeptuneInstanceSettings, modelled on NeptuneClusterSettings, stores what
a request carries and DescribeDBInstances reads it back with the AWS
defaults otherwise; StorageEncrypted, KmsKeyId and StorageType are the
cluster's. The first member of a cluster is its writer and deleting it
promotes the next. Covered by unit, integration and Java SDK tests and a
Terraform compat fixture with a writer and a reader instance.

---------

Co-authored-by: kurtmc <2661907+kurtmc@users.noreply.github.com>
2026-09-04 09:45:29 -04:00
Kévin Dehoux 84ec8ae8e7 feat(dynamodb): index-qualified PartiQL SELECT with ConsistentRead validation (#2953)
* feat(dynamodb): index-qualified PartiQL SELECT with ConsistentRead validation

ExecuteStatement parsed FROM "Table" only — a dot aborted the lexer
with 'Unexpected character', so PartiQL could not read through a
secondary index at all. Lex the qualifier, resolve it to an access
path, and route the read the way AWS does (characterised on real AWS,
eu-west-1, 2026-09-02):

- equality on the selected source's partition key queries it; any
  other WHERE shape becomes a full scan of the table or index with the
  remaining conditions as a filter
- ConsistentRead on a GSI-qualified statement is rejected with
  'Strongly consistent read is not supported on Global Secondary
  Indexes' — PartiQL's own wording, distinct from Query/Scan
- an unknown index omits the index name from the message, again
  unlike Query/Scan; index resolution also precedes the consistent-
  read check
- SELECT over an index surfaces only projected attributes, and an
  explicitly selected non-projected column is rejected
- BatchExecuteStatement SELECT statements must resolve through the
  table's primary key; index-qualified or partial-key statements get
  a per-statement ValidationError slot

Consistent reads on base tables and LSIs stay legal, NextToken/Limit
now paginate both read branches, and GetItem stays a base-table-only
shortcut.

Reproduced with paritysuite/dynamodb-conformance (new
tests/tier2/partiql/executeStatementIndex.test.ts plus ExecuteStatement
cases in tier3/error-messages/indexReads.test.ts): the qualified-read
and message cases fail against main and pass with this change.

Signed-off-by: Kévin Dehoux <dehoux.kevin@gmail.com>

* fix(dynamodb): bind the PartiQL NextToken to its issuing statement

A PartiQL NextToken carried only the last evaluated key, so replaying a
token against another table or access path with identical key names and
scalar types was accepted: Scan continued from the foreign key and
skipped items, Query restarted and duplicated them. Real AWS binds the
opaque token to the request: replaying it against any other statement,
table or access path is rejected with 'NextToken does not match request',
while a changed Limit or a dropped ConsistentRead is accepted and an
older token replays idempotently (characterised on real AWS, eu-west-1,
2026-09-03).

The token now embeds a SHA-256 digest of the statement text and
parameter values alongside the key, and decoding verifies it against the
current request. Wire integration tests cover statement, parameter,
index-qualified and cross-table replay plus the accepted Limit change;
the SDK twin asserts the exact message; the conformance suite gains the
base-table-to-index replay case.

Signed-off-by: Kévin Dehoux <dehoux.kevin@gmail.com>

---------

Signed-off-by: Kévin Dehoux <dehoux.kevin@gmail.com>
2026-09-04 09:25:46 -04:00
Mario Toffia 9220c057b7 feat(iot): domain configurations (#3008)
* feat(iot): add the domain configuration model and service

Stores AWS IoT Core domain configurations the way the API reports them:
a new configuration is ENABLED and CUSTOMER_MANAGED (ENDPOINT without a
domain name), carries one VALID server certificate, the default TLS
policy and an ARN with the short id AWS appends. Update changes the
status, authorizer, TLS, certificate and protocol settings; delete
refuses an ENABLED configuration, as AWS does; list filters by service
type and pages with marker and pageSize. Tags work on the ARN.

* feat(iot): serve the domain configuration API

Adds the REST-JSON routes CreateDomainConfiguration,
DescribeDomainConfiguration, UpdateDomainConfiguration,
DeleteDomainConfiguration and ListDomainConfigurations under
/domainConfigurations, registered with the IoT service so the
X-Amzn-Errortype header is set for unsigned callers too. Tags on a
configuration ARN go through IotTagHandler; the IoT /untag route now
uses the same handler as /tags instead of calling IotService directly.
DescribeEndpoint accepts iot:CredentialProvider, the endpoint type
that pairs with the CREDENTIAL_PROVIDER service type.

* feat(iot): provision AWS::IoT::DomainConfiguration

Adds IotDomainConfigurationCfnProvisioner over the domain configuration
service. Ref is the configuration name; Fn::GetAtt Arn, DomainType and
ServerCertificates resolve to what DescribeDomainConfiguration reports
(ServerCertificates as a JSON string, since attributes are strings).

Like the CloudFormation handler, a configuration is created ENABLED and
a DomainConfigurationStatus of DISABLED is applied with a follow-up
update; tags go through TagResource and are reconciled on update; a
delete disables the configuration first because the API refuses to
delete an ENABLED one. UpdateStack keeps the configuration when the
createOnly properties (DomainName, ServiceType, ValidationCertificateArn,
ServerCertificateArns) are unchanged and replaces it otherwise, with a
fresh generated name when the template names none.

Inventory TSV, fixture wiring and the generated resource-type table
updated.

* docs(iot): describe domain configurations and add the stack integration test

IotDomainConfigurationCfnIntegrationTest provisions the type through a
stack and asserts Ref and every Fn::GetAtt attribute against
DescribeDomainConfiguration, the in-place status update, and that
DeleteStack removes the configuration.

* test(iot): cover domain configurations in the Java and Go SDK suites

Both cases create, describe, list, update and delete a configuration
through the real SDK clients and check the AWS error types on the
duplicate create, the refused delete of an ENABLED configuration and
the describe after deletion.

* fix(iot): remove a renamed domain configuration and keep the status when the template omits it

A template that changes DomainConfigurationName creates the new
configuration and now removes the previous one, as the generated-name
replacement already did; before, the old configuration outlived the
stack. An update without DomainConfigurationStatus no longer forces
ENABLED: the field is omitted and the current status stays, as the AWS
handler does.

The service rejects a structured JSON value where a string, boolean,
list or object is expected instead of turning it into an empty string
or silently clearing the authorizer, and validates the whole update
before touching the stored record.

* fix(iot): let stack rollback remove a domain configuration and make same-name creates atomic

A configuration created by a stack is recorded, with the owned marker,
before the follow-up status update, so a failure there still lets the
create rollback delete it. A replacement that fails after the new
configuration exists removes it again, re-enables the previous one if
it had been disabled on the way out, and marks the resource restored,
as the other provisioners do.

CreateDomainConfiguration checks and stores the name in one step, so
two overlapping creates of the same name cannot both succeed. A tags
value that is not a list is rejected. The Java SDK compatibility case
looks for a leftover configuration instead of swallowing every cleanup
exception.

* fix(iot): point the resource back at the prior domain configuration after a failed replacement

After the unwind removes the replacement and re-enables the previous
configuration, the resource now carries the previous name and
attributes again, without the owned marker, so it describes the
configuration that is still there rather than the one just removed.

* feat(iot): serve the AWS-managed domain configurations

Every AWS account has iot:Data-ATS, iot:Data, iot:CredentialProvider
and iot:Jobs without creating them. They now exist in every region on
first use: AWS_MANAGED, ENABLED, no server certificate, and the address
DescribeEndpoint returns as their domain name. They can be updated and
tagged like any other configuration, but not deleted, as on AWS. A
client that starts by describing iot:Data-ATS gets an answer instead of
a 404.

* fix(iot): report a failed replacement cleanup as a rollback failure

When the unwind of a failed replacement cannot remove the new domain
configuration, the resource now carries the rollback-failure marker
with the reason, so the stack ends in UPDATE_ROLLBACK_FAILED instead of
reporting a clean rollback while the configuration is still there. The
marker moves next to the restored one in CfnRollback so extracted
provisioners can set it; the legacy provisioner keeps its alias.

* fix(iot): serialise every read-modify-write on a domain configuration

Update, delete, tag and untag read a record, change it and write it
back. Two overlapping writers lost each other's changes: sixteen tag
writers on one configuration left seven keys. All of them now run under
the lock the create already used, and a test pins the invariant. A JSON
round trip with the mapper setup persistent storage uses pins that the
model reloads intact.

* fix(iot): keep the prior status the unwind compares against and never delete a same-name replacement

The store hands out its live record, so disabling the prior on the way
to deleting it changed the very object the unwind later compared
against, and a prior whose delete failed half way was left DISABLED
while the stack reported a clean rollback. The status seen at the start
is now kept and used. The test reproduces the aliasing instead of
handing the provisioner a fresh copy per call.

A replacement under the same explicit name normally fails on the
create; if it goes through because the prior vanished in between, the
prior is no longer deleted, which would have removed the configuration
just created.

* fix(iot): tolerate a domain configuration that vanishes while a stack delete disables it

The disable that precedes the delete now treats ResourceNotFoundException
as already deleted, the way the delete itself does. The SDK cases also
enable an already ENABLED configuration, the call a client makes when
it only wants to be sure the configuration is on.
2026-09-04 01:05:21 -05:00
TATSUNO “Taz” Yasuhiro 21f165b2e9 perf(build): drop KotlinPoet and ICU4J from the protobuf schema path (#2992)
Wire's schema parser drags in KotlinPoet, which drags in kotlin-reflect. Floci
parses .proto and never generates Kotlin. 274.4 to 260.2 MiB, 88.7 to 85.0 MB
gzipped.
2026-09-03 20:59:21 -04:00
Vũ Thế Huy 262495df67 fix(dynamodb): reject unused ExpressionAttributeNames/Values on PutItem, DeleteItem, Scan, Query (#2923)
* fix(dynamodb): reject unused ExpressionAttributeNames/Values on PutItem, DeleteItem, Scan, Query

The checkUnusedEan / checkUnusedEav helpers were only wired into handleUpdateItem
and (names only) handleQuery, so PutItem, DeleteItem and Scan accepted expression
attribute entries not referenced by any expression and performed the operation,
where AWS returns ValidationException. Query accepted unused values for the same
reason.

Wire both helpers into handlePutItem, handleDeleteItem and handleScan, and add the
missing checkUnusedEav call to handleQuery, each checking against the tokens
actually referenced by that operation's expressions.

Closes #2893

* fix(dynamodb): also reject unused EAV on legacy KeyConditions + FilterExpression Query

Addresses PR review: the unused ExpressionAttributeNames/Values check in
handleQuery was gated on KeyConditionExpression != null, so a Query combining
legacy KeyConditions with FilterExpression skipped it. Widen the guard to fire
whenever any expression parameter (KCE, FilterExpression, ProjectionExpression)
is present, and add an integration case for the mixed path. Also replace an em
dash in the new test comment per repo style.

* test(dynamodb): reference the aliased name in the reserved-word conformance case

The sdk-test-node "reserved word aliased via ExpressionAttributeNames passes"
case supplied ExpressionAttributeNames {#st: status} on a PutItem whose
ConditionExpression (attribute_not_exists(pk)) never referenced #st. Real AWS —
and now Floci, per #2893 — rejects unused ExpressionAttributeNames entries with
ValidationException. Point the ConditionExpression at #st so the alias is
actually used; the reserved-word aliasing behaviour under test is unchanged.

* fix(dynamodb): run Query unused EAN/EAV check unconditionally

Addresses PR review: the previous guard (keyConditionExpr || filterExpr ||
projectionExpression) still let a legacy KeyConditions Query carrying a stray
ExpressionAttributeNames/Values map through without validation. Drop the guard
so the checks always run; the token sets are still derived only from the
expressions that can legitimately reference those maps, so a correct request is
unaffected. Add an integration case for legacy KeyConditions with no expression
parameter.

* test(dynamodb): reference the aliased name in the sdk-test-java reserved-word case

Mirror of the sdk-test-node fix: reservedWordWithAliasPasses supplied an unused
ExpressionAttributeNames {#st: status} on a PutItem whose ConditionExpression
referenced pk, which #2893 now correctly rejects. Point the condition at #st.

* fix(dynamodb): AWS "can only be specified when using expressions" wording for PutItem/DeleteItem

Addresses PR review: when ExpressionAttributeNames/Values is supplied with no
expression parameter at all, this PR's new checkUnusedEan/checkUnusedEav calls
reported "Value provided in ExpressionAttributeNames unused in expressions:
keys: {...}". Real AWS answers that sub-case with "<param> can only be
specified when using expressions: ConditionExpression is null" instead.

Add rejectExprAttrsWithoutExpression, parameterised on the null-expression
message, and wire it into handlePutItem and handleDeleteItem ahead of the
unused-alias checks. Both operations only accept ConditionExpression, so the
named param is unambiguous; the wording matches the pre-existing PutItem+EAV
guard from #826. EAV is checked before EAN to preserve that guard's order.

Scan and Query still return the "unused in expressions" 400 for this sub-case:
those ops accept multiple expression parameters and AWS's exact wording there
is unverified. The helper is parameterised so it is a one-line change per op
once the strings are measured.
2026-09-03 10:49:08 -04:00
Kenshin Okinaka 812911fd03 feat(ses): support tag operations on tenant ARNs (#2832)
* feat(ses): support tag operations on tenant ARNs

* fix(ses): shield the stored tenant record from tag-callback mutation

* test(ses): cover the cross-region guard for tenant TagResource/UntagResource

* docs(ses): drop em dashes from the tenant tag additions
2026-09-02 22:14:39 -04:00
luiseterc c54b237cd8 fix(ec2): include network metadata in instance type responses (#2943) 2026-09-02 16:36:41 -04:00
Aniket Shukla 7d693de663 fix(dynamodb): reject QueryFilter with KeyConditionExpression (#2935)
* fix(dynamodb): reject QueryFilter with key expression

* test(dynamodb): keep QueryFilter test legacy
2026-09-02 11:41:14 -04:00
Kévin Dehoux 6dec21479b fix(dynamodb): reject ConsistentRead on GSI Scan (#2931)
Query already rejected ConsistentRead=true on a global secondary index,
but Scan silently performed the read. AWS returns ValidationException
'Consistent reads are not supported on global secondary indexes' for
both operations.

Extract the check into rejectConsistentReadOnGsi and apply it to both
handlers; strongly consistent reads on tables and LSIs stay legal.

Reproduced with paritysuite/dynamodb-conformance
(tests/tier3/error-messages/indexReads.test.ts): the Scan case failed
against 2.0.1 and passes with this change; the in-repo
DynamoDbAccessPathIntegrationTest gains a wire-level Scan case plus an
LSI-acceptance guard, and the Java SDK compat twin covers both ops.

Signed-off-by: Kévin Dehoux <dehoux.kevin@gmail.com>
2026-09-02 10:59:33 -04:00
Brian Taylor 2bf9b57bd9 fix(lambda): omit Environment when no variables are set (#2838)
* fix(lambda): omit Environment when no variables are set

Real AWS omits the Environment member entirely from CreateFunction,
GetFunction, GetFunctionConfiguration and ListFunctions responses when a
function has no environment variables. Floci always emitted it, as an
empty object.

The Terraform provider reads a present-but-empty Environment back as an
environment {} block in state, so any function declared without variables
plans a removal on every run and never converges. On Lambda@Edge, where
environment variables are not permitted at all, the block can never
legitimately exist and each no-op apply also republishes the function.

Layers, KMSKeyArn, FileSystemConfigs and VpcConfig in the same response
builder already omit-when-empty; Environment was the outlier.

* test(compat): correct Environment assertions to match live AWS

Three assertions in the Python and Java SDK compatibility suites required
an Environment block that real AWS does not send:

  - test_get_function_configuration_environment_always_present
  - test_update_environment_variables_round_trip (the cleared case)
  - LambdaFunctionConfigTest.getFunctionConfigurationHasDefaults

Measured against the live service in both directions: a function created
without variables comes back with no Environment member, and clearing to an
empty Variables map removes it again. The tests encoded Floci's previous
behaviour rather than the API's, which is why they went green.

Also corrects the wording of the Java clear case. It sends an Environment
with no Variables member, which is 'leave unchanged', not 'clear' — live AWS
keeps the existing variables, as Floci already did. The assertion now pins
that instead of describing a clear that never happened.
2026-09-01 10:56:48 -04:00
Kenshin Okinaka b0fe8311a0 feat(ses): support v2 tenant-scoped sending with association gate (#2815)
* feat(ses): support v2 tenant-scoped sending with association gate

* fix(ses): guard tenantForSending against a null TenantName and pin the raw-test charset

* fix(ses): validate an inline bulk template before the tenant gate
2026-08-31 09:35:40 -04:00
Vũ Thế Huy 426fbcb284 feat/redshift auth proxy (#2751)
* feat(redshift): add auth proxy port range and endpoint-host config

* feat(redshift): add containerHost/containerPort/proxyPort to Cluster model

* feat(redshift): add RedshiftAuthProxy reusing the RDS PostgreSQL protocol handler

* feat(redshift): add RedshiftProxyManager registry with shutdown hook

* feat(redshift): front new clusters with an auth proxy and advertise it

* feat(redshift): stop/update proxy on delete/modify, start it on snapshot restore

* feat(redshift): keep proxy port stable across reboot and adopt-on-startup

* test(redshift): integration coverage for JDBC through the auth proxy

* test(redshift): reinstate JDBC connectivity check now that the proxy exists

* docs(redshift): document the cluster auth proxy and its config

* fix(redshift): prevent minor port leak when proxy fails to start

* fix(redshift): rollback container on proxy failure and surface teardown errors

* fix(redshift): stop auth proxy on rollback to prevent listener collisions

* fix(redshift): ensure proxy shutdown failure does not abort container and port cleanup

* fix(redshift): add proper logging for intentionally ignored cleanup exceptions

* fix: Wait for Redshift database readiness before proxying

Previously, RedshiftContainerManager just slept for 3 seconds before marking the container as started. On slower CI environments, the PostgreSQL database might take longer to initialize, resulting in Connection Refused when the RedshiftAuthProxy forwards connections.
Now, RedshiftContainerManager polls the database using psql until it's ready, up to 60 seconds.

* fix(redshift): prevent proxy port reallocation on shutdown failure

Addresses a review comment indicating that if a Redshift auth proxy fails to shut down during rollback or deletion, its port must not be released into the available pool. Reassigning a still-bound port would cause subsequent cluster creations to fail with a BindException.
Instead, we now tolerate proxy shutdown errors but intentionally leak the port allocation to prevent collisions.

* fix(redshift): fix failing tests due to proxy changes

1. RedshiftOperationsTest checked for a hardcoded port 5440, but the RedshiftService now allocates dynamic proxy ports. Removed the exact port assertion.
2. RedshiftContainerManager's psql readiness check was connecting via local Unix socket, which succeeded before PostgreSQL was actually ready to accept remote TCP connections from the proxy. Added '-h 127.0.0.1' to enforce TCP readiness.

* test(redshift): use Awaitility to connect to proxy

Use Awaitility to retry the initial connection in RedshiftProxyIntegrationTest to prevent transient 'Connection attempt failed' errors on slower CI environments.

* chore(redshift): use proper imports instead of fully-qualified class names in tests

* fix(redshift): fix compiler errors introduced during import cleanup

* fix(redshift): resolve proxy lifecycle bugs and CI network issues

- Throw RuntimeException from RedshiftProxyManager.stopProxy if proxy is not found. This allows RedshiftService to catch it and intentionally leak the port, preventing port collisions if a proxy fails before registration.
- Force RedshiftProxyIntegrationTest to connect via 127.0.0.1 instead of the endpoint address, which resolves to host.docker.internal in CI environments and causes UnknownHostException.

* fix(redshift): prevent proxy port exhaustion on startup failures

Instead of blindly assuming missing proxies denote a leaked port, RedshiftProxyManager now tracks proxies that failed their socket cleanup during startup. stopProxy throws an exception only if the socket is known to be leaked. This allows RedshiftService to safely release ports after clean proxy startup failures, addressing Greptile's feedback about port exhaustion.

* fix(redshift): retain proxy reference to allow retry on close failure

As identified by Greptile, stopProxy previously removed the proxy from the registry before calling proxy.stop(). If stop() threw an exception, the proxy reference was lost, preventing any subsequent retry from ever finding it and attempting to close it again. stopProxy now only removes the proxy from the registry after stop() returns successfully. Additionally, failedCleanups is now retained instead of cleared, ensuring retries continue to safely leak the port if cleanup remains impossible.

* fix(redshift): abort cluster deletion if proxy fails to stop

As highlighted by Greptile, previously deleteCluster would swallow proxy shutdown failures and delete the cluster metadata anyway. This eliminated the retry path, stranding the unclosed proxy and its port reservation until the process exited. Now, if stopProxyAndReleasePortSafely fails, deleteCluster throws an exception to preserve the cluster metadata so the deletion can be retried.

* test(redshift): lock in proxy lifecycle failure-recovery behaviors

Bổ sung test cho ba hành vi hardening chưa được cover, để refactor sau
không âm thầm phá vỡ:

- stopProxy giữ lại proxy trong registry khi close() ném, cho phép retry
  gọi lại đúng instance và chỉ deregister sau khi stop sạch
- marker leak khi startup cleanup thất bại được retain qua mọi retry và
  chỉ bị xoá bởi một lần start mới thành công
- deleteCluster abort với InternalFailure, giữ nguyên container + metadata
  khi proxy không stop được; retry sau đó hoàn tất khi proxy stop OK

Đồng thời bỏ "-p 7100-7199:7100-7199" trong compatibility.yml: proxy bind
0.0.0.0 trong container floci và sdk-test-java chạy trên compat-net nên
JDBC đi container-to-container qua alias "floci", không cần publish port
ra host. Giữ lại FLOCI_SERVICES_REDSHIFT_ENDPOINT_HOST=floci.

* fix(redshift): keep an unclosable proxy reachable for later retry

Theo phản hồi mới của Greptile: khi start/replace proxy thất bại và
cleanupFailedStart cũng không đóng được listener, code cũ chỉ lưu relayKey
vào một Set rồi vứt object RedshiftAuthProxy. stopProxy sau đó ném vĩnh
viễn mà không còn cách nào chạm tới listener để thử đóng lại, khiến
cluster không xoá được và port bị giữ mãi trong dải hữu hạn.

Thay Set<String> failedCleanups bằng Map<String, RedshiftAuthProxy>
unclosableProxies. cleanupFailedStart giữ lại chính proxy đó; stopProxy và
stopAll thử đóng lại, chỉ gỡ entry khi stop thành công. startProxy không
còn xoá marker khi start mới — chỉ một lần stop thành công mới gỡ, vì
listener cũ có thể vẫn đang bound.

* fix(redshift): retry proxy port bind to absorb reboot rebind race

rebootCluster giữ nguyên proxy port của cluster để endpoint ổn định, nên
listener cũ bị đóng rồi bind lại đúng port đó chỉ vài ms sau. Dưới tải
(CI runner ARM) kernel có thể chưa nhả port và SO_REUSEADDR không giúp
được khi accept loop cũ đang teardown -> BindException -> RebootCluster
trả 500. Đây là nguyên nhân test RedshiftOperationsTest.
testClusterAndSnapshotLifecycle fail chập chờn.

start() giờ retry bind tối đa ~1s, chỉ nuốt BindException; IOException
khác vẫn propagate ngay. Thêm test dựng cảnh port bị chiếm tạm thời rồi
nhả, xác nhận proxy vẫn bind được.

* fix(redshift): tear down proxy and release port when rebootCluster fails

Nếu startProxy/restoreSnapshot ném sau khi proxy đã (re)start trong
rebootCluster, hai nhánh catch chỉ set status "failed" rồi rethrow —
proxy mới vẫn chạy và port vẫn nằm trong usedPorts, không nhánh nào dọn.
Giờ cả hai catch gọi stopProxyAndReleasePortSafely như createCluster và
restoreFromClusterSnapshot đã làm; proxyPort được hoist ra ngoài try với
sentinel -1 để rollback an toàn kể cả khi chưa cấp port.

Thêm test: restoreSnapshot ném -> proxy được stop lại, AwsException nổi lên.

* fix(redshift): serialize createCluster/deleteCluster/restoreFromClusterSnapshot

modifyCluster và rebootCluster đã synchronized nhưng create/delete/restore
thì không, dù cả năm method đều chạy chuỗi container + proxy + port nhiều
bước trên cùng một cluster. deleteCluster(x) chạy song song rebootCluster(x)
có thể để lại metadata mồ côi trỏ tới container/proxy đã dừng. Thêm
synchronized cho ba method còn lại để nhất quán.

* fix(rds,redshift): close backend socket when the auth handshake fails

handleConnection mở kết nối TCP tới container Postgres trước khi gọi
handleAuth. Chỉ nhánh thành công (bridge) và vài nhánh lỗi có kiểm soát
mới đóng backend; nếu handleAuth trả về sớm ở một probe trần (SSLRequest
không kèm startup) hoặc ném IOException (client ngắt giữa handshake), catch
cũ chỉ đóng client -> mỗi health-check TCP làm rò một connection tới
Postgres, ăn dần max_connections.

Chuyển việc đóng socket sang finally, đóng cả client lẫn backend
(idempotent, nhánh thành công đã đóng sẵn). Áp cho cả RdsAuthProxy vì
RedshiftAuthProxy được copy từ đó. Thêm test: client drop giữa handshake
-> backend nhận EOF.

* fix(redshift): stop replacement container and keep dump on failed reboot

Rollback của rebootCluster (b44fd1e3) mới chỉ stop proxy + release port,
để container thay thế chạy tiếp sau một cluster "failed", và finally vẫn
xoá tempDump. Vì container gốc đã stop và không có volume, tempDump là bản
sao duy nhất của data -> mất data không khôi phục được (bug có sẵn, giờ
mới lộ).

rollbackReboot() giờ stop luôn container thay thế (như createCluster/
restoreFromClusterSnapshot). tempDump chỉ bị xoá khi reboot thành công;
khi fail thì giữ lại và log đường dẫn để khôi phục thủ công.

* fix(redshift): make reboot rollback phase-aware to protect the original

Commit trước cho rollbackReboot stop container vô điều kiện. Nếu reboot
fail ngay ở takeSnapshot hoặc stopProxy — lúc container gốc (chứa data,
không volume) VẪN đang chạy — thì rollback lại force-remove chính nó, huỷ
bản sao data hoàn chỉnh duy nhất và chỉ còn dump rỗng/dở.

Thêm hai cờ:
- originalTornDown: đã stop proxy + container gốc -> rollback mới được
  đụng vào proxy/port
- replacementStarted: đã start container thay thế -> rollback mới được
  stop container
Fail trước hai mốc đó: không đụng gì, trạng thái gốc còn nguyên.

Thêm test: takeSnapshot ném -> cm.stop và stopProxy không được gọi.

* fix(redshift): clean an orphan replacement container on failed reboot

containerManager.start có thể tạo container Docker rồi mới ném ở
waitForReady, nên cờ replacementStarted (set sau khi start return) bỏ sót
trường hợp này -> orphan chạy dưới tên cluster.

Bỏ replacementStarted, gate rollback theo mỗi originalTornDown: một khi
proxy + container gốc đã stop thì container gốc chắc chắn biến mất, nên
containerManager.stop (xoá theo tên) chỉ có thể chạm replacement — kể cả
replacement do start() tạo dở rồi ném.

Thêm test: start() ném -> rollback vẫn gọi cm.stop để dọn orphan.

* fix(redshift): remove orphan cluster metadata on failed create/restore

* fix(redshift): keep failed cluster metadata if proxy stop fails

* fix(redshift): fix TooManyActualInvocations in proxy tests

* fix(redshift): clear proxyPort on reboot rollback if port is released

* fix(redshift): retain reserved port on reboot startup failure

* fix(redshift): retain proxy port in reboot rollback and teardown failed startup recovery

* fix(redshift): skip failing cluster and retaining dump if reboot fails before teardown
2026-08-31 09:03:26 -04:00
Aniket Shukla 2480daaa09 fix(athena): route database DDL to Glue (#2757)
* fix(athena): route database DDL to Glue

* fix(athena): preserve DDL execution failures
2026-08-30 18:26:48 -04:00
Kenshin Okinaka fc3c28323a feat(ses): support v2 tenant suppression attributes and tenant-scoped suppression list (#2743)
* feat(ses): support v2 tenant suppression attributes and tenant-scoped suppression list

* fix(ses): guard runWithTenant against a null TenantName

* fix(ses): collapse an absent TenantName to the service-level message on tenant suppression ops

* fix(ses): collapse an absent TenantName to the service-level message on the remaining tenant ops

* fix(ses): collapse an empty TenantName to the service-level message on GetTenant/DeleteTenant
2026-08-30 14:53:06 -04:00
Matan Baruch 477e8ae7b9 fix: repair main CI (AslExecutor test compilation, Redshift compat test endpoint) (#2726)
* fix(stepfunctions): repair test compilation after the AslExecutor constructor gained CustomResourceLiveness

#2703 added AslExecutorTaskHistoryEventsTest and #2688 added a
CustomResourceLiveness parameter to the AslExecutor constructor; each was
green alone, but merged together main no longer compiles the test sources.
Pass a mock for the new parameter.

* chore: retrigger CI

* fix(redshift): resolve the compat test endpoint from TestFixtures instead of hardcoding localhost

The sdk-test-java RedshiftTest built its own client against a hardcoded
http://localhost:4566 and dialed the DescribeClusters endpoint address
directly, but the CI harness serves Floci at FLOCI_ENDPOINT (a non-localhost
host), so both API calls failed with connection refused on every run. Use the
suite's TestFixtures.redshiftClient() (added alongside the test but unused)
and proxyHost() for the JDBC URL, the same pattern RdsJdbcCompatTest uses.

* fix(redshift): drop the compat test's JDBC hop, the endpoint isn't harness-reachable

DescribeClusters returns the backing container's own host and port (Redshift
has no RDS-style auth proxy), so the JDBC connection can't succeed when Floci
runs in a container: confirmed on CI, where the API assertions now pass and
only the JDBC hop fails with connection refused. Keep the API coverage and
leave a note; a follow-up proxy would let the connection check return.
2026-08-29 16:13:53 -05:00
Vũ Thế Huy a1383fdd3d feat(redshift): implement Redshift emulation with snapshot and parameter group support (#2472)
* feat: add redshift domain models

* feat: add redshift service and test

* feat: add redshift query handler and routing

* feat(redshift): implement data plane container manager and wire storage

This commit implements Redshift Container Manager, wires the StorageFactory into RedshiftService, uses AwsException for error handling, implements Describe/Delete Clusters, and adds integration tests with AWS SDK in the compatibility tests project.

* feat: add redshift operations models and service logic

* fix: correct yaml indentation for redshift storage config

* fix: remove invalid redshift storage properties

* feat: implement pg_dump and psql for redshift snapshots

* feat: add redshift core operations query actions

* test: add redshift operations integration test

* fix(redshift): Write snapshot SQL dumps to file storage and add Parameter model

* docs: add redshift implementation plan, design spec, and PR description

* chore: remove superpowers working files

* fix(redshift): scope snapshots and cluster recovery per account, restore original password

- Scope snapshot SQL dump files under redshift-dumps/{accountId}/ so
  same-identifier snapshots from different accounts no longer collide,
  overwrite, or delete each other's data.
- Restore uses the source cluster's real master password instead of a
  hardcoded value, falling back to "admin" only when the source cluster
  no longer exists.
- Recreate Docker containers for all persisted "available" clusters on
  startup, across every account (not just the default), fixing clusters
  that were reloaded with stale endpoints but no running container.
- Add AccountAwareStorageBackend.accountId() accessor needed for the
  account-scoped dump path.

* fix(redshift): add logging for cleanup failures in RedshiftOperationsTest

* fix(redshift): scope container identity per account, persist snapshot password

- RedshiftContainerManager now keys its in-memory container map and Docker
  container name by accountId + clusterIdentifier, instead of just the
  cluster identifier. Previously two accounts creating a cluster with the
  same identifier would share (and clobber) the same Docker container,
  so startup recovery for the second account silently skipped its own
  cluster and left it advertised with a stale endpoint.
- Snapshot now captures masterPassword at snapshot-creation time, so
  restoreFromClusterSnapshot can recover the original credential even
  after the source cluster has been deleted, instead of falling back to
  "admin".
- Clean up fully-qualified java.nio.file / commons-compress references in
  RedshiftContainerManager in favor of imports.

* feat(redshift): implement adoptOrStart method to reuse existing containers

* chore: gitignore subagent-driven-development scratch workspace

* feat(redshift): add tagging support to RedshiftService

- Add tags field to Cluster, Snapshot, and ClusterParameterGroup models
- Inject RegionResolver into RedshiftService constructor
- Implement tag CRUD methods: createTags, deleteTags, describeTags, listTagsForResource
- Add resolveTagHandle ARN resolver for tagging operations
- Add 6 new unit tests covering tag operations and error cases

* feat(redshift): wire CreateTags/DeleteTags/DescribeTags into the query handler

* feat(redshift): store real parameter values on ClusterParameterGroup

* fix(redshift): use proper imports and preserve parameter metadata on modify

* feat(redshift): wire ModifyClusterParameterGroup, return real DescribeClusterParameters values

* feat(redshift): add ClusterSubnetGroup model and CRUD

* feat(redshift): wire ClusterSubnetGroup CRUD into the query handler

* feat(redshift): add ClusterSubnetGroupName/VpcSecurityGroupIds metadata to Cluster

* feat(redshift): add RedshiftContainerManager.alterUserPassword

* fix(redshift): prevent SQL injection in alterUserPassword via username validation

* feat(redshift): add RedshiftService.modifyCluster

* feat(redshift): add RedshiftService.rebootCluster (dump/restore based, no data loss)

* feat(redshift): wire ModifyCluster/RebootCluster into the query handler

* test(redshift): add compatibility coverage for tagging, subnet groups, modify/reboot

* fix(redshift): use imports and unique names in compatibility test

Follow this file's established conventions: proper imports instead of
fully-qualified SDK types, and TestFixtures.uniqueName() instead of
hardcoded resource names, matching the pattern used by the sibling
test methods.

* fix(redshift): address final whole-branch review findings

* fix(redshift): address PR review feedback and green the CI

Review comments:
- Translate three Vietnamese comments in RedshiftContainerManager and
  RedshiftService to English (repo is English-only).
- alterUserPassword: reword the single-quote guard to cite the AWS
  ModifyCluster MasterUserPassword constraint rather than the psql SQL
  literal, and enforce the full documented set for parity — reject
  ' " \ / @, require length 8-64 and at least one upper/lower/digit.
- adoptOrStart: LOG.warnv on the container-gone branch so a fresh empty
  cluster after a lost container is a searchable line, not a silent one.
- Move the .superpowers/ scratch ignore from the shared .gitignore to
  .git/info/exclude (local tooling, not project output).

CI failures:
- Register redshift.model.Parameter for reflection so
  PersistedModelReflectionTest passes and native-image persistence works
  (fixes CI shard 3 and the native sdk-test-java compat run).
- Convert RedshiftQueryHandler.handle() from an if/else chain to
  switch (action) so the docs action-table generator can extract the
  action list, matching every other Query handler. Bodies unchanged.
- Register redshift in tools/docs/services.yaml, add docs/services/redshift.md
  with the generated action table, and add the Service Matrix row in
  docs/services/index.md (fixes Docs Action Tables / Action tables in sync).

* fix(redshift): reject path traversal in SnapshotIdentifier

createSnapshot spliced the request's SnapshotIdentifier straight into a
host path (<persistentPath>/redshift-dumps/<accountId>/<id>.sql). A value
with traversal segments or an absolute prefix escaped the account dump
directory: snapshot creation would write pg_dump output over an arbitrary
host file, and the resulting absolute path was persisted so a later
restore (arbitrary read into an attacker-controlled DB) or delete
(arbitrary unlink) trusted it.

- validateSnapshotIdentifier: enforce AWS's format (1-255 chars, leading
  letter, letters/digits/non-consecutive hyphens) — rejects '.', '/', '\'
  so no separator can appear.
- Keep a normalise + startsWith(dumpDir) containment check as defence in
  depth.
- restore/delete now verify the stored sqlDump path still resolves inside
  the account dump dir before touching it, so a path written by the
  pre-fix code can't be acted on.

Also replace inline java.* fully-qualified names in RedshiftService and
RedshiftQueryHandler with top-of-file imports.

* fix(redshift): validate snapshot dump path before restore provisioning

The trusted-dump-path check added in the previous commit ran inside the
try block, after restoreFromClusterSnapshot had already persisted the
target cluster as "creating" and started its container. Rejecting an
untrusted path then left the container running and a "failed" cluster
record behind, blocking a retry with the same identifier
(ClusterAlreadyExists).

Move the check ahead of all provisioning — right after the snapshot is
loaded, before clusters.put and containerManager.start — so a rejected
restore creates no resources.

---------

Signed-off-by: Vũ Thế Huy <31652864+vuthehuyht@users.noreply.github.com>
2026-08-29 15:25:02 -04:00
Kenshin Okinaka 67f75c7e1d feat(ses): support v2 tenant resource associations (#2710)
* feat(ses): support v2 tenant resource associations

* fix(ses): reject nameless association ARNs and stop key-suffix resource matching
2026-08-29 14:29:36 -04:00
TATSUNO “Taz” Yasuhiro 5600d21f32 feat(stepfunctions): emit task history events and chain previousEventId (#2703)
A Task state now emits Scheduled, Started, and Succeeded or Failed
events. Service integrations get Task* events. Direct Lambda ARNs get
LambdaFunction* events. Activity ARNs get Activity* events.
taskScheduledEventDetails carries the resolved Parameters or Arguments
as a JSON string. previousEventId now chains every event to the one
before it. The first state's Entered event points to 0, matching real
AWS. Details now include inputDetails and outputDetails where AWS has
them. Event shapes were verified against real AWS.

Fixes #2520
2026-08-29 14:06:41 -04:00
Facundo ParedesandFacundo Paredes ff61c2b2a5 feat(stepfunctions): describe a distributed Map run after it finishes (#2694)
* feat(stepfunctions): describe a distributed Map run after it finishes

DescribeMapRun was not implemented, and arn:aws:states:::aws-sdk:sfn:describeMapRun
reached the end of the dispatch chain in invokeResource, so a distributed Map could
not be inspected once it was over: the Map run ARN was minted from a fresh UUID,
written into the S3 manifest, returned in the Map result and then dropped.

A run is now retained where the ResultWriter mints that ARN, which is also the only
place an ASL author reads it. The manifest is no shortcut to the counters, since it
writes FAILED and PENDING as empty arrays and puts every item under SUCCEEDED, so
the run carries the item count taken where the iterations complete.

A Map fails on the first item that fails, so a retained run is one whose every item
succeeded. That fixes the status, both tolerances and the redrive counters at the
values us-east-1 reports for such a run, and leaves succeeded, total and
resultsWritten as the item count. An unbounded Map, which ASL spells as MaxConcurrency
0 or by omitting it, is reported as Integer.MAX_VALUE.

The Task integration recases the wire response rather than restating it, so the two
renderings of a run cannot drift, and renders both dates as the SDK's ISO-8601.

Closes #2671

* refactor(stepfunctions): close a Map run's window on the export that mints its ARN

recordMapRun sampled the wall clock and then folded the child timings into both
ends of the run's window, but the clock is read after MapIterationScheduler has
joined every child and after applyResultWriter has exported, so it is at or past
every child's stop. Math.max over the timings could therefore never move stop off
that sample, and the javadoc promised a last-item stop the code never computed.

The sampled value is the faithful one: AWS closes a Map run's window on the export
rather than on the last item, and the sample is taken immediately after it. Only
start is recovered from the timings, which is the one end the Map state records
nowhere else. DescribeMapRun returns the same startDate and stopDate as before.

* test(compatibility): cover DescribeMapRun through the AWS SFN SDK client

StepFunctionsDescribeMapRunIntegrationTest only exercises the endpoint via
RestAssured, leaving the SDK's own request serialization, endpoint routing
and response deserialization untested, contrary to AGENTS.md's rule that
management APIs be validated with AWS SDK clients.

---------

Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com>
2026-08-29 00:05:50 -04:00
Sam Fakhreddine c96dc98065 feat(s3): opt-in global bucket namespace and replication config (#2640)
* feat(s3): bucket replication configuration round-trip

PUT/GET/DELETE ?replication store the replication configuration verbatim
(validated for a Role and at least one Rule with a Destination/Bucket)
instead of falling through to CreateBucket. Storage-only fidelity — floci
performs no actual replication. Split from a cross-service commit; the IAM
password-policy and CloudFormation SSM-parameter changes ship separately.

* fix(s3): resolve buckets cross-account under a global bucket namespace

S3 bucket names are globally unique in AWS: a bucket lives in one account but is
legitimately reachable cross-account. floci's per-account isolation broke LZA,
which has member accounts read/write a management-owned shared assets bucket and
runs cross-account custom resources (e.g. Custom::S3PutBucketReplication) whose
Lambda calls back under a different account context than the bucket's owner.

Add an opt-in globalBucketNamespace mode (default off, preserving isolation):
bucket/object existence RESOLUTION spans every account's partition while LISTING
stays owner-scoped. Reads route through resolveBucket/resolveObject; bucket-config
MUTATIONS route through a new owner-aware mutateBucket helper that resolves the
owning account via AccountAwareStorageBackend.findAnyAccountEntry and writes back
to the owner's partition (putForAccount) rather than forking a phantom bucket into
the caller's partition. Applied to put/deleteBucketReplication — the path LZA's
Logging stage exercises cross-account.

* test(s3): guard getObject against torn reads under concurrent overwrite

LZA's Bootstrap stage fans out ~15 CodeBuild actions that redundantly re-upload
the same artifact keys (Source.zip/Config.zip) while other builds concurrently
download them. A non-atomic truncate-then-write would let a reader observe an
empty/partial object — which surfaced as an empty src-Config secondary source and
ENOENT: global-config.yaml. Add a stress test (4 writers / 4 readers) asserting
getObject never returns a torn view of a constant-size key.

* docs(s3): document the global bucket namespace flag

Describe FLOCI_SERVICES_S3_GLOBAL_BUCKET_NAMESPACE in s3.md, the
multi-account isolation exception, and the environment-variable reference.

* feat(s3): account-level Block Public Access (s3control PublicAccessBlock)

Add account-scoped PUT/GET/DELETE PublicAccessBlock to the s3control
controller, keyed by the x-amz-account-id header and stored separately
from the bucket-level configuration. LZA's Custom::PutPublicAccessBlock
custom resource calls this account-level op while building the
LoggingStack; without a route the resource reported FAILED and the
stack rolled back (NoStack on CDK readback).

(cherry picked from commit a1cdf186ac7909647350ced455c4e0ba5d2d26a0)

* fix(s3): persist account-level Block Public Access

The account-level (s3control) PublicAccessBlock configuration was held in a
plain ConcurrentHashMap, bypassing StorageFactory while every other piece of
S3 state goes through it. Block Public Access is a security control, and LZA's
Custom::PutPublicAccessBlock runs once per governed account during the
LoggingStack deploy — it does not re-run on a resumed pipeline. A restart
therefore dropped the control silently and every governed account started
reporting NoSuchPublicAccessBlockConfiguration.

Move it to a StorageFactory-backed store (s3-account-public-access-block.json)
addressed through the explicit *ForAccount overloads, so the account comes from
the validated x-amz-account-id header and globalBucketNamespace never widens it.
The s3 descriptor already declares storageKey/storageMode, so no catalog change
is needed and PersistentPathValidator now covers this state.

clear() no longer wipes the config: like the bucket and object stores, its
lifecycle belongs to StorageFactory.clearAll().

* fix(s3): check x-amz-account-id against the caller on Block Public Access

The account-level PublicAccessBlock operations took the account solely from the
x-amz-account-id header, which was only checked for being non-blank. Any caller
could read, overwrite or delete any account's Block Public Access configuration
by setting one header — and Block Public Access is a security control.

AWS s3control answers AccessDenied when the header does not name the caller's
own account: there a cross-account call carries credentials assumed into the
target account, so header and caller always agree. Compare the header against
the caller's resolved account and return the same AWS-shaped AccessDenied (403)
on a mismatch, resolving the caller exactly as AccountAwareStorageBackend does
so the check and the storage partition can never disagree.

One exception is kept deliberately: the configured default (management) account
may act on any account, because Floci's launched Lambdas run on placeholder
credentials that resolve to the management account instead of assuming a role in
the target account. Without it LZA's Custom::PutPublicAccessBlock — the reason
these operations exist — would be denied for every governed account. This is the
same allowance S3Service.mutateBucket already makes for
Custom::S3PutBucketReplication.

Enforcement is scoped to the three PublicAccessBlock routes; the tag routes on
this controller accept and ignore the header as before.

* docs(s3): state the global bucket namespace trade-off explicitly

No behaviour change. The flag widens bucket resolution across accounts, which
reads as an account-isolation violation to a reviewer working from a checklist.
Say the intent in place, on the config option and in the S3 guide: S3 bucket
names are globally unique in AWS, a bucket lives in one owning account, and
cross-account access is a policy decision — so a hard per-account partition
models a state AWS cannot reach and fails legitimate cross-account calls with
NoSuchBucket. Record what it costs too: with the flag on, only IAM and bucket
policy stand between a caller and another account's object. Mutations still
write back to the owning account and listing stays owner-scoped, and the flag
is off by default.

* fix(s3): keep the account-aware bucket replication over the upstream #2519 duplicate

Upstream landed its own Put/Get/DeleteBucketReplication (ce4f6d1c4), which
duplicated the branch implementation. The branch copy stays because it goes
through mutateBucket (the caller-scoped mutation the LZA
Custom::S3PutBucketReplication path requires) and validates Role, Rule and
Destination/Bucket; upstream's root-element MalformedXML check is folded
into it so nothing upstream tested is lost. Duplicate Bucket field and
accessors removed.

* fix(s3): enforce the modeled AccountId pattern and ReplicationRule status enum

Account-level Block Public Access took x-amz-account-id as its storage
partition key after only a blank check, so a value outside the s3control
AccountId shape (^\d{12}$) filed a security configuration under a partition
no account could address again.

PutBucketReplication stored the document after checking only that a Role, a
Rule and a Destination/Bucket were present, so a rule with a missing or
out-of-enum Status round-tripped through GetBucketReplication as a document
AWS would have rejected. Both now answer the error the operation already
uses for its other input guards.

* fix(s3): resolve GetBucketReplication cross-account under the global bucket namespace

putBucketReplication and every other bucket-config mutation resolve cross-account
through mutateBucket/resolveBucket when globalBucketNamespace is enabled, but
getBucketReplication still called bucketStore.get(bucketName) directly. A
management-account caller could write a bucket's replication configuration
cross-account (mirroring LZA's Custom::S3PutBucketReplication path) but a
follow-up GetBucketReplication under the same caller saw NoSuchBucket instead of
the configuration it just stored.

RED test: getBucketReplicationResolvesCrossAccount in
S3GlobalBucketNamespaceTest failed with NoSuchBucket before this change.

* fix(s3): validate each replication rule's own destination bucket

PutBucketReplication checked that at least one Bucket appeared anywhere in the
document, then validated only Status per rule. A multi-rule document where only
one rule carried a Destination/Bucket satisfied that document-wide check and
round-tripped through GetBucketReplication as a configuration AWS would have
rejected as MalformedXML.

Destination elements appear in the same document order as their owning Rule
(extractGroupsMulti can't see nested Destination/Bucket as a Rule leaf), so
pairing the Destination list position-for-position with the Rule list and
requiring an equal count plus a non-blank Bucket in each enforces that every
rule carries its own destination.

RED test: putReplicationRejectsARuleWithoutItsOwnDestinationBucket in
S3ReplicationConfigurationIntegrationTest got 200 instead of 400 before this
change.

* fix(s3): remove unreachable duplicate ?replication dispatch

The PUT and GET handlers each had two identical `if (hasQueryParam(uriInfo,
"replication"))` branches — a rebase artifact. The earlier branch in each
method always returns first, so the second was dead code that risked a future
routing change updating only one copy.

* docs(s3): expose global-bucket-namespace in the canonical application.yml

globalBucketNamespace() was documented in EmulatorConfig and in
docs/services/s3.md but absent from the s3 block in both application.yml
files, leaving the runtime configuration surface out of sync with what the
code and docs describe.

* test(s3): assert torn-read stress threads actually finish

The writer/reader threads were joined with a 30s timeout but never checked for
liveness afterward. A thread still running past the timeout could leak past
the test (hanging the suite) or let the assertions pass vacuously without that
thread's reads or writes having completed.

* fix(s3): reject malformed PutPublicAccessBlock bodies

s3control's PutPublicAccessBlockRequest requires PublicAccessBlockConfiguration,
but the controller normalized any body — null, empty, unparseable, or a
different root element entirely — into a valid configuration with every flag
defaulted to false via canonicalPublicAccessBlockXml. For an account-level
Block Public Access control, that silently disabled every protection on a bad
request instead of failing it.

Reject a body whose root element is not PublicAccessBlockConfiguration with
the same MalformedXML the bucket-level replication path already uses for this
class of error, before normalization runs.

RED test: putRejectsAMalformedOrWrongRootBody in
S3ControlAccountIdEnforcementTest got 200 instead of 400 before this change.

* fix(s3): validate replication destinations against their own rule, not the document total

Counting Rule and Destination elements document-wide and requiring the totals to match let a
rule with two Destinations balance a rule with none, satisfying the check while storing a
configuration AWS would reject as MalformedXML. Destination is Required: Yes directly on Rule, so
PutBucketReplication now walks the parsed element tree and requires each Rule to have exactly one
Destination of its own with a non-blank Bucket, instead of comparing counts across the whole
document.

* fix(s3): reject a replication destination with multiple Bucket elements

Destination.Bucket is a required scalar member (botocore
s3/2006-03-01/service-2.json: "Bucket":{"shape":"BucketName"}), not a list.
child("Bucket") returns only the first match, so a Destination with two Bucket
children silently accepted the first and stored a document AWS would reject
as MalformedXML.

Count the Bucket children explicitly and require exactly one, instead of
taking child("Bucket")'s single match unconditionally.

RED test: putReplicationRejectsADestinationWithMultipleBucketElements in
S3ReplicationConfigurationIntegrationTest got 200 instead of 400 before this
change.

* fix(s3): wire bucket-policy operations through cross-account resolution

getBucketPolicy/putBucketPolicy/deleteBucketPolicy still resolved via
bucketStore directly, unlike object read/write and replication, so a
management-account caller got NoSuchBucket on a member-owned bucket's
policy even with the global bucket namespace enabled. Route them
through resolveBucket/mutateBucket like the rest of the cross-account
paths, and document the IAM-enforcement dependency and the same-name
non-determinism case in the trade-off writeup.

* docs(s3): name the flag that actually gates bucket-policy evaluation

The trade-off write-up said global-bucket-namespace's IAM/bucket-policy
protection depends on FLOCI_SERVICES_IAM_ENFORCEMENT_ENABLED, but that flag
only gates identity-policy checks in IamEnforcementFilter before a request
reaches S3 — bucket-policy evaluation itself (S3Service.authorizeS3Read/
authorizeS3Write, which reads the stored bucket policy) is gated separately
by FLOCI_SERVICES_S3_ENFORCE_AUTH, which also defaults false. Name both
flags and make explicit that the S3-specific one is what actually turns
bucket-policy evaluation on or off.
2026-08-28 11:24:47 -04:00
Kenshin Okinaka 2963601f69 feat(ses): support v2 tenant CRUD (CreateTenant/GetTenant/ListTenants/DeleteTenant) (#2644)
* feat(ses): support v2 tenant CRUD (CreateTenant/GetTenant/ListTenants/DeleteTenant)

Add the first phase of SES v2 multi-tenancy: tenant create/get/list/delete via the
RPC-style POST routes under /v2/email/tenants. A new SesTenantService owns the tenant
store, id/ARN generation (tn-<hex>, arn:aws:ses:<region>:<account>:tenant/<name>/<id>),
the ENABLED sending status, and the TenantName validation (1-64 chars [A-Za-z0-9_-],
duplicate -> AlreadyExistsException, unknown -> NotFoundException); the facade delegates
and the controller only parses/renders. Resource associations, tenant suppression, and
tenant-scoped sending are follow-ups.

* docs(ses): correct account-scoping description in SesTenantService Javadoc
2026-08-28 11:03:12 -04:00
Matan Baruch 277809fb41 feat(aps): add Amazon Managed Service for Prometheus workspaces (#2604)
* feat(aps): add Amazon Managed Service for Prometheus workspaces

Implements the AMP workspace lifecycle (CreateWorkspace,
DescribeWorkspace, ListWorkspaces, UpdateWorkspaceAlias,
DeleteWorkspace) plus tagging through the shared /tags/{resourceArn}
dispatcher via a TagHandler with service key aps. Previously the aps
service did not exist, so aws_prometheus_workspace could not be created
through Terraform or Pulumi at all.

Workspaces are ACTIVE from birth so the provider's create waiter
(CREATING to ACTIVE) completes on its first DescribeWorkspace poll, and
a deleted workspace answers DescribeWorkspace with the typed
ResourceNotFoundException its delete waiter matches. createdAt is
serialized as restJson1 epoch-seconds; the ListWorkspaces alias
parameter is a prefix filter, matching the provider's alias_prefix.

clientToken is accepted and ignored, kmsKeyArn is stored and echoed,
and no alertmanager/rulegroups/scraper/logging operations are included.

* refactor(aps): build ARNs via RegionResolver and parse tag ARNs with AwsArnUtils

Replaces the inlined AwsArnUtils.Arn.of + config.defaultRegion pair with
regionResolver.getRegion()/buildArn so a request signed for another
region gets an ARN and endpoint in that region, and drops the
EmulatorConfig dependency that existed only for that getter. The tag
dispatcher path now parses ARNs with AwsArnUtils.parse plus an explicit
workspace/ prefix check (the SchedulerTagHandler idiom), so a
non-workspace aps ARN fails with ValidationException instead of a
misleading workspace ResourceNotFoundException. Also makes the delete
and alias mutators void (their returns were unused) and removes a dead
DELETING status mutation.

* docs(aps): map the aps service key to managed-prometheus.md in the service matrix

The docs-check gate matches ResolvedServiceCatalog external keys against
docs/services/index.md rows by filename; aps is documented at
managed-prometheus.md, so it needs the same alias treatment as
kafka -> msk.

* fix(aps): partition workspaces by request region and align minor wire details

Review follow-ups from #2604:

- Key the workspace store by region (region::workspaceId, like
  CloudWatchLogsService's groupKey), and thread the SigV4-resolved request
  region through every lifecycle and TagHandler operation, so workspaces
  created in one region are invisible to describe/list/delete/tag calls
  served in another. Covered by unit and HTTP region-isolation tests.
- Default ListWorkspaces to pages of 100 (AWS's documented default) while
  keeping the 1000 ceiling, via Pagination's seven-argument overload.
- Strip leading/trailing blanks from aliases at create, alias update, and
  the list prefix filter, per the documented normalisation.
- Return DeleteWorkspace's 202 with an empty body instead of {}.
- Reject tag keys beginning with the reserved aws: prefix in TagResource
  with a ValidationException.

* refactor(aps): align the reserved tag-key check with sibling services

- Match the aws: prefix case-insensitively as a plain loop, the same idiom
  as FisService and BatchService, instead of a case-sensitive stream chain.
- Derive key() from keyPrefix() so the :: separator lives in one place, and
  hoist the region prefix out of the scan predicate.
- Replace the two near-identical SigV4 Authorization literals in the
  integration test with an auth(region) helper.
2026-08-28 10:05:42 -04:00
武田隆志 29325006bb fix(appsync): use ApiKey.id as the API key value (#2645)
CreateApiKey returned a short random id and kept the value the execute
endpoint validates in a non-model apiKey field, which the AWS CLI and SDKs
drop. On AWS the id itself is the da2- key value sent as x-api-key, so make
id that value, validate against it, and drop the extra field. Keys persisted
by earlier builds keep their short id, stay listable and deletable, and never
authenticate (as before).
2026-08-28 09:59:42 -04:00
MAN$I VERMAandPriamo Germosen 0205e4ed7e fix(msk): persist CreateCluster broker node groups, encryption, client auth, logging, configuration and tags (#2366)
* fix(msk): persist CreateCluster broker node group, encryption, client auth, logging, configuration and tags

* fix(msk): return the v2 Provisioned envelope and keep internal cluster state persistable

Addresses the two review findings on #2366, plus adjacent parity gaps.

Persistence: MskCluster is the shape WalStorage/PersistentStorage/HybridStorage
serialize, all with a plain ObjectMapper. Marking bootstrapBrokers, containerId
and volumeId @JsonIgnore to keep them out of API responses also stripped them
from the store, so a restart on non-mock storage came back with no bootstrap
brokers (breaking GetBootstrapBrokers and the Pipes Kafka source) and no
container or volume ID (orphaning the Docker resources). Those fields are
serializable again - as is accountId, which putCluster needs to write back to
the right account partition - and the API-facing exclusion moved to explicit
response views in MskController, matching toConfigurationView.

V2 shape: DescribeClusterV2/ListClustersV2 returned the flat v1 ClusterInfo.
The real v2 Cluster nests broker node group, encryption, client auth, monitoring,
logging, broker count and kafka version under Provisioned, with a top-level
ClusterType. An AWS SDK v2 client - what terraform-provider-aws calls - reads
them only there, so the flat shape left them invisible to exactly the callers
this fix is for.

Also:
- configurationInfo is a request-only member; the configuration is now reported
  on currentBrokerSoftwareInfo as configurationArn/configurationRevision, where
  the Terraform provider reads it from. It has no top-level response member on
  either API version.
- Apply AWS's server-side defaults for enhancedMonitoring (DEFAULT) and
  encryptionInTransit (TLS_PLAINTEXT / inCluster true), so an omitted member
  does not read back as drift.
- Omit absent optional members instead of serializing them as null.
- Cover the v2 envelope through the real AWS SDK in the compatibility suite, and
  add a plain-ObjectMapper round-trip test guarding the persistence regression.

* test(msk): mirror the storage mapper's configuration in the round-trip test

* fix(msk): round-trip openMonitoring, storageMode and rebalancing too

Three more CreateCluster request members that were discarded the same way, and
that AWS echoes on DescribeCluster (flat) and DescribeClusterV2 (under
Provisioned). openMonitoring and storageMode both map to terraform-provider-aws
attributes on aws_msk_cluster, so dropping them left the same non-converging
plan this change set is about.

* feat(msk): add the tag API, serverless clusters and CreateCluster validation

Closes the four gaps left open by the metadata round-trip work.

Tags: MSK had no tag endpoints at all, so tags could be set at create time and
read back from Describe but never updated. AWS puts them on /v1/tags/{arn},
which AppSync already owned - and two JAX-RS resource methods cannot claim the
same path and method. Resolved the way /tags/{arn} already was: the dispatch and
wire-shape logic moved out of SharedTagsController into a shared TagDispatcher,
a V1TagsController serves /v1/tags/{arn} on top of it, and the two handler sets
are kept apart by a @V1Tags qualifier so each service stays reachable only on
the path AWS defines for it. AppSync's three controller methods became
AppSyncTagHandler with its wire shape unchanged; MskTagHandler is new. MSK tags
clusters and configurations, so MskConfiguration gained a persisted tags map.

Serverless: CreateClusterV2 silently flattened a serverless request into a
provisioned cluster, which then reported itself as provisioned and echoed broker
metadata the caller never sent. It is now a first-class shape - clusterType,
a serverless envelope on the v2 response, and exactly one of provisioned and
serverless per request. The v1 API predates serverless and its ClusterInfo
cannot represent one, so DescribeCluster rejects it the way AWS does and
ListClusters omits it.

Validation: a create with no clusterName built an ARN containing
cluster/null/<uuid> and stored a cluster unaddressable by name. clusterName is
now required and length-checked, and the members AWS documents a range or an
enum for are checked too. The presence of kafkaVersion, numberOfBrokerNodes and
brokerNodeGroupInfo is deliberately still not required - the emulator has always
defaulted those, and tightening it is a separate, deliberate break.

Also: MskConfiguration.accountId was @JsonIgnore, the same persistence bug the
cluster model had - an async write-back after a reload had no account to target.
ConnectivityInfo gained the networkType member it was missing on both shapes.

* test(msk): point the v2 kafkaVersion assertions at the provisioned envelope

These two predate the v2 shape fix and asserted
clusterInfo.currentBrokerSoftwareInfo.kafkaVersion - the flat v1 layout on a v2
response, which is exactly what that fix corrected. They were codifying the bug,
so they moved to clusterInfo.provisioned.currentBrokerSoftwareInfo.kafkaVersion
rather than the view changing back.

* fix(msk): drop the broker-count ceiling and name the invalid parameter

Applies the two findings from the #2571 review to the code that is actually
going to land.

The 1-15 range came from the SDK/CLI reference, which carries an
__integerMin1Max15 shape for numberOfBrokerNodes. Two other AWS sources
contradict it: the REST API reference documents no minimum or maximum for that
member - on a page that does give ranges for its neighbours, volumeSize 1-16384
and revision min 1 - and the quota page allows 30 brokers per ZooKeeper cluster
and 60 per KRaft cluster, both adjustable upward. Capping at 15 rejected
clusters real MSK creates, turning "converges on the wrong number" into an
outright apply failure for every count from 16 up. The floor stays: a zero or
negative broker count is nonsense and every source agrees.

MSK's Error schema is message plus invalidParameter, "the parameter that caused
the error". Every validation failure now names the member it rejected, via the
four-argument AwsException the mapper already splats into the body. The
pre-existing configuration validations are left as they are - that is merged
code, not this change's.

---------

Co-authored-by: Priamo Germosen <6233424+pgermosen@users.noreply.github.com>
2026-08-26 23:17:03 -04:00
Kenshin Okinaka c7cd78e3b3 feat(ses): extend tag endpoints to contact lists, custom verification email templates, and dedicated IP pools (#2589)
* feat(ses): extend tag endpoints to contact lists, custom verification email templates, and dedicated IP pools

* feat(ses): accept inline Tags on v2 CreateCustomVerificationEmailTemplate

* fix(ses): match probed AWS behavior for empty Tags/TagKeys and avoid tag-list aliasing

* docs(ses): describe the actual ValidationException wire body
2026-08-26 21:15:09 -04:00
Alex Banna 17e77ba9d3 fix(iam): correct GetAccountSummary provider and access-key counts (#2426)
* fix(iam): align account summary with AWS quotas

* test(iam): use SDK summary key types

* fix(iam): preserve root access key summary semantics

* fix(iam): retain current account summary quotas

* docs(iam): correct account summary tracking note

* fix(iam): update managed policy role quota
2026-08-26 13:09:55 -04:00
Matan Baruch 8b23ed8f4a feat(secretsmanager): persist and return secret resource policies (#2587)
PutResourcePolicy and DeleteResourcePolicy were inert stubs returning an
empty object, and GetResourcePolicy never returned a policy, so
aws_secretsmanager_secret_policy could not be created through Terraform
or Pulumi: the provider uses the ARN echoed by PutResourcePolicy as the
resource id, and an empty response fails the create outright.

The policy is now stored on the secret and round-trips through the three
ops, which also share the existing recovery-window guard: real AWS
rejects all three on a secret marked for deletion with
InvalidRequestException, and the provider substring-matches that message
on GetResourcePolicy to treat the policy as gone.

BlockPublicPolicy is accepted but not enforced, and
MalformedPolicyDocumentException fires on JSON-parse failure only.
2026-08-26 11:41:55 -04:00
Alex Banna 399bf20387 fix(signin): preserve AWS token error modes (#2554) 2026-08-25 23:38:18 -05:00
Alex Banna 4083d0667d fix(eventbridge): return 400 for missing resources (#2553) 2026-08-25 23:30:22 -05:00
Tom Longhurst e4356def24 fix(dynamodb): enforce composite query order (#2471)
* fix(dynamodb): enforce composite query order

Closes #2462

* fix(dynamodb): validate legacy composite queries
2026-08-25 22:23:28 -05:00
d3871e1f25 feat(resourceexplorer2): add AWS Resource Explorer 2 with cross-service resource discovery (#2485)
* feat(resourceexplorer2): Add AWS Resource Explorer 2 with cross-service resource discovery

Resource Explorer 2 lets AWS SDK clients discover resources across
S3, RDS, DynamoDB, ElastiCache, and OpenSearch through a single
query interface — the same way real AWS Resource Explorer aggregates
resources from multiple services.

Architecture: a ResourceProvider CDI interface in core/resource/
decouples Resource Explorer from individual services. Each service
implements the interface to expose its resources. Resource Explorer
discovers all providers via CDI Instance<ResourceProvider> and
queries them live on every request — no intermediate store, no
eventual consistency. New services become discoverable by
implementing the interface; Resource Explorer never imports service
packages directly.

Query parsing: hand-written character-by-character tokenizer that
implements the full Resource Explorer filter syntax — all 10 filter
attributes (accountid, application, id, region, resourcetype,
resourcetype.supports, service, tag, tag.key, tag.value), comma-OR
within filters, negation (-), wildcard suffix (*), quoted strings,
backslash escaping, and free-form text keywords. ListResources
rejects free-form text (filter-only mode); Search accepts both.
Tokens are classified by splitting on the first unescaped colon and
looking the prefix up against the known attributes, matching the
documented grammar.

API surface: 20 REST JSON endpoints covering ListResources, Search,
ListSupportedResourceTypes, full Index CRUD (CreateIndex always
creates LOCAL — promote via UpdateIndexType, matching real AWS),
full View CRUD with Scope and FilterString, BatchGetView with
Errors for missing ARNs, default view association, and pagination
with NextToken on all list operations. Tag operations use the
existing SharedTagsController + TagHandler infrastructure. A
default AGGREGATOR index and default view with tags included are
auto-provisioned on startup so ListResources works without setup.

AWS behavioral fidelity (matched against the API reference, not
guessed): ListResources/Search with no view and no regional default
return UnauthorizedException (401), not 404; the default view is
scoped per region; CreateView requires a unique, regex-valid
ViewName (ConflictException 409 / ValidationException 400) and only
accepts "tags" as an included property; promoting a second aggregator
index returns ConflictException; ListResources suppresses NextToken
at MaxResults=1000; Search/ListResources cap results at the first
1000 matches; QueryString is required (empty string allowed) and
MaxResults is range-validated. Pagination offsets are clamped so a
stale NextToken against a shrunk live result set returns an empty
page instead of a 500.

All response JSON uses PascalCase field names built via Jackson
ObjectNode (never valueToTree on domain models) to match the AWS
SDK wire format exactly. Verified by decompiling every SDK model
class with javap and comparing field-by-field, then running 16
read-only SDK tests against production resource-explorer-2 in
us-east-1.

ElastiCache ReplicationGroup gains arn and region fields so
Resource Explorer can discover it. RDS resources get tags via
ResourceGroupsTaggingService (the cross-service tagging API)
since floci's RDS service doesn't implement AddTagsToResource.

Indexes and views are persisted (hybrid storage) in production;
tests pin the service to in-memory storage so runs stay isolated
and idempotent.

Testing:
- 50 query parser unit tests covering the full grammar
- 20 filter evaluation unit tests against synthetic resources
- 9 pagination unit tests for the offset clamp and 1000-result cap
- 73 integration tests (@QuarkusTest + RestAssured), grouped with
  @Nested by behavior class: conditional/stateful response fields,
  data provenance across services, edge/boundary pagination,
  cross-service data consistency, filter semantics, and AWS API
  fidelity (401 no-default-view, conflict on duplicate view name and
  second aggregator, view-name and included-property validation)
- 28 SDK compatibility tests using real AWS SDK v2
  ResourceExplorer2Client, asserting every field the SDK model
  exposes. Dual-mode: run against floci or real AWS via
  FLOCI_TARGET=aws (mutating tests skipped against real AWS).

* feat(lambda): expose functions to Resource Explorer 2

Implement ResourceProvider so Lambda functions surface via the
Resource Explorer 2 ListResources/Search APIs and lambda appears in
ListSupportedResourceTypes. Iterates $LATEST versions only so published
versions don't produce duplicate function entries.

* feat(sns): expose topics to Resource Explorer 2

* feat(kms): expose keys to Resource Explorer 2

* feat(sqs): expose queues to Resource Explorer 2

Queue ARNs aren't persisted on the model; reconstruct them from the
region (recovered from the storage key) plus the queue name via
regionResolver.buildArn.

* feat(ecr): expose repositories to Resource Explorer 2

* feat(stepfunctions): expose state machines to Resource Explorer 2

* feat(msk): expose clusters to Resource Explorer 2

* feat(pipes): expose pipes to Resource Explorer 2

* feat(acm): expose certificates to Resource Explorer 2

* feat(cognito): expose user pools to Resource Explorer 2

* feat(iam): expose users and roles to Resource Explorer 2

IAM is a global service: its ARNs carry no region, and Resource Explorer
reports global resources with the region "global" (not an empty string),
matching real AWS. Emit two resource types, iam:user and iam:role.

* test(resourceexplorer2): parameterize per-service ListResources coverage

The ten single-service resource tests were byte-for-byte identical
except for the service name and resource type — the same
service-filter/assert-no-foreign-service/assert-type-present shape
copied ten times. Fold them into one @ParameterizedTest whose CsvSource
carries the (service, resourceType) pairs, so adding a service is one
row instead of a new @Nested class. IAM stays separate: it reports the
global region and two resource types, which the shared shape can't express.

* feat(amazonmq): expose brokers to Resource Explorer 2

Amazon MQ arrived on main after this branch was cut. Implement
ResourceProvider so brokers surface via Search/ListResources and mq
appears in ListSupportedResourceTypes, matching the other services
already wired into Resource Explorer. Brokers carry an ARN and tags, so
the mapping is the same shape as the rest: one mq:broker resource per
stored broker.

* feat(lightsail): expose resources to Resource Explorer 2

Lightsail landed upstream (#1583) after this branch began and models
taggable, ARN-bearing resources (instances, disks, static IPs, key
pairs) that AWS Resource Explorer indexes. Without a ResourceProvider
its resources were invisible to Search/ListResources, unlike every
other resource-owning service on this branch.

LightsailService now implements ResourceProvider: getResources() maps
each stored resource node to an ExplorerResource, deriving region and
account from the ARN and resourceType as lightsail:<Type>;
getSupportedResourceTypes() advertises the four stored types (static
IPs flagged non-taggable, matching AWS).

Coverage: a focused unit test asserts the node->ExplorerResource
mapping (arn, type, region, account, tags) without Quarkus, plus the
parameterized RE2 integration test seeds a Lightsail instance and disk
and asserts both surface via ListResources.

* feat(rum): expose app monitors to Resource Explorer 2

CloudWatch RUM (added upstream in #1797) owns taggable, ARN-addressable
app monitors, so it fits the ResourceProvider extension point the rest of
this branch uses to surface resources to Resource Explorer 2 Search,
ListResources, and ListSupportedResourceTypes.

RUM is the first RE2 provider whose API model carries neither an ARN nor a
region (GetAppMonitor returns neither), so getResources() reconstructs the
ARN: the region comes from the storage key, and the owning account is
captured at creation time on the AppMonitor. That owner account is
@JsonIgnore'd so it never leaks into the RUM API body and is not persisted;
getResources() falls back to the default account for monitors reloaded from
disk. Resolving the account at creation rather than at query time is what
keeps a monitor's identity stable — an earlier draft read the account from
the request context inside getResources(), which stamped every resource
with the account of whoever called ListResources instead of its true owner.

Injecting RegionResolver into RumService (threaded through the existing unit
tests) and adding RegionResolver.getDefaultAccountId() support this.

Adds RumResourceProviderTest, including a regression test proving the owner
account is the creator's, not the querying caller's, plus a RumServiceTest
assertion that the owner account never appears in the serialized API body.
Extends ResourceExplorer2IntegrationTest to seed an app monitor and assert
rum:appmonitor surfaces via ListResources and ListSupportedResourceTypes.

* feat(resourceexplorer2): complete the API surface and close the AWS gaps

Follow-up to the Resource Explorer 2 branch, addressing the gaps found reviewing
it against the AWS API reference and search-syntax documentation.

Wire-level corrections:

- MaxResults ceilings are now per-operation, as AWS models them: 1000 for
  Search/ListResources/ListSupportedResourceTypes, 100 for indexes, 50 for views,
  10 for member indexes. ListSupportedResourceTypes previously rejected page sizes
  AWS accepts, and ListViews accepted ones it rejects.
- ListViews is scoped to the calling Region. AWS returns "the views available in
  the AWS Region in which you call this operation"; every Region's views were
  being listed.
- Free-form keywords are OR'd rather than AND'd, which is how AWS reads them. The
  remaining deviation — AWS ranks a non-matching resource lower instead of
  excluding it — is documented rather than emulated, since a keyword-only search
  returning the whole account is not a useful local answer.
- A tag filter against a view whose IncludedProperties omit `tags` is rejected
  with a ValidationException, as AWS documents for tag: / tag.key: / tag.value: /
  application:, instead of being evaluated on data the view may not expose.
- Backslash escaping is honoured throughout the query grammar: escapes now survive
  tokenization and are resolved only where the character's meaning is decided, so
  `\-`, `\:`, `\,` and `\*` are literal text and a quoted phrase neutralises every
  operator inside it.
- application: matches the application name as well as the resource-group ARN;
  resourcetype.supports:tags consults the provider's declared tag support instead
  of passing everything through; free-form keywords match tag keys and values.

The remaining 12 operations are implemented, taking the service to all 32:
the multi-Region setup lifecycle (CreateResourceExplorerSetup,
DeleteResourceExplorerSetup, GetResourceExplorerSetup) provisions real indexes and
views and records each Region's outcome independently, so one Region's failure is
reported through its ErrorDetails rather than abandoning the task. The
organization and trusted-service surfaces answer with the wire-accurate empty
result, since floci models neither.

Eleven more services expose their resources: EC2 (instances, VPCs, subnets,
security groups, volumes, internet and NAT gateways, route tables),
CloudFormation, CloudWatch Logs, EventBridge, Secrets Manager, SSM, ECS, EKS,
Kinesis, Firehose, and ELB v2 — thirty providers in total. API Gateway and
Route 53 stay out: RestApi carries no Region and Route53Service resolves no
account id, so each needs a field added to an unrelated service first.

Also documents the service, which a new service requires: docs/services/
resource-explorer.md with the generated action table, the deviations above, and
the routing note, plus the mkdocs nav, README, and environment-variable entries.

Seven existing tests asserted on the emulator's total resource count, which thirty
providers push past Search's 1000-result cap; they are scoped to a bounded slice
so their arithmetic stays meaningful. 24 tests added for the new behaviour.

* fix(rum): keep a monitor's owning account across updates

UpdateAppMonitor rebuilds the AppMonitor from its current state and never carried
ownerAccountId over, so an update silently reassigned the monitor to whichever
account next called ListResources. Resource Explorer then reported a wrong ARN and
OwningAccountId for any monitor not owned by that caller.

getResources' fallback for monitors reloaded from disk — where the transient owner
account did not survive — was the configured default account. monitorStore.keys()
is already scoped to the calling account by the account-aware backend, so a monitor
reachable there is owned by that caller by construction; the caller's account is
the correct fallback.

Also addresses review findings on the Resource Explorer branch: braces in the
compatibility test's cleanup, a synchronized override in the Lightsail provider
test's storage stub, and four unread locals in the integration test.

* chore: drop the stray local-dev Dockerfile

docker/Dockerfile.localdev was carried in with the Resource Explorer work
but is unrelated to it: nothing in the repo references it, and its header
points at a CI pipeline and dev cluster that do not exist in this org.

* fix(resourceexplorer2): order paginated results before slicing

NextToken is a bare offset, but the list it indexes into is rebuilt on
every call by iterating Instance<ResourceProvider> and StorageBackend.scan,
neither of which promises an order. Offset pagination is only well defined
over a stable order: page through Search or ListResources with MaxResults
smaller than the result set and the second page indexes into a differently
arranged list, silently dropping or repeating resources.

Sort on a unique key before every paginate call: ARN for resources and
indexes, the view ARN for ListViews, the resource type for
ListSupportedResourceTypes. The regression test drives a provider that
reshuffles its resources on each call, which is what an unordered
map-backed store is free to do; without the sort a 25-resource set pages
down to 16 distinct ARNs.

This also makes ResourceProvider#getResources()'s "ordering is not
significant" contract true rather than merely permitted.

* docs: add the Resource Explorer row to the service matrix

The downmerge picks up #2465's service-matrix gate, which fails
`make docs-check` for any service registered in ResolvedServiceCatalog
without a row in docs/services/index.md — resource-explorer-2 was one.

The descriptor's external key carries the API version suffix while the
page is resource-explorer.md, so it also needs an alias entry, the same
way apigatewayv2 and cognito-idp do.

* test(resourceexplorer2): scope the tag-provenance lookup to the caller's Region

dynamoDbTagResourceUpdatesResourceExplorer took Resources[0] from an
unfiltered ListResources and tagged it. ListResources spans every Region
the view covers while DynamoDB TagResource resolves the table in the
request's Region, so the ARN it picked only worked as long as the first
result happened to be local.

Deterministic ARN ordering makes that assumption fail reliably instead of
by luck: the first table is now eu-west-2's and TagResource reports it as
not found. Filter on region:us-east-1, the same way the region-scoping
tests in this class already do.

---------

Co-authored-by: Marius Volkhart <marius@volkhart.com>
Co-authored-by: Hector Ventura <hectorvent@gmail.com>
2026-08-25 21:05:52 -05:00
NAMAN JAIN 943b4c1b45 feat(efs): add Elastic File System (file systems, mount targets, access points) (#2371)
* chore(efs): initialize service structure

* feat: implement EFS service models for file system and mount target management

* feat(efs): implement EFS metadata service emulator

This introduces support for the AWS Elastic File System (EFS) service, handling the control plane operations across the 2015-02-01 REST API.

- Scaffolded and generated EFS DTO models with Jackson PascalCase mapping

Created EfsService with StorageBackend capabilities for File Systems, Mount Targets, Access Points, and Policies
Created EfsController for all mapped REST-JSON routes under /2015-02-01
Registered EFS in the global EmulatorConfig and ResolvedServiceCatalog
Added comprehensive EfsIntegrationTest verifying end-to-end API lifecycle
Created EFS service documentation in docs/services/efs.md

* feat(efs): implement EFS metadata service emulator

This introduces support for the AWS Elastic File System (EFS) service, handling the control plane operations across the 2015-02-01 REST API.

- Scaffolded and generated EFS DTO models with Jackson PascalCase mapping
- Created EfsService with StorageBackend capabilities for File Systems, Mount Targets, Access Points, and Policies
- Created EfsController for all mapped REST-JSON routes under /2015-02-01
- Registered EFS in the global EmulatorConfig and ResolvedServiceCatalog
- Added comprehensive EfsIntegrationTest verifying end-to-end API lifecycle
- Created EFS service documentation in docs/services/efs.md

* fix(efs): address code review comments

- Fixed describe listings to be appropriately region-scoped
- Ensured idempotency token caching for AccessPoint and FileSystem creations
- Altered creation timestamps to use standard epoch seconds

* fix(efs): register models for reflection to satisfy native-image requirements

* fix(efs): resolve remaining review comments and add documentation

- Prevented file system deletion when mount targets exist
- Cleaned up policies and access points upon file system deletion
- Validated parent file system exists during Access Point creation
- Added proper logging for tolerated exceptions during mount target deletion
- Created missing documentation page docs/services/efs.md

* fix(efs): prevent deletion races by locking on file system ID

Wraps all state-mutating operations on file systems and their dependent resources in synchronized blocks keyed by the file system ID. This guarantees that CreateMountTarget, CreateAccessPoint, and similar operations cannot race with DeleteFileSystem, satisfying the Greptile review for P1 Deletion races dependent creation.

* fix(efs): resolve additional concurrency bugs identified by Greptile

- Prevents duplicate access point creation when concurrent requests reuse the same ClientToken across different file systems by adding a dedicated token lock.
- Prevents resurrection of deleted mount targets by wrapping modifyMountTargetSecurityGroups and deleteMountTarget in target-specific locks.

* fix(efs): enforce idempotent parameter matching for access points

* fix(efs): enforce parameter matching for idempotent creation requests

- Compares all parameters in CreateFileSystem (PerformanceMode, ThroughputMode, Encrypted, KmsKeyId, ProvisionedThroughputInMibps) when CreationToken matches
- Compares all parameters in CreateAccessPoint (FileSystemId, PosixUser, RootDirectory) when ClientToken matches
- Throws IdempotentParameterMismatch if parameters differ on a retried token, satisfying Greptile bot review

* fix(efs): enforce idempotent parameter matching for nested access point fields

- Compares PosixUser.SecondaryGids
- Compares RootDirectory.CreationInfo (OwnerUid, OwnerGid, Permissions)
- Throws IdempotentParameterMismatch if nested parameters differ on a retried token, satisfying Greptile bot review

* fix(efs): enforce idempotent parameter matching for default field omission and tags

- Treats null PerformanceMode as 'generalPurpose' for equality checks
- Treats null ThroughputMode as 'bursting' for equality checks
- Treats null Encrypted as false for equality checks
- Strictly compares tag lists in both CreateFileSystem and CreateAccessPoint
- Throws IdempotentParameterMismatch if these differ on a retried token, satisfying Greptile bot review

* fix(efs): override equals and hashCode on Tag model to enable correct idempotency comparison

- Resolves issue where identical tag values on retries were evaluated as mismatched due to object identity comparison
- Satisfies Greptile bot review for Tag idempotency checks

* fix(efs): enforce idempotent parameter matching for AvailabilityZoneName and Backup settings

- Persists AvailabilityZoneName (and derived ID) on the FileSystem during creation if supplied
- Implicitly creates an ENABLED/DISABLED BackupPolicy during CreateFileSystem to match AWS default behavior
- Compares AvailabilityZoneName on retry
- Evaluates Backup request flag against stored BackupPolicy status
- Satisfies final Greptile bot review for missing idempotency parameters

* fix(efs): evaluate creation-time backup configuration rather than current mutable policy during retries

- Adds originalBackupParameter to FileSystem model to immutably capture the configuration at creation time
- Refactors idempotency check to evaluate this stored value rather than querying the potentially modified live BackupPolicy
- Addresses Greptile P1 defect where PutBackupPolicy broke CreateFileSystem retries

* fix(efs): resolve backup retry snapshot persistence across emulator restarts

- Replaces @JsonIgnore FileSystem property with a dedicated originalBackupStore
- Ensures the original backup parameter is properly persisted and reloaded from disk
- Maintains AWS API contract fidelity while preventing IdempotentParameterMismatch on restarts

* fix(config): resolve EmrServerless and EFS configuration syntax

* fix(efs): prevent stale mount targets by deleting them inside the file system lock

* fix(efs): correct file-system policy endpoint path to singular /policy

* fix(efs): apply query string filters correctly for describe operations

* fix: align EFS emulator with AWS specifications

- Fix idempotency matching logic for CreateFileSystem and CreateAccessPoint
- Implement modern TagResource, UntagResource, and ListTagsForResource APIs
- Dynamically resolve regions and ARNs via RegionResolver
- Detect mount target subnet conflicts and dynamically resolve AZs
- Remove unused obsolete EFS model classes
- Ensure UpdateFileSystem returns 202 Accepted status code

* docs: generate EFS action table from controller

Resolves 'make docs-check' failure by injecting the floci:actions sentinel markers so the automated docs tool can maintain the supported actions list.

* fix: align EFS emulator with AWS specifications

- Fix idempotency matching logic for CreateFileSystem and CreateAccessPoint
- Implement modern TagResource, UntagResource, and ListTagsForResource APIs
- Dynamically resolve regions and ARNs via RegionResolver
- Detect mount target subnet conflicts and dynamically resolve AZs
- Remove unused obsolete EFS model classes
- Ensure UpdateFileSystem returns 202 Accepted status code

* docs: generate EFS action table from controller

Resolves 'make docs-check' failure by injecting the floci:actions sentinel markers so the automated docs tool can maintain the supported actions list.

* fix: prevent stale count on mount target deletion failure

Removes the generic catch block in deleteMountTarget so that an unexpected exception during the file system update causes the entire operation to fail, leaving the mount target intact instead of silently deleting it and causing an inconsistent parent count.

* fix: store original creation requests to prevent false idempotency conflicts

When a file system or access point is updated or retagged, its mutable state changes. Retries using the original creation token were incorrectly compared against this mutated state, causing IdempotentParameterMismatch conflicts. This commit introduces dedicated storage backends to retain the original CreateFileSystemRequest and CreateAccessPointRequest, ensuring that idempotent retries correctly compare their parameters against the original request rather than the current mutated state.

* fix: store original creation requests to prevent false idempotency conflicts

When a file system or access point is updated or retagged, its mutable state changes. Retries using the original creation token were incorrectly compared against this mutated state, causing IdempotentParameterMismatch conflicts. This commit introduces dedicated storage backends to retain the original CreateFileSystemRequest and CreateAccessPointRequest, ensuring that idempotent retries correctly compare their parameters against the original request rather than the current mutated state.

* refactor: remove unused idempotent parameter stores in EFS

Dropping originalFileSystemRequestStore, originalAccessPointRequestStore, and originalBackupStore, as parameter matching is no longer performed by the EFS emulator. These stores were persistent and written to on every create but never read, unnecessarily keeping state files around.

* fix(efs): resolve compliance issues and reviewer feedback

- Populate AccessPointDescription.Name from tags during create and describe
- Return 404 FileSystemNotFound for unknown IDs or CreationTokens in DescribeFileSystems
- Implement Marker/MaxItems pagination for DescribeTags
- Refactor AZ-ID generation to match exact AWS shapes (e.g. usw2-az1)
- Clear ProvisionedThroughputInMibps on transition to elastic/bursting mode
- Reject update requests setting ProvisionedThroughputInMibps on non-provisioned filesystems
- Add trailing newline to ThroughputMode.java
- Expand integration tests for ThroughputMode transitions

---------

Signed-off-by: NAMAN JAIN <naman.049259@tmu.ac.in>
2026-08-25 19:48:38 -05:00
Hector Ventura 0b78284017 test(kinesisanalytics): disable the Flink 1.18 lifecycle test on arm64 (#2547)
apache/flink 1.15/1.18/1.19 publish amd64-only images, so on an arm64 host
(the compat CI runners) the JobManager can never become healthy and
KinesisAnalyticsV2Flink118Test burns its full 300-second RUNNING wait before
skipping - 310s of the sdk-test-java leg for coverage that never ran.

DisabledOnOs(architectures = "aarch64") skips the class at discovery on
arm64 while keeping it live on amd64 machines, and leaves the Flink 2.x
line (KinesisAnalyticsV2Flink23Test, multi-arch image) covering the real
cluster path everywhere.
2026-08-24 18:54:59 -04:00
Tom Longhurst a57c6c8112 fix(dynamodb): validate query key types (#2469)
* fix(dynamodb): validate query key types

Closes #2467

* fix(dynamodb): harden query validation

* fix(dynamodb): validate query value payloads
2026-08-24 18:11:05 -04:00
Tom Longhurst e3df59ae1f fix(dynamodb): validate cursor key types (#2470)
* fix(dynamodb): validate cursor key types

Closes #2468

* fix(dynamodb): reject malformed cursors
2026-08-24 17:52:17 -04:00
kk feb669d58b fix(bedrock-agentcore): support memory tagging and dropped fields (#2501)
* fix(bedrock-agentcore): tag memory resources and honor dropped CreateMemory/UpdateMemory fields

Three divergences from AWS in the Memory control plane (#2316):

- Memory ARNs were not taggable: the shared /tags/{arn} handler dispatched
  only agent/ and gateway/ segments, returning ValidationException for
  memory/ ARNs even though AWS supports TagResource on memories.
- CreateMemory silently dropped tags, encryptionKeyArn, and
  memoryExecutionRoleArn: accepted with 202, never stored.
- UpdateMemory ignored eventExpiryDuration (and memoryExecutionRoleArn),
  applying only description.

Memory now persists all three fields, the tag handler dispatches three
ways (with the foreign-account 404 guard covering memories), and
UpdateMemory applies description, eventExpiryDuration (validated 3-365),
and memoryExecutionRoleArn. Matching AWS, the Memory response shape never
embeds tags; they surface only via ListTagsForResource.

* fix(bedrock-agentcore): validate UpdateMemory input before mutating stored state

A rejected update (out-of-range eventExpiryDuration) could leave the
description already applied, because get() returns the live stored object
and validation ran after the first setter. Validate all inputs up front,
and pin the no-partial-mutation behavior with unit and integration tests.

Also deduplicates the @Order(3) collision in BedrockAgentCoreMemoryIntegrationTest.

Addresses review feedback from pgermosen.
2026-08-24 17:32:28 -04:00
Kenshin Okinaka 622ba0adbd feat(ses): support v2 PutAccountDetails and GetAccount Details (#2498)
* feat(ses): support v2 PutAccountDetails and GetAccount Details

Add the SES v2 PutAccountDetails operation and surface its data under GetAccount's
Details. Details are per-region and present-when-set (like VdmAttributes): GetAccount
omits the block until PutAccountDetails is called for the region. MailType and
WebsiteURL are required, and their null violations are reported together (aggregated),
matching AWS; MailType/ContactLanguage are enum-constrained. Floci has no sandbox and
runs no production-access review, so ReviewDetails.Status is reported as GRANTED.

Add unit and integration tests, and document the operation.

* test(ses): cover ProductionAccessEnabled in account details

ProductionAccessEnabled is a GetAccount top-level member (not an
AccountDetails field), and Floci has no sandbox so it stays true
regardless of the value sent to PutAccountDetails. Add an integration
case asserting the top-level flag stays true and never appears inside
Details, and assert at the service layer that the value is still stored
as given.
2026-08-23 20:48:31 -04:00
William St John Bacon 87e804492a feat(organizations): add AWS Organizations service (#2489)
* feat(organizations): add AWS Organizations service

Implements the AWS Organizations control plane over JSON 1.1
(AWSOrganizationsV20161128.*): organizations and roots, the OU tree,
member accounts, all policy types, tags, trusted service access,
delegated administrators, the organization resource policy, and the
invitation/handshake flow.

Organizations is global and cross-account, so records are addressed
through the explicit *ForAccount methods on AccountAwareStorageBackend
rather than the request-context-derived get/put: a member account
calling DescribeOrganization has a different request account than the
one owning the data. The caller account is used for authorization
instead — mutations are management-account only, members get read
access to their own organization, and outsiders get
AWSOrganizationsNotInUseException.

Because Floci already resolves a 12-digit access key id to an account,
an account created by CreateAccount is immediately usable as a caller
identity against every other service.

* fix(organizations): emit only AWS's handshake resource types

Review feedback on #2489.

The ORGANIZATION resource on an INVITE handshake was carrying a
MASTER_ACCOUNT_ID child. HandshakeResourceType is a closed enum and that
value is not in it, so the AWS SDK deserializes it as
UNKNOWN_TO_SDK_VERSION rather than failing loudly. AWS's documented
children are MASTER_EMAIL and MASTER_NAME; emit those instead. The
javadoc already described the correct pair, so it was the code that
deviated. Adds an integration test pinning the resource types against
the enum so this cannot regress.

Also from review:

- POLICY_TYPES and EFFECTIVE_POLICY_TYPES are rendered into validation
  messages, but Set.of's iteration order is unspecified and salted per
  JVM run, so the same rejection could read differently between runs.
  Declare them as ordered Lists with companion Sets for O(1) membership.
- listHandshakesForAccount called organizationById — itself a full scan —
  once per handshake. Build the orgId to management-account map once.
2026-08-23 17:18:42 -04:00
Aniket Shukla 43e5e903d1 fix(appsync): wait for schema creation in SDK test (#2456) 2026-08-22 21:54:05 -04:00
Tom Longhurst 30f965d056 fix(dynamodb): validate index access paths (#2278)
* fix(dynamodb): validate index access paths

* fix(dynamodb): address review feedback

* test(dynamodb): cover composite sparse index
2026-08-22 00:13:46 -04:00
Alex Banna 04d120fdd5 feat(fis): add AWS FIS support (#2435)
* feat(fis): add AWS FIS support

* refactor: add typed FIS persistence models

* ci(fis): retrigger timed-out build

* fix(fis): reject trailing JSON request bodies
2026-08-21 00:09:04 -04:00
Matt Van HornandMatt Van Horn 967ea843a0 fix: preserve Route 53 private hosted-zone VPC associations (#2342)
* fix: preserve Route 53 private hosted-zone VPC associations

Fixes #2294

* fix(route53): correct SDK accessor, validate VPC, dedupe test order

Addresses @pgermosen's three review points:

1. sdk-test-java failed to compile: the real SDK accessor for the VPCs list is
   vpCs(), not vpcs(). Confirmed with javap against the pinned
   route53-2.44.14.jar.

2. parseVpcAssociation accepted a <VPC> element carrying only one of VPCId /
   VPCRegion and still marked the zone private with a half-populated
   association. AWS requires both together whenever VPC is present, so an
   incomplete element is now rejected with InvalidInput/400.

3. Route53IntegrationTest had two methods at @Order(3), leaving their relative
   order undefined. Renumbered the trailing cases so every order is unique.

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
2026-08-20 23:28:14 -04:00
Saatvik Arya 2314c85b62 fix(lambda): serialize resource policy mutations (#2430)
* fix(lambda): serialize resource policy mutations

* fix(lambda): serialize restored policy statements
2026-08-20 23:14:42 -04:00
Alex Banna f2ad05ce22 feat(cloudfront): forward origin custom headers (#1832)
* feat(cloudfront): serve distribution requests from S3 and custom origins

* feat(cloudfront): forward origin custom headers

* fix(cloudfront): omit Allow-Credentials and Vary for wildcard S3 CORS rules

withS3CorsHeaders emitted Access-Control-Allow-Credentials: true for every matched
rule, including one whose AllowedOrigin is "*" (where evaluateCors echoes "*").
The CORS specification forbids that pairing and browsers reject it for credentialed
requests, so the emulator produced a response that fails in a browser while passing
against Floci.

Verified against real S3 rather than inferred. Bucket with AllowedOrigins ["*"]:

  Access-Control-Allow-Origin: *
  Access-Control-Allow-Methods: GET
  Access-Control-Max-Age: 3000

and with a concrete AllowedOrigin it additionally returns

  Access-Control-Allow-Credentials: true
  Vary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method

Both preflight and actual GET behave identically. Vary is now also conditional: the
wildcard response is byte-identical for every origin, so there is nothing to vary on,
and real S3 omits it there too.

* chore: re-run CI

The Build and Test failure on the previous head was RuntimeApiServerTest's
extension/stop race, a pre-existing flake unrelated to this change — it also failed
on #1820, #1823 and on #2131's own branch (the PR that tried to de-flake it).
Reproduced locally under `--cpus=1` and fixed separately.

* fix(cloudfront): wildcard aliases match exactly one subdomain level

wildcardAliasMatches did a plain suffix check, so "*.example.com" also matched
a.b.example.com. AWS is explicit that a wildcard alternate domain name replaces the
wildcard at that level only:

  "you can't add alternate domain names that are at levels higher or lower than the
   wildcard. For example, you can't add the alternate domain names example.com or
   marketing.product.example.com."

  https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html

Practical effect: a distribution owning "*.example.com" would answer for
a.b.example.com, which on AWS belongs to whoever owns "*.b.example.com" — or to
nobody. Require the label standing in for the wildcard to contain no dot.

wildcardAliasesMatchSubdomainsAndPreferMoreSpecificNames asserted the old behaviour
(a.b.example.test resolving to the *.example.test distribution); it now asserts no
match, plus the same for a deeper wildcard.

* test(dynamodb): retain Quarkus port for cleanup

* fix(cloudfront): isolate mocked storage backends

* fix(ec2): wire managed prefix list storage in public IP test

* fix(cloudfront): allow authorization origin custom headers

* fix(cloudfront): preserve S3 preflight CORS headers
2026-08-20 22:21:51 -04:00
Alex Banna 520c0f4da2 feat(cloudfront): apply response-headers policies when serving (#1833)
* feat(cloudfront): serve distribution requests from S3 and custom origins

* feat(cloudfront): add response headers policy support

* chore: re-run CI

The Build and Test failure on the previous head was RuntimeApiServerTest's
extension/stop race, a pre-existing flake unrelated to this change — it also failed
on #1820, #1823 and on #2131's own branch (the PR that tried to de-flake it).
Reproduced locally under `--cpus=1` and fixed separately.

* fix(cloudfront): wildcard aliases match exactly one subdomain level

wildcardAliasMatches did a plain suffix check, so "*.example.com" also matched
a.b.example.com. AWS is explicit that a wildcard alternate domain name replaces the
wildcard at that level only:

  "you can't add alternate domain names that are at levels higher or lower than the
   wildcard. For example, you can't add the alternate domain names example.com or
   marketing.product.example.com."

  https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html

Practical effect: a distribution owning "*.example.com" would answer for
a.b.example.com, which on AWS belongs to whoever owns "*.b.example.com" — or to
nobody. Require the label standing in for the wildcard to contain no dot.

wildcardAliasesMatchSubdomainsAndPreferMoreSpecificNames asserted the old behaviour
(a.b.example.test resolving to the *.example.test distribution); it now asserts no
match, plus the same for a deeper wildcard.

* test(dynamodb): retain Quarkus port for cleanup

* fix(cloudfront): isolate mocked storage backends

* fix: validate credentialed CloudFront CORS headers

* fix: log ignored CloudFront policy parse errors

* fix(ec2): wire managed prefix list storage in public IP test

* fix(cloudfront): preserve custom CORS-like headers
2026-08-20 18:06:12 -04:00
Alex Banna d778a6e393 feat(rds): model Aurora Serverless v2 scaling configuration on DB clusters (#1829)
* feat(rds): model Aurora Serverless v2 scaling configuration

* test(dynamodb): retain Quarkus port for cleanup
2026-08-20 13:06:30 -04:00
Saatvik Arya 5744082c5e fix(apigatewayv2): return stage tags across protocols (#2413)
* fix(apigatewayv2): return stage tags across protocols

* test(apigatewayv2): cover reserved stage tag stripping
2026-08-19 23:50:48 -05:00
Matt Van Horn bd8d99b757 fix: apply S3 Vectors metadata filters (#2417)
Fixes #2160
2026-08-19 23:17:36 -05:00
Saatvik Arya c22652dd15 fix(lambda): resolve ARN and function URL invocations in owning account (#2414)
* fix(lambda): resolve ARN and function URL invocations in owning account

* test(lambda): adapt account routing fixtures to layer service

* fix(lambda): migrate legacy ARN invocation targets
2026-08-19 18:55:21 -04:00
lex00 337dead734 fix(ec2): derive default vpc/subnet/sg ids per region (#2384)
* fix(ec2): derive default vpc/subnet/sg ids per region

The default VPC, subnets, and security group seeded by ensureDefaultResources
used literal ids ("vpc-default", "subnet-default-a/b/c", "sg-default")
regardless of region. Storage was already keyed by region, so nothing
actually collided server-side, but every region echoed identical ids back
to callers, making a region's default resources indistinguishable from any
other region's via the AWS SDK/CLI.

Add Ec2Service.defaultVpcId/defaultSubnetId/defaultSecurityGroupId, which
derive region-scoped ids (e.g. "vpc-default-eu-west-1"), and use them at
every seeding and fallback-resolution call site in Ec2Service. RdsService's
default DB subnet group lookup now calls Ec2Service.defaultVpcId(region) too,
so it keeps resolving against the right region's default VPC.

Updates tests across Ec2Service/Ec2Integration/Eks/ElbV2/AutoScaling/
CloudFormation that asserted on the old literal ids, and adds a regression
test (Ec2ServiceTest#defaultVpcSubnetAndSecurityGroupIdsAreRegionScoped)
asserting two different regions get distinct default vpc/subnet/sg ids.

Fixes lex00/floci#21

* fix(ec2,rds): resolve default vpc/sg ids against persisted storage

ensureDefaultResources skips reseeding a region that already has a VPC on
file, so storage written before default ids were made region-scoped keeps
its old unscoped literal ("vpc-default"/"sg-default") forever. Every lookup
that blindly computed the new scoped id instead of resolving against what
storage actually holds would silently stop finding that region's real
default VPC and security group.

Added Ec2Service.resolveDefaultVpcId/resolveDefaultSecurityGroupId, which
check the scoped id first and fall back to the pre-#21 literal. Used them
at every lookup call site (runInstances' default subnet/SG fallback,
createSecurityGroup's default-VPC fallback, DescribeAccountAttributes,
and RdsService.buildDefaultSubnetGroup's vpc-id filter). Seeding itself is
unchanged, it always assigns the new scoped id for a genuinely fresh
region.

RdsServiceTest mocks Ec2Service, so its shared setup now stubs
resolveDefaultVpcId to match the old static call's behavior.

* test(compat): fetch RDS proxy subnet ids per signed region

sdkScopesTheSameDbProxyNameBySignedRegion reused the shared us-east-1
subnetIds field for both the east and west proxy, which only worked
because default subnet ids collided across regions before #21. Real AWS
scopes subnet ids per region and rejects a cross-region id, which is
exactly what floci now correctly does too.

Added subnetIdsFor(Region) and an ec2Client(Region) fixture, and changed
createIamProxy to take explicit subnet ids instead of the shared field.

* test(cloudformation): use region-scoped subnet ids in the update-reconcile test

dbSubnetGroupTemplate hardcoded the pre-#21 unscoped "subnet-default-a/b"
literals, written before this branch's default-id fix landed. Broke on
rebase since those subnets no longer exist under that name. Matches the
sibling test method in the same file, which already used
Ec2Service.defaultSubnetId(region, az).

* docs(ec2): spell out the #21 comment references

Bare #21 in this repo links to floci-io/floci#21, not the fork issue the
comment means.
2026-08-19 17:14:48 -04:00