Use a shared task result for all mock-backend failures without changing
their scripts, the two role-default lookup scripts included, and retrieve
each result in the test that started it.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Retrying a failed zero-ETL destination reloaded it through the admin connection without checking the caller, so a role that could not create the database still got it back. The retry now checks the caller's own privileges first: it goes ahead only for a superuser, or a role with CREATEDB that is a member of the database's owner, and otherwise refuses with PostgreSQL's own "permission denied to create database". The database name is quoted with PostgresWire.quoteLiteral. A nightly Docker check runs each condition against a real PostgreSQL 16, and both test classes share one fixture.
A child process holds a copy of every socket the JVM has open until it
execs, so a listener a test has just closed keeps its port bound for that
moment. S3DistCpProgramTest starts python3 while RdsProxyManagerTest
rebinds one port two hundred times, and the rebind failed with "Address
already in use" on main and on open pull requests.
ParallelLocksInventoryTest now counts a plain class that starts a process,
directly or through a src/test or src/main class that does, as one that
needs ParallelLocks.PORTS, and the fifteen classes it finds take it in
READ mode. ParallelLocks and AGENTS.md say why.
GetUsagePlanKeys ignored limit and position and returned every key attached to the plan in one response. It now pages with the same id-ordered pageById helper and pageResponse envelope GetUsagePlans and GetAuthorizers use: 25 keys by default, 500 at most, limit=0 rejected, position on nonterminal pages only, and an unknown position rejected with BadRequestException. GetUsage and the data plane keep the unpaged list.
Closes#9062
AWS::S3::BucketPolicy resolves its PolicyDocument through resolveJsonAttribute before storing it, so a Ref or Fn::Sub that returns the policy as text is stored as written instead of being serialized again into a quoted string. AWS::ECR::Repository's RepositoryPolicyText uses the same resolver in place of its own copy of the unwrap. An SDK test covers a policy written as an object, as a string and through Fn::Sub, checking the stored JSON and the denied read after create and after an unchanged update.
With floci.services.rds.endpoints-in-vpc on, each instance of an Aurora DB
cluster gets its own address in its VPC, as a standalone instance does, and
serves the cluster's port, which the API reference says "is managed by the
cluster". The cluster reports the names the Aurora user guide gives its
endpoints, <cluster>.cluster-<identifier>, <cluster>.cluster-ro-<identifier>
and <endpoint>.cluster-custom-<identifier>, and Floci's DNS server resolves
them to the instances as Aurora points them: the cluster endpoint to the
writer, following a failover; the reader endpoint to another instance, or
the writer when none is served; a custom endpoint to one of the instances it
holds, picked at random, and none once its static members are all deleted.
Answers live five seconds, the TTL of Aurora's DNS zones. A Multi-AZ DB
cluster, whose instances Floci does not create, and an Aurora Serverless v1
cluster, which has none, keep the proxy endpoint.
The names are routed again whenever a cluster's instances, writer or custom
endpoints change, under one lock, and are restored at restart. An IAM token
generated for any of a cluster's names is good at each of its instances, and
the proxies' certificate covers the names. StopDBCluster removes the
instances' relays and StartDBCluster serves them again; a failed instance
create forgets its name and leaves the names as they were; a cluster
restored from a snapshot serves the snapshot's port.
Refs #6273
Step Functions tasks that pass a role now get the iam:PassRole checks a direct request of the same operation gets: ECS RunTask and UpdateService, Scheduler CreateSchedule and UpdateSchedule, the CloudFormation stack and StackSet operations, and EMR createCluster, which takes the passed-role table's RunJobFlow reading, the JobFlowRole instance profile passing its roles to EC2. The role lookups move from IamEnforcementFilter to PassedRoleLookups, shared by the filter and the task checks. DynamoDB tasks offer the condition keys a direct request gets (dynamodb:LeadingKeys, dynamodb:Attributes, dynamodb:Select) from the extraction moved to DynamoDbConditionKeys, a write is checked once per return mode, and optimized getItem and scan tasks return only the projection they were checked for.
AWS's Service Reference lists iam:PassRole for RunJobFlow, passing its
roles to application-autoscaling.amazonaws.com, ec2.amazonaws.com and
elasticmapreduce.amazonaws.com without saying which member's role goes
where, and JobFlowRole names an instance profile rather than a role.
The passed-roles table left the operation unread, so a caller allowed
elasticmapreduce:RunJobFlow could launch a cluster with any service role
and any instance profile.
A new vendored source, tools/aws/sources/emr-roles.json, written by its
own script from the EMR API reference, management guide and AWS CLI
reference, gives each member's role. The guide's page of each role names
its default role ("The default role name is EMR_EC2_DefaultRole"), and
the full access policy it gives users passes each default role to one
service ("iam:PassedToService": "ec2.amazonaws.com*"). The API reference
calls JobFlowRole an instance profile ("Also called instance profile and
Amazon EC2 role"), and the CLI reference's create-cluster examples give
the roles by name (--service-role EMR_DefaultRole). The steps' runtime
role, StepExecutionRoleArn, is not passed: "You can control access to
the runtime role with the condition key elasticmapreduce:ExecutionRoleArn."
The generator reads the source through ROLE_SOURCES, as it reads EKS's,
now taking a documented iam:PassedToService over a trust policy, a member
by name or as an instance profile where the source says so, and leaving
out a member whose role a condition key controls. RunJobFlow moves out of
notRead: ServiceRole to elasticmapreduce.amazonaws.com and AutoScalingRole
to application-autoscaling.amazonaws.com, each by name or ARN, and the
roles of the instance profile JobFlowRole names, by name or ARN, to
ec2.amazonaws.com, found with the instance-profile lookup RunInstances
already uses. A profile IAM does not hold passes no role, as Floci's EMR
already reads JobFlowRole. An instance-profile member is not read for a
call with no request of its own, which has no such lookup.
The instance profile is now found one way everywhere it is used
(IamService.instanceProfileNamed): by its name, or by its own ARN, path
and account included. IAM's passed-role check, EMR's step role and an
EC2 instance's credentials each read it their own way, and EMR kept only
the name after an ARN's last slash. A JobFlowRole ARN of another account
or path then found no role to check but ran the steps as the local
profile's role.
A member's JSON value is now read as the text a handler reads it as, a
number or a Boolean included, as the request resources and condition
keys already read a body's values. The passed-roles reader took strings
alone, while EMR takes "JobFlowRole":123456 as the profile 123456, so a
role named by a number went unchecked.
BatchIsAuthorized and BatchIsAuthorizedWithToken share one requireBatchSize check against MAX_BATCH_REQUESTS = 30, the API reference's "An array of up to 30 requests", in place of an inline copy in each action. Behavior is unchanged. Tests cover 30 requests accepted and 31 refused on both actions, a missing, empty or non-array batch, and the refusal end to end.
PutEvents counts each entry's size as the EventBridge User Guide gives it: 14 bytes for an explicit Time, plus the UTF-8 bytes of Source, DetailType, Detail and every Resources entry. A request whose entries total more than 1 MiB is refused with ValidationException "Total size of the entries in the request is over the limit." before any entry is published.
An EventBridge rule's EventPattern is read through CloudFormationTemplateEngine.resolveJsonAttribute, as the archive provisioner's is, in place of the rule's own resolve, null check and text-or-JSON step. A string pattern still reaches PutRule as written and an object is serialized once. The rule provisioner and AppSync target fixtures call the real conversion on their mocked engines.
A v2 SendEmail or SendBulkEmail naming a stored template was not checked
on that template, so a policy granting or denying ses:SendEmail on one
template did not reach a v2 send with it. The request-resources generator
now reads, from botocore's shapes, the name and ARN members of a structure
named after a resource type inside a request structure
(Content.Template.TemplateName and TemplateArn, DefaultContent.Template
for bulk sends), and the table and its reader accept a field of a
structure inside a structure.
With TLS on, CreateEventSource and DescribeEventSource add *.c01.events-webhook.<region>.<host> to Floci's generated server certificate, so a client that verifies the certificate accepts a source's webhook URL. One wildcard covers every source of a Region. The source is stored under the service lock and the certificate is reissued outside it, as the API Gateway, Cognito and IoT custom domain operations do. A user-provided certificate is not changed. The TLS handshake test helper is shared through TlsTestSupport.
With the new opt-in floci.services.rds.endpoints-in-vpc, a standalone DB
instance gets its own address in the subnet of its Availability Zone, as on
RDS, and serves the Port it was created with, or its engine's default, under
the name RDS gives it: <instance>.<identifier>.<region>.rds.<dnsSuffix>, with
one identifier per account and Region. Floci's DNS server answers the name
with the address, so two instances can both serve 5432.
A relay container at the address forwards each connection to the instance's
auth proxy, so IAM authentication, TLS and the master login are unchanged;
IAM tokens bind to the name and port the proxy binding publishes. The
address follows the instance through create, stop and start, a backend
started on retry, a move to another DB subnet group, a blue/green
switchover, delete, a failed create and a restart, and keeps its subnet and
VPC in use for DeleteSubnet and DeleteVpc.
VpcAddressRelays serves any endpoint this way next to VpcContainerLeases,
which now takes back a preferred address; RdsDnsRecordSource answers the
names, and AwsEndpoints builds them. Clusters and DB proxies keep the proxy
endpoint for now.
Refs #6273
CreateCluster and UpdateClusterConfig take EKS Auto Mode's node role in
computeConfig.nodeRoleArn. AWS's Service Reference lists iam:PassRole
for both operations, with iam:PassedToService ec2.amazonaws.com and
eks.amazonaws.com, but not which member's role goes to which service.
Floci never checked the node role: CreateCluster read only its cluster
role, by hand, and UpdateClusterConfig was left out of the table.
A new vendored source, tools/aws/sources/eks-roles.json, written by its
own script from the EKS API reference and user guide, gives each member's
role and the service its trust policy is for. CreateCluster's roleArn is
the cluster IAM role ("provides permissions for the Kubernetes control
plane"), whose page links from the member and whose trust policy names
eks.amazonaws.com. nodeRoleArn is "the IAM Role EKS will assign to EC2
Managed Instances", whose description names the EKS Auto Mode IAM
reference, whose node IAM role section links the guide's page of that
role, whose trust policy names ec2.amazonaws.com. The generator reads
the source (ROLE_SOURCES) to choose, among the services the Service
Reference names for an operation, the one each member's role is for. It
fails on a vendored role for a service the reference does not name, and
on one no operation reads. --verify checks the source against the live
pages.
So CreateCluster now needs iam:PassRole on roleArn for eks.amazonaws.com
and on computeConfig.nodeRoleArn for ec2.amazonaws.com, and
UpdateClusterConfig on its node role for ec2.amazonaws.com. Both move
into the generated table. So do CreateNodegroup, CreateFargateProfile,
CreateAddon and UpdateAddon, whose roles PassedRoles read by hand, the
same members to eks.amazonaws.com the generator gives from botocore and
the Service Reference. Their hand readers are gone, and Step Functions'
EKS tasks now check them as a direct request does.
StatisticValues sent beside Values and Counts is read as a summary of the same distribution, so the weighted samples are kept without counting the summary twice. A conflicting scalar Value or a malformed summary still fails before anything is published. The weighted-summary and metric-math alarm tests share one JSON-to-Query conversion in CloudWatchTestRequests.
PutBucketReplication passes the Role of its ReplicationConfiguration to
S3, and AWS's Service Reference lists iam:PassRole for it with
iam:PassedToService s3.amazonaws.com. Floci never checked it: the
passed-roles table recorded the operation as not read, because its
request body is XML, so a caller allowed s3:PutReplicationConfiguration
could name any role.
PassedRoles now reads a REST-XML body the way the condition keys of a
REST-XML request are read (XmlParser.valuesAt): each member at the
elements botocore serializes it as, below the document element, a
list's elements under the name its shape gives them or as member. The
text is read without surrounding whitespace, which S3 keeps in a Role it
accepts. The generator reads rest-xml models too, and fails on a role
member reached through a map or a flattened list, which an XML body
does not nest as the table's paths do. Two operations move from notRead
into the table: S3's PutBucketReplication (Role, to s3) and S3 Access
Grants' CreateAccessGrantsLocation (IAMRoleArn, with no named service).
Form parameters are now read only from a request the Query controller
dispatches (IamActionRegistry.isQueryRequest: a form posted to the root
path), as formParameters already documented. A request to another
protocol's route is read as its handler reads it, whatever Content-Type
it is sent with: an S3 replication configuration sent as
application/x-www-form-urlencoded was parsed as one form key, so its role
went unchecked while S3 stored the XML. The same held for tag-on-create
and request resources reading a REST request's JSON body.
S3's PutBucketReplication now refuses with MalformedXML a document that
is not well-formed as a whole, or whose configuration does not hold
exactly one Role with text, as it already counts each rule's Destination
and Bucket. It read the first Role anywhere in the document from a parse
that stopped where the configuration ended, so a second Role holding an
element, or content after the configuration, left IAM reading no role
while S3 stored the document.
The table is keyed by operation, as the Service Reference lists it, but
the enforcement filter and the Step Functions request checks looked it
up by the IAM action. The two differ for PutBucketReplication, which is
authorized as s3:PutReplicationConfiguration, so its entry would never
have been found. Both now look roles up by the request's operation, as
tag-on-create already does. DMS's ModifyDataProvider and
ModifyMigrationProject, authorized as UpdateDataProvider and
UpdateMigrationProject, are found the same way once Floci serves them.
Capacity providers are stored under region::name and resolved through their ARN's region, so DescribeCapacityProviders lists only the region's own and a name is free in each region; a provider stored under its bare name is re-filed on its next write, its legacy key dropped only when the ARN matches. Account settings carry the region in their key, as botocore's PutAccountSetting says they are set per Region, and a row stored without one is the default region's. The CloudFormation capacity provider provisioner passes the stack's region. FARGATE and FARGATE_SPOT stay built in to every region.
Renaming an AWS::RDS::DBInstance created the new instance in the stack's Region but deleted the old one through the Region-less deleteDbInstance, which uses the default Region. A stack outside the default Region left its old instance behind, and could delete a same-named instance in the default Region. The delete now passes the stack's Region.
A cluster's trino-exchange-manager now makes Trino's
exchange-manager.properties, for fault-tolerant execution. With no
properties it is EMR's default, spooling in the cluster's HDFS in
trino-exchange/ under the trino user's home; exchange.base-directories
with exchange.use-local-hdfs names HDFS directories, and an s3://
directory spools in Floci's S3. The Trino project's Trino refuses EMR's
exchange.use-local-hdfs and an hdfs:// directory in a filesystem exchange
manager, so Floci leaves the first out and gives HDFS directories Trino's
own hdfs exchange manager, with a core-site.xml naming the cluster's
NameNode as its hdfs.config.resources: without one, Trino takes an hdfs://
directory for another file system's ("Wrong FS ... expected: file:///").
CreateEventSource refuses a webhook HMAC SecretValue over 512 bytes, checked right after the 16-byte minimum, as RotateWebhookCredentials already does. A static token and a Basic password over 512 bytes stay accepted.
RevokeResource answered UnsupportedOperation. It now revokes a webhook event source or a subscriber for good. A revoked source answers 403 on its webhook URL and refuses UpdateEventSource and RotateWebhookCredentials with InvalidStateException. A revoked subscriber receives no more events and refuses UpdateSubscriber the same way. Both can still be described, listed and deleted, and report Revoked once revoked while leaving the member out before.
DeleteEventBus ignores revoked sources and subscribers, which outlive their bus under a key a new bus of the same name cannot reach. ListSubscribers pages by bus name, subscriber name and ARN, so an orphan and its namesake on the recreated bus both show.
A rule's update rollback snapshot also records its prior physical ID, ARN, name and bus, and restores them once the targets are back, so a rename or bus move that a later resource fails leaves the stack on the original rule. A failed target restore keeps the snapshot for ContinueUpdateRollback, and a rule moved to the default bus no longer keeps a stale EventBusName.
Under enforcement a REST route no rule maps and no vendored model names
runs unchecked. AWS AppConfig with its data plane, AWS CodeArtifact and
Amazon CodeGuru Reviewer were among those: Floci serves each and no rule
mapped them.
Vendors the appconfig, appconfigdata, codeartifact and codeguru-reviewer
models' routes, 120 operations, so each request is checked as its
operation's action: a caller holding no grant for one is now refused
where the request used to pass. A request signed with a vendored model's
own name, which Floci also serves (appconfigdata), is checked under the
signing name the routes file records for that model (appconfig).
The three namespaces join the table of request resources. CodeArtifact's
48 operations and CodeGuru Reviewer's 14 read every type the Service
Authorization Reference marks required. Nine of AppConfig's 58 act on a
required type the table reads no member for (a deployment, a hosted
configuration version, an experiment run, a configuration profile named
as Configuration), so those are checked on the types it does read.
AppConfig Data's StartConfigurationSession is checked on the application
its ApplicationIdentifier names by its id or its name, from a measured
entry quoting AWS's own refusal of it on application/<app_id>, and
GetLatestConfiguration on the configuration of the session its
ConfigurationToken names: a reading gives a request's token that a
create of its service answers as naming what that create's session is
on, which the service finds.
A request member whose botocore shape is an account id now gives the
account of what the request names wherever a REST request carries it,
its path and query too, as the generator's own rule says, not only in
its body: CodeArtifact's domain-owner, QuickSight's AwsAccountId path
label on 196 operations, and Signer's GetSigningProfile profileOwner.
Such a resource in another account than the caller's is named as an ARN
of another account already is, in that account and as the caller's of
that name too, unless its service acts on it in that account. Signer,
ECR, CodeArtifact and Redshift do and say so, so each is checked on that
account's resource alone, as AWS checks it: Signer now reads the profile
or job its profileOwner or jobOwner names in that account, as AWS does,
where it read the caller's own, and saves a job it revokes there. Such a
request needs the owner's grant beside the caller's own policy, as AWS
requires of a cross-account request: CodeArtifact gives IAM a domain's
and a repository's policy, and Signer the profile permissions
AddProfilePermission adds, as the resource's policy (ResourcePolicyProvider),
a permission of one profile version holding for that version alone: a
job's, the version that signed it.
A resource a request names by another spelling than its service stores
it under is checked as the service reads it (resolveStoredArn, now also
for an ARN the reader builds from members): an AppConfig environment or
configuration profile by its id when named by its name, a CodeArtifact
PyPI or NuGet package by its normalized name, as AWS writes it in ARNs.
AppConfig, CodeArtifact and CodeGuru Reviewer give IAM the tags they hold
on the resource a request names (an application, a domain, repository or
package group, an association), so a grant conditioned on aws:ResourceTag
reaches a tagged resource; Signer reads a profile's tags in the profile's
own account, another account's included. A tagged create is checked for tagging on what
it makes where botocore's response gives it: CreateEnvironment answers
an Environment whose Id is the new environment's, AssociateRepository
the RepositoryAssociation whose AssociationArn is the association it
makes. A tagged StartDeployment's tags go on the deployment it makes,
its DeploymentNumber AppConfig's to mint, open. AppConfig stays out of
the passed-roles table: CreateExtension and UpdateExtension pass a role
in Actions{}[].RoleArn, a map of lists that file does not read.
A new vendored source, tools/aws/sources/codeartifact-permissions.json,
written by its own script from the CodeArtifact user guide, gives what
neither botocore nor the Service Reference says: CopyPackageVersions is
checked as ReadFromRepository on its source repository and as
CopyPackageVersions on its destination repository, and a package with
no namespace has an empty one in its ARN (package/my_domain/my_repo/
npm//react), so a request leaving namespace out is checked on that ARN.
A variable the reference names Encoded and a botocore shape's name is
filled from the member of that shape and encoded as its service encodes
it, through StoredResourceArns: CodeArtifact's package group pattern,
percent-encoded in lower case, which CodeArtifact now writes into the
group's own ARN as AWS does (/npm/team/* is /npm/team/%2a). A tag call
spelling a group's pattern otherwise (%2A), which CodeArtifact reads as
the same group, is checked on the group's own ARN, which CodeArtifact
resolves it to, so a deny on that ARN holds.
With AppConfig in the table, a tag call naming one of its ARNs with the
slash unencoded is refused as a path its model does not give, as for
every namespace the table reads; AppConfig's tests now send the ARN
encoded, as an SDK does. AppConfig Data's GetLatestConfiguration, which
a route filter moves off GET /configuration so S3's bucket of that name
keeps its route, is moved under an internal prefix the request records,
as every such route is, so IAM matches it on its modeled path. The table
tests place a create's members where the table locates them, expect a
member holding the type's own ARN to name it as it is, and expect each
resource in the account its own account member gives.
trino-node's and trino-log's properties now go into the image's own
node.properties and log.properties, after its lines, so an image of
trino.image's keeps its settings; Floci names the node only where neither
gives it an id; and trino-env's nested export
properties ("If any classification ends in env, use the export
sub-classification") become the Trino container's environment, which a
catalog reads as ${ENV:NAME} where its connector takes Trino's
configuration, as Iceberg's does. The exports come after Floci's
AWS settings, which they may change as a trino-env.sh would, and before
the variables Floci writes Trino's files from, which they may not.
The RDS/DSQL listener-coexistence test now retries a BindException while it waits for both ports to be released, instead of failing on the first attempt, and the RDS master-role fixture connects through PostgreSQL's Driver directly, as the neighbouring RDS fixtures do.
SimulatePrincipalPolicy decided in its own method beside the evaluator that enforcement uses, so the two could drift. The simulator now takes its decision from the decision record that explain builds, over the same policies parsed and organization levels walked once, and the separate method is gone.
No answer changes. Both paths check explicit denies first, then the service control policies, the identity allow, the permissions boundary and the session policy, and a request that the boundary and the session policy both lack ends in an implicit deny either way.
The EC2 port-forward sidecars and the ECS task-role credentials proxy each
spelled out their socat addresses by hand. SocatTcpRelay now builds them: a
forking listener with nodelay and the data-plane accept backlog, and a
nodelay connection to the target. The EC2 sidecar commands are unchanged; the
ECS credentials proxy gains nodelay and the 4096 backlog its listener lacked.
For an identified workload, Route 53 and Cloud Map private DNS answers come only from zones associated with the querying VPC, account and Region; visibility is decided before the most specific zone is chosen, authoritative negative answers are kept, and conflicting runtime identities are refused. A caller with no known VPC keeps its private answers. EC2 and ECS register their guests' VPCs for the lifetime of the workload, revoking them on confirmed stop, and a terminating instance's IAM sessions and metadata tokens are revoked independently of Docker removal. The guest DNS checks run as nightly Docker checks.
A step's trino-cli got FLOCI_TRINO_SERVER whenever the cluster had a Trino
image, including with docker-network host, container:<id> or none, where
the primary node runs no metastore and so no Trino. It now gets it only
where Floci's Trino runs, the same check the cluster's background start
and the outside host use.
CreateFunction accepted python3.15, ruby4.0, java8.al2023, java11.al2023 and java17.al2023, but ImageResolver had no image for them, so every invoke failed with "The runtime parameter ... is not supported". They now map to python:3.15, ruby:4.0, java:8.al2023, java:11.al2023 and java:17.al2023 on public.ecr.aws/lambda, so every identifier in Lambda's supported runtimes table resolves to an image.
The Lambda docs no longer say that any runtime with a base image works, and name the deprecated runtimes Floci runs instead.
Awaitility sleeps one poll interval, 100 ms, before its first check, so every await in the suite paid that even when its condition already held. AwaitilityDefaults sets the default poll delay to zero. A @QuarkusTest class sees its own copy of Awaitility from the Quarkus runtime class loader, so the default is applied by a JUnit launcher session listener for plain classes and by a Quarkus before-class callback for Quarkus classes, each pinned by its own test.
ProvisionedConcurrencyPoolTest relied on the old first sleep after an initialization failure. It now waits until the retried put is accepted, since the stop count moves before the handle leaves pendingTeardown.
ListAgents, ListLocations and ListTasks scanned every Region, and the by-ARN reads, updates, deletes, CreateTask's location lookups and the tag calls read the store whatever Region the request was signed for. Each resource is stored under its ARN, which carries its Region, so lists and reads now keep only the request Region's through RegionResolver.inRequestRegion, and an ARN of another Region answers InvalidRequestException.