Commit Graph
153 Commits
Author SHA1 Message Date
Priamo Germosen 30d8d3ff5c fix(core): route a Query action by its service's botocore model (#5879)
A Query request without a usable credential scope is routed by its
Action and Version, and IAM enforcement authorizes it under the service
that routing picks. The names each service routed were kept by hand in
AwsQueryController and had drifted from what the services serve: 170
names Floci dispatches, across eight services, reached no service and
fell through to SQS. They answered UnsupportedOperation in SQS's
namespace and were authorized as SQS actions.

Each Query service's API versions and operations now come from its
botocore models: tools/aws/regen_query_services.py writes them, from the
pinned botocore, to aws/query-services.json, and make aws-data-check
fails when the file is stale. Every name a service defines reaches it,
implemented here or not. Floci keeps the list of services and their
order, Cognito's names, which no Query model holds, and ElastiCache's
ValidateIamAuthToken, which no model defines.

A name several services define goes to the first of them when the
request names no Version. Ten such names get a pinned owner instead,
the service that serves them here, where the order would pick an
earlier one that does not. The routing parity test checks every
dispatched action with and without a Version and no longer needs its
list of known gaps.
2026-10-17 10:17:18 -05:00
Kenshin Okinaka 6aac097c82 chore(tools): generate the request shapes from one shared script (#5816)
regen_dynamodb_shapes.py and regen_sesv2_shapes.py carried the same
build() and main(); the SES v2 one only added the filter that drops
members bound to the URI, query string or headers, which leaves
DynamoDB's model unchanged since it has none. request_shapes.py now
holds load_model(), a build() that takes the generator's name, render()
and main(), and each script names its model and output. Both vendored
files regenerate unchanged.
2026-10-16 17:54:54 -05:00
Kenshin Okinaka e24a2882bc fix(ses): check v2 send request bodies against the service model (#5765)
* fix(ses): check v2 send request bodies against the service model

SendEmail, SendBulkEmail and SendCustomVerificationEmail read their
members by hand, so a member of the wrong JSON type was coerced, read as
empty, or rejected with a Floci-specific BadRequestException, depending
on which member it was. AWS deserializes the whole body against the
model first and answers the first member of the wrong type, in body
order, with a SerializationException and its deserializer message.

tools/aws/regen_sesv2_shapes.py vendors the body shapes of botocore's
SES v2 model into src/main/resources/aws/sesv2-request-shapes.json, kept
in sync by make aws-data-check like the DynamoDB shapes.
SesV2RequestShapes checks a body against them, and the three send
endpoints call it before reading any member. The type checks it makes
redundant are removed from the send helpers. A null address list
element still passes and fails as "Invalid email address null.", as on
AWS.

Only the string, blob, list, structure and map messages have been
probed, so number, boolean and timestamp members are left to their
controllers.

* fix(ses): report a null v2 send address where SES does

A null element of a v2 send address list was rejected for the whole
request while the body was read. SES lets it through deserialization
and reports it later: SendEmail answers "Invalid email address null."
after its content and sender checks and before the tenant lookup, and
SendBulkEmail reports it as the INVALID_PARAMETER status of the entry it
belongs to, of every entry for a null Reply-To, or as "Destination
cannot be empty" when no entry of the request has a non-null recipient.

The address lists now keep the null, SendEmail checks for it ahead of
the tenant gate, and the bulk entry check reports it per entry. Two
ordered integration tests that shared an @Order value get their own.

* chore(core): share the vendored request-shape model

DynamoDbRequestShapes and SesV2RequestShapes each carried the same
Shape and Model records and the same parse() and load(), and load()
repeated VendoredResources.read. RequestShapeModel in core.common now
holds that half and both checks use it; each keeps its own walk and its
protocol's messages.
2026-10-16 06:46:25 -04:00
TATSUNO “Taz” Yasuhiro 0492fc9842 feat(lambdaweb): CloudFormation types for Lambda Web Functions (#5722)
* feat(lambdaweb): CloudFormation types for Lambda Web Functions

AWS::Lambda::WebFunction, AWS::Lambda::WebFunctionRevision and
AWS::Lambda::WebFunctionEndpoint provision through the resource
registry. Ref of each is its ARN. Every property of a revision is
createOnly in the registry schema, so a changed revision mints a new one
and the displaced revision is deleted once the update commits. An
endpoint keeps its identity while its function, name, type and regions
stay the same. Fn::GetAtt on RegionalEndpoints is recorded as a gap.

Part of #5699

* fix(lambdaweb): compare a revision against the function's default log group

revisionMatches filled a request without a log group with the existing
revision's log group, so a template that dropped a custom log group kept
the old revision. The default is the function's log group, as when a
revision is created. replaceTags returns the updated function.

* fix(cloudformation): put a Lambda Web function or endpoint back after a failed stack update

A function's tags and an endpoint's mutable configuration are changed in
place on update. The provisioner now snapshots them before the change and
restores them from rollbackUpdate, as the other in-place provisioners do.
The function attributes after a tag update come from the updated
function, so UpdatedAt moves with the tag change.

* test(cloudformation): roll a Lambda Web stack update back after a failed revision

A revision that fails to create after the endpoint moved to a replaced
revision rolls the stack back. The endpoint returns to the kept revision
and the replacement is deleted. The doc page says that a CloudFormation
endpoint is always Disabled with RevisionWeights, since the schema has no
AutoDeploymentMode, and that a failed update puts in-place changes back.

* fix(cloudformation): refuse AutoDeploymentMode on a Lambda Web endpoint

The registry schema has no AutoDeploymentMode property and AWS fails a
template that sets it at validation. An endpoint from CloudFormation is
always Disabled and routes by RevisionWeights. Floci passed the property
through to the service, which accepted LatestRevision.

* refactor(lambdaweb): share the create and tag steps between the API and CloudFormation paths

createFunction and createFunctionShell both check the name and refuse a
duplicate under the function's lock. tagResource and replaceTags both
check the tags, lock, write, stamp and persist. Each pair now calls one
private helper, so the two paths cannot drift.
2026-10-15 19:02:50 -04:00
Allen Sanborn 1e423420ed fix(ec2): resolve a NAT gateway's network interface and mark its Elastic IP associated (#5622)
* fix(ec2): resolve a NAT gateway's network interface and mark its Elastic IP associated

CreateNatGateway gave each gateway address a networkInterfaceId of
"eni-" + randomHex(17), but nothing else knew about that interface:
DescribeNetworkInterfaces had no NAT arm, so the id DescribeNatGateways
publishes (aws_nat_gateway.network_interface_id) answered
InvalidNetworkInterfaceID.NotFound. The Elastic IP the gateway took was
also never marked associated, so DescribeAddresses showed a held
allocation as free.

The interface id is now derived from the gateway id, as endpoint ENIs
are, and DescribeNetworkInterfaces reports one requester-managed
nat_gateway interface per gateway address, built from the stored
address so the two reads cannot disagree. CreateNatGateway records the
association, interface and private address on the allocation (no
instanceId), and DeleteNatGateway clears them if the association is
still the gateway's.

* fix(ec2): refuse a NAT gateway on an occupied Elastic IP, keep its association, scope its ENI lookup to the account

CreateNatGateway rejects an allocation already held by an instance or another gateway
(Resource.AlreadyAssociated) under the lock that writes the association. DisassociateAddress
rejects an association owned by a NAT gateway. The NAT arm of DescribeNetworkInterfaces reads
gateways and subnets for the account asked about.

* fix(ec2): lock NAT gateway EIP release, treat a legacy gateway's EIP as held

DeleteNatGateway releases the Elastic IP under the lock CreateNatGateway
takes. CreateNatGateway also refuses an allocation any live gateway
references, covering gateways persisted before Address records were
marked. The CloudFormation networking test gives the replacement NAT
gateway a new EIP: replacement creates before it deletes, and AWS's
CreateNatGateway refuses an EIP still associated elsewhere.

* fix(ec2): AssociateAddress refuses a NAT gateway's Elastic IP; legacy gateways hold theirs

AssociateAddress checks for a gateway holding the allocation and writes
under the allocation lock CreateNatGateway and DeleteNatGateway take, so
an instance cannot take over an address the gateway still claims. The
gateway scan behind that check, and CreateNatGateway's, now includes
unmigrated pre-account-isolation gateway records for the default
account, never another account's.

* fix(ec2): scope NAT gateway ownership checks to the caller's records

callerNatGateways scanned every account's gateways before filtering. Read
the caller's own records, plus unprefixed legacy records only for the
default account.

* fix(ec2): create a NAT gateway failed on an Elastic IP already in use

CreateNatGateway with an allocation another gateway or an instance holds
no longer answers 400. As the NatGateway shape documents, the gateway is
created in state failed with FailureCode Resource.AlreadyAssociated and
FailureMessage "Elastic IP address <alloc> is already associated". It
gets no interface, claims nothing, and does not count as a holder.
AWS::EC2::NatGateway fails the resource and deletes the failed gateway.

ReleaseAddress on an allocation a NAT gateway holds, legacy gateways
included, answers InvalidIPAddress.InUse. DisassociateAddress and
ReleaseAddress run under privateIpAllocationLock. The NAT interface lookup
reads legacy unprefixed gateways and subnets for the default account. It
also loads the interface's tags, and DeleteNatGateway deletes them.
endpointEniId and natEniId become one helper, eniIdFromSeed.

* test(cloudformation): say why the replacement template keeps NatEip

The replacement template keeps NatEip for two reasons. On AWS a gateway
given an Elastic IP the displaced gateway still holds is created failed.
And Floci update cleanup deletes removed resources before the old copies
of replaced ones, so dropping the EIP while replacing its gateway would
try to release it while it is still held.

* fix(ec2): a failed NAT gateway does not pin its subnet or VPC

#5503 made DeleteSubnet and DeleteVpc refuse while a NAT gateway that is
not deleted sits in the subnet. A failed gateway was never created and
holds no interface, so it no longer counts, matching the Elastic IP
holder check.
2026-10-15 13:53:49 -04:00
Vũ Thế Huy d3fce14256 feat(redshift-serverless): add release track, managed workgroup and reservation reads (#5691)
* feat(redshift-serverless): add release track, managed workgroup and reservation reads

Add GetTrack, ListTracks, ListManagedWorkgroups, ListReservations,
ListReservationOfferings, GetReservation, GetReservationOffering and
CreateReservation so SDK, CLI and IaC clients no longer get an unknown
operation error. Floci models no zero-ETL managed workgroups and sells no
reservations, so the lists are empty and the reservation lookups answer
ResourceNotFoundException. The two release tracks are current and trailing.

Required members, patterns and lengths come from the AWS model through
RedshiftServerlessRequestShapes; only the track names, which the model leaves
unenumerated, are checked by hand.

* refactor(redshift-serverless): reuse Pagination.paginate and remove unused admin handle method

Rely on Pagination.paginate for maxResults and nextToken validation in listTracks and listWithoutItems, matching the other Redshift Serverless lists. Remove the unused handle method and its duplicate unknown-operation response in RedshiftServerlessAdminJsonHandler.
2026-10-15 13:46:35 -04:00
danielxoi fa682b2d62 fix(cloudformation): clean up, roll back and delete AWS::EC2::VPC like the other EC2 types (#5503)
* fix(cloudformation): clean up, roll back and delete AWS::EC2::VPC like the other EC2 types

A CidrBlock change, or a tenancy change other than dedicated to default,
replaces the VPC, but the provisioner never recorded the displaced one and had
no delete arm, so the old VPC was left behind; in-place Tags, EnableDnsSupport
and EnableDnsHostnames changes were not snapshotted, so a later failing
resource left the VPC changed and reported rollback as not implemented.

Ec2VpcCfnProvisioner now follows Ec2NetworkCfnProvisioner: ReplacementCleanup
records the displaced VPC and deletes it after the update commits or restores
it on rollback; a prior-state snapshot restores DNS attributes, tags and a
dedicated-to-default tenancy change on rollback, eagerly when provision itself
fails; and a delete arm through CfnDeletes.safeDelete removes the VPC on stack
teardown, tolerating only InvalidVpcID.NotFound so stack-external dependents
fail the delete with DependencyViolation, as on AWS.

* refactor(cloudformation): use the shared CfnRollback.guarded in the VPC provisioner

* fix(ec2): count instances and NAT gateways as subnet and VPC dependents

DeleteSubnet and DeleteVpc checked subnets, security groups, route tables,
ACLs, gateways and endpoints but not the instances and NAT gateways living in
a subnet, so a stack teardown could remove a subnet and its VPC out from under
an instance launched into it out of band. Both now fail with
DependencyViolation while an instance that is not terminated (shutting-down
still holds its interface) or a NAT gateway that is not deleted sits in the
subnet, as on AWS. The rollback integration test also pins Boom after the VPC
with DependsOn so the scenario cannot pass by ordering alone.

* fix(cloudformation): keep the VPC and subnet rollback snapshot until the restore succeeds

rollbackUpdate removed the in-place snapshot before restoring; a restore that
threw left the resource persisted as UPDATE_FAILED with no prior state for a
ContinueUpdateRollback retry. Ec2VpcCfnProvisioner and the pre-existing
Ec2NetworkCfnProvisioner now restore first and remove after, as the AgentCore
provisioner already did. The describeTags loop shared by Ec2Tags.reconcile and
the VPC snapshot moves to Ec2Tags.current.

* fix(ec2): count standalone network interfaces and interface endpoints as subnet dependents

A subnet is pinned by any network interface in it, not only the ones an
instance or NAT gateway owns: a standalone interface from
CreateNetworkInterface and an interface or Gateway Load Balancer endpoint
keep DeleteSubnet at DependencyViolation on AWS too. The endpoint test that
deleted a subnet out from under a live endpoint relied on that state being
reachable; it now asserts the refusal and that the published interface ids
are unchanged.

* fix(cloudformation): wait for terminated on instance delete and resolve VPC properties before creating

With real containers an instance is still shutting-down when the stack's
instance delete returns, so the subnet delete that follows was refused by the
new resident check and the stack ended DELETE_FAILED. The instance provisioner
now polls until the instance is terminated or gone, as CloudFormation does.

The VPC provisioner created the VPC before EnableDnsSupport, EnableDnsHostnames
and Tags were resolved, so a resolution failure left it untracked; the resolves
now run first, as the subnet provisioner does. Ec2Tags.current drops reserved
aws: keys so a rollback snapshot never tries to write one, and the replacement
integration test waits in the stack's own region.
2026-10-15 11:14:56 -04:00
XuJian 7f8383db38 feat(cloudformation): provision SES email identities (#4812)
* feat(cloudformation): provision SES email identities

* fix(cloudformation): retry pending SES update rollback

* fix(cloudformation): keep recovered SES resource complete

* fix(cloudformation): retain recovered SES state on failed replacement

* test(cloudformation): use shared waiter for SES DKIM verification
2026-10-15 10:26:40 -04:00
Vũ Thế Huy 77384dc3de feat(redshift-serverless): validate requests against the AWS model constraints (#5641)
* feat(redshift-serverless): validate requests against the AWS model constraints

Generate the input constraints (required members, length, pattern, enum,
number range, list size) from botocore's Redshift Serverless model with
tools/aws/regen_redshift_serverless_shapes.py and vendor them under
src/main/resources/aws, like the DynamoDB request shapes. A new
RedshiftServerlessRequestShapes check runs before dispatch and answers a
ValidationException. Pagination members are left to the services, which keep
reporting InvalidPaginationException.

Move the request parsing and error helpers that the JSON handler, the usage
limit service and the service each carried a copy of into ServerlessSupport,
so the resource families that follow share one implementation.

* fix(redshift-serverless): address review findings on request validation

- Match a model pattern against the whole value, so an unanchored pattern such
  as the account id no longer accepts a value that merely contains a match.
- Count string lengths in Unicode code points, so a tag of 200 supplementary
  characters is not rejected for exceeding 256 UTF-16 units.
- Validate only the actions the handler implements, so a modeled but
  unsupported action keeps answering UnknownOperationException.
- Read every string member through ServerlessSupport.text and reject a tag key
  or value that is not a string, so a numeric nextToken or tag member is a
  ValidationException instead of being treated as absent or coerced.
- Regenerate the vendored shapes from botocore 1.43.113, the version
  tools/aws/requirements.txt pins.
- Cover the rejected-request case with a state check, and add the pattern, code
  point, page token and tag regressions.

* refactor(redshift-serverless): use VendoredResources, ServerlessSupport.notFound and update docs
2026-10-15 09:06:46 -04:00
TATSUNO “Taz” Yasuhiro 6f78083080 feat(lambdaweb): Lambda Web Functions control plane (#5706)
* feat(lambdaweb): Lambda Web Functions control plane

The lambda-web service model (apiVersion 2025-03-07) signs as lambda, so
it is served under the lambda service at /2025-03-07/... with the AWS
wire shapes, state words and error wording of the 20 operations on web
functions, revisions, endpoints, tags and the resource policy.

Revisions and endpoints converge at once. They are stored Active and an
endpoint update is stored Successful, while the create and update
responses report the transitional state AWS reports, so a CLI waiter
settles on its first poll. Code comes from an S3 object that must exist.
IamAuth, the resource policy and the endpoint domain are stored but not
served yet.

Part of #5699

* fix(lambdaweb): carry the page position in the token

The nextToken of a list operation was a UUID keyed into an in-memory
anchor map that only grew and was not scoped to the account. The token
is now a core Pagination cursor that encodes the request (operation,
region, account, function, filters and page size) and the cursor of the
item the page ended on. A token reused with other parameters gets the
AWS "does not match the request" error and any other token the AWS
"invalid or has expired" error.

AWS issues UUID tokens and rejects any other shape, so Floci no longer
reproduces the pattern error for a malformed token.

* fix(iam): resolve a Lambda Web revision or endpoint named by its ARN

The route resource for IAM enforcement took the path segment after
revisions or endpoints as the id. A revision or endpoint ARN in that
position carries slashes, so the resource ARN ended in the ARN's first
segment and a policy scoped to the revision or endpoint did not apply.
The id is now the last segment of such an ARN.

* fix(lambdaweb): add the values of a repeated state filter

AWS lists a function when any state filter in the request names its
state. A later state filter replaced the earlier one, so a request with
state=Active followed by state=Failed listed nothing.

* fix(lambdaweb): refuse empty arrays in a resource policy

AWS answers an empty Action or Resource array with the policy syntax
error and an empty principal array with the invalid principal error,
which wins when all three are empty. Floci stored such a policy.

* fix(lambdaweb): judge a wildcard principal by the operator and value of its condition

A trusted condition key alone kept an Allow for every principal out of
the public check. AWS blocks the policy unless a positive operator pins
the key: StringNotEquals and the IfExists forms do not count, nor does a
wildcard in an account value or in the account field of an ARN value,
while a wildcard elsewhere in an ARN and a literal * under StringEquals
do.
2026-10-15 06:46:52 -04:00
Hector Ventura 3afb5b430e fix(partitions): source the China CloudFront suffix and GovCloud API Gateway zones (#5618)
* fix(partitions): source the China CloudFront suffix and GovCloud API Gateway zones

Two values listed as open questions have a published source in the China and
GovCloud user guides, so they become vendored facts in aws/region-facts.json
instead of a commercial constant.

A generated CloudFront distribution domain name ended in cloudfront.net in
every partition. The China guide's CloudFront page names the default domain
there as *.cloudfront.cn
(https://docs.amazonaws.cn/en_us/aws/latest/userguide/cloudfront.html), and
the commercial suffix is the one in the example name of the botocore
CloudFront model (Distribution$DomainName, DistributionSummary$DomainName).
floci.services.cloudfront.domain-suffix loses its cloudfront.net default and
becomes optional: unset, the suffix follows the request's partition, with the
commercial one where a partition has no CloudFront; set, it applies in every
partition as before. CloudFront distributions and streaming distributions,
Cognito and AppSync custom domains and edge-optimized API Gateway domains all
resolve it through CloudFrontEdgeDomain.domainSuffix.

A regional API Gateway custom domain reported one placeholder hosted zone id in
every region. The GovCloud guide's API Gateway page states the regional
endpoint zone for us-gov-west-1 (Z1K6XKP9SAGWDV) and us-gov-east-1
(Z3SE9ATJYCRCZJ)
(https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-abp.html);
those two regions now report it, and the generator resolves each region
through its description in partitions.json. No source gives the zone for any
other region, which keeps the placeholder and stays an open question.

The generator reads both sentences from either rendering of a guide page: the
page text, or the Markdown AWS serves at the same URL with .md, which escapes
the asterisk in the CloudFront sentence.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* fix(partitions): require each sourced fact and resolve edge domains in the request's partition

The GovCloud API Gateway page parser accepted a page stating only one
region's regional hosted zone, so an edited guide would have dropped the
other zone from region-facts.json without failing. It now requires a zone
for every aws-us-gov region.

The region-facts self check validated cloudfrontDomainSuffix only when it
was present. It now requires the suffix for aws and aws-cn, and the
regional hosted zone for both GovCloud regions, as it already requires
consoleHost; a missing commercial suffix would otherwise have reached
the orElseThrow in CloudFrontEdgeDomain.domainSuffix at runtime.

CloudFrontEdgeDomain.create resolved its partition from the region alone,
falling back to the commercial one, so an AppSync or API Gateway custom
domain in a region no partition publishes (allowed under
allow-unknown-regions) took the commercial suffix and hosted zone in a
China deployment. It now takes the partition the caller's RegionResolver
resolves, which falls back to the deployment's partition, as the
CloudFront and Cognito paths already do.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-14 19:25:56 -04:00
Mario Toffia a5228a0bf7 fix(cloudformation): apply TimeToLiveSpecification on DynamoDB tables (#4951)
* feat(dynamodb): add typed time-to-live operations to the table access

DynamoDbTableAccess gains timeToLive and updateTimeToLive next to the
stream operations. The native engine reads the TTL flag and attribute
from the table definition and calls DynamoDbService.updateTimeToLive
under the scope's account; the Local engine sends DescribeTimeToLive
and UpdateTimeToLive.

* fix(cloudformation): apply TimeToLiveSpecification on DynamoDB tables

An AWS::DynamoDB::Table declaring TimeToLiveSpecification reached
CREATE_COMPLETE while DescribeTimeToLive answered DISABLED, because the
provisioner never read the property.

The provisioner now reconciles TTL against what the table reports, so
UpdateTimeToLive is called only when the setting differs: enabled turns
it on, Enabled false or a block removed on an update turns it off with
the current attribute name, and renaming an enabled attribute fails with
the DynamoDB ValidationException before anything changes. Enabled with
no AttributeName fails with ValidationError before the table is created.

An in-place table update now records the tags, stream and TTL setting
it replaces, and rollbackUpdate puts all three back, so a stack whose
update fails on a later resource ends UPDATE_ROLLBACK_COMPLETE instead
of UPDATE_ROLLBACK_FAILED. A restore that throws keeps the snapshot.

* fix(cloudformation): roll back and clean up failed DynamoDB table provisions

A table's in-place update that failed after its snapshot, for example on
UpdateTimeToLive after the tags and the stream had changed, lost the
snapshot: the engine put the previous resource back and reported
UPDATE_ROLLBACK_COMPLETE with the changes still live. The provisioner
now retains a failed attempt that carries its snapshot, so the engine
hands it to rollbackUpdate. A failure before the snapshot changed
nothing and still uses the engine's restore.

A provision that failed after createTable left the new table behind,
on create and on a replacing update alike. The provisioner now deletes
a table this attempt created, tolerating ResourceNotFoundException, and
never one it adopted or updates in place. A delete that fails is logged
and leaves the physical id and the rollback ownership marker, so the
stack's create rollback retries it. A table recreated because the
update target was gone takes no snapshot, since it has no prior state.

* fix(cloudformation): match the AWS status reasons for invalid TimeToLiveSpecification

Renaming an enabled TTL attribute and enabling TTL without an
AttributeName now fail with the handler message AWS CloudFormation
reports, as measured in eu-west-1, and with its InvalidRequest handler
error code. The resource status reason is the AWS inner text exactly;
the type and logical id prefix are gone, since AWS does not include them.

* fix(cloudformation): scope DynamoDB table TTL to the stack and validate Enabled

- An update leaves TTL alone when neither the template nor the previous
  one declared TimeToLiveSpecification, so TTL enabled outside the stack
  survives, as on AWS.
- A TimeToLiveSpecification without Enabled, or with a non-Boolean one,
  fails model validation before the table is created.
- A replacing update whose created table cannot be deleted reports a
  rollback failure naming the table instead of leaving it untracked.
2026-10-14 15:57:36 -04:00
Hector Ventura d84a764cf9 fix(deps): bump botocore to 1.43.113 and regenerate the vendored AWS data (#5613)
Regenerate partitions.json and dynamodb-request-shapes.json from
botocore 1.43.113. The partition data gains the
training-session-runtime.sagemaker endpoint prefix under the sagemaker
signing name and lists kafkaconnect in aws-eusc. Neither changes a
service Floci serves: the new SageMaker prefix is not published in any
partition yet and api.sagemaker already is in all of them, and
kafkaconnect is not implemented. The DynamoDB request shapes are
unchanged apart from the provenance line.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-13 23:57:18 -04:00
Andre Kurait 63e0302c12 fix(apigateway): validate and normalize imported integration types (#5543)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-13 23:48:12 -04:00
Priamo Germosen eba058266b fix(iam): authorize an operation as the action AWS checks for it (#5604)
Under enforcement a request naming its operation, in a Query Action or an
X-Amz-Target header, was authorized as <namespace>:<Operation>, the operation's
own name. AWS authorizes some operations as an action of another name: SQS
SendMessageBatch, DeleteMessageBatch and ChangeMessageVisibilityBatch as
sqs:SendMessage, sqs:DeleteMessage and sqs:ChangeMessageVisibility, and SNS
PublishBatch as sns:Publish. None of the batch names is an IAM action, so a policy
AWS honours for a batch call was denied, and a policy naming the batch operation
granted something AWS does not check.

AWS publishes the mapping in the Operations of each Service Reference file.
tools/aws/regen_iam_authorized_actions.py vendors the operations authorized by
exactly one action of their own namespace under another name, 235 over 33
namespaces, into src/main/resources/aws/iam-authorized-actions.json. Everything else
keeps its own name. The generator leaves out operations that list:
- several actions, whose extras apply only when tags or a role are passed;
- no action, which is missing data;
- an action of another namespace;
- another action while one of the operation's own name exists;
- a tagging action alone;
- the same action for several SDK clients, which AWS can authorize differently,
  as S3 and S3 Control's GetPublicAccessBlock;
or whose name is listed again with another answer. A record of the wrong shape
fails the run instead of being skipped.
make iam-authorized-actions-check gates the file's shape on pull requests that touch it, and
iam-authorized-actions-verify, run by the IAM Data Drift workflow, checks every
entry against AWS.

IamAuthorizedActions reads the file through the new core.common
VendoredResources, rather than adding one more copy of the read-or-fail block a
dozen catalogs carry, and the Query and X-Amz-Target paths ask it for the action.
DynamoDB TransactGetItems, which AWS authorizes as dynamodb:GetItem, keeps its own
name: the transaction check recognizes the call by it and checks every Get as
dynamodb:GetItem on its own table, with its own dynamodb:LeadingKeys. Renamed, the
call would skip that check and be authorized as one GetItem whose body has no
top-level Key, which a ForAllValues condition accepts, so a fine-grained policy
would grant every key.

The check for operations AWS serves without credentials reads the Query action
directly, rather than through resolve with a placeholder scope, now that resolve
returns the authorized action. A Query request naming no action is not one of them.

An SDK compatibility test covers SendMessageBatch and PublishBatch, granted by
the single-item action and refused under the batch name, with enforcement on.
2026-10-13 22:29:06 -05:00
Hector Ventura 8bd88bfb40 fix(codepipeline): link approval notifications to the partition's console host (#5595)
* fix(codepipeline): link approval notifications to the partition's console host

The approval-needed notification built consoleLink and approvalReviewLink on
the commercial console host for every pipeline, so a pipeline in China or
GovCloud sent its approver to a console where the pipeline does not exist.

The console host becomes a vendored per-partition fact, consoleHost in
aws/region-facts.json, read by the generator from the user-guide snapshots
under local/aws/aws-docs/partition-guides: cn/console.md for aws-cn
(console.amazonaws.cn), gov/configure-account.md for aws-us-gov
(console.amazonaws-us-gov.com) and gov/govcloud-organizations.md for the
commercial host. The China guide also spells the host console.www.amazonaws.cn
once, in cn/managing-aws.md; the console page's own statement is the one used.
A guide page that lost its sentence, or states two hosts with it, fails the
generation instead of leaving a stale value.

CodePipelineEventPublisher resolves the host from the execution's region, since
it runs on a worker thread without a request context. No source states a
console host for the ISO or EUSC partitions, which keep the commercial one and
are listed as an open question. The path after the host stays the commercial
console's: no source gives the per-service path per partition.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* fix(codepipeline): parse the China console host from the Markdown guide page, require sourced hosts

AWS serves each user-guide page as Markdown at the same URL with .md in
place of .html, and that rendering writes the China console host as a
link, "[https://console.amazonaws.cn](https://console.amazonaws.cn).".
The aws-cn pattern only took the page-text form, so a snapshot saved
from the Markdown page failed the generator, and with it the rest of
"make aws-data-sync". The pattern now takes both forms.

The docstring names the three guide page URLs and the path each is
saved under.

self_check now requires consoleHost for the three partitions that have
a source (aws, aws-cn, aws-us-gov). The shape-only check used when the
sources are not checked out accepted a file without them, which would
link approval notifications to the commercial console.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-13 23:02:27 -04:00
Kenshin Okinaka 94a801e05f fix(deps): bump botocore to 1.43.111 and regenerate the vendored AWS data (#5498)
Regenerate partitions.json and dynamodb-request-shapes.json from the
installed botocore 1.43.111 package. DynamoDB's request type check now
covers ExportTableToPointInTime FilterSpecification.

The partition data also lists eventsv2 (aws), runtime.sagemaker
(aws-iso-e), dax (aws-us-gov) and the cloudwatch-omni / eventsv2
signing-name mappings. None of these change a service Floci serves:
dax and eventsv2 are not implemented, and the sagemaker, events and
cloudwatch signing names resolve as before.

local/aws was not checked out, so the provenance label names the installed
package and regionFlags are carried over from the previous file; the data
is otherwise identical to a local/aws generation.
2026-10-13 21:59:10 -05:00
Nazimuddin Tajuddin Basha daef71ca76 feat(guardduty): add Malware Protection plans and AWS::GuardDuty::MalwareProtectionPlan (#5373)
* feat(guardduty): add Malware Protection plans and AWS::GuardDuty::MalwareProtectionPlan

Adds CreateMalwareProtectionPlan, GetMalwareProtectionPlan,
UpdateMalwareProtectionPlan, DeleteMalwareProtectionPlan and
ListMalwareProtectionPlans, and routes plan ARNs through the shared tag
operations.

Adds a CloudFormation provisioner for AWS::GuardDuty::MalwareProtectionPlan.
Ref and Fn::GetAtt MalwareProtectionPlanId return the plan id, and Arn,
CreatedAt, Status and StatusReasons are set. Role, object prefixes, the
tagging action and tags update in place; a different BucketName is rejected
because the update API cannot change the bucket.

Management plane only: no scan runs, so a plan stays ACTIVE.

Closes #4657

* fix(guardduty): address review findings on Malware Protection plans

- Apply a plan update all-or-nothing: validate every supplied field before
  storing any, so a rejected request no longer changes the role.
- Page ListMalwareProtectionPlans by the last returned id instead of an
  offset, so deleting a plan between pages neither fails nor skips, and use
  the documented default page size of 100.
- Restore a plan on a failed CloudFormation stack update from a snapshot
  taken before the first change, and delete a plan an update created in
  place of one deleted out of band.
- Clear ObjectPrefixes and Actions on a stack update that drops them.
- Apply the creation tag rules to the shared tag routes.
- Require the role to be an IAM role ARN.
- Use explicit types instead of var.

* style(guardduty): import ArrayList instead of fully qualified name

* test(cloudformation): wire GuardDuty into CfnProvisionerFixture

CfnProvisionerFixtureTest requires every provisioner to be reachable through a public Builder setter. Add a guardDuty(...) setter that registers GuardDutyMalwareProtectionPlanCfnProvisioner.

* fix(guardduty): address second review round on Malware Protection plans

- Rolling back a stack update that recreated a plan deleted out of band now
  restores the prior plan's Arn, CreatedAt, Status and StatusReasons, not only
  its id, so Fn::GetAtt no longer names the deleted replacement. The
  out-of-band test now changes the plan's properties: unchanged resources are
  skipped on update, so it never reached the create before.
- Plan tag keys are checked against GuardDuty's documented TagKey pattern
  (^(?!aws:)[a-zA-Z+-=._:/]+$) on creation and on TagResource.
- The tag routes require the supplied ARN to equal the stored plan's ARN, so
  a matching plan id under another account, service or partition is
  ResourceNotFoundException.
- The /malware-protection-plan routes move behind a @PreMatching filter that
  rewrites only guardduty-signed requests to /_guardduty, as DlmRouteFilter
  does, so path-style S3 requests for a bucket of that name reach S3.

* style(guardduty): import Instant and List, drop em-dash, document the plan route

Review on #5373: GuardDutyController used an inline java.time.Instant and its
Javadoc carried an em-dash, which AGENTS.md rules out. The Javadoc's routing
paragraph now names /malware-protection-plan next to /detector and /admin and
says GuardDutyRouteFilter keeps a same-named S3 bucket reachable. The
CloudFormation and plan integration tests import List and nullValue instead of
spelling them out.

* refactor(core): share signed-service route rewriting across DLM, GuardDuty and Resource Explorer 2

DlmRouteFilter, GuardDutyRouteFilter and ResourceExplorer2PathRewriteFilter each
repeated the same path test, credential-scope check and rewrite. They now
delegate to SignedServiceRoute in core.common.

The helper also reads the signing service from the X-Amz-Credential query
parameter when there is no Authorization header, as ServiceEnabledFilter does
(which now uses the same lookup), so a query-signed plan request reaches
GuardDuty instead of S3.

A request sent straight to an internal prefix that is not signed for the
service is refused as S3 refuses that bucket name, rather than reaching the
service's routes. Resource Explorer 2's prefix moves from /re2 to /_re2, since
re2 is a valid bucket name.
2026-10-13 13:17:16 -04:00
Allen Sanborn 63b48342d6 feat(redshift): add snapshot copy and snapshot schedule operations (#5574)
* feat(redshift): add snapshot copy and snapshot schedule operations

Terraform's aws_redshift_snapshot_copy, aws_redshift_snapshot_schedule and
aws_redshift_snapshot_schedule_association failed with InvalidAction because
the Query handler had no arms for these actions.

- EnableSnapshotCopy / DisableSnapshotCopy / ModifySnapshotCopyRetentionPeriod
  store the copy settings on the cluster, and DescribeClusters reports
  ClusterSnapshotCopyStatus while copy is enabled. RetentionPeriod defaults
  to 7 and ManualSnapshotRetentionPeriod to -1. Faults follow the Redshift
  model: SnapshotCopyAlreadyEnabledFault, SnapshotCopyAlreadyDisabledFault,
  SnapshotCopyDisabledFault (modify), InvalidRetentionPeriodFault and
  SnapshotCopyGrantNotFoundFault.
- Create/Describe/Modify/DeleteSnapshotSchedule and
  ModifyClusterSnapshotSchedule. The association lives on the cluster, so
  DescribeSnapshotSchedules derives AssociatedClusters (state ACTIVE) and
  filters by ClusterIdentifier from it, and a deleted cluster cannot leave a
  stale association. Deleting a schedule in use is refused with
  InvalidClusterSnapshotScheduleState.
- Snapshot schedules take part in CreateTags/DeleteTags/DescribeTags as
  resource type snapshotschedule.

No snapshot is copied to another region or taken on a schedule; the docs
say so.

* fix(redshift): reject malformed snapshot schedules and in-use copy grant deletion

* fix(redshift): validate snapshot copy region and snapshot schedule identifier

EnableSnapshotCopy now refuses a DestinationRegion that is not a published
AWS region with UnknownSnapshotCopyRegionFault (404), as the model lists.

CreateSnapshotSchedule now refuses a ScheduleIdentifier containing anything
but letters, digits and hyphens with InvalidParameterValue (400). The API
reference allows alphanumerics; the management guide's example uses a hyphen.
2026-10-13 13:12:34 -04:00
Vũ Thế Huy b8e628356c feat(cloudformation): provision ElastiCache serverless caches (#5423)
* feat(cloudformation): provision ElastiCache serverless caches

Add the AWS::ElastiCache::ServerlessCache provisioner on top of the serverless cache API, with dotted Endpoint.* and ReaderEndpoint.* Fn::GetAtt attributes, in-place modification, rejected immutable changes and replacement on rename.

* fix(cloudformation): reject a malformed NoPasswordRequired on ElastiCache users

* fix(cloudformation): restore serverless cache settings on a failed update and reset removed ones

* refactor(elasticache): inject ElastiCacheService once into the serverless service

* fix(cloudformation): replace a serverless cache on its create-only properties

Register AWS::ElastiCache::ServerlessCache in create-only-properties.json so a
change to ServerlessCacheName, SubnetIds, KmsKeyId or SnapshotArnsToRestore is
reported as a replacement instead of being applied in place or ignored.

Share one Docker availability probe across the ElastiCache integration tests and
validate the tag count in one place in ElastiCacheServerlessService.

* fix(cloudformation): reject custom-named serverless cache replacement on create-only properties

* fix(cloudformation): simplify serverless create-only update check and share replacement error
2026-10-13 13:00:16 -04:00
Hector Ventura 1b7c79fd9e fix(signin): accept the cross-device redirect on each partition's sign-in host (#5557)
The cross-device redirect_uri was matched against the commercial
<region>.signin.aws.amazon.com only, so a login that resolved another
partition's Sign-In host was refused with invalid_request.

regen_partitions.py now reads botocore's signin endpoint ruleset and
vendors one signinHost per partition into aws/partitions.json. The
redirect is accepted on the Sign-In host of a region in the deployment's
partition, and another partition's host is refused. The device
authorization client ids keep their literals: the Sign-In model spells
them the same way in every partition.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-13 07:47:19 -04:00
danielxoi f50437efba feat(cloudformation): provision AWS::BedrockAgentCore::Runtime, RuntimeEndpoint and Memory (#5226)
* feat(cloudformation): provision AWS::BedrockAgentCore::Runtime, RuntimeEndpoint and Memory

The AgentCore control plane is emulated but had no CloudFormation provisioner,
so the three types fell through to the generic stub that exposes only Arn and
a template using Fn::GetAtt [Memory, MemoryArn] in an IAM policy failed the
stack. BedrockAgentCoreCfnProvisioner maps every template property the
services can store onto CreateAgentRuntime / CreateAgentRuntimeEndpoint /
CreateMemory, publishes Ref as the registry schema's primaryIdentifier and
Fn::GetAtt for every read-only property, updates in place when the
create-only properties are unchanged and replaces otherwise, and deletes on
stack teardown. Properties the emulated services have no model for are logged
once at warn and listed in the docs.

* fix(cloudformation): make AgentCore updates rollback-aware and authoritative

Reachable through CfnProvisionerFixture (two-service inference arm). In-place
updates snapshot the prior runtime, endpoint and memory configuration and tags,
restore them on rollback, and delete a created entity when a later step of the
same provision fails. The template is authoritative: UpdateAgentRuntime replaces
the full configuration as AWS's PUT does (omitted authorizer, protocol and
environment are cleared on the SDK path too), and the partial-update Memory and
Endpoint calls get a replace-omitted overload for the provisioner. Nested
AWS::NoValue members are omitted rather than stored blank, and the control
service validates networkMode and serverProtocol with the API's
ValidationException wording.

* fix(cloudformation): accept AGUI runtimes and share the guarded provision helper

The protocol check left out AGUI, which the AgentCore API and the Runtime
schema allow, so an AG-UI runtime was refused through the API and in a stack.

Ec2NetworkCfnProvisioner and BedrockAgentCoreCfnProvisioner carried the same
guarded helper; it now lives on CfnRollback, taking the provisioner's
in-place undo as a callback, and both use it.
2026-10-12 21:38:57 -04:00
Jay aff6f0eec4 fix(cloudformation): expand a SAM function's EventInvokeConfig (#5524)
* fix(cloudformation): expand a SAM function's EventInvokeConfig

SAM's EventInvokeConfig was dropped, so a function declaring retries, a maximum
event age or invoke destinations deployed with Lambda's defaults and no
destination at all. It now expands as AWS's SAM translator expands it: an
AWS::Lambda::EventInvokeConfig on $LATEST or the AutoPublishAlias alias, the
inline role policy for each destination, the SQS queue or SNS topic SAM creates
for a destination given only its Type, and SAM's conditions and error messages.

The function's Condition, DeletionPolicy and UpdateReplacePolicy now reach every
resource generated for it, as SAM passes them through. A condition naming another
with anything but a string is rejected as CloudFormation rejects it, which also
fails the template SAM produces for a conditional function with a conditional
destination, as on AWS.

* fix(cloudformation): resolve SSM parameters for the SAM transform and omit NoValue destinations

CloudFormation resolves an AWS::SSM::Parameter::Value<String> parameter before it
runs the SAM transform, so a destination Type taken from one is the stored value.
The transform now gets the given parameter values over each Default, with
SSM-typed parameters read from Parameter Store, wherever it runs.

A Destination of AWS::NoValue passes through SAM unchanged and leaves its side
without an ARN, which CloudFormation's validation rejects. The event invoke config
provisioner resolved it to an empty string and stored that; it now omits
AWS::NoValue, so the destination fails as the schema requires.

* refactor: share SHA-1 as Digests.sha1

The SAM transform's generated condition names, EC2 key pair fingerprints and
the SAML assertion name qualifier each made their own one-shot SHA-1 digest.
They now share Digests.sha1 beside sha256. Also moves samTransformParameters
above resolveSsmParameters' Javadoc, which it had been inserted beneath.
2026-10-12 18:34:39 -04:00
Vũ Thế Huy 86b32584f3 feat(cloudformation): provision ElastiCache users and user groups (#5422)
* feat(cloudformation): provision ElastiCache users and user groups

Add AWS::ElastiCache::User and AWS::ElastiCache::UserGroup provisioners with authentication mode handling, create-only UserName, membership deltas, engine changes and replacement on rename.

* fix(cloudformation): address review findings for ElastiCache users and user groups

- Require Engine property when provisioning AWS::ElastiCache::User

- Reject invalid and conflicting AuthenticationMode combinations

- Add setUserGroupMembers to atomically update group membership under lock

- Require UserIds property when provisioning AWS::ElastiCache::UserGroup

- Snapshot and restore User and UserGroup on stack update rollback

- Tighten replaced subnet group deletion assertion in integration test

* refactor(elasticache): share user authentication and user group update logic

Move the AuthenticationMode / Passwords / NoPasswordRequired decision into
UserAuthentication so the query handler and the CloudFormation provisioner
no longer duplicate it. Make modifyUserGroup and setUserGroupMembers share
one locked update path, and drop the concurrency test that passed without
the lock.
2026-10-12 14:28:27 -04:00
Alessandro Lattao 85e0061a6f feat(cloudformation): provision AWS::ApiGatewayV2::DomainName and ApiMapping (#5038)
* refactor(apigateway): move the v2 domain and API mapping rules into the service

CreateDomainName and CreateApiMapping on /v2/domainnames kept their rules in
ApiGatewayController: the one-configuration check, the refusal of inputs Floci
does not emulate, the flattening onto the shared custom-domain store, the API
and stage existence check, the mapping key conflict check, the API type the
mapping is routed as, and the mapping id. A CloudFormation provisioner cannot
reach a controller, so it would have had to copy them.

They now live in ApiGatewayService. createV2DomainName validates the body and
creates the domain; createApiMapping checks the API and stage, refuses a key
that is taken and routes the mapping as the API's protocol type; getApiMapping,
deleteApiMapping and apiMappingId follow. ApiGatewayService takes
ApiGatewayV2Service for the API and stage lookup, so the whole rule sits in one
place and a caller needs one service. Nothing on the v2 side depends on the v1
service, so this adds no cycle. Leaving the lookup in ApiGatewayV2Service was
tried first, but then every caller had to resolve the API before calling into
ApiGatewayService, and the rule was split across two classes again.

The code is moved, not rewritten: messages, error codes, the order of the
checks and the id scheme are unchanged, and the controller delegates.

* feat(cloudformation): provision AWS::ApiGatewayV2::DomainName and ApiMapping

Both types were left to the stub arm. A stack reported CREATE_COMPLETE, but no
domain or mapping existed, Fn::GetAtt on the domain resolved to literals such
as DomainResource.RegionalDomainName (so a Route 53 alias built from it pointed
nowhere), and with allow-stub-unsupported-resource-types off the stack rolled
back.

ApiGatewayV2DomainCfnProvisioner creates them through the v2 rules in
ApiGatewayService and injects only that service. Ref on a domain is its name
and Fn::GetAtt returns DomainNameArn, RegionalDomainName and
RegionalHostedZoneId as GetDomainName reports them. Ref on a mapping is its
ApiMappingId, which is also its only attribute.

Updates follow AWS. DomainName is the only createOnly property of either type,
and everything else changes in place: the domain's configuration is replaced as
a whole, as DomainNameConfigurations is on AWS, and a mapping's ApiId, Stage and
ApiMappingKey change without a new id. To keep the id across a key change, a
mapping now stores the apiMappingId it was given instead of deriving it from
its key on every read. A record persisted before is still read under the
derived id, and a new mapping gets the id it always had unless another mapping
holds it. Deriving the id and documenting the difference was the first version;
it was dropped because Ref changed where AWS keeps it, and the change set
already reported the key change as an update.

A replacement creates the new entity and leaves the displaced one to
ReplacementCleanup, so it is deleted in UPDATE_COMPLETE_CLEANUP_IN_PROGRESS,
kept under UpdateReplacePolicy: Retain, and put back when a later resource
fails the update. The first version deleted the old domain inside provision, as
the v1 provisioner does, and a failed rename then ended in
UPDATE_ROLLBACK_FAILED with the original domain and its mappings already gone.
A mapping moved to another domain gets an id the displaced mapping does not
hold, since two mappings under one physical id cannot be told apart, and the
domain of each displaced id is recorded beside the cleanup. An in-place update
snapshots what it changes, so a failed stack update restores it instead of
ending in UPDATE_ROLLBACK_FAILED.

CDK templates needed the v2 rules to match AWS in two more places.
apigateway.DomainName with a multi-level basePath maps a REST API through
AWS::ApiGatewayV2::ApiMapping, so a mapping now accepts a REST API stage. And
the restrictions AWS documents for API mappings are enforced, in the API and in
templates alike: no v2 call on an edge-optimized domain, with AWS's message;
TLS_1_2 for an HTTP API or a multi-level key, which also keeps such a domain on
TLS_1_2; no WebSocket API beside an HTTP or REST API; and AWS's key characters
and length.

The id-only delete accepts <ApiMappingId>|<DomainName>, the type's primary
identifier, which is how Cloud Control names a mapping; a bare id still answers
NotFoundException, so Cloud Control cannot report a delete that did not happen.
The integration test deploys two templates aws-cdk-lib 2.272.0 synthesized,
checked in with the app that produced them, and compat-cdk deploys the same
shapes.

* fix(apigateway): answer v2 domain and API mapping calls as API Gateway does

The review of this PR found four places where Floci answered differently
from API Gateway. Each was measured against API Gateway in eu-west-1 on
2026-10-04, with an imported certificate on a throwaway domain.

An HTTP API custom domain is regional. CreateDomainName and
UpdateDomainName with an endpoint type of PRIVATE, or one API Gateway does
not know, give a REGIONAL domain, where Floci refused the first and stored
the type on an update. EDGE is refused with "EDGE endpoint type is not
supported for APIGatewayV2 domainName", not the message for v2 calls on an
existing edge-optimized domain.

API mapping keys are checked as API Gateway checks them, with its messages:
a key does not end with '/', does not start with '/' or hold '//', holds
letters, digits and $-_.+!*'(), between its levels, and is at most 300
characters. No key, an empty one, or on a create one of whitespace only, is
the root; an update refuses whitespace only. Floci took "/" for the root and
had its own message for the characters, without the comma.

UpdateApiMapping and UpdateDomainName answer over the v2 HTTP API, not only
from CloudFormation. What an UpdateApiMapping leaves out keeps its value.

Cloud Control identifies an AWS::ApiGatewayV2::ApiMapping by the type's
primary identifier, <ApiMappingId>|<DomainName>, while CloudFormation's Ref
stays the bare id: CloudControlService derives the identifier from the
desired state, as it already names primary identifier fields by type, and
the provisioner deletes by it with the create-time attributes too.

* fix(apigateway): refuse a v2 update of an edge domain, and recover a compound identifier whole

The second review pass found three gaps in the previous commit.

UpdateDomainName through the v2 API converted a v1-created edge-optimized
domain to REGIONAL. The v2 API does not manage an edge-optimized domain, so
the update is refused with the message every other v2 call on one gets, and
the CloudFormation in-place update goes through the same check.

A v2 UpdateDomainName without a configuration returned the domain unchanged
without looking at the rest of the body, so a mutual TLS request was
silently dropped. ApiGatewayService.updateV2DomainName now refuses what
Floci does not emulate, and the edge-optimized domain, either way.

Cloud Control's recovery of a create that finished just before a restart
took the identifier after the last '|' of its key, which for an API
mapping's <ApiMappingId>|<DomainName> left only the domain. It now takes
everything after the key's third separator.

A later review pass found four more points.
UpdateApiMapping fills in what its body leaves out under the lock the update
takes, so two partial updates of one mapping cannot write back each other's
old values. A v2 domain's certificate is stored as the v1 API's regional
certificate, which is what a regional domain reports through both APIs; a
domain the v2 API wrote before still reports the one it holds until its
configuration is replaced. The domain ARN both APIs and both CloudFormation
provisioners build comes from ApiGatewayService.domainNameArn, the Cloud
Control test waits with the awaitSuccess helper main has since gained, and
requireMappingAllowed's javadoc is back on it.
2026-10-12 11:28:04 -04:00
Hector Ventura 1aabc8b4fe fix(ec2): give availability-zone ids AWS's shape, shared by EC2, flow logs and EFS (#5486)
* fix(efs): report the zone id EC2 reports for the same zone

EFS derived its own availability-zone id (use1-az1) by splitting the region
on hyphens, while EC2 publishes <region>-az<n> for subnets and zones, so a
mount target and its subnet disagreed. The abbreviation also only worked
for three-part regions: us-gov-west-1a and eusc-de-east-1a kept the whole
region. EFS now takes the id from the helper EC2 and VPC flow logs use.

Also drops an allowlist pattern for flow-log region abbreviations that
matches no source line since flow logs moved to the same helper.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* fix(ec2): give availability-zone ids AWS's shape, shared by EC2, flow logs and EFS

EC2 published <region>-az<n> as a zone id and EFS its own abbreviation, so
a mount target and its subnet disagreed and neither matched AWS in every
region. AvailabilityZoneIds in core.common now derives the id for all
three: AWS's short region prefix and -az<n> (use1-az1, apne1-az1,
usgw1-az1, cnn1-az1). The prefix rule is attested for the commercial, China
and GovCloud regions; AWS publishes no zone id for an ISO or EUSC region,
so those keep the whole region as the prefix instead of a guessed one.

Zone a is still az1, b az2, and so on: AWS maps names to ids per account,
which Floci does not model. CreateSubnet resolves AvailabilityZoneId in the
new shape and refuses the old one.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-12 06:47:02 -04:00
Anders Wasen bfa9c2fbcc feat(cloudformation): provision Application Auto Scaling targets and policies (#5407)
* feat(cloudformation): provision Application Auto Scaling targets and policies

AWS::ApplicationAutoScaling::ScalableTarget and ::ScalingPolicy had no
provisioner, so a template that scales an ECS service failed on those two
resources although the Application Auto Scaling service behind them, including
the ECS capacity adjuster, was already there. This wires the two together.

A scalable target has no name of its own: it is keyed by the triple of service
namespace, resource id and scalable dimension, and CloudFormation's Ref is those
three joined by a pipe. That composite is the physical id, which is also what a
policy's ScalingTargetId carries when a template points one at the other with
Ref, so the provisioner splits it back into the triple. A policy's Ref is its
ARN rather than its name, so deleting one resolves the ARN through
findPolicyByArn to recover the name and triple the service deletes by.

Because the target's id is derived from the triple, changing any part of it
replaces the target rather than updating it, so both types go through
ReplacementCleanup to deregister what they displaced. Deletes tolerate only
ObjectNotFoundException through CfnDeletes.safeDelete: a target takes its own
policies with it, so a stack teardown reaches an already-deleted policy by
ordinary ordering, while any other failure still surfaces as DELETE_FAILED.

The properties each schema marks required are enforced rather than defaulted.
MinCapacity and MaxCapacity on a target, and PolicyName and PolicyType on a
policy, would otherwise register a target that never scales or accept a template
CloudFormation itself rejects.

The two scaling configuration blocks are parsed by the same code the
PutScalingPolicy API path uses, extracted to ScalingConfigurationParser, since
CloudFormation spells their members exactly as the API does. One parser means a
template and an API call cannot disagree about what a policy means.

ScheduledActions on a target is logged rather than dropped silently: Floci does
not run scheduled scaling, and a template that scales on a clock should not look
fully provisioned when nothing is scheduled.

* fix(cloudformation): resolve intrinsics inside the scaling configuration blocks

Review on #5407: the two scaling configuration blocks and SuspendedState reached
the parser as raw template JSON, so an intrinsic inside one was never resolved.
That is worse than it sounds, because an intrinsic is still a non-null node:
hasNonNull passes and the value is read with asDouble, asText or asBoolean,
which answer 0, "" and false. A policy written as TargetValue: !Ref TargetCpu
registered as a policy targeting 0 percent rather than failing, a ResourceLabel
built with Fn::Join arrived empty, and a flag behind Fn::If read false.

Each block now goes through ctx.engine().resolveNode first, which is what
AutoScalingScalingPolicyCfnProvisioner already does with its own block. Only
nested objects were affected: the top-level properties were already read through
ctx.resolveOptional, which resolves.

A target's Tags were dropped as well, passed to the service as an empty map
rather than read with ctx.resolveTags.

ScheduledActions now carries a note in the generated resource-type table rather
than only a warning in the log, so the gap is visible before someone wonders why
their clock-based scaling never fires.

* test(cloudformation): make the SuspendedState intrinsic test fail without its fix

Review on #5407: anIntrinsicInsideSuspendedStateIsResolvedToo passed against the
previous commit too. REFS had no Suspend entry, so the flag resolved to an empty
string and read false either way, and assertNotNull held regardless because the
raw block was already an object. The test pinned nothing.

REFS now maps Suspend to true and the assertion is on
isDynamicScalingInSuspended(), so it fails with expected: <true> but was:
<false> when SuspendedState is read without resolveNode. The redundant copy of
the properties node is gone.
2026-10-11 12:19:25 -04:00
Priamo Germosen d884d55c26 fix(iam): evaluate every IAM action against the resource it acts on (#5404)
Under enforcement, almost every IAM action reached the policy evaluator with
* as its resource, because ResourceArnBuilder named only the server-certificate
operations and everything else fell through to the wildcard. A statement naming
an IAM resource was therefore ignored, and wrongly in both directions, because
the evaluator globs the statement's pattern against the request's resource and
a resource of * is matched as that literal string. So a Deny on
arn:aws:iam::000000000000:user/bob did not stop DeleteUser for bob, while an
Allow scoped to that same user did not permit DeleteUser on anyone at all: a
least-privilege policy naming the resource it meant to grant refused the call.
Measured both ways by reverting this resolver to the wildcard, which turns the
permitted call in aResourceScopedAllowGrantsThatUserOnly into a 403 and the
refused call in aDenyNamingOneUserLeavesTheOthersAlone into a 200. Nothing
failed and nothing warned, which is the dangerous shape for an emulator people
test policies against.

The resource type each action is evaluated against now comes from AWS's own
authorization metadata for IAM, action by action. That is not the parameter an
action happens to take: AddUserToGroup and RemoveUserFromGroup are evaluated
against the group, AddRoleToInstanceProfile and RemoveRoleFromInstanceProfile
against the instance profile, and EnableMFADevice, DeactivateMFADevice and
ResyncMFADevice against the user rather than the device they name. Mapping those
from the request's parameters would have scoped them to the wrong resource and
let a deny on the right one pass.

An action acting on a resource that exists is checked against that resource's
stored ARN. The reference gives the formats as user/${UserNameWithPath},
group/${GroupNameWithPath} and so on, so the path is part of the ARN a policy
names, and only the store knows it; the stored ARN also carries the partition
the resource was created in, which re-minting from the caller's signing region
would get wrong. A create has nothing stored, so its ARN is minted from the
request's own Path: reading a stored path there would authorize a create into
/team/ against the root path.

A policy, MFA device, SAML provider, OIDC provider or principal is named by an
ARN the request already carries, so that is passed through rather than rebuilt
from parts. Only an ARN is: a hardware MFA device's SerialNumber is a bare
serial, and naming the request after it would produce a resource no policy could
be written against.

That table is read before the one keyed by resource type, so an action in both
would silently take its ARN parameter and the mistake would look like a resource
that never matches rather than like a bug. An attach is the case that makes it
worth pinning down: it carries both a user and a policy ARN, and the reference
gives it the user alone, so it stays out of that table and
iamNamesTheUserRatherThanThePolicyOnAnAttach is what holds it there.

UpdateUser and UpdateGroup join UpdateServerCertificate in naming both the old
resource and the one the request would produce. Both are documented, which the
certificate case was not: UpdateUser's reference says the requester "must have
appropriate permissions on both the source object and the target object", and
UpdateGroup's that a principal allowed to update the old group but not the new
one has the update fail.

Two actions name their role indirectly and are derived rather than looked up.
CreateServiceLinkedRole does not name the role it creates, so the check reads
the same ServiceLinkedRoles table the create reads and cannot name a different
role. GetServiceLinkedRoleDeletionStatus carries only a DeletionTaskId, and its
reference publishes that identifier's format as
task/aws-service-role/<service-principal-name>/<role-name>/<task-uuid>, which is
the role's own path and name with a prefix in front and a uuid behind; the role
is already deleted by the time the status is asked for, so there is no stored ARN
left to read either way. The /aws-service-role/ path moved to that class, so there is one copy of
it rather than a second in the builder. GetAccessKeyLastUsed names only a key,
and is evaluated against a user: the User Guide's own iam:*AccessKey* example
scopes exactly that set to user/${aws:username}, so the owner is resolved from
the key.

That covers all 130 of the IAM actions this emulator dispatches that AWS gives a
resource type, out of 164 in total. The remaining 34 have no resource type in the
reference, such as ListUsers, GetAccountSummary and SimulateCustomPolicy, so *
is the right answer for them. An action that names its target only by defaulting
to the calling user, such as GetUser or ChangePassword with no UserName, is
resolved from the credential instead, which the last paragraph here sets out.

Nine enforcement tests drive the whole path rather than the ARN the builder
returns, since the defect was invisible: a scoped statement was ignored, not
rejected. They cover a deny that must bind to one user and leave another alone,
the stored path being part of the ARN, the group and the instance profile being
the resource where two entities are named, a managed policy named by ARN, a
create authorized against the path it asks for, a rename refused on its
destination alone, and a scoped Allow granting one user only. Reverting the
mapping to the wildcard fails all nine.

The map is vendored rather than written out here, because a hand-written copy of
AWS's metadata is exactly what tools/aws exists to prevent.
regen_iam_action_resources.py generates src/main/resources/aws/iam-action-resources.json
from the same reference, 190 actions with the resource types each is authorized
against plus the ARN format of all 15 resource types, and it gates the file the
way regen_service_namespaces.py gates the namespace list: --check offline for
shape, --verify online against AWS. A type the file claims and AWS does not fails,
since that would authorize against a resource AWS does not use, which is the one
outcome worse than the wildcard. A type or an action AWS has added is reported
without failing, because being behind leaves that action on * and failing there
would break this build for someone else's launch. make
iam-action-resources-check runs per pull request beside the namespace check, and
make iam-action-resources-verify weekly in the drift workflow. Its unit tests need
no step of their own: make aws-data-test in that same job already runs every
generator's.

So no list of actions is written down here. What stays in code is the half that is
Floci's rather than AWS's: the parameter each resource type arrives in, the nine
creates and the name each spells, the actions whose request carries an ARN, the
three resolved from something other than a name, and the three resource types
that belong only to actions the handler does not dispatch. IamActionResourcesTest
checks the code against the data: every resource type AWS uses must be resolved
or declared unresolved, every create must have exactly one type to mint, and
every minted prefix must match the ARN format AWS publishes for that type. A
regeneration that brings in a new resource type then fails a test naming the
type, rather than quietly putting that action back on *, which is the permissive
answer and a silent one. The create check reads the resolver's own map rather
than restating it, so a create added there is checked too, and the minting falls
back to the wildcard instead of indexing an empty list: a create AWS authorizes
against no single type has no ARN to build, and a request should not fail on
what is a defect in this class.

The reason each declared-unresolved type gives is a claim about the handler, not
about the builder, so nothing inside the builder can check it, and getting it
wrong is silent and fail-open: dispatching such an action without teaching the
resolver its type leaves it evaluated against *, which is the gap this closes.
UnresolvedResourceTypesIntegrationTest therefore sends every action carrying one
of those types and holds it to answering UnsupportedOperation, naming the action
and what to do if it no longer does. No other vendored-data loader validates at class init
either, so the checks read the data the way AwsPartitions and
AwsServiceNamespaces do: parse, and let the gate and the tests have the opinion.

The nineteen user actions whose UserName the model marks optional act on the
user who signed the request, so that user is the resource they resolve to. The
access key id in the credential names the identity, which is the same lookup
GetAccessKeyLastUsed already makes on a key passed as a parameter, and the
stored ARN carries the path and partition as everywhere else here. The wildcard
still stands when the signer is not an IAM user, an account's root stand-in and
a session credential having no user record to name.

What stays at the wildcard is what AWS gives no resource type, 34 of the 164.

Closes #4979

The online gate verifies the ARN formats as well as the action mapping. A format
drifts invisibly otherwise: the offline check only asks whether it still looks
like an IAM ARN, and a changed one does, while the minting reads that string to
place the resource type. So a right-looking file could build a wrong ARN.

The resource types this class covers are worked out from its own tables rather
than restated in the test, so a type cannot be waved through by adding it to a
list in the test file. That is the check the earlier startup guard made.

The three actions whose resource the request carries in some other form hold
their own resolver, rather than being listed in one place and routed by name in
another. A list cannot then say an action is handled while the dispatch has
nothing for it, since adding a key means supplying the resolver that goes with
it.

The enforcement suite removes what it creates. The emulator is shared, so a user,
group, role, profile, policy or provider left behind turns up in the next class
to list one, and the shared fixture helper grew the prerequisites IAM enforces
before a delete: group memberships and attached policies for a user, inline and
managed policies for a role and a group. A rename leaves its destination name
behind rather than the name that was created, and the create test goes through
the enforced path, so both register their own removal.

The drift workflow stays one check, and make iam-data-verify is what keeps that
honest. Two sequential steps stop at the first failure: while the namespace list
was stale, the action resource check this change adds never ran at all, so the
gate arrived unexercised in CI. The target runs both regardless of the first
result and then fails, naming the file that drifted rather than leaving a reader
to guess from one message. The workflow file is renamed to match what it covers,
and the IAM targets it uses join .PHONY, which they should have done when they
were added.

That namespace check was red because AWS retired evidently and iotevents, and
the vendored list still claimed both. Regenerating it drops those two, picks up
end-user-messaging and startups, and leaves the count at 456. A retired
namespace only narrows wildcard expansion; a policy naming one literally is
still reported, since a namespace written out is kept whether or not the catalog
knows it.
2026-10-11 09:12:29 -05:00
Vũ Thế Huy bac2c7cbf9 feat(elasticache): add serverless cache APIs (#5366)
* feat(elasticache): add serverless cache APIs

Add CreateServerlessCache, DescribeServerlessCaches, ModifyServerlessCache and DeleteServerlessCache over the Query protocol. Each cache is backed by a hidden cluster that the ordinary cluster APIs do not list, with its own user-group authentication path in the proxy.

* fix(elasticache): sua loi container rollback, validation tag, leak log stream va npipe hang

- Thu hoi container va storage khi tao Memcached provisioning that bai
- Format thong bao loi deleteCacheCluster chua cluster id
- Validate tag key trong CreateServerlessCache khi co tag value
- Chuan hoa case-insensitive cho userGroupId va region key cho nhom attachment
- Giai phong dung logStream khi stop container trong ElastiCache va Memcached container manager
- Tat validateAfterInactivity tren npipe trong FlociDockerHttpClient de tranh deadlock tren Windows

* fix(elasticache): release serverless backing on reset and make delete and list tolerant

- release backing clusters and user group attachments in clear()
- let DeleteServerlessCache be retried after the backing cluster is already gone
- keep DescribeServerlessCaches working when one cache has lost its backing
- drop the unused replaceTags and document that tags are create-only

* fix(core): drop the named-pipe stale-connection change, #5400 makes it
2026-10-11 08:53:07 -04:00
Aymen JAMAAOUI 61fe304619 feat(cloudformation): provision CloudFront public keys, key groups and functions (#5390)
* fix(cloudfront): reject CreateFunction when the name already exists

* feat(cloudformation): provision CloudFront public keys, key groups and functions

* fix(cloudformation): validate CloudFront function properties and always drop its tags on delete

* fix(cloudformation): require the CloudFront function comment and reuse resolveOptional
2026-10-11 00:16:51 -04:00
Hector Ventura c6068e8cf5 chore(iam): generate the managed-policy catalog from iam-dataset (#5403)
* chore(iam): generate the managed-policy catalog from iam-dataset

The three managed-policy resources were hand-seeded in #2194, #3237 and #3275,
so nothing noticed when AWS added or revised a policy. tools/aws/
regen_managed_policies.py now rebuilds them from the local/aws/iam-dataset
checkout: names, paths, versions and update dates from
aws/managed_policies.json, documents from aws/managedpolicies/. Deprecated
policies leave the catalog except AWSLambdaFullAccess, which #2194 kept on
purpose. createDate (from the AWS managed policy reference pages) and the
curated descriptions are not in the dataset and are carried over.

It joins make aws-data-sync and aws-data-check. CI has no iam-dataset, so
there the check verifies the three files agree and keep their shape, the way
regen_region_facts.py handles its missing corpus.

This commit changes no data; only the catalog header gains a generated-by
line. The files were taken from three dataset days, and the generator
reproduces each from its own: the names from 2026-08-12 (f18cb038), the
versions from 2026-09-08 (a52abe16), and the documents from 2026-09-08 too,
except AWSCodeStarServiceRole, which matches 2026-09-07 (1c729479).

* chore(iam): refresh the managed-policy catalog from iam-dataset 2026-09-19

make aws-data-sync against the local/aws/iam-dataset checkout (72d2a4f62,
2026-09-19). Catalog 1566 -> 1578 policies:

- 12 added: AIDevOpsChannelAccessPolicy, AIDevOpsReleaseManagementVPCPolicy,
  AWSWellArchitectedAgentOrganizationsServiceRolePolicy,
  AmazonBioDiscoveryFullAccess, AmazonBioDiscoveryInAppFullAccess,
  AmazonODBAutonomousDatabaseAdmin, AmazonODBExadataVmClusterAdmin,
  AmazonODBExascaleStorageVaultAdmin, AmazonODBExascaleVmClusterAdmin,
  AmazonSageMakerHyperPodInferenceGatewayAccess, AssuranceServiceRolePolicy,
  NetworkSecurityManagerServiceRolePolicy. All are on v1, so their
  createDate is the dataset's date.
- 0 removed.
- 22 changed: 21 moved to a new default version with a new document and
  update date (among them ReadOnlyAccess and SecurityAudit), and
  AWSCodeStarServiceRole kept v12 but took the document and update date
  the dataset recorded on 2026-09-08.

No path or description changed, and the service-linked role table still
matches the documents (make slr-check).

* chore(iam): make the managed-policy generator's date fetch and offline check stricter

--fetch-create-dates now reads the reference page of every policy past v1
that has no creation date, not only of policies new to the catalog, so a
policy first vendored without the flag can be dated by a later run. A page
that cannot be read leaves that one policy undated with a warning instead
of ending the run with nothing written.

The offline check compares the catalog with a re-render of its parsed
entries, so content outside the generated header and policy entries fails
it instead of passing unnoticed.

* chore(iam): refresh the managed-policy catalog from iam-dataset 2026-10-09

The dataset moved after the first refresh. Regenerated against 2244bd78a
(2026-10-09) with --fetch-create-dates. Catalog 1578 -> 1586 policies:

- 11 added. Ten are on v1 and take the dataset's date;
  AWSCloudWatchOmniServiceRolePolicy is on v2 and takes its creation date
  from its reference page.
- 3 removed: the CloudWatch Evidently policies, which the dataset now
  marks deprecated.
- 45 moved to a new default version, among them SecurityAudit (v94) and
  ReadOnlyAccess (v190).

The generated header said createDate falls back to the dataset's date for
a policy with no reference page. It does so only for a policy that entered
the catalog on v1; one past v1 stays undated, and the header now says so.
AWSConfigRole is still the only policy without a creation date.
2026-10-10 13:40:04 -04:00
Vũ Thế Huy 475d230ebc feat(cloudformation): provision ElastiCache cache clusters and subnet groups (#5307)
* feat(cloudformation): provision ElastiCache cache clusters and subnet groups

Add AWS::ElastiCache::CacheCluster and AWS::ElastiCache::SubnetGroup provisioners with Ref, Fn::GetAtt endpoint attributes, create-only replacement and update handling. Subnet group updates now carry tags through modifyCacheSubnetGroup, and Memcached clusters record their network type.

* fix(elasticache): validate cluster name, rollback subnet groups and preserve memcached tags

* fix(elasticache): align in-use error wire code and enforce schema required properties
2026-10-10 11:11:00 -04:00
TATSUNO “Taz” Yasuhiro e4278a800c chore(style): Enforce no-FQCN rule on new files, existing bad files later (#5094)
* chore: flag unnecessary fully qualified type names with Checkstyle

Use the built-in UnnecessaryFullyQualifiedType check. It allows a
qualified name when another type with the same simple name is used in
the same file.

The 379 files that have such names today are listed in
suppressions.xml, so only new files are checked for now. Remove an
entry once its file is clean.

* docs: drop the written no-FQCN rule now that Checkstyle checks it

* docs: keep the written no-FQCN rule for files Checkstyle still skips

The baselined files are not checked, and the comment that names a clash
is not something the check can enforce.
2026-10-10 09:22:14 -05:00
Mario Toffia 233d05eab1 docs(cloudformation): scope required AppSync resources (#4897)
The AppSync page did not say which AWS::AppSync resource types
CloudFormation provisions, what Ref and Fn::GetAtt return for them, or
what happens to the AppSync types Floci does not serve. A CDK app that
deploys a GraphQL API had to read the provisioner to find out.

The page now has a CloudFormation section. It lists the six provisioned
types with their Ref value and Fn::GetAtt attributes, and the
differences measured by deploying the same template to AWS and to
Floci: Ref on GraphQLApi and ApiKey returns the id where AWS returns the
ARN, GraphQLEndpointArn is not modeled, the URL and DNS attributes point
at Floci, and AWS refuses Fn::GetAtt Id on a GraphQLSchema while Floci
resolves it. It also states that a schema given only by S3 location
and S3 code locations are refused, and that the remaining AppSync types
are stubbed by default.

The generated CloudFormation resource-type table gets a row note with
the Ref difference and a link to that section.
2026-10-09 14:54:03 -04:00
David Phillips da6a7dd085 build: enforce Java import order with Checkstyle (#5326)
* style: align Java imports with project guidelines

* build: enforce consistent Java import order

* style: follow IntelliJ import order
2026-10-08 20:50:53 -04:00
Priamo Germosen df4fa58ea1 fix(iam): take service-linked role names and suffix support from AWS evidence (#5293)
CreateServiceLinkedRole guessed both things it cannot derive. The role name came
from capitalising the principal, which is wrong for 141 of the 162 services the
table covers: acm.amazonaws.com is AWSServiceRoleForCertificateManager on AWS and
was AWSServiceRoleForAcm here. And a CustomSuffix was accepted for every service,
where AWS refuses one for 68 of the 71 it has been recorded against, so the
emulator minted roles AWS would have rejected outright.

Both now come from iam/service-linked-roles.tsv, generated by
tools/slr/service_linked_roles.py and gated by make slr-check. One table, because
both facts come out of one pass over the same AWS-validated snapshot: the name
from a recorded create response, the suffix verdict from the test's own
parameterisation. Writing either by hand only captures what someone noticed, and
every finding behind this change came from grepping.

Sources, each row recording its own: recording, actual create responses and the only
source that can establish suffix support; policy-documents, role ARNs in the vendored
AWS managed policies, names only; and docs, from AWS's own service-linked role
pages, quoted and linked in the generator. Counts live in the table's header, where
this script keeps them right.

Two shapes in the policy documents have to be refused rather than read, and both
were being read. A name followed by `*` is a prefix pattern: the policy writes
AWSServiceRoleForAmazonCognitoIdpEmail* where the recorded create returns
AWSServiceRoleForAmazonCognitoIdpEmailService, so reading the prefix invents a role
AWS never mints. Twenty-one principals rested on nothing but such a prefix. And a
role name is unique per account, which these documents ignore: they point
maintenance.elasticbeanstalk at the parent's AWSServiceRoleForElasticBeanstalk, so
taking that at face value made the sibling's create fail as a duplicate of a role
it does not own. A collision guard drops the weaker row back to the derived
fallback and says so; an unresolvable collision is an error for a human.

KNOWN_SOURCE_CONFLICTS is empty as a result. Its one entry was never a
disagreement between sources, only that truncated prefix read as a name. The
mechanism stays for a real one.

make slr-check runs offline: policy-documents rows must still match the vendored
JSON, every vendored service must be in the table, it must be sorted, and a suffix
verdict on a non-recording row is an error because nothing but a recording can
establish one. Three extraction traps have a test each, all three being ones the
real data walked into: an underscore can be part of a name, so splitting on the
CustomSuffix separator truncates ApplicationAutoScaling_CassandraTable; a policy
matching suffixed roles writes the prefix with a trailing separator; and a
wildcard ARN names a role without saying which principal mints it, which is how an
earlier pass handed plain GuardDuty the MalwareProtection role's name.

The name was not only wrong against AWS, it was inconsistent within the tree.
ConnectService built an ARN for AWSServiceRoleForAmazonConnect while
CreateServiceLinkedRole minted AWSServiceRoleForConnect for the same principal:
two roles for one purpose. GuardDutyService, MacieController and RamController
each hard-coded their own name too, and all four were right where IamService was
wrong. They read the table now, and a test fails if a principal any of them builds
an ARN for loses its row, since the fallback would quietly derive a name again.

ApplicationAutoScalingService was wrong a different way. It maps a namespace to a
dimension itself, and had no arm for appstream, cassandra, ec2 or sagemaker, so
all four fell to CustomResource where AWS names them AppStreamFleet,
CassandraTable, EC2SpotFleetRequest and SageMakerEndpoint. It prefers the table
now and keeps its switch for the namespaces nothing records, where the shape is
right even when the dimension is a guess. Its dynamodb arm is gone with the rest:
the table covers that namespace, so the arm was unreachable and a second copy of a
fact the table owns, free to disagree with it while never running. A test pins
dynamodb resolving through the table, since removing the arm is what left nothing
else covering it.

Two behaviour changes worth calling out. rds.amazonaws.com is AWSServiceRoleForRDS
rather than the derived Rds, which flipped one existing expectation. And two table
names are long enough that a suffix alone breaches the 64-character RoleName
limit, ApplicationDiscoveryService's ContinuousExport role leaving three
characters and SageMakerEndpoint six, so that check now reports "The role name"
rather than "The derived role name", which stopped being true.

cloud9 is in the table because deleting IamService's three-entry override map
dropped it: autoscaling and ram were covered, cloud9 was not, and it regressed to
the derived AWSServiceRoleForCloud9. Two tests caught it. Rather than restore the
literal, which is the circular sourcing this work exists to remove, its User Guide
settles it and the row carries that citation.

The table is registered in quarkus.native.resources.includes rather than exempted
from it. AwsManagedPolicies is exempt because parsing its 3.5 MB at image build time
and keeping the result in the heap beats shipping the source twice; at 13 KB that
saving is not worth depending on the static initialiser running at build time, and
NativeImageResourceIncludesTest is the thing that says so.

The header records the sha256 of the snapshot the recording rows came from, because
that half cannot be rechecked offline and --check can only say so rather than fix
it. A digest makes the next --refresh a diff against a known source: an unchanged
digest means any difference in the table came from the vendored policy documents,
and a changed one says the recordings moved with it. --check cannot verify the
digest without the snapshot, but it does reject a table that has quietly lost the
line, or one claiming no snapshot while carrying recording rows.

Refs #5084
2026-10-08 07:49:50 -05:00
Hector Ventura 8a1d1ddcd3 fix(partition): read strict-mode service availability from endpoint rulesets too (#5231)
* fix(partition): read strict-mode service availability from endpoint rulesets too

Strict partition mode refused services AWS serves. The per-partition
service list came from botocore's endpoints.json alone, which leaves out
IAM, Route 53, Budgets and Cost Explorer in aws-eusc and IAM and Cost
Explorer in aws-iso-e, although each service's endpoint ruleset has an
explicit branch for the partition (iam.eusc-de-east-1.amazonaws.eu). The
generator now adds those partitions, for services endpoints.json lists
somewhere, and records them under servicesFromRulesets.

The execute-api signing name was mapped to Connect Participant only, so
IAM-authorized API Gateway invokes were refused in China, EUSC and the
ISO partitions. A signing name is now left out of the alias map when a
service whose own endpoint prefix is that name is listed nowhere, so
strict mode no longer judges execute-api.

The docs and config comments no longer say IAM is absent from aws-eusc.

* test(partition): assert API Gateway answers the strict-mode execute-api probe

The execute-api strict-mode test accepted any response but a 200 that
lacked the strict-mode error, so a 500 or an unrelated rejection would
also pass. It now requires API Gateway's own answer for a missing API:
a 404 NotFoundException with "Invalid API id specified".
2026-10-06 23:07:22 -04:00
Hector Ventura 1b61945f28 fix(partition): hold escaped host regexes to the DNS suffix gate (#5232)
The partition literal gate's dns-suffix pattern matched amazonaws.com but
not a Java regex that escapes its dots (amazonaws\\.com), so hand-written
host patterns escaped it. With the dots allowed to be escaped, the gate
found two on main:

- ECR's pull-through cache recognised an ecr upstream only on the
  commercial and China suffixes, while Floci's own registry recognises an
  ECR image URI in every partition. The upstream host pattern is now
  built from AwsPartitions.dnsSuffixRegex() the same way.
- The console sign-in host pattern in SigninService has no published
  non-commercial form, so it carries a partition-literal escape like the
  console literals beside it.
2026-10-06 22:49:23 -04:00
Matheus Oliveira c6304a26c8 feat(cloudformation): provision AWS::Transfer::User (#5076)
* feat(cloudformation): provision AWS::Transfer::User

Adds the user type to TransferCfnProvisioner with in-place update and replacement.

* Fix #4655

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

* docs: count the IAM SSH public key operations in the service matrix

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

---------

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-10-04 18:19:43 -04:00
Vũ Thế Huy 99a6b4050c feat(redshift-serverless): add running workgroups and Data API WorkgroupName support (#5012)
* feat(redshift-serverless): add running workgroups and Data API WorkgroupName support

Redshift Serverless workgroups get full CRUD (Create/Get/List/Update/Delete),
tagging by ARN, and the AWS::RedshiftServerless::Namespace and ::Workgroup
CloudFormation types with dotted Fn::GetAtt keys taken from the registry
schema. A namespace has at most one workgroup, and DeleteNamespace is refused
while one is attached.

Each workgroup runs a PostgreSQL container behind an authenticating proxy,
sharing the managers and the proxy port pool with provisioned Redshift. Add
GetCredentials, accept WorkgroupName (name or ARN) in the Redshift Data API,
and push a changed namespace adminUserPassword down to the running backend.
The runtime is re-attached when Floci restarts.

Not covered: snapshots, usage limits, endpoint access, and COPY/UNLOAD/Spectrum
on workgroups.

* fix(redshift-serverless): stop the runtime when workgroup creation fails after it started

If persisting the workgroup record failed after the container and proxy were
already running, the runtime was left behind with no record. createWorkgroup
now stops it (best effort) and releases the endpoint on the failure path.

Fix the CloudFormation error for a NamespaceName change: suggesting a new
WorkgroupName can never succeed because a namespace holds only one workgroup.

* fix(redshift-serverless): reset omitted CloudFormation properties and order startup observers

When UpdateStack drops a property from the template, the provisioner now sends
its default (BaseCapacity, EnhancedVpcRouting, PubliclyAccessible, Port,
TrackName, PricePerformanceTarget) instead of keeping the stored value, which
matches CloudFormation semantics. MaxCapacity has no default and keeps its
stored value.

Give the workgroup StartupEvent observer a @Priority after RedshiftService so
every persisted cluster has reserved its proxy port before workgroups restore
theirs.

Also remove an unused import and move DEFAULT_DATABASE to the top of
RedshiftContainerManager.

* fix(redshift-serverless): address review findings on password rotation and namespace updates

- Roll the backend password back when a rotation cannot be completed or stored, and apply
  it last so validation failures never leave the backend ahead of the stored namespace.
- Keep a workgroup endpoint reserved when its runtime cannot be stopped during clear().
- Reject an in-place DbName change in CloudFormation, since it is fixed at creation.
- Reset an omitted KmsKeyId and DefaultIamRoleArn on CloudFormation updates.

* fix(redshift-serverless): keep rollback failures from masking errors and drop stale GetAtt role

- Do not reset the proxy password when the role restore fails, and attach restore
  failures to the original exception instead of replacing it.
- Remove Namespace.DefaultIamRoleArn from the stack resource when an update no
  longer declares a default role.

* docs: correct the Redshift Serverless operation count in the service matrix

* fix(redshift-serverless): expose Workgroup.ConfigParameters through Fn::GetAtt

* fix(redshift-serverless): parse ConfigParameters resolved from a GetAtt attribute

* docs(redshift-serverless): list every unsupported operation group
2026-10-04 15:34:24 -04:00
Mario Toffia 66f04cde25 feat(eventbridge): provision AWS::Events::Archive (#4818)
* fix(eventbridge): make UpdateArchive a partial update

UpdateArchive reset the event pattern to null and the retention to 0
whenever a request omitted them. On AWS an omitted Description,
EventPattern or RetentionDays keeps the stored value, an empty
Description or EventPattern clears it, and RetentionDays 0 sets 0.

* feat(eventbridge): provision AWS::Events::Archive

CloudFormation stubbed AWS::Events::Archive with a fake ARN and created
nothing. EventsArchiveCfnProvisioner now creates a real archive through
EventBridgeService.

Ref is the archive name and Fn::GetAtt Arn the archive ARN. ArchiveName
is generated when omitted and kept across updates. Description,
EventPattern and RetentionDays update in place, sending only the
properties the template declares, and a failed stack update restores
them from a snapshot. Changing SourceArn or ArchiveName, or dropping an
explicit name, replaces the archive and deletes the displaced one once
the update commits. A replacement that keeps an explicit name is refused
with CloudFormation's custom-named resource error before any change.
KmsKeyIdentifier is ignored.

Closes #4815

* fix(eventbridge): reject an archive source that is not an existing bus of the account and region

CreateArchive now checks EventSourceArn as AWS does, before the archive
name: a bus in another account fails with AccessDeniedException, one in
another region with ValidationException, and a bus that does not exist
with ResourceNotFoundException. The AWS::Events::Archive provisioner goes
through the same service call, so a stack can no longer reach
CREATE_COMPLETE with an archive that could never capture an event.

* test(eventbridge): roll back an in-place archive update when a later resource fails

A stack update changes an archive's description and retention in place,
then fails on a second archive whose source bus does not exist. The stack
ends UPDATE_ROLLBACK_COMPLETE, DescribeArchive shows the original values
and the second archive was never created. The golden case passes on AWS
and is mirrored in the Floci integration test.

* fix(cloudformation): refuse declaring a generated archive name explicitly

Adding ArchiveName with the name CloudFormation generated for an unnamed
archive asks AWS to replace the archive under the same custom name, which
it refuses with the custom-named resource error and rolls the stack back.
Floci took the in-place path and reached UPDATE_COMPLETE; the existing
refusal now also fires when the previous name was generated.

* fix(cloudformation): provision a real archive when updating a stack whose archive was stubbed

A stack created before AWS::Events::Archive had a provisioner holds the dispatcher's stub, whose physical id names no archive. Its next update now creates the archive instead of failing to describe that id, and the stub id is left to the replacement cleanup.

* fix(eventbridge): validate archive description, pattern and retention as CreateArchive and UpdateArchive do

CreateArchive and UpdateArchive now reject a description over 512 characters, an event pattern over 4096 characters and a negative retention with the ValidationException AWS returns, all violations reported together. The check runs before the source, existence and duplicate checks, so it also fails the AWS::Events::Archive resource in a stack.
2026-10-04 13:39:49 -04:00
TATSUNO “Taz” Yasuhiro ace5cbfc63 chore(style): replace var in more files no open PR touches (#5071)
* chore: replace var with explicit types in src/main files no open PR touches

* chore: replace var with explicit types in src/test files no open PR touches

* chore: replace var with explicit types in sdk-test-java files no open PR touches
2026-10-04 10:08:48 -05:00
Aswin A 4d980a361f fix(docs): prevent stale service action counts (#5018)
* fix(docs): prevent stale service action counts

* test(docs): validate composite service action counts

* fix(docs): clarify action count validation coverage

* fix(docs): derive shared tagging route counts

* fix(docs): align service action counts
2026-10-04 08:18:53 -04:00
TATSUNO “Taz” Yasuhiro 4e842a85aa chore(style): replace var in files no open PR touches (#4789)
* chore(style): replace var with explicit types in src/main

Drop the NoVar suppressions of the src/main files that no open PR touches.

* chore(style): replace var with explicit types in src/test

Drop the NoVar suppressions of the src/test files that no open PR touches.

* chore(style): replace var with explicit types in sdk-test-java

Drop the NoVar suppressions of the compatibility test files that no open PR touches.
2026-10-02 17:45:36 -05:00
Hector Ventura ae216f22a0 chore(core): gate comparisons of a partition with the literal "aws" (#4892)
* chore(core): gate comparisons of a partition with the literal "aws"

The five checks #4791 fixed compared a parsed ARN's partition with "aws", so
RDS, ElastiCache and RAM broke silently outside the commercial partition, and
make partition-check could not see them: a bare "aws" is not an arn:aws:
prefix. partition_literals.py gains a gated aws-partition-compare category,
scanned over the code with comments and text blocks blanked, that catches
"aws".equals(...), .equals("aws"), their equalsIgnoreCase forms and
Objects.equals with "aws". Run against main before #4791 it reports exactly
those five sites.

The three remaining uses compare an account, a command name and a reserved
SSM name prefix, not a partition, and are escaped with a reason. AGENTS.md
states the rule next to the other partition rules, so reviews flag it too.
The audit table sizes its columns to the longest category name.

Part of #4272.

* chore(core): end the Objects.equals match at its call and gate switch labels on "aws"

Greptile on #4892: the Objects.equals arm read past the call's closing
parenthesis, so foo(Objects.equals(a, b), "aws") matched a comparison that is
not there; each argument now allows one level of nested calls and the match
ends at the call's own parenthesis. And a switch on a partition branched on
"aws" without a match, so case labels naming "aws", alone or in a list, are
caught too. main has none, so no new escapes and the baseline stays empty.
2026-10-02 09:36:30 -04:00
XuJian bcb50b765f feat(cloudformation): provision Transfer Family servers (#4809)
* feat(cloudformation): provision Transfer Family servers

* fix(cloudformation): clear Transfer update snapshot after success

* test(cloudformation): cover Transfer tag rollback

* fix(cloudformation): match Transfer server return values
2026-10-01 22:28:47 -04:00
Hector Ventura 27ddf0bb00 fix(core): mint every regionless ARN in its partition and gate blank-region Arn.of calls (#4787)
* fix(core): mint every regionless ARN in its partition and gate blank-region Arn.of calls

Part of #4272 (P10a). Arn.of derives the partition from the region, so a
blank region always minted arn:aws:, and the partition literal gate could not
see it because it is a call shape, not a literal. Sixteen call sites did this,
and three gated literals were left:

- RdsSigV4Validator built the rds-db:connect resource as arn:aws:rds-db:, so a
  China IAM policy naming arn:aws-cn:rds-db: never matched and IAM auth to an
  RDS proxy was denied there.
- CloudFront, Organizations, Cost Explorer anomaly monitors and the SSO portal
  role ARN now take the request's partition (RegionResolver injected).
- S3 bucket ARNs (event notifications, AWS::S3::Bucket Arn, Cost Explorer S3
  usage) take the bucket's or the stack region's partition; the Lambda CFN
  default role, the Kinesis ESM invokeIdentityArn, the EC2 launch template
  CreatedBy and the SQS AddPermission root principal take their own region's.
- FlinkContainerManager's fallback key goes through Arn.of, and the
  CloudFormation S3 TemplateURL host check accepts every partition's DNS suffix.

partition_literals.py gains a gated, code-scoped blank-region-arn category
(Arn.of with a "" or null region, comments excluded). The baseline is now
empty, so any new literal or blank-region mint fails Partition Literals.

* fix(core): scan blank-region Arn.of calls across lines and skip text blocks

Greptile on #4787: the blank-region-arn category ran per line, so a call whose
region argument sits on the next line escaped it, and text-block contents were
kept, so an example inside one would count as a call against the empty
baseline. code_text now blanks comments and text blocks over the whole source
and the code categories match across lines, reporting the line the call starts
on.
2026-10-01 00:32:39 -04:00
TATSUNO “Taz” Yasuhiro 76adb9a97e chore(style): Enforce NoVar rule on new files, existing bad files later (#4362)
* chore: ban var with Checkstyle in CI

Checkstyle runs tools/checkstyle/checkstyle.xml over src and compatibility-tests/sdk-test-java in its own workflow. It stays out of the Maven lifecycle because a full run takes about 30 seconds.

Code that already uses var is listed in tools/checkstyle/suppressions.xml, one entry per service and one per compatibility-tests file, so each can be cleaned and removed in its own PR.

* docs: point AGENTS.md and CONTRIBUTING.md at Checkstyle

* chore: load Checkstyle suppressions from checkstyle.xml

IDE plugins such as CheckStyle-IDEA set config_loc to the config directory and now apply the same suppressions as CI. Maven sets config_loc through propertyExpansion.

* chore: exclude files, not directories, from the var check

New files in services that still use var are now checked too.

* chore: exclude the renamed NativeDynamoDbJsonHandler files from the var check
2026-09-30 21:53:14 -05:00
Mario Toffia a338a430cc feat(cloudformation): provision Cloud Map namespaces and services (#4599)
* feat(cloudformation): provision Cloud Map namespaces and services

AWS::ServiceDiscovery::PrivateDnsNamespace, PublicDnsNamespace,
HttpNamespace and Service were stubbed, so a stack reported them created
while nothing existed in Cloud Map and Fn::GetAtt resolved to literals.

CloudMapCfnProvisioner creates them through CloudMapService. Ref returns
the id; Fn::GetAtt exposes Id and Arn, HostedZoneId on a DNS namespace and
Name on a service. An unnamed service is named <LogicalId>-<12 chars>, as
measured on AWS. Description, DnsConfig, HealthCheckConfig and Tags update
in place; a createOnly change replaces the resource through
ReplacementCleanup, and a rolled-back replacement restores the createOnly
record. A Ref to a Number parameter is coerced back to a JSON number for
DnsRecords TTL and FailureThreshold.

Closes #4596
* fix(cloudformation): roll back in-place Cloud Map updates

An in-place namespace or service update followed by a later resource
failing left the Cloud Map changes live and the stack in
UPDATE_ROLLBACK_FAILED, since rollbackUpdate only undid replacements.
The provisioner now keeps the description, DnsConfig, HealthCheckConfig
and tags an in-place update overwrites and puts them back on rollback;
a committed update drops the snapshot.
* fix(cloudmap): reject DNS record type changes on service update

UpdateService only changes the TTLs of a service's existing DNS records on AWS. An in-place CloudFormation update that changes the record types, or gives a DnsConfig to a service without one, now fails with InvalidInput instead of being applied, so it rolls back like on AWS and a rollback never has to remove a DnsConfig.
* fix(cloudmap): accept only TTL changes in a service DnsConfig update

UpdateService carries only DnsRecords on AWS and CloudFormation does not support a RoutingPolicy update. Comparing the record types as a set let a RoutingPolicy change or an added record of the same type through; the requested and stored DnsConfig now have to match apart from the TTLs.
* fix(cloudmap): ignore DNS record order in a service DnsConfig update

A TTL-only update that listed the same records in another order was rejected. The comparison now uses the sorted record types, so counts, types and RoutingPolicy still have to match.
* test(cloudformation): restore a real HealthCheckConfig in the Cloud Map rollback test

The in-place rollback test went from a null health check config to null, so dropping it from the snapshot would have passed.
2026-09-30 21:45:18 -05:00
Hector Ventura 0bc85f3ef8 fix(sts): mint global STS and IAM ARNs per partition and add a strict partition mode (#4743)
* fix(sts): mint global STS and IAM ARNs per partition and add a strict partition mode

GetCallerIdentity's root fallback, the AssumeRole family's session ARNs, the
OIDC provider ARN and GetFederationToken built their ARNs with an empty
region, which falls back to the commercial partition, so they carried arn:aws:
whatever partition the request signed. They now go through
RegionResolver.buildGlobalArn. GetAccountSummary reports
GlobalEndpointTokenVersion only where the partition publishes a global STS
host, which is aws alone.

floci.partitions.strict (FLOCI_PARTITIONS_STRICT, default false) refuses a
request signed for a service AWS publishes in another partition but not in
the request's one (CloudFront in GovCloud, IAM in aws-eusc) with the
unknown-service guard's 404, mirroring the host that never resolves on AWS.
endpoints.json omits the services that ship only an endpoint ruleset, so a
service the data lists nowhere is served everywhere. Credential scopes carry
signing names, and 46 of them differ from the endpoints.json keys they cover
(73 keys, such as ecr for api.ecr); regen_partitions.py vendors that map as
signingNames and AwsPartition.offersSigningName joins it.

Part of #4272

* fix(core): read the gzipped botocore models the pip package ships when collecting signing names

The botocore wheel ships each service model as service-2.json.gz, while the checkout under local/aws/botocore ships it plain. collect_signing_names looked only for the plain file, so in CI, which resolves botocore to the installed package, it found no models, generated an empty signingNames and failed aws-data-check against the committed map. It now reads either form, as regen_dynamodb_shapes.py already does.

* fix(sts): keep an assumed-role session in its role's partition, and answer strict-mode Query requests in XML

GetCallerIdentity rebuilt an assumed-role session's ARN with an empty region, which falls back to the commercial partition, so a session AssumeRole issued as arn:aws-cn:sts:: came back as arn:aws:sts::, and a chained AssumeRole was then refused by a China trust policy as a caller from another partition. The session ARN now takes the partition its role ARN names.

Strict partition mode refused a form-encoded Query request (IAM in aws-eusc) with a JSON body; it now returns the Query XML error the unknown-region guard beside it already returns for such requests.

* fix(iam): mint IAM resource ARNs in the request's partition and keep them there

CreateUser, CreateGroup, CreateRole, CreatePolicy, CreateInstanceProfile and
CreateOpenIDConnectProvider minted arn:aws: whatever partition the request
signed, while STS now followed the request. Under China that denied
AssumeRoleWithWebIdentity (the trust policy names the arn:aws: provider ARN
CreateOpenIDConnectProvider returned, matched against arn:aws-cn:), and
AssumeRole reported the request's partition while GetCallerIdentity reported
the role's.

An IAM resource is now created in the request's partition and keeps it:
UpdateUser and UpdateGroup re-mint in the stored ARN's partition. Anything
derived from a stored role follows the role: all three AssumeRole handlers,
resolveCallerArn and the web identity OIDC provider ARN take the role ARN's
partition through AwsArnUtils.partitionOrDefault. The credential report's
root row takes the request's partition.

* fix(sts): mint a session from the stored role, and keep one credential report per partition

AssumeRole, AssumeRoleWithWebIdentity and AssumeRoleWithSAML find the role by
account and name, but minted the session ARN from the RoleArn the request
named. A China role assumed with an arn:aws: RoleArn therefore came back as an
arn:aws:sts:: session, while AssumeRole registered the session under the
stored role's ARN, so GetCallerIdentity reported aws-cn. All three handlers
now mint the session from the stored role's ARN when the role exists and
register it under the same ARN.

The credential report was cached once per account, so a report generated for
one partition was handed to a caller in another for four hours, with the
wrong partition's root row. It is now kept per partition.
2026-09-30 20:48:20 -04:00