Commit Graph
349 Commits
Author SHA1 Message Date
William St John Bacon 054508df87 feat(organizations): add CloudFormation resource types (#2495)
* feat(organizations): add CloudFormation resource types

Adds OrganizationsCfnProvisioner covering AWS::Organizations::Organization,
OrganizationalUnit, Account, Policy and ResourcePolicy. Attribute names are
taken from the registry schemas' readOnlyProperties so Fn::GetAtt resolves
the keys AWS publishes.

CloudFormation's delete path hands over a physical id and a region but no
caller identity, and every Organizations mutation is management-account
scoped. Rather than injecting a second collaborator into the provisioner,
OrganizationsService gains findManagementAccountForResource, which recovers
the owning account from the resource id — so the provisioner keeps to the
one-injected-service convention the other provisioners follow.

provision serves create and update: an OU is renamed in place rather than
recreated (ParentId is create-only in the schema), a Policy's TargetIds are
reconciled in both directions, and an Account is moved to its ParentIds
entry after creation.

The integration test asserts through stack Outputs backed by Fn::GetAtt: an
unmapped attribute does not fail provisioning, it silently resolves to the
literal "LogicalId.Attr", so asserting CREATE_COMPLETE would pass with every
attribute unwired.

* fix(organizations): converge CFN provisioning on partial failure and tag drops

Set the physical id as soon as the create call succeeds in provisionAccount
and provisionPolicy, before moveAccount and reconcileTargets respectively.
Both can throw once the resource already exists — a ParentIds entry pointing
at a missing OU raises DestinationParentNotFoundException, and attachPolicy
can fail on a bad target — and without an id CloudFormation's rollback has
nothing to call delete() with, leaving the account or policy a real member of
the organization but unmanaged by the stack.

Make putResourcePolicy replace its tag map rather than merge into it, so a key
dropped from a template is removed on update instead of lingering. A resource
policy is not a TagResource target, so resolveTagOwner rejects rp- ids and the
provisioner cannot reach it through replaceTags the way the other types do;
Put is the only call that can converge those tags. Supplying Tags states the
full set, while omitting them leaves the existing ones untouched, matching how
an absent Tags property behaves for every other Organizations type.

* fix(organizations): mark created accounts and policies as rollback-owned

CloudFormationService.rollbackCreatedResources deletes a CREATE_FAILED
resource only when it carries both a physical id and the
CfnRollback.ROLLBACK_OWNED_ATTR marker. The provisioner set the id but not
the marker, so rollback walked straight past an account whose MoveAccount
failed after CreateAccount had already made it a member of the organization.
The account survived, the organization could not be deleted while it still
contained one, and the stack reported ROLLBACK_FAILED instead of unwinding.

Set the marker as soon as the create call returns, the way
IamRoleCfnProvisioner does, so the create and the ownership record cannot
drift apart. OrganizationsCfnRollbackIntegrationTest drives a real stack
whose ParentIds names an OU that does not exist and asserts the account id
reaches the stack events, that rollback emits DELETE_COMPLETE for it, and
that neither the account nor the organization is left behind.

* feat(organizations): map OU Path and Account State/Paths

The published registry schemas declare three readOnly properties the
provisioner did not map: OrganizationalUnit Path, and Account State and
Paths. An unmapped key does not fail provisioning — CloudFormationTemplateEngine
resolves it to the literal string "LogicalId.Attr" — so a template asking for
Fn::GetAtt Dev.State silently got back "Dev.State".

Path and Paths are the organization path, o-<org>/r-<root>[/ou-<ou>]*[/<id>]/,
which needs a walk from the resource up to the root. OrganizationsService owns
that hierarchy and already computes the chain for effective-policy merging, so
it exposes it as organizationPath rather than the provisioner rebuilding it.
The account path is read after the move: accounts are always created under the
root, so reading it earlier would publish a path the account no longer lives at.

State is the parameter AWS is retiring Status in favour of on 2026-09-09. Floci
only ever puts an account in ACTIVE or PENDING_CLOSURE, both of which are also
AccountState values, so the two agree; PENDING_ACTIVATION and CLOSED are phases
the emulator does not model. Paths is list-typed in the schema, but an account
has exactly one parent and so exactly one path, and the engine's Fn::Select
splits a comma-delimited scalar back into a list, so the string-valued attribute
map carries it without loss.

Adding the Path lookup to provisionOrganizationalUnit opens the same window that
stranded accounts before: a call that can throw once the OU is already a real
member of the organization. Mark the OU stack-owned as soon as the create
returns, matching the account and policy paths, so rollback can still delete it.

* fix(organizations): Ref on Organization returns the management account id

AWS documents Organization as the one Organizations type where bare Ref
returns the management account id rather than the resource's own id;
Fn::GetAtt Org.Id already returned the organization id correctly. Adds
an OrgRef stack output/assertion covering the case, since the existing
integration test only ever exercised Fn::GetAtt on Org.
2026-08-26 14:05:23 -04:00
Sam Fakhreddine 45240998ac feat(controltower): add AWS Control Tower with landing-zone and baseline lifecycle (#2578)
* feat: controltower models + service (TDD)

Adds LandingZone/EnabledBaseline models and ControlTowerService with a
lazy-seeded landing zone, UpdateLandingZone reconciliation sink, static
baseline catalog, and IdentityCenter auto-enable derivation. Unblocks
LZA's Prepare stage (controlTower.enable: true) which otherwise fails
with UnknownOperationException on POST /list-landingzones.

Landing zone version is pinned to "4.0" to satisfy LZA's
validateLandingZoneVersion check, and the seeded manifest always
includes securityRoles (dereferenced unguarded by LZA's
makeManifestDocument). Empty ListLandingZones is never observable
since that is LZA's create-path trigger, which floci does not
implement (see issues/controltower/01-gap-analysis.md).

12/12 unit tests (U1-U12) pass.

* feat: controltower REST-JSON controller + catalog wiring (TDD)

Adds the 8 Control Tower routes (list/get/update landing zone, landing
zone operation polling, list baselines, list/enable enabled baselines,
baseline operation polling) and wires the service into EmulatorConfig
and ResolvedServiceCatalog so it's health-checked and routed like any
other emulated service. Integration tests I1-I6 exercise the same
sequence LZA's Prepare stage drives: seed read, manifest reconcile via
UpdateLandingZone, register-OU baseline enable/poll, and per-account
isolation.

* docs: controltower service

Documents the pre-seed/reconciliation-sink model, the pinned 4.0
landing-zone version, the IdentityCenter baseline auto-enable rule,
and the explicit non-goals (create-landing-zone path, sso-admin,
identitystore, IAM/KMS/Organizations create-path prerequisites).

* feat(controltower): baseline update/reset operation groundwork

Cherry-picked from the ControlTower-scoped slice of 919285e6, which
bundled this alongside an unrelated ConfigService delivery-channel fix
directly on integration/all-features and never made it to this branch.

Adds EnabledBaseline.lastOperationIdentifier, a getEnabledBaseline
lookup helper, and a recordOperation helper that also tracks insertion
order -- the plumbing ResetEnabledBaseline/UpdateEnabledBaseline (next
commit) build on top of.

* feat(controltower): add landing zone lifecycle and operation tracking

(cherry picked from commit 3ddea8f3afd1aebe065b504fe877f21851809438)

* fix(controltower): correct CreateLandingZone route typo

@Path("/create-landing-zone") didn't match botocore's real wire route
/create-landingzone (no hyphen, matching every sibling ControlTower
route's convention) -- confirmed against gate.py, which flipped from
MISSING to SUPPORTED after the fix. The existing test had been
silently exercising the wrong path all along.

* chore: drop local-only bug-ledger file before upstream

issues/0026 is this fork's internal tracking, not something upstream
has a convention for.

* fix(config): declare controltower enabled toggle in both application.yml files

Upstream's ServiceConfigYamlCoverageTest requires every service config with an
enabled() toggle to declare it explicitly in both files; this branch predates
that test and fails it without the declaration.

* fix: reconcile Control Tower OU guardrails

* fix: seed Control Tower SNS prerequisite

* docs(controltower): add the service matrix row

* fix(controltower): validate landingZoneIdentifier on Get/UpdateLandingZone

GetLandingZone and UpdateLandingZone accepted any request body and answered
with the stored landing zone regardless of which one the caller named, so an
unknown ARN still returned the seeded landing zone instead of an error.

Both now require landingZoneIdentifier and return ResourceNotFoundException
when it does not match the stored ARN, matching real Control Tower.

The check seeds before comparing, unlike Delete/ResetLandingZone which must
report a missing landing zone rather than re-seed one. That keeps the lazy
seed intact: LZA reads ListLandingZones first and passes back the ARN it
returns, so the reconciliation-sink path is unaffected.

* fix(controltower): scope the operation ledger per account and region

The ledger backing GetLandingZoneOperation, ListLandingZoneOperations and
GetBaselineOperation was a single process-global map, so any caller could
enumerate every other account's operation identifiers, and it grew for the
lifetime of the process.

There is now one ledger per account+region, holding the most recent 250
operations and evicting the oldest. Read paths look the ledger up rather
than creating it, so an unknown scope cannot grow the map.

An identifier from another scope still answers with the default operation
type and SUCCEEDED rather than an error: that is the same restart-safe
behaviour an identifier issued before a restart gets, and LZA depends on it
when it polls an operation whose ledger entry is gone.

* docs(controltower): correct the CreateLandingZone path and the scope section

The operation table gave CreateLandingZone a hyphenated /create-landing-zone
path. The controller and the AWS Control Tower service model both spell it
/create-landingzone, one word, like every other landing-zone URI — the docs
were what was wrong, and both review bots flagged the controller because of
them.

The "deliberately not implemented" list also contradicted itself, describing
ResetLandingZone and ResetEnabledBaseline as implemented sinks under a
not-implemented heading. It is now split into operations that answer without
the underlying effect and operations nothing serves at all.

Also documents the identifier validation and the ledger scoping and cap added
in the preceding two commits, adds the missing ListLandingZoneOperations row,
and replaces the controller javadoc's stale operation count with a
description of the surface.

* fix(controltower): pin remediationTypes to its single modeled value

The current botocore Control Tower model constrains remediationTypes on
both CreateLandingZone and UpdateLandingZone to a list of exactly one
element (min 1 / max 1) whose only valid value is INHERITANCE_DRIFT.
The shared reader now rejects anything else with ValidationException
instead of silently storing it.

* fix(controltower): enforce modeled ARN and version constraints on EnableBaseline

EnableBaseline read baselineIdentifier, targetIdentifier and baselineVersion
and stored them verbatim. The botocore model pins all three: the two
identifiers to min 20 / ^arn:aws[0-9a-zA-Z_\-:\/]+$, and baselineVersion to
^\d+(?:\.\d+){0,2}$ with max length 10. UpdateEnabledBaseline right next to it
already validated the same shapes, so the two operations disagreed about what
they would accept.

targetIdentifier is the enabled-baseline storage key and feeds the
organizationalUnitId() substring parse, so a non-ARN value persisted a record
that no subsequent GetEnabledBaseline (which does check isArn) could reach.

Reject with ValidationException, the error the model lists for the operation,
and extract the version check into requireBaselineVersion so both operations
share one rule.
2026-08-26 13:44:31 -04:00
Alex Banna 09d7502b28 feat(signin): add secure branded consent flow (#2429) 2026-08-26 11:02:05 -04:00
NAMAN JAIN ac6cb06af4 feat(lakeformation): lake formation (#2427)
* feat(lakeformation): implement Lake Formation emulator

* chore(docs): register LakeFormationJsonHandler in deferred_handlers

* fix(lakeformation): resolve code review comments

* fix(lakeformation): ensure wildcard exclusions generate distinct keys

* fix(lakeformation): include tableCatalogId in DataCellsFilter keys

* fix(lakeformation): include LF-tag values in permission identity key and add integration tests

* fix(lakeformation): configure Jackson for PascalCase and fix JSON-1.1 handler

* fix(lakeformation): escape tag values in permission key to prevent collision

* fix(lakeformation): include embedded CatalogId in permission key and fix tag value encoding collision

* fix(lakeformation): include embedded CatalogId in permission key and fix tag value encoding collision

* feat(lakeformation): migrate from JSON 1.1 dispatcher to REST JSON

- Remove LakeFormationJsonHandler and its routing in AwsJson11Controller
- Create standard JAX-RS LakeFormationController mapped to specific actions
- Update ResolvedServiceCatalog to correctly route Lake Formation requests via restProxyClasses
- Implement regional data isolation via keys prefixing region in MemoryLakeFormationStorage
- Add modeled AlreadyExistsException and EntityNotFoundException handling in LakeFormationService
- Update LakeFormationIntegrationTest to send standards-compliant HTTP POST calls to mapped endpoints

* fix(lakeformation): revoke grant options when base permission is revoked

When a permission exists in both permissions and permissionsWithGrantOption and a revoke names it only in permissions, the grant option is now properly revoked as well to prevent dangling grant options and inconsistent permission states returned to clients.

* fix(lakeformation): correct LF tag casing to match AWS wire protocol

The AWS Lake Formation API uses LFTags, LFTag, LFTagPolicy, and LFTagExpression on the wire. The Jackson PascalCase naming strategy incorrectly converted internal lfTags fields to LfTags, causing silent mapping failures (e.g. AddLFTagsToResourceRequest lost its tags, and TBAC Resource.LFTag lost its resource identity entirely).

Added explicit @JsonProperty annotations to ensure strict compliance with AWS specifications.

* fix(lakeformation): apply filters when listing resources and permissions

The list-resources and list-permissions endpoints were completely ignoring the provided filters and returning the entire in-memory storage, which violates AWS behavior and breaks Terraform synchronization (since it sees permissions of other principals).

Updated MemoryLakeFormationStorage to natively apply:
- listResources: EQUALS, NOT_EQUALS, and BEGINS_WITH for RESOURCE_ARN FilterConditions
- listPermissions: Principal identification checks and exact Resource matching

* fix(lakeformation): resolve multiple minor conformance issues

- Add @JsonInclude(NON_NULL) to all Lake Formation model classes to omit empty JSON fields from wire responses
- Validate that PermissionsWithGrantOption is a subset of Permissions in GrantPermissions
- Validate that ResourceArn starts with 'arn:' in RegisterResource
- Create AwsThrowableMapper to map generic service NPEs to standard AWS 500 InternalFailure responses
- Update index.md documentation to reflect Lake Formation's REST JSON protocol instead of JSON 1.1

* test(lakeformation): cover missing API operations and TBAC grant

Added explicit coverage for the remaining 8 Lake Formation operations to ensure all endpoints execute against the mock storage cleanly:
- RegisterResource, DescribeResource, ListResources, DeregisterResource (Resource lifecycle)
- ListLFTags, DeleteLFTag (Tag lifecycle extension)
- AddLFTagsToResource, RemoveLFTagsFromResource (Tag assignment)

Also added a dedicated TBAC round-trip test (grantAndListPermissionsTBAC) to assert that grants scoped to LFTag resources serialize correctly and are successfully retrievable via ListPermissions.

* fix(lakeformation): enforce AWS-compatible FilterCondition operators and logic

- MemoryLakeFormationStorage now correctly implements AWS's EQ and NE operator strings instead of EQUALS and NOT_EQUALS (which bots and SDKs never send).
- Unrecognized operators now throw an InvalidInputException instead of silently matching everything.
- LakeFormationService now correctly ANDs all filters in the FilterConditionList by passing the entire list to storage rather than arbitrarily dropping all but the first.
- Fixed a Quarkus JAX-RS deployment conflict where Resource Explorer 2 and Lake Formation both mapped to POST /ListResources. The conflict was resolved by rewriting Resource Explorer 2's ambiguous path at the pre-matching filter layer, allowing both services to co-exist securely.

* fix(lakeformation): enforce required inputs on GrantPermissions and handle malformed records

- Added explicit validation to GrantPermissions and RevokePermissions to ensure Principal, Resource, and Permissions are present, throwing an InvalidInputException if missing.
- Null-guarded principal and resource dereferencing in MemoryLakeFormationStorage's listPermissions filter. This prevents a malformed grant record from triggering a NullPointerException and causing a 500 InternalFailure for all subsequent list operations.

* chore(lakeformation): pin ListResources filter in tests and document intentional omissions

- Updated LakeFormationIntegrationTest.resourceLifecycle to register a second resource, strictly asserting that ListResources with an EQ filter correctly isolates and returns only the requested resource.
- Added code comments to MemoryLakeFormationStorage documenting the deliberate omission of pagination (MaxResults, NextToken) and specific optional list filters (ResourceType, IncludeRelated), clarifying the design choice for future maintainers.
- Reverted the repo-wide AwsThrowableMapper addition as it falls outside the scope of the Lake Formation protocol fixes and warrants its own dedicated review.

* chore(lakeformation): Reverted the repo-wide AwsThrowableMapper

- Reverted the repo-wide AwsThrowableMapper addition as it falls outside the scope of the Lake Formation protocol fixes and warrants its own dedicated review.

---------

Signed-off-by: NAMAN JAIN <naman.049259@tmu.ac.in>
2026-08-26 10:29:31 -04:00
Aniket Shukla 859db2f352 feat(cloudwatch-logs): add resource policy actions (#2574) 2026-08-25 23:41:09 -05:00
Allen Sanborn 2e8cbc13d7 feat(ec2): support ModifyVpcEndpoint and persist the endpoint policy (#2526)
* feat(ec2): implement ModifyVpcEndpoint and store the endpoint policy

ModifyVpcEndpoint returned UnsupportedOperation. In a survey that drove 183
Terraform roots against Floci it was the single largest blocker, with 205 recorded
occurrences -- roughly five times the next entry.

A gateway endpoint is normally declared with its route tables, subnets and policy
attached after the endpoint itself exists, so aws_vpc_endpoint reaches for this
action in the ordinary case rather than an exotic one. EC2 is otherwise well
supported, which makes the failure especially expensive: a configuration builds most
of its infrastructure and then loses all of it to one refused call.

    Error: modifying EC2 VPC Endpoint (vpce-...): operation error EC2:
    ModifyVpcEndpoint, https response error StatusCode: 400,
    api error UnsupportedOperation: Operation ModifyVpcEndpoint is not supported.

Nearly all the state was already modelled -- VpcEndpoint carries routeTableIds,
subnetIds, securityGroupIds and privateDnsEnabled -- so this adds the handler, the
add/remove set semantics, and the one missing field.

The update is taken under the endpoint's stripe lock, following the convention
already used for network ACL entries and prefix lists. Terraform declares each
aws_vpc_endpoint_route_table_association as its own resource and applies them in
parallel, so several ModifyVpcEndpoint calls land on one endpoint at once; an
unsynchronized read-modify-write loses all but the last, and the losers' waiters then
poll for an association that was silently dropped:

    Error: waiting for VPC Endpoint Route Table Association (vpce-.../rtb-...) to
    become available: couldn't find resource (21 retries)

PolicyDocument is the missing field. CreateVpcEndpoint accepted it and silently
dropped it, and DescribeVpcEndpoints reported no policy, so an endpoint declared
with a policy read back without one and showed as drift on every plan even when
ModifyVpcEndpoint was never called. It is now honoured on create, on modify, and
cleared by ResetPolicy, which AWS documents as returning the endpoint to the default
full-access policy (modelled here as carrying no document).

Add/remove are set operations. AWS accepts adding an id that is already associated,
or removing one that is not, so both directions are idempotent. Every referenced id
is validated before anything is mutated, so a request naming one bad id cannot leave
the endpoint half-modified -- covered by a test.

Reference: request parameters, their optionality, and the minimal
{return, requestId} response --
https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyVpcEndpoint.html

Not implemented, as nothing in the model backs them yet: DnsOptions, IpAddressType
and SubnetConfiguration.N. They are accepted and ignored rather than rejected, which
matches how the other unmodelled endpoint attributes already behave.

Verified end to end. A Terraform configuration with two
aws_vpc_endpoint_route_table_association resources previously failed with the
"couldn't find resource" wait above, leaving one of the two associations dropped; it
now applies 6 resources with both associated. 378 existing EC2 and CloudFormation
tests still pass.

The concurrency test drives the service directly rather than over HTTP: requests
through the test server are serialized enough that an HTTP-level test passes even
with the lock removed. Driven through the service it fails on every run without the
lock, which is what makes it worth having.

* fix(ec2): honour ModifyVpcEndpoint presence semantics and the CFN endpoint policy

Follow-up corrections to the ModifyVpcEndpoint implementation in the preceding
commit. Three behaviour changes, each with a test that fails without it.

PolicyDocument was treated as absent when blank. The EC2 model gives the member no
`min`, so the only test the request supports is whether it is present; an empty
string is a value the caller supplied, and discarding it is the same silent-drop bug
the previous commit fixed for the create path. Presence is now the test, on create,
on modify, and when rendering DescribeVpcEndpoints.

An omitted VpcEndpointId reported InvalidVpcEndpointId.NotFound for the id "null".
VpcEndpointId is the sole required member of ModifyVpcEndpointRequest, and an absent
required Query parameter is MissingParameter here, as it already is for CreateSubnet
and CreateVpc. A present-but-unknown id still reports NotFound.

Ec2VpcEndpointCfnProvisioner passed null for the new policy parameter, so an
AWS::EC2::VPCEndpoint declaring PolicyDocument still lost it -- the EC2 API path was
fixed while the CloudFormation path kept the original bug. The property is declared
as JSON in the template and so arrives as an object node; it is serialised the way
IamRoleCfnProvisioner already serialises AssumeRolePolicyDocument.

Also tightens two error assertions in Ec2ModifyVpcEndpointTest that checked only for
status 400. UnsupportedOperation is also a 400, so both passed unchanged with the
action unrouted -- they proved nothing about the fix. Asserting the error code takes
the class from 8 of 11 failing to 9 of 11 when ModifyVpcEndpoint is unrouted.

Documents the action in docs/services/ec2.md, including the members accepted and
ignored.

* fix(cfn): resolve intrinsics in the VPC endpoint PolicyDocument

The AWS::EC2::VPCEndpoint provisioner serialised PolicyDocument straight
off the raw template node, so a policy built with Ref, Fn::Sub or
Fn::Join was stored as literal template syntax and DescribeVpcEndpoints
reported it verbatim.

Route it through CloudFormationTemplateEngine.resolveJsonAttribute, the
helper added in #2317 for JSON-valued attributes. It resolves the tree
and then unwraps a textual result instead of re-serialising it, avoiding
the double-encoding a naive resolveNode(...).toString() produces. It
also returns null for a null or missing node, so the old has()/isNull()
guard is redundant and goes away.

The javadoc previously cited IamRoleCfnProvisioner's bare toString() of
AssumeRolePolicyDocument as precedent; that precedent predates #2317 and
is no longer the right one to follow, so it now cites the helper instead.
2026-08-25 22:54:44 -05:00
soreavis ce4f6d1c48 fix(s3): route the replication subresource instead of falling through (#2519)
PUT /{bucket}?replication fell through to CreateBucket: in the default
region the idempotent-create path answered 200 with a Location header
and stored no replication configuration, and elsewhere it failed with
BucketAlreadyOwnedByYou. GET fell through to ListObjects and returned
a ListBucketResult the SDK silently parsed as an empty replication
configuration. Only DELETE was routed, as a no-op.

Route PUT and GET alongside the existing DELETE case, per the issue's
suggested fix: the configuration is stored verbatim on the bucket and
echoed back — Floci does not model replication behavior, and neither
the SDK nor the Terraform provider needs it to. The PUT body's
ReplicationConfiguration root is validated (MalformedXML otherwise);
GET on a bucket with no stored configuration answers
ReplicationConfigurationNotFoundError (404), which is what the SDK and
aws_s3_bucket_replication_configuration treat as "not configured".

Now that PUT stores a configuration, DeleteBucketReplication clears it
instead of no-opping (still an unconditional 204, matching AWS), and a
DELETE on a missing bucket answers NoSuchBucket instead of the no-op's
204.

IamActionRegistry maps the three verbs to the documented actions:
s3:PutReplicationConfiguration for PUT and DELETE (AWS authorizes
DeleteBucketReplication with the put action) and
s3:GetReplicationConfiguration for GET. The mapping mirrors the
controller's per-method dispatch order: on PUT and GET accelerate is
dispatched ahead of replication, while the DELETE chain routes
replication and never routes accelerate to an operation.

Closes #2296
2026-08-25 22:51:56 -05:00
Kenshin Okinaka 60dd795703 fix(ses): reject non-string tag members with SerializationException (#2512)
* fix(ses): reject non-string tag members with SerializationException

SesController.parseTagsArray coerced tag Key/Value via asText(null), so a
non-string member (number, boolean, object, array) was silently turned
into a string (123 -> "123") and accepted, across all five SES tag entry
points that share the method (CreateEmailIdentity, CreateConfigurationSet,
CreateEmailTemplate, CreateContactList, TagResource).

AWS's restJson1 deserializer rejects a non-string tag member with
SerializationException / 400 (probe-confirmed). parseTagsArray now rejects
a present-but-non-string Key/Value the same way, leaving missing/null
members to the downstream service validation.

* fix(ses): reject non-object tag list elements with SerializationException

parseTagsArray validated Key/Value types but not that each Tags element is
a JSON object, so a scalar/array/null element fell through to service-layer
validation. Reject a non-object element with SerializationException,
matching AWS's restJson1 deserializer (AWS returns 500 for a null element,
a server-side bug, normalized to the same 400).
2026-08-25 22:50:49 -05:00
Kenshin Okinaka 29f6e7ac6b fix(ses): enforce full AWS tag validation across all SES resources (#2504)
* fix(ses): enforce full AWS tag validation across all SES resources

The shared SES tag validator only checked a single tag's key/value
length, so CreateConfigurationSet, CreateEmailTemplate,
CreateEmailIdentity, CreateContactList, TagResource, and tenant tagging
all silently accepted invalid tag sets.

Add SesTags.validate(List<Tag>) matching probe-confirmed AWS SES v2
behavior: at most 50 tags, unique keys, key 1-128 / value 0-256 code
points, both key and value restricted to letters, numbers, Unicode
whitespace, and _ . : / = + - @, and the aws: key prefix
(case-insensitive) reserved for system tags. Lengths are counted by
Unicode code point (Smithy semantics), not UTF-16 code units.
TagResource enforces the 50-tag limit on the merged (existing +
incoming) set, allowing updates to existing keys. Messages and
evaluation order mirror AWS; all violations are BadRequestException / 400.

Route every SES tag entry point through the validator, and validate
CreateEmailIdentity's tags before the identity is persisted so an
invalid tag set fails atomically instead of leaving the identity behind.
Update the integration tests that encoded the old non-AWS behavior (an
omitted tag value now returns 400 like real AWS).

* test(ses): cover CreateEmailTemplate invalid-tag rejection

Route-level coverage that CreateEmailTemplate rejects an invalid tag set
(duplicate keys) atomically without persisting the template. The
service-level SesTags call was otherwise only exercised through
SesTagsTest, so a regression removing it could pass unnoticed.
2026-08-25 22:47:58 -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
Anders Wasen a3044e065e feat(rds-data): adding data-api support for lable/name and batch (#2518)
* feat(rds-data): adding data-api support for lable/name and batch

* feat(rds-data): fixing PR robots comments

* feat(rds-data): fixing PR comments; adding tests
2026-08-25 09:40:33 -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
Tedd 72dfa634f7 fix(apigateway): support AWS type Lambda integration and fix duplicate Content-Type header (#2049)
* fix(apigateway): support AWS type Lambda integration and fix duplicate Content-Type header

Integration tests for AWS type lambda integration with apigateway and duplicate content-type headers

Addressing Greptile review the qualifier is now preserved end to end and covered by tests

* fix(apigateway): resolving review feedback, adding in comment to LambdaArnUtils re lastIndexOf fallback, and updating DOCs with Line re v1 execution plane integration type behaviour
2026-08-24 17:24:09 -04:00
Abhigya 1ca19c722a fix(cognito): AWS-accurate UsernameAttributes pools — UUID username, alias sign-in, and token/revocation parity (#1849)
* feat: mint UUID username with mutable email alias for UsernameAttributes pools

* fix(cognito): align token claims, alias-exists, read-attributes, and not-found status with AWS

* fix(cognito): align token claims, alias-exists, read-attributes, not-found status, and canonical-username revocation with AWS

* fix(cognito): accept canonical UUID on RESEND, harden migration sub-minting and email validation)

* fix(cognito): AliasExistsException guard check

* test(cloudformation): expect 400 for Cognito ResourceNotFoundException

Align the post-deletion DescribeUserPool/DescribeUserPoolClient assertions
with the AWS-accurate 400 status now returned for Cognito
ResourceNotFoundException.

* fix(cognito): bind CUSTOM_AUTH challenge USERNAME to the session user

RespondToAuthChallenge validated SECRET_HASH against the caller-supplied
USERNAME while resolving the user from the session, so the two were allowed
to disagree. That reduced SECRET_HASH from a per-user binding to a bare
proof-of-client-secret check, and let callers pass locally against requests
real Cognito rejects.

Resolve the supplied USERNAME the same way sign-in does and require it to
match the session user; aliases still work since the caller may legitimately
send the email while the session holds the UUID.

Also compare SECRET_HASH with MessageDigest.isEqual instead of String.equals
so the MAC comparison does not short-circuit on the first differing byte,
matching the SRP path in CognitoSrpHelper.
2026-08-24 14:43:49 -04:00
TATSUNO “Taz” Yasuhiro b6418dbfee feat(sfn): support mocked service integrations (SFN_MOCK_CONFIG) (#2452)
* feat(sfn): support mocked service integrations (SFN_MOCK_CONFIG)

StartExecution accepts a state machine ARN with a test case suffix in
the Step Functions Local format. The test case comes from the mock
configuration file named by SFN_MOCK_CONFIG. A mocked Task state
returns the configured Return payload or fails with the configured
Throw error instead of calling the integrated service. The mocked
error and cause reach Retry and Catch unchanged. States not named in
the test case still call their real integration, so mocked and real
calls combine in one execution. Behavior was verified against Step
Functions Local 2.0.0.

Closes #2283

* fix(sfn): never retry or catch States.Runtime even when named explicitly

* fix(sfn): keep a bare trailing '#' unstripped on StartSyncExecution
2026-08-24 00:04:17 -04:00
Matheus Oliveira 700acc65c7 feat(docs): guard the service matrix against undocumented services (#2465)
* docs(services): add SWF, Cloud Control API, and EMR Serverless to the service matrix

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(docs): fail CI when a registered service has no service-matrix row

check_service_matrix.py compares descriptor() registrations in
ResolvedServiceCatalog.java against the matrix, via an alias/deferred
registry in tools/docs/service_matrix.yaml. Deferred entries require a
`by:` expiry date so the exemption can't become permanent (see #2436).

Wired into `make docs-check`.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

---------

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-08-23 21:04:30 -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
Matheus Oliveira 824701481c feat(core): label emulated resource containers with io.floci.* identity (#2497)
* feat(core): add io.floci.* resource-identity labels

Introduces ContainerStorageHelper.resourceIdentityLabels(service,
resourceId, accountId, region), so a container manager can tag its
spawned container with the emulated resource's identity. Additive to
the existing floci/floci_emulator/floci_namespace labels.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(rds): label RDS containers with resource identity

RDS backing containers now carry io.floci.service=rds,
io.floci.resource-id=<instanceId>, io.floci.account, and io.floci.region
so a spawned container can be mapped back to the DBInstanceIdentifier
it emulates without empirical docker exec probing.

Account/region reuse the same ARN parsing already done for log-stream
routing; extracted into resolveRuntimeIdentity so both call sites share
one source of truth.

Closes #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(docdb): label DocDB containers with resource identity

DocDB backing containers now carry io.floci.service=docdb and
io.floci.resource-id=<clusterId> alongside account/region.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(elasticache): label ElastiCache Redis/Valkey containers with resource identity

Backing containers now carry io.floci.service=elasticache and
io.floci.resource-id=<groupId> alongside account/region.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(elasticache): label ElastiCache Memcached containers with resource identity

Backing containers now carry io.floci.service=elasticache and
io.floci.resource-id=<clusterId> alongside account/region.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(memorydb): label MemoryDB containers with resource identity

Backing containers now carry io.floci.service=memorydb and
io.floci.resource-id=<clusterName> alongside account/region.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(neptune): label Neptune containers with resource identity

Backing containers now carry io.floci.service=neptune and
io.floci.resource-id=<clusterId> alongside account/region.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(msk): label MSK containers with resource identity

Redpanda backing containers now carry io.floci.service=msk and
io.floci.resource-id=<clusterName> alongside account/region.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(opensearch): label OpenSearch containers with resource identity

Backing containers now carry io.floci.service=opensearch and
io.floci.resource-id=<domainName> alongside account/region.
RegionResolver is now injected into OpenSearchDomainManager.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(ecs): label ECS task containers with resource identity

Backing containers now carry io.floci.service=ecs and
io.floci.resource-id=<taskId> alongside account/region.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(eks): label EKS k3s containers with resource identity

Backing containers now carry io.floci.service=eks and
io.floci.resource-id=<clusterName> alongside account/region.
RegionResolver is now injected into EksClusterManager.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(amazonmq): label AmazonMQ containers with resource identity

RabbitMQ backing containers now carry io.floci.service=amazonmq and
io.floci.resource-id=<brokerId> alongside account/region.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(mwaa): label MWAA containers with resource identity

Both the Postgres metadata container and the Airflow container now
carry io.floci.service=mwaa and io.floci.resource-id=<environmentName>
alongside account/region. RegionResolver is now injected into
MwaaEnvironmentManager.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(kinesisanalytics): label Flink containers with resource identity

Both the JobManager and TaskManager containers now carry
io.floci.service=kinesisanalytics and io.floci.resource-id=<applicationName>
alongside account/region.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(batch): label Batch job containers with resource identity

Job containers now carry io.floci.service=batch and
io.floci.resource-id=<jobId>, using the job's own account/region
(already carried on BatchJob) rather than RegionResolver.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(codebuild): label CodeBuild job containers with resource identity

Build containers now carry io.floci.service=codebuild and
io.floci.resource-id=<buildId> alongside account/region.

No new unit test: the container-spawn call site lives inside the
private multi-phase runBuild() method, entangled with real filesystem
and source-download side effects with no existing seam for unit
testing in isolation (CodeBuild's only coverage today is the
QuarkusTest-based CodeBuildIntegrationTest, which would need a real
Docker daemon and a full build run to assert container labels).

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(lambda): label function containers with resource identity

Lambda containers now carry io.floci.service=lambda and
io.floci.resource-id=<functionName>, reusing the existing
ARN-based region resolution and adding the equivalent account lookup.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(ec2): label EC2 instance containers with resource identity

Backing containers now carry io.floci.service=ec2 and
io.floci.resource-id=<instanceId>, using the already-passed region
parameter and a new RegionResolver dependency for the account id.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* feat(ecr): label the shared registry container with resource identity

The registry:2 container carries io.floci.service=ecr with no
resource-id, since it is a shared singleton, not a per-resource
container.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* docs(core): document io.floci.* resource-identity labels

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* style(tests): use imports instead of inline FQCN in resource-identity label tests

Cleans up the Batch, EKS, and OpenSearch label tests added earlier in
this branch, which used fully-qualified names inline instead of imports.

Relates to #1818

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* fix(kinesisanalytics): restore Mockito import and awsEnv param in Flink label test

Silently dropped by the rebase's clean auto-merge; the test no longer compiled
without them.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* docs(core): note ECR keeps every identity label except resource-id

EcrRegistryManager still passes account/region for the shared registry
container; only resourceId is omitted. Docs previously said the opposite.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* test(elasticache): log swallowed IOException in label test cleanup

Matches the pattern already used in the DocDB/Neptune/MemoryDB label tests.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

---------

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-08-23 20:47:00 -04:00
kk b243504b48 docs(bedrockagentcore): document the AgentCore services (#2436)
* docs(bedrockagentcore): register AgentCore in the service matrix, env-var reference, and README

* docs(readme): restore FIS to the architecture diagram lost in the main merge

---------

Signed-off-by: kk <kannanpoem1984@gmail.com>
2026-08-23 18:03:28 -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
TATSUNO “Taz” Yasuhiro 56e74d64c6 feat(sfn): support Retry policies in Task, Parallel, and Map states (#2455)
* feat(sfn): honor Retry policies in the ASL executor

Task, Parallel, and Map states previously ignored their Retry field, so
any failure went straight to Catch or failed the execution. They now
retry per the ASL spec. ErrorEquals matching reuses the Catch matcher,
including the States.ALL and States.TaskFailed wildcards, and
States.Runtime is never retried. AWS defaults apply when fields are
omitted (MaxAttempts 3, IntervalSeconds 1, BackoffRate 2.0).
MaxDelaySeconds is honored. Each retrier keeps its own attempt counter
and an exhausted retrier falls through to Catch. The context object
field $$.State.RetryCount increments per attempt.

Attempt counts, defaults, backoff timing, retry before catch order,
and per attempt RetryCount resolution were verified against real AWS
Step Functions in us-east-1 using execution histories.

Two deviations are documented. The delay between attempts is capped at
30 seconds, matching the cap Floci applies to Wait states.
JitterStrategy is accepted but ignored.

Refs #2283

* test(sfn): add end-to-end Retry integration tests

Covers the JSON 1.0 wire protocol path. The fail-then-succeed case
works without mocks by resolving the DynamoDB table name from
$$.State.RetryCount, so attempt 0 targets a missing table and the
retry targets one that exists. This also exercises per attempt
Parameters re-resolution, which real AWS does the same way. The other
cases cover retrier exhaustion falling through to Catch and an
unmatched error failing without retry.

* fix(sfn): unwrap branch failures so Parallel Retry and Catch apply

* fix(sfn): isolate the context object per Parallel branch and per branch state

* fix(sfn): fail a missing Lambda function as Lambda.ResourceNotFoundException

* test(sfn): cover Retry and Catch for Parallel and Map states

* feat(sfn): support JitterStrategy FULL in Retry backoff

* fix(sfn): keep branch Error causes wrapped so executions still terminate
2026-08-23 17:13:30 -04:00
Kenshin Okinaka c969ffc31d feat(ses): support +label subaddressing on mailbox simulator addresses (#2464)
The SES mailbox simulator lets senders add a +label to distinguish test messages,
so bounce+order-123@simulator.amazonses.com triggers a bounce like the bare address.
SimulatorAddresses now strips a +label from the local part (only + separates the
label; bounce-label@... is not a simulator address) before matching the type
case-insensitively. Add unit tests and document the behavior.
2026-08-23 16:26:41 -04:00
hisham-coderandHisham Mohammed f3b22e7964 fix(ecs): roll service tasks onto a changed task definition (#2483)
UpdateService with a new taskDefinition recorded a deployment but left the
running tasks on the old revision forever: a redeploy (new image tag, new
environment) never reached the containers, and the only way to apply it was
to StopTask by hand so the reconciler relaunched.

The reconciler now counts only tasks on the service's current task
definition towards desiredCount, so replacements start first, and when the
service is over desiredCount it drains the stale tasks before anything
else — the shape of AWS's rolling deployment with the ECS deployment
controller. Stopped reason names the replaced task definition.

The service pins the resolved task-definition ARN on CreateService and
UpdateService (AWS stores and reports the ARN), so a family or
family:revision reference compares exactly with each task's
taskDefinitionArn; a service persisted with a raw reference is pinned on
its first reconciler tick.

Co-authored-by: Hisham Mohammed <hisham.ma.mohammed@gmail.com>
2026-08-23 16:19:01 -04:00
Vedant Madane bd3b5b427b docs: add MWAA to service matrix and correct service count (#2496)
MWAA already has a service page and is registered in the catalog, but the
matrix at docs/services/index.md omitted it. Add the row and bump the
headline count from 72 to 73.

Fixes #2205

Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com>
2026-08-23 15:26:18 -04:00
Davor Santic a2389e7733 fix(ecs): round-trip runtimePlatform and logConfiguration on task definitions (#2443)
RegisterTaskDefinition parsed a fixed field list and dropped everything
else, so a task definition registered with a runtimePlatform or a
container logConfiguration came back from DescribeTaskDefinition without
them. A client that verifies its own write — Terraform, or a deploy tool
comparing the registered revision against desired state — saw drift that
was not there.

Both are now parsed, stored on the task definition, and serialized back
with the AWS wire shape. A request that omits them still produces a
response without the keys, so nothing changes for existing callers.

The two fields are set on the task definition returned by
EcsService.registerTaskDefinition, following the pattern already used for
task-level volumes. That mutation happens after the value was stored, so
a backend that serializes on put (persistent, hybrid, WAL) had captured
the pre-mutation value; the definition is now written back, which also
makes the existing volumes round-trip survive a restart.
2026-08-22 00:22:32 -04:00
soreavis 353d9c842f feat(kinesis): add PutRecords request caps and a per-stream max record size (#2438)
PutRecords enforced only the per-record limit. AWS also caps a request at
500 records and 10 MiB including partition keys; both are now whole-request
rejections with InvalidArgumentException, since per-record ErrorCode only
carries throughput and internal failures. The count cap is checked upfront
and the byte cap as the loop goes, so neither an over-long batch nor an
oversized one is fully decoded before it is rejected. Undecodable or
non-string Data counts toward the cap at the UTF-8 bytes the caller sent,
so a batch of malformed records cannot slip past it.

The per-record maximum becomes per-stream state defaulting to 1024 KiB, set
by CreateStream's MaxRecordSizeInKiB or UpdateMaxRecordSize (1024-10240) and
reported by DescribeStreamSummary. UpdateMaxRecordSize documents
ValidationException for an out-of-range size. CreateStream doesn't, and
reserves ValidationException for the on-demand case, so it answers
InvalidArgumentException. Streams persisted before the field existed
deserialize to the default.
2026-08-21 16:15:25 -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
Alex Banna 470ec77711 feat(signin): support AWS login credentials provider (#2428)
* feat(signin): add AWS login credentials provider

* fix(signin): initialize secure random at runtime

* fix(signin): make refresh exchange idempotent

* fix(signin): match AWS OAuth token contracts

* refactor(signin): add typed token result model

* fix(signin): align errors with AWS exception handling
2026-08-20 23:34:40 -04:00
Abhigya f45d64a00e feat(sns): deliver topic broadcasts to application-protocol platform endpoints (#1856)
* feat(sns): deliver topic broadcasts to application-protocol platform endpoints

Add an application-protocol case to deliverMessage so publishing to a
topic fans out to subscribed mobile push platform endpoints, matching
real SNS behavior. Thread messageStructure through the delivery boundary
so platform-specific payload keys (GCM/FCM/APNS) resolve per endpoint,
and factor the push-capture tail of publishToEndpoint into a shared
capturePushForEndpoint helper. Disabled endpoints are skipped in the
fan-out rather than failing the publish. Broadcast pushes surface in the
same retrospection API keyed by EndpointArn.

* fix(sns): validate MessageStructure synchronously before topic fan-out

Topic Publish with MessageStructure=json now validates that the message is
a JSON object with a top-level default entry up front, mirroring the real
SNS API. Previously a malformed envelope was only rejected lazily inside
per-subscriber delivery, where deliverMessage's catch swallowed the
InvalidParameter and logged a warning while publish still returned a
success messageId, so application subscribers silently received no push.

* fix(sns): validate MessageStructure per entry in PublishBatch

publish() validates a MessageStructure="json" envelope synchronously before
fan-out, but publishBatch() only threaded MessageStructure into deliverMessage.
A batch entry with a malformed or default-less envelope was therefore added to
Successful while deliverMessage's catch swallowed the resulting InvalidParameter,
dropping the push for every application subscriber.

Run the same validation per entry, reporting a bad envelope as that entry's
BatchResultErrorEntry (InvalidParameter, senderFault=true) instead of throwing,
so the rest of the batch still publishes as real PublishBatch does.

* fix(sns): resolve MessageStructure=json payload per protocol on fan-out

Under MessageStructure="json", only the application protocol consumed the
envelope: sqs, lambda, http/https, email, email-json and sms each delivered
the raw JSON structure. Real SNS resolves per-protocol for every subscriber,
picking the value under the protocol key and falling back to default.

deliverMessage now resolves the payload for each subscription through the
(renamed) resolveProtocolPayload, which already keyed off an arbitrary
string; application keeps resolving against the push platform inside
capturePushForEndpoint. validateTopicMessageStructure guarantees default
exists before fan-out, so the fallback cannot come up empty.

* fix(sns): ignore non-string MessageStructure=json keys, matching AWS

Under MessageStructure=json, real SNS ignores a protocol key whose value
is not a string ("Non-string values will cause the key to be ignored"),
falling back to default rather than stringifying it. resolveProtocolPayload
was calling protocolValue.toString(), so {"default":"hi","sqs":42} delivered
the literal "42" to an SQS subscriber instead of "hi".

Only textual values are now accepted for both the protocol key and the
default fallback; non-textual values fall through. validateTopicMessageStructure
is tightened to require a textual default so a non-string default is rejected
synchronously rather than throwing (and being swallowed) during fan-out.

Adds regression tests for a non-string protocol key falling back to default
and for rejection of a non-string default.

* chore: remove unnecessary file
2026-08-20 23:10:38 -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
TATSUNO “Taz” Yasuhiro bc13801121 feat(lambda): support kubernetes as the lambda runner (#1941)
* feat(lambda): support kubernetes as the lambda runner

* fix(lambda): keep the port reserved when a failed launch cannot confirm pod deletion

* fix(lambda): carry the owning account in the layer Content.Location URL

The URL is fetched unsigned. Without an X-Amz-Credential query the
account filter falls back to the default account, so a layer published
under another account resolves the wrong bucket namespace and 404s.
Mirror the credential query the kubernetes executor already appends to
its download URLs.

* chore(build): raise the surefire heap to 6g

The suite outgrew the 4g default heap of 16g CI runners. At OOM a full
GC reclaims almost nothing, so the live set is real. The heap dump
shows 192 surviving QuarkusClassLoader instances, each pinned test app
keeping its own copy of the Jandex index. This PR widens the classpath
with the kubernetes client, which made each pinned copy heavier and
tipped CI over the edge. Verified locally that the full suite passes
with 6g and fails with 4g. Unpinning the leaked classloaders remains
follow-up work on main.
2026-08-20 12:52:32 -04:00
Matt Van Horn bd8d99b757 fix: apply S3 Vectors metadata filters (#2417)
Fixes #2160
2026-08-19 23:17:36 -05:00
NAMAN JAIN 8a673fc580 feat(emrserverless): support EMR Serverless applications (#2403)
* feat(emrserverless): add EMR Serverless application management emulator

This adds a full emulator for the EMR Serverless Application management plane,
allowing tools like Terraform to provision and manage EmrServerless applications.
Includes full CRUD operations, route collision handling, and integration tests.

* fix(emrserverless): disambiguate local endpoint routing using SigV4 auth header

* fix(emrserverless): resolve bot feedback on ARNs, idempotency, updates, and list controls

* fix(emrserverless): resolve bot feedback on idempotency races and dropped update fields

* fix(emrserverless): add jobLevelCostAllocationConfiguration to updates

* fix(emrserverless): retain nested configuration fields using dynamic properties

* fix(emrserverless): add required field validation and correct 404 status code

* docs(emrserverless): document unsupported tagging APIs

* fix(emrserverless): increase ListApplications maxResults limit to 100

* test(emrserverless): fix integration test assertions to align with required field validations and correct 404 status code

* fix(emrserverless): revert ListApplications maxResults limit to 50 to match AWS limits

* test(emrserverless): add validation tests for CreateApplication required fields
2026-08-20 00:08:21 -04:00
Priamo Germosen 7505110ed9 feat(msk): add configuration revision actions (#2344)
* fix(core): extract shared pagination helper, reject maxResults=0

Closes #2339, #2340.

ListResult<T> and its paginate()/encode()/decode() helpers existed as
five near-identical private copies (BedrockAgentCoreGatewayService,
BedrockAgentCoreIdentityService, BedrockAgentCoreMemoryService,
BedrockAgentCoreControlService's three list methods, and MskService),
not the two originally scoped in #2340 - the ListResult<T> record was
already shared within bedrockagentcorecontrol, which is what earlier
scoping missed. Extracts core.common.Pagination + PaginatedResult<T>
and migrates every one of them, deleting both now-unused per-service
ListResult model classes.

Every duplicate collapsed "maxResults omitted" and "maxResults=0"
onto the same primitive int, defaulting both to the full page instead
of rejecting the explicit zero the way AWS's MaxResults min:1
constraint requires (confirmed against botocore's real kafka and
verified live: botocore itself refuses to send MaxResults=0
client-side). Pagination.paginate/parseMaxResults take a boxed
Integer so the two cases are distinguishable, and every migrated
service now rejects 0 with its own existing error code
(ValidationException for the bedrockagentcorecontrol services,
BadRequestException for MSK) - the fix lands once, not five times.

Also carries over the MskController fix from #2336: an
Integer-typed @QueryParam converts before the resource method runs,
so a non-numeric maxResults was a bare 404 instead of an AWS-shaped
400. Every migrated REST controller now binds maxResults as a String
and calls Pagination.parseMaxResults, closing the same gap in
BedrockAgentCoreGatewayController/ControlController/MemoryController
that MSK already had fixed.

* feat(msk): add configuration revision actions

Closes #2338.

Adds UpdateConfiguration, ListConfigurationRevisions, and
DescribeConfigurationRevision, the three actions #2299 explicitly
scoped out ("a separate follow-up issue"). MskConfiguration now
stores a full revision history (revisions + serverPropertiesByRevision
keyed by revision number) instead of a single latest-revision field -
UpdateConfiguration appends rather than overwrites, and
DescribeConfigurationRevision is the only action that returns
serverProperties (base64), matching AWS's real shapes: Configuration/
DescribeConfigurationResponse/CreateConfigurationResponse never
include it, verified against botocore's kafka service model the same
way as #2336/#2343 rather than trusting the docs page.

ListConfigurationRevisions builds on the shared Pagination.paginate
helper from #2343 (cursor = zero-padded revision number) instead of
introducing a sixth duplicate of that logic.

getLatestRevision() is now derived from the revision list rather than
a separately-stored field, so it can never drift out of sync with it.

* fix(msk): guard configuration schema upgrade and update-race in UpdateConfiguration

Old (pre-revision-history) persisted configurations have latestRevision/
serverProperties keys this class no longer maps, which previously threw and
failed the entire msk-configurations.json load; ignore them instead and
reject updates against such an entry with a 400 rather than NPE-ing.

Also serialize UpdateConfiguration's read-modify-write behind a lock so two
concurrent updates for the same ARN can no longer derive the same revision
number and silently overwrite each other's serverProperties.

* fix(msk): stop leaking mutable revision state through getters

MskConfiguration#getRevisions/getServerPropertiesByRevision returned the
live internal List/Map, which is why MskService#updateConfiguration was
mutating through them directly - and in an order (revision appended,
then its properties inserted) that let an unsynchronized reader observe
a revision with no server properties yet and NPE on Base64-encoding it.

Add MskConfiguration#addRevision to own both writes in the safe order,
and have the getters return copies so callers can no longer bypass it.

* fix(msk): guard revision reads with the same lock updateConfiguration writes under

listConfigurationRevisions/describeConfigurationRevision read revisions
and serverPropertiesByRevision - plain, non-thread-safe collections -
without holding configurationUpdateLock, so a concurrent updateConfiguration
could race the reader's iteration/copy, not just return stale data.

* fix(msk): close remaining unsynchronized-read races on configuration revisions

Two more gaps in the same family as the last fix:

- deleteConfiguration didn't take configurationUpdateLock, so it could
  race updateConfiguration and get resurrected by the update's trailing
  put(arn, ...) after the delete already removed the entry.
- getLatestRevision() is read directly from MskController with no access
  to the service's lock at all, so no per-call-site synchronized block
  can close that gap. Make revisions/serverPropertiesByRevision
  CopyOnWriteArrayList/ConcurrentHashMap instead, so every current and
  future reader is safe by construction rather than by remembering to
  take a lock it may not have access to.

* fix(msk): migrate pre-revision-history configurations onto revision 1

A configuration persisted before this PR's schema change stored a single
"latestRevision" object plus a flat "serverProperties" string. Those keys
were only being swallowed by ignoreUnknown, so the entry loaded with an
empty revision list and getLatestRevision() == null. AWS marks
Configuration's LatestRevision required, and toConfigurationView builds
into a HashMap - which keeps a key with a null value, unlike Map.of - with
no NON_NULL inclusion configured anywhere in the application. So
DescribeConfiguration and ListConfigurations emitted a required member as
an explicit "latestRevision": null for those entries, and
UpdateConfiguration rejected them permanently.

Map both old keys back onto revision 1 at load time instead. The data was
always still there, so this is a migration rather than a degradation, and
it un-breaks UpdateConfiguration for those configurations as well.

- The setters are deserialize-only: @JsonSetter is an explicit marker, so
  it survives the @JsonIgnore split on getLatestRevision() without
  re-enabling the write side. The old shape is read, never written back.
- Jackson calls the two setters in whatever order the keys sit in the
  file, so neither can assemble the revision alone; each buffers its half
  and the pair completes the migration.
- A legacy entry with no serverProperties migrates to an empty string, not
  null: serverPropertiesByRevision is a ConcurrentHashMap, which rejects
  null values, and DescribeConfigurationRevision base64-encodes what it
  finds without a null check.
- The updateConfiguration guard stays, now covering only an entry with no
  revision data at all rather than every pre-schema configuration.

Also corrects the comment in listConfigurationRevisions, which still
justified its lock by calling the collections plain and non-concurrent.
That was true when it was written but stopped being true in 93bc30e7; the
lock is kept, for consistency with describeConfigurationRevision reading
both collections, not to prevent a torn read.

Verified locally: MskServiceTest 34, MskControllerTest 2,
MskControllerIntegrationTest 20 - 0 failures, 0 errors. Reverting only the
MskConfiguration change fails 6 of the new tests, confirming they bite.
2026-08-19 21:53:33 -05:00
Michal Schreiber 7b83bd5283 feat(rds,docdb): tag DocumentDB clusters and parameter groups (#2408)
* fix(rds): tag DB and DB cluster parameter groups

The tag resolver handled db, cluster, subgrp, db-proxy and og, so tagging a
parameter group answered that Floci does not implement the type — a live account
tags both, and the terraform provider reads a group's tags as part of its read.
DocumentDB's cluster parameter groups are these records too, so the same read
fails for aws_docdb_cluster_parameter_group.

Neither model carried tags, and neither carried the ARN a caller tags by: the
create response omitted it, leaving nothing to address the group with. Both are
stored and reported now, and tags given at create are kept, as a live account
keeps them.

* feat(docdb): tag clusters and instances

aws_docdb_cluster reads a cluster's tags as part of every read, so a cluster
that created fine failed its apply on DBClusterNotFoundFault — created, but not
readable.

DocumentDB signs with the rds credential scope, and on that scope it is told
apart by Engine or a cluster/instance identifier. The tag actions carry neither,
only the ARN of the resource they address, so they reached the RDS handler,
which does not hold DocumentDB's records. The router reads that ARN now, and an
ARN naming something DocumentDB does not have still goes to RDS.

Clusters and instances store tags, keep the ones given at create, and answer the
three tag actions. Behaviour follows a live account: an existing key is
overwritten, removing a key that is not present is not an error, and an ARN in
another region or account is rejected with the one message AWS gives for both —
storage is keyed by identifier alone, so without that check an ARN naming
another region would be answered with this caller's cluster.

A tag update is a read-modify-write, so it takes the record's monitor and the
other writers take the same one; otherwise tagging a cluster while it is being
deleted stores it again. Paths that hold both take the instance's monitor before
the cluster's.

Filters on ListTagsForResource are accepted without validation: a live account
rejects an unrecognised name, but Floci carries no list of the ones it accepts,
and the tags of one named resource are the same answer either way.

* fix(rds,docdb): store an empty value for a tag given without one

A tag whose Key arrived without a Value was stored with a null, and the read
hands the tags back as an immutable copy, which rejects nulls — so one such tag
made every subsequent read of that resource fail with an internal error, not
just the tag that caused it. A live account stores an empty value and reads it
back.

Both handlers parse tags the same way and both had it.

* fix(rds,docdb): match the whole ARN when routing tags, and give legacy groups one

Two things reported on review.

Routing read the trailing name of the ResourceName ARN and looked it up in
DocumentDB storage, but RDS and DocumentDB share one ARN space: an RDS resource
whose name a DocumentDB record happens to share was answered — and mutated —
out of the wrong store, and an RDS parameter group or option group could be
resolved as a cluster. The whole stored ARN is matched now, which settles
region, account, type and name at once, as the db-cluster-id filter already
does.

And only creation assigned a parameter group's ARN, so a group persisted by an
earlier version read back without one, leaving describe with no ARN to report
and the caller nothing to tag by. The read that backfills a missing region
backfills the ARN too.

The service keeps rejecting an ARN from another region or account: the router
no longer sends it one, but the check guards its own contract, and it is
covered directly rather than through the endpoint.

* fix(rds,docdb): keep one identifier space across the RDS family

Matching the whole ARN still left one ambiguity: an RDS cluster and a
DocumentDB cluster of the same name in the same account and region produce the
same ARN, and a tag call naming it could only reach one of them.

A live account settles it — creating an Aurora cluster named like an existing
DocumentDB one is refused with DBClusterAlreadyExistsFault, because the RDS
family shares one identifier space. Floci already refused that direction, since
a create naming an identifier DocumentDB holds is routed to DocumentDB, which
answers AlreadyExists; the other direction was open, so a docdb create could
take a name RDS already had.

A create naming an identifier RDS holds now goes to RDS whatever engine it
names, so it answers AlreadyExists too and the two stores cannot both hold one
identifier — which is what makes an ARN unambiguous.

* fix(rds,docdb): report a persisted identifier held by both services

Creates can no longer put one identifier in both stores, but state written
before that can, and a restart loads it. For such a record the identifier
checks in the router already send every action to DocumentDB — describe, modify
and delete included — and have long before tags existed, so tags answer from
there too: one identifier keeps one answer, rather than a tag call reaching a
record no describe can show.

The collision is logged once per ARN, since the RDS record behind it cannot be
reached on this scope at all and only deleting one of the two records fixes it.

* fix(docdb): build cluster and instance ARNs from the caller's region

The ARN was built from the configured default region, so a caller signing for
anywhere else got back an ARN naming somewhere they were not — and since a tag
call is checked against the region it is made from, that caller could not tag
the cluster the create had just answered with.

It also reopened the identifier collision from the other side: the create-time
check looked for an RDS record in the request region while the ARN landed in
the default one, so signing the create for another region got past the check and
produced two records under one ARN. DocumentDB keys records by bare identifier,
so the check now covers every region — narrower than AWS, which allows one name
per region, but Floci cannot hold both and answer either correctly.

The check also asked about the wrong identifier for instances: CreateDBInstance
names its parent cluster, and that cluster existing in RDS is the normal case,
not a clash. Only the identifier being created is checked, and the clash is
answered with AlreadyExists directly rather than by handing the create to a
service that rejects the engine first.

* fix(rds): scope the create-time identifier check to the request's region

Widening it to every region broke what RDS actually does: names are scoped by
region, so the same instance name in two regions is two resources, and
RdsControlPlaneTest.sdkScopesTheSameDbInstanceNameBySignedRegion pins exactly
that. The second create answered DBInstanceAlreadyExists.

The cross-region case that widening was meant to cover is closed by the ARNs
instead: each carries the region it was created in, so two records of one name
in different regions never share an ARN and no tag call has to choose between
them. What must not exist is one identifier in both services in one region, and
that is what the check now asks about.

* fix(docdb): decide ownership of an identifier per region

The routing checks asked whether DocumentDB holds an identifier at all, and its
records are keyed by identifier alone, so a name DocumentDB held in one region
was taken away from RDS in every other one: the create was refused as already
existing, and a describe, modify or delete answered from the wrong region's
record.

The region now comes from the one place a record carries it — the ARN — so
DocumentDB claims an identifier only in the region it was created in. Records
written before ARNs carried the caller's region read as the configured default,
which is the region they were in fact created under.

This was true before tags existed; it becomes reachable in a way worth fixing
now that a create in another region records that region rather than the default.

* fix(docdb): check the identifier on every route into DocumentDB

The create-time check lived in the rds credential scope's branch, but
DocumentDB is reachable under its own scope too, and that one dispatches
straight to its handler — which knows only its own store. A create signed that
way could take an identifier RDS already held in the region, which is the state
the ARN matching relies on being impossible.

The check is one method now, called from both routes.

Neptune shares the same identifier space and its scope is not checked either;
that is untouched here, since this PR's invariant is about the ARN a tag call
resolves and Neptune holds no tags.

* fix(docdb): resolve a tag ARN to the record it names, not to the identifier

resolveTagTarget checked the ARN's region against the caller's and then loaded
the record by identifier, and records are keyed by identifier alone — so an ARN
whose region matched the request but named a record stored in another region
resolved to that other record, and tagged it.

Reachable on the docdb credential scope, which dispatches to this service
directly rather than through the routing that matches the whole ARN. The stored
ARN is now compared with the one asked for, and anything else is not found.
2026-08-19 20:23:32 -04:00
Michal Schreiber 06d58aad36 feat(elasticache): support cache subnet groups (#2401)
* feat(elasticache): support cache subnet groups

CreateCacheSubnetGroup was unsupported, so aws_elasticache_subnet_group could
not be created and no Redis or Valkey module placing a cluster in a VPC could
apply. DescribeCacheSubnetGroups already answered with an empty list, so the
read half existed with nothing behind it.

Adds Create, Modify and Delete, and makes the describe return what was created.

A group's VpcId and each subnet's availability zone come from the subnets rather
than the request, because that is where AWS reads them: resolving the subnets
against EC2 is part of answering, not an optional check. The service follows the
RDS DB subnet group, which faces the same problem.

Taken from a live account: the create response and its ARN, SupportedNetworkTypes
on both the group and each subnet, and the error for each rejection — subnets
that do not exist, subnets spanning two VPCs, a duplicate group, and a name that
breaks the identifier rule. Describe and delete word their not-found differently
from one another, and both are reproduced as AWS words them.

Tags given at create are stored and readable through ListTagsForResource, rather
than accepted and dropped. A modify naming no subnets keeps the stored ones as
they are instead of resolving them again, which would fail a description-only
change if a subnet had since been deleted.

* fix(elasticache): resolve subnet group subnets in the caller's region

CreateCacheSubnetGroup and a subnet-changing ModifyCacheSubnetGroup looked the
subnet ids up in the configured default region. A caller in any other region had
its own subnets rejected as invalid, and the group was reported under an ARN
built from the caller's region while its VPC and availability zones came from
somewhere else.

Resolve against the request's region, which is the region the ARN already uses.

* fix(elasticache): report a subnet group's subnets in the order they were given

describeSubnets answers in the subnet store's own scan order, and the group was
built by iterating that answer, so the order a group reported its subnets in was
arbitrary between calls — the model documents the order the caller gave.

Build the zone map from the requested ids. Adds a CLI case covering the region
the subnets are resolved in, which is what caught this: it read Subnets[0] and
disagreed with itself between runs.

* fix(elasticache): answer a missing cache subnet group with 400, not 404

The service model declares CacheSubnetGroupNotFoundFault a 400, where the
parameter-group fault a few hundred lines up is a 404 — the two really differ,
in the wire code as well as the status, and the status was carried across from
the parameter-group code. All three sites answered 404, and the integration
test pinned it there, so a client reading the status saw the wrong one.

The difference is now stated where the copy would be made, since either fault
looks like a mistake beside the other.
2026-08-19 18:03:54 -04:00
Mihai BlidaruandMihai Blidaru bba5ffb644 feat(firehose): honor CompressionFormat and FileExtension on S3 delivery (#2410)
Firehose accepted CompressionFormat on the control plane and echoed it back on
DescribeDeliveryStream, but the delivery path never read it: every delivered
object held the raw record bytes, with no compression extension in the key and
no Content-Encoding. The divergence was silent, since only a consumer reading
the delivered objects (Athena over .gz, Spark reading Snappy, anything that
decompresses by extension or encoding) ever saw the wrong bytes.

Deliveries are now compressed the way real AWS compresses them:

  UNCOMPRESSED   (no extension)  (no Content-Encoding)
  GZIP           .gz             gzip
  ZIP            .zip            zip            single deflated entry, UUID name
  Snappy         .snappy         snappy-java    xerial stream format
  HADOOP_SNAPPY  .snappy         hadoop-snappy  Hadoop block framing

Snappy is the xerial snappy-java stream format, not the official Snappy framing
format, so a consumer must use snappy-java's own reader; HADOOP_SNAPPY is the
block framing Hadoop and Spark consumers read. Both are reproduced byte for
byte against real AWS. HADOOP_SNAPPY deliberately carries .snappy rather than
the .hsnappy the S3 object name documentation tables: the service delivers
.snappy, reproduced on two separate dates, and only Content-Encoding tells the
two variants apart.

Content-Type is now application/octet-stream for every format, including
UNCOMPRESSED, matching AWS instead of the previous application/x-ndjson.

Buffered records are concatenated as bytes rather than through a String.
Record payloads are arbitrary bytes, and compression makes the corruption of
anything that is not valid UTF-8 observable.

FileExtension is implemented alongside it, since it governs the same part of
the key: it replaces the extension the compression format contributes instead
of being appended to it, the empty string means "not specified", and it changes
only the key, never the body or its Content-Encoding. Building the extension
into the key belongs to S3ObjectKeyResolver, which already owns the key format,
so the resolver now takes the destination and resolves prefix, time zone and
extension together.

Both members are validated, with the code and message shape captured from real
AWS's raw HTTP responses rather than from an SDK's rendering of them.
Unsupported values answer ValidationException naming the shape that carried
them, so the same bad value reports
extendedS3DestinationConfiguration.compressionFormat,
s3DestinationConfiguration.compressionFormat or
extendedS3DestinationUpdate.compressionFormat, which is why the wire-shape
check runs from the handler.

snappy-java becomes a direct dependency: it is the only Java library that
writes the xerial stream format, it already shipped as a runtime-scope
transitive of kafka-clients, and its version comes from the Quarkus BOM.

For the GraalVM native image the loader needs run-time initialization; left to
build-time initialization the image still builds and then dies with
UnsatisfiedLinkError on the first compression. Snappy and SnappyLoader are the
only classes on the compression path with a static initializer, which jdeps and
a set of Mandrel 25.0.4 builds confirm is the whole requirement.

Two deviations from AWS are documented rather than changed, both newly verified
while testing this: Floci appends a newline after records that lack one where
AWS inserts no separator at all, and Floci accepts streams with no destination
configuration where AWS requires exactly one complete destination.

Closes #2328

Co-authored-by: Mihai Blidaru <mihai.blidaru@lynxfctech.com>
2026-08-19 16:44:01 -04:00
Michal Schreiber 29b0d600c6 feat(rds,docdb): answer DescribeGlobalClusters (#2402)
* feat(rds,docdb): answer DescribeGlobalClusters

aws_docdb_cluster reads global cluster information as part of every cluster
read, so a cluster that created successfully failed its apply on
UnsupportedOperation — created, but not readable.

DocumentDB's signing name is rds and the action carries no engine or cluster
identifier to route on, so the request reaches RdsQueryHandler whichever service
the caller has in mind; the docdb scope Floci also accepts is answered the same
way. Global clusters are not modelled, so the list is empty, which is what a
live account with none answers.

Behaviour follows a live account: MaxRecords outside 20-100 is rejected before
the identifier is looked up, a named identifier that does not exist is
GlobalClusterNotFoundFault, and a marker is rejected after the identifier. The
response is in the RDS namespace, which is the namespace DocumentDB answers in.

Filters are accepted without validation: every name AWS accepts answers empty
here, and a partial list of accepted names would refuse filters a live account
allows.

* fix(rds): infer rds for DescribeGlobalClusters on unsigned requests

Without a credential scope the service is inferred from the action name, and an
action the RDS handler serves but the inference list does not name is dispatched
to SQS, which answers UnsupportedOperation for it.

* fix(rds): infer rds for every action the RDS handler serves

The inference list that routes unsigned Query requests named 32 of the 43
actions RdsQueryHandler dispatches. The other eleven — the cluster parameter
groups, the option groups, and both snapshot describes — were dispatched to SQS,
which answers UnsupportedOperation for them.

The two sets now match exactly: every dispatched action is inferable, and
nothing inferable is undispatched. None of the added names appear in another
service's inference list, so no existing routing changes.
2026-08-19 15:40:36 -04:00
Michal Schreiber 6b628179f3 feat(elasticache): support cache parameter groups (#2392)
* feat(elasticache): support cache parameter groups

CreateCacheParameterGroup was unsupported, so a Redis module that sets any
parameter could not apply at all — most set at least maxmemory-policy. The
describe was a stub that answered with an empty list whatever was asked of it.

Adds the group surface over the Query protocol:

- CreateCacheParameterGroup, DescribeCacheParameterGroups,
  ModifyCacheParameterGroup, DescribeCacheParameters, DeleteCacheParameterGroup
- ListTagsForResource for a parameter group ARN, without which the tags a create
  carries would be stored and never readable
- the default.* groups AWS publishes for all 13 families, derived rather than
  stored: nothing can modify or delete them, so persisting them would only add
  records to migrate and a writer to race

Taken from a live account: the create response and its ARN, IsGlobal, and the
error each rejection carries — CacheParameterGroupAlreadyExists for a duplicate,
CacheParameterGroupNotFound for an unknown group, and the identifier rule that
rejects a name containing a dot, which is also how AWS refuses to delete a
default group.

Each writer takes one monitor keyed by the group name before it reads. Guarding
the record cannot serve a create, which has no record yet, so two of them would
both pass the existence check; and a modify that resolved its record before
locking would write back a group a concurrent delete had removed.

floci does not carry AWS's per-family catalogue of parameter names, so it stores
what a caller sets and reports it with source "user". Rejecting names missing
from a partial catalogue would refuse configurations AWS accepts, so nothing is
rejected on that basis, and a request for system parameters returns none rather
than reporting user parameters under another source.

* fix(elasticache): answer tags for the ARN that was asked about

ListTagsForResource read the trailing name out of the ARN and ignored the rest,
so an ARN naming another account or region was answered with this caller's
group of the same name — a response describing a different resource than the
request identified.

The ARN is now checked before it is used, with the errors AWS gives for each:
InvalidARN for a string that is not seven components, "Unauthorized call.
Please check the region or customer id" for another region, "The resource ARN
does not belong to the caller's account." for another account, and
"<name> is not present" for a group that does not exist, which is worded
differently from the describe's not-found.

Tightening the tolerated exception in the race test, as review asked, turned up
a second problem: a modify whose group had been deleted reported "is a default
group and cannot be modified", because absence from the store was read as
proof of a published default. The two are now told apart, and both errors are
asserted directly rather than only when the race happens to expose them.

* fix(elasticache): check every component of a tag ARN, not only region and account

An ARN in another service's namespace was accepted as long as its region and
account matched, so arn:aws:rds:<region>:<account>:parametergroup:<name> was
answered with the ElastiCache group of that name — tags for a resource the
caller did not ask about.

The partition and service are checked too, with the errors AWS gives: "partition
field is wrong. Expected value is aws" and "service field is wrong. Expected
value is elasticache".

* fix(elasticache): word each parameter group not-found the way AWS words it

Three actions, three sentences on a live account. Delete omits the space after
the type name — that is verbatim, and the line now says so, because it reads
like a typo and the next person to tidy it would silently stop matching AWS.

Modify was the one that was actually wrong: it answered with describe's
sentence. A live account words it "CacheParameterGroup not found: <name>",
which is neither describe's nor delete's.

Pinned by a test that asserts all three, so the odd one cannot be quietly
aligned with the others.
2026-08-19 15:25:05 -04:00
floverfelt f8b07a78ff feat(lambda): add the ability to name and label lambda containers, code volumes (#2409) 2026-08-19 14:21:47 -04:00
AgustinBertagna 3f12428d97 feat(appsync): Phase 7 — GraphQL execute authentication (#2380)
* feat(appsync): register GraphQL execute controller in the service catalog

Unsigned POST /v1/apis/{apiId}/graphql was not a registered AppSync resource, so the data-plane path could be claimed by other catch-all routes.

* feat(appsync): default API key expiry and reject duplicate auth providers

CreateApiKey now expires in seven days when omitted, caps expiry at 365 days, and looks keys up by value. Create/UpdateGraphqlApi reject duplicate API_KEY, IAM, and Lambda providers.

* feat(appsync): authenticate GraphQL execute requests

Classify credentials by header shape and require a configured provider before GraphQL runs. Request failures return HTTP 401 UnauthorizedException on the data-plane envelope.

* feat(appsync): enforce SDL field authorization on GraphQL execute

Wrap registered fields with AuthorizationDataFetcher so directive mismatch, Cognito groups, IAM field DENY, and Lambda deniedFields stay HTTP 200 with null data and errors[].

* test(appsync): execute GraphQL over HTTP with an SDK-created API key

Cover data-plane success with x-api-key and 401 without credentials after management CreateGraphqlApi/CreateApiKey.

* fix(appsync): match missing-header 401 text and SigV4 precedence

AWS returns Missing authorization header when credentials are absent, evaluates auth before schema, and routes SigV4 Authorization ahead of x-api-key without falling back to the API key.

* fix(appsync): emit field-level Unauthorized GraphQL errors

AWS AppSync returns HTTP 200 with errorType Unauthorized and
Not Authorized to access {field} on type {type}, not UnauthorizedException.

* fix(appsync): omit sourceIp from OIDC identity

Official AppSync OIDC identity is only sub, issuer, and claims.

* fix(appsync): round API key expiry down to the hour

CreateApiKey and UpdateApiKey store expires as epoch seconds rounded
down to the nearest hour, matching the AWS API Reference.

* fix(appsync): match duplicate auth provider BadRequestException text

AWS names the 1-based additional provider index and the repeated type.

* fix(appsync): reject API key expiry outside 1-365 days

CreateApiKey and UpdateApiKey now raise ApiKeyValidityOutOfBoundsException
when expires is not between 1 and 365 days from now.

* fix(appsync): set ApiKey deletes to expires plus 60 days

AWS keeps expired da2 keys for 60 days and returns deletes as epoch
seconds rounded down to the hour.
2026-08-19 11:46:11 -04:00
Michal Schreiber 74da157681 feat(apigatewayv2): support custom domain names and API mappings (#2390)
* feat(apigatewayv2): support custom domain names and API mappings

POST /v2/domainnames was not routed, so it matched the S3 controller's catch-all
and answered with an S3 XML error about multipart uploads, which an SDK
expecting JSON cannot deserialize. The same was true of the API mappings a
domain is used through.

Adds the eight actions over the records the REST endpoints already keep, since a
custom domain is one resource in AWS reachable through both APIs. A domain
created here is therefore visible to the v1 endpoints and resolves through the
Host-header routing that already exists:

- CreateDomainName, GetDomainName, GetDomainNames, DeleteDomainName
- CreateApiMapping, GetApiMapping, GetApiMappings, DeleteApiMapping
- the mapping id is derived from what identifies the mapping, so it survives a
  restart and is the same id whichever API created it

Taken from a live AWS account rather than the service model alone, which the
model does not tell you:

- every domain reports RoutingMode API_MAPPING_ONLY and an ipv4 IpAddressType
- a create without exactly one configuration is "Invalid input. Expected one
  domain name configuration"
- a duplicate domain is BadRequestException, not a conflict — for the REST API
  too, so the shared code and the test that asserted 409 were both wrong
- deleting an API that a domain still maps to is refused: "Please remove all API
  mappings for the API from your custom domain names"
- an unknown domain is "Invalid domain name identifier specified"

Tags are stored and returned rather than dropped, which would have left
terraform with a diff it could never settle. Mutual TLS, ownership verification
certificates, routing rules and non-ipv4 address types are refused rather than
accepted and ignored, so nothing is answered with a domain that behaves
differently from the one that was asked for.

* fix(apigatewayv2): make api mapping ids unique and validate what a mapping points at

Five problems from review of the previous commit.

Mapping ids were derived by hashing the base path, so two keys sharing a Java
hash shared an id and a read or delete by that id picked between them. The base
path is encoded rather than hashed, which cannot collide.

An omitted mapping key and an explicit empty one produced two different records,
where the shared store keeps the root mapping under "(none)" and could no longer
find either from v1. Both spellings now canonicalise to the one record, and a
second attempt is the ConflictException AWS answers: "ApiMapping key already
exists for this domain name".

A mapping was accepted for an API or stage that does not exist, returning 201
for something that routes nowhere. Both are looked up first, and answer as AWS
does: "Invalid API identifier specified: <id>" and "Invalid stage identifier
specified".

The delete guard scanned only the caller's region, so an API could still be
deleted out from under a mapping made in another region. It scans every region,
since a mapping is keyed under the region of its domain rather than of its API.

A domainNameConfigurations entry that was not an object passed the size check and
then failed an unchecked cast, answering 500 instead of the AWS-shaped 400.

* fix(apigateway): canonicalise base paths on write, key mapping ids off what is stored

Canonicalising only where the v2 mapping id was derived left the collision it was
meant to remove: the store could hold "(none)", "/" and "" as separate records
that all mean the root, and folding them together at id time gave them one id for
a read or a delete to choose between.

Base paths are canonicalised where they are written instead, matching what reads
have always done. The store can no longer gain a second record meaning the root,
and a v1 mapping created as "" can now be read back as "", which it could not
before: the write kept the raw value while the read looked for the canonical one.

The id is derived from the path a record is stored under rather than its
canonical form, so state persisted before this change keeps one id per record
rather than several records sharing one. No endpoint can create such a record
now, so that property is asserted directly against the records deserialization
can restore.

* fix(apigateway): delete the mapping record that was selected, not its canonical twin

The v2 endpoints select a mapping by an id derived from the path its record is
stored under, then deleted it through the lookup that normalises the root. For a
record left under "/" or "" by state written before writes were canonicalised,
that deleted the canonical root instead and left the selected record in place.

Deletion by record now addresses the stored path exactly, so the record that
answered the lookup is the record that goes. The normalising delete stays for
callers that pass a key to look one up by, which is what the REST endpoint does.

* fix(apigatewayv2): identify a mapping by its stored key, not by the field it reports

BasePathMapping normalises an empty base path to "(none)" in its constructor, so
a record the old write path left under the key "" reports "(none)" from its own
field. Deriving the mapping id from that field gave it the canonical root's id,
and deleting by it removed the canonical root while leaving the record behind —
the collision the previous commit was meant to close, through the one door it
left open.

The service exposes mappings keyed by the base path each record is stored under,
and the v2 endpoints derive ids, resolve lookups and delete through that key. The
key is the only thing that identifies a record; the field can disagree with it.

Seeded through the storage backend the service uses, since no endpoint creates
such a record any more: the test asserts the two records keep separate ids, each
id resolves to its own record, and deleting one leaves the other.
2026-08-18 20:27:44 -04:00
Michal Schreiber 8d33c65129 feat(s3): support bucket metrics configurations (#2382)
* feat(s3): support bucket metrics configurations

PutBucketMetricsConfiguration was not routed, so a metrics call fell through to
the unqualified CreateBucket and came back as BucketAlreadyOwnedByYou, which
tells the caller nothing about what happened. The DELETE was worse: it fell
through to DeleteBucket and silently removed the whole bucket while reporting
success, so delete-bucket-metrics-configuration destroyed the bucket it was
called on.

Adds the four actions, stored per bucket and keyed by id:

- PutBucketMetricsConfiguration, GetBucketMetricsConfiguration,
  ListBucketMetricsConfigurations, DeleteBucketMetricsConfiguration
- the body is parsed and re-serialized rather than echoed back, so responses are
  built by floci and a filter survives the round trip in AWS's shape: repeated
  Tag elements inside And, with no wrapping element
- an id in the body that disagrees with the query string is MalformedXML, and an
  unknown id is NoSuchConfiguration on both get and delete, neither of which AWS
  treats as a no-op
- put and delete take the bucket monitor the other bucket-scoped mutations use,
  so concurrent puts of different ids cannot drop one another

Behaviour taken from a live AWS account: the status codes (204 on put and
delete, 404 for an unknown id), both error codes, and the exact XML of the
single-configuration and list responses.

floci records the configurations and returns them; no metrics are produced from
them, and the listing is unpaged, so a continuation token is neither issued nor
honoured.

* fix(s3): validate metrics filters, use the shared XML utilities, guard the delete

Three problems in the previous commit.

The filter was normalized rather than validated, so bodies AWS rejects were
accepted: a filter naming more than one predicate or none, an And of fewer than
two conjuncts, an unknown predicate, and a tag missing its key or value.
Verified against a live account that each is MalformedXML, and the parser now
answers the same.

Parsing and response building went around XmlParser and XmlBuilder, which
AGENTS.md requires, and the S3 namespace was declared again rather than taken
from AwsNamespaces. The bespoke DocumentBuilderFactory carried its own security
configuration, where XmlParser disables DTDs and external entities for everyone
in one place. The controller branches now delegate to handler methods like their
siblings instead of inlining the work.

A metrics mutation resolved the bucket record before writing it back, while
DeleteBucket took no monitor, so a delete landing in between was undone by the
write and the bucket returned. DeleteBucket now takes the same bucket monitor as
the bucket-scoped mutations, and those re-read the record under it, so a
mutation that lost the race reports NoSuchBucket rather than restoring the
bucket. Its test forces that interleaving rather than racing for it.

* fix(s3): reject malformed metrics bodies and stale writes over a recreated bucket

Re-reading the record for presence was not enough. A bucket deleted and then
recreated under the same name leaves a different record in the store, so a
mutation that had resolved the old one passed the presence check and wrote it
back, replacing the new bucket with the old one's state. The check now compares
the record itself, and a mutation holding a superseded one reports NoSuchBucket.

The parser also accepted bodies whose elements were duplicated or misplaced: a
second Id or Filter, or a stray element under the root, was normalized away
rather than refused, so what was stored was not what was sent. The root now has
to be exactly one Id and at most one Filter, in either order.

The concurrency tests wait on thread state rather than sleeping, so they observe
the interleaving instead of hoping for it: instant on a fast machine and not
flaky on a slow one. DeleteBucket taking the bucket monitor is asserted directly,
since the window it closes — a delete between a mutation's re-read and its write
— is too narrow to force from a test.
2026-08-18 18:46:35 -04:00
Michal Schreiber 23015a7475 fix(secretsmanager,rds): rotate secrets that an AWS service manages (#2378)
* fix(secretsmanager): rotate secrets that an AWS service manages

RotateSecret required a rotation Lambda for every secret, so a secret RDS
manages through ManageMasterUserPassword could never enable rotation:

  InvalidRequestException: You tried to enable rotation on a secret that
  doesn't already have a Lambda function ARN configured and you didn't
  include such an ARN as a parameter in this call.

AWS rotates those secrets itself, so they carry no Lambda at all. It accepts
RotateSecret with rotation rules alone, and refuses a Lambda ARN outright:
"Rotation Lambda ARN is not supported for a service-managed secret."

Key the behaviour off ownership rather than the rds! name prefix, since
anyone may create an ordinary secret called rds!something and that must not
grant it managed-rotation semantics:

- Secret carries an owningService, set by floci services only and never
  settable over the wire
- RDS marks the master user secret it creates as owned by rds, with the two
  tags AWS attaches to it
- RotateSecret needs no Lambda for an owned secret, rejects one, and skips
  the Lambda rotation lifecycle that has nothing to invoke
- DescribeSecret and ListSecrets report OwningService, and the owning-service
  ListSecrets filter matches on it instead of always returning nothing

Covered by unit tests and by a CLI compatibility test that walks the whole
path: create the instance with --manage-master-user-password, describe the
secret it produced, then rotate it with rules and no Lambda ARN.

Behaviour confirmed against a live AWS account: a db.t3.micro postgres
instance created with --manage-master-user-password, then describe-secret and
rotate-secret against the secret it produced.

* fix(secretsmanager): keep managed rotation across restarts, report a real version

Two problems in the previous commit:

A secret persisted before ownership tracking deserializes without an owning
service, so after an upgrade RotateSecret went on rejecting the Lambda-free
call these secrets are rotated with. RDS backfills ownership at startup from
the instances that name those secrets: RDS state is what makes a secret
managed, so that is what the backfill reads, never the secret's name.

RotateSecret answered a service-managed rotation with the request token as
VersionId, while nothing stages a version for that token, so reading the
advertised version failed with "can't find the specified secret version".
Report the current version instead, which exists and holds the value a caller
reads back.

* fix(secretsmanager): back-fill ownership per account, stop claiming a rotation

The startup backfill ran outside any request, so the secrets store resolved the
default account while the instances it read span every account. Secrets owned by
another account were left unmarked, and a same-named default-account secret could
be written instead. The secret's ARN names its own account and region, so
markOwnedByService takes the ARN and addresses that account's store directly.

RotateSecret also recorded LastRotatedDate for a service-managed secret while
neither the master password nor the stored value changed, so the secret claimed a
rotation that GetSecretValue and the database would contradict. floci does not
re-issue the credential, so it no longer reports one: rotation is enabled and
scheduled, and NextRotationDate still follows from the rules.

* fix(rds): never fail startup on the master user secret backfill

The backfill reads persisted state at StartupEvent, so a storage error while
scanning instances would have stopped the emulator from starting over work that
is not needed to serve requests. It now logs and moves on, per instance and for
the scan as a whole.

* fix(rds): run the secret ownership backfill after storage is loaded

The backfill observed StartupEvent, as does EmulatorLifecycle.onStart, which
calls storageFactory.loadAll(). Two observers of one event have no ordering
between them, so under hybrid or WAL storage the backfill could write ownership
into memory that the reload then replaced with the older on-disk secret, leaving
rotation rejected exactly where the backfill exists to help.

It now hangs off restorePersistedRuntime(), which the lifecycle already calls
after loadAll() for the same reason, alongside the other persisted-state fixups.
2026-08-18 17:38:11 -04:00
Michal Schreiber bc0f88c9b1 feat(ec2): support transit gateway route tables, associations and routes (#2348)
* feat(ec2): support transit gateway route tables, associations and routes

CreateTransitGatewayRouteTable, DescribeTransitGatewayRouteTables and
DeleteTransitGatewayRouteTable; Associate, Disassociate and
GetTransitGatewayRouteTableAssociations; Enable, Disable and
GetTransitGatewayRouteTablePropagations; CreateTransitGatewayRoute,
DeleteTransitGatewayRoute and SearchTransitGatewayRoutes.

Part three of #2308, on top of the gateway in #2329 and the attachments
in #2347. Backs aws_ec2_transit_gateway_route_table and the association,
propagation and route resources beside it.

Behaviour taken from a live account rather than the reference:

- a table asked for by name is neither default; only the one a gateway
  mints for itself is
- an attachment associates with exactly one table, so a second attempt is
  Resource.AlreadyAssociated rather than a move
- association reports the transitional associating and disassociating,
  while propagation reports the settled enabled and disabled at once
- enabling propagation twice is
  TransitGatewayRouteTablePropagation.Duplicate
- a blackhole is a static route in the blackhole state rather than a type
  of its own, and carries no attachment
- deleting a table is refused while it is a gateway's default association
  table, and again while attachments are associated, both IncorrectState
  with their own messages
- an id that does not exist is InvalidRouteTableID.NotFound while one of
  the wrong shape is InvalidRouteTableId.Malformed, casing included

Associations live on the attachment record rather than in a store of
their own, since an attachment has at most one; propagations are their
own records, since an attachment may propagate into several tables.

Propagated routes are derived when routes are searched, from each enabled
propagation joined to the attached VPC's CIDR blocks, rather than
written down. Storing them would go stale the moment a VPC's CIDR
associations changed, and would need invalidating from every VPC and
attachment path.

Deleting an attachment removes its propagations and leaves a static route
that named it as a blackhole, which is what the live API does: the
destination stays configured with nowhere to go. Deleting a gateway takes
its tables' propagations, routes and tags with them, so nothing outlives
the table it belongs to. Every mutation runs under the region-scoped
topology lock introduced in #2347.

* fix(ec2): keep route table operations within one gateway and one lock

Three gaps found sweeping the new surface before review rather than after
it, each checked against a live account.

A route table reached attachments of any gateway. Associating,
propagating or routing to another gateway's attachment was accepted and
recorded, leaving a table pointing at something outside its own gateway.
AWS refuses all three as though the attachment did not exist, which is
the same shape a subnet from another VPC gets, and all five call sites
now do the same.

modifyTransitGateway writes route tables through its default-table
markers but held only the gateway's striped lock, so a modify racing a
route table delete could put the deleted table back. It and
createTransitGateway now take the topology lock as well, which makes the
rule exceptionless: every write to a gateway, route table, attachment,
propagation or route happens under that one lock, acquired before any
striped one.

Deleting an attachment left its propagations and any static route naming
it behind. On AWS the propagations go and the route survives as a
blackhole - the destination stays configured with nowhere to go - and
that is now what happens here. Deleting a gateway takes its tables'
propagations, routes and tags with it, so nothing outlives the table it
belongs to.

* feat(ec2): support ReplaceTransitGatewayRoute

Completes the route surface beside create, delete and search. Backs a
provider moving a route between an attachment and a blackhole without
recreating it.

Verified on a live account: replacing a destination the table has never
held writes it rather than reporting it missing, so this is an upsert
rather than an update. The target moves as a unit - a route turned into
a blackhole keeps no attachment, and one pointed back at an attachment
regains its id, resource and resource type together.

It carries the same rules as the rest of the route table surface: the
attachment has to belong to the table's own gateway, the write happens
under the topology lock, and a route it wrote is blackholed like any
other when its attachment is deleted.

* fix(ec2): apply the route search filters instead of ignoring them

SearchTransitGatewayRoutes handled four filter names and let every other
one through a default arm that matched everything, so a search by
route-search.supernet-of-match, subnet-of-match or longest-prefix-match
returned the whole table. A plausible wrong answer rather than an error.

The three take different value forms, which the reference does not spell
out. Observed on a live account, against a table holding 10.0.0.0/8,
10.1.0.0/16, 10.1.1.0/24 and 192.168.0.0/16:

  supernet-of-match 10.1.1.0/24  -> /8, /16 and /24, the exact match included
  subnet-of-match   10.1.0.0/16  -> /16 and /24, the exact match included
  longest-prefix-match 10.1.1.5  -> /24
  longest-prefix-match 10.1.9.9  -> /16
  longest-prefix-match 8.8.8.8   -> nothing

So the containment filters take a CIDR and match inclusively in either
direction, while longest-prefix-match takes a bare address and returns
the one most specific route covering it. Handing either the other's form
returns nothing there, and now here.

An unrecognised filter name is rejected rather than ignored, matching
InvalidParameterValue: Value (nonsense) for parameter Filter is invalid.
Silently accepting one answers a question that was never asked.
2026-08-18 15:59:58 -04:00
Feyikemi Ogunsanya 36a55f5060 feat(eventbridge): add Connection API actions (#1897)
* feat(eventbridge): add Connection model and state enum

* feat(eventbridge): wire connection storage through EventBridgeService

* feat(eventbridge): implement CreateConnection

* feat(eventbridge): implement DescribeConnection and ListConnections

* feat(eventbridge): implement UpdateConnection and DeleteConnection

* feat(eventbridge): build connection responses with credential sanitization

* feat(eventbridge): dispatch Connection actions in EventBridgeHandler

* test(eventbridge): add Connection lifecycle integration test

* test(eventbridge): cover connection secret stripping and validation errors

* docs(eventbridge): document Connection actions

* fix(eventbridge): register ConnectionState for reflection and validate auth type changes

* chore: remove stray PR body helper file

* fix(eventbridge): default IsValueSecret to true when omitted on connection parameters

IsValueSecret is optional on Connection header/query/body parameters, and
AWS treats an omitted flag as secret. Reading it with asBoolean(false)
inverted that default, so a parameter that simply didn't set the flag
came back in cleartext from DescribeConnection instead of masked.

Reported by @abanna on PR #1897.

* test(eventbridge): cover DescribeConnection masking when IsValueSecret is omitted

Reproduces the leak abanna reported on PR #1897: a header parameter that
doesn't set IsValueSecret must still come back masked, not in cleartext.
Fails against the pre-fix asBoolean(false) default.
2026-08-18 09:30:25 -04:00
Matheus Oliveira 3374bfeb04 feat(rds): add option group CRUD (#2352)
Adds CreateOptionGroup, DescribeOptionGroups, ModifyOptionGroup and
DeleteOptionGroup, mirroring the DB parameter group actions. DB instances now
accept OptionGroupName and report OptionGroupMemberships, so a group still
attached to an instance faults on delete.

Fixes #2304

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-08-18 07:13:20 -04:00