* fix(memorydb): restore persistent cluster runtimes after restart
Restore account-scoped cluster backends, authentication and stable proxy endpoints from persisted metadata. Retain data storage across restart and preserve retryable ownership on failed provisioning cleanup.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* fix(memorydb): retain default backend and log names
Keep default-account/default-region container and engine-log names stable while retaining scoped runtime and proxy keys. Pass the logical name and stored owner through creation, restoration, deletion and rollback. Use an unambiguous separator for foreign Docker names in the retained hyphen-prefix collision case, without changing foreign log names or persisted volume identities. Preserve restore and cleanup coverage; new naming regressions fail the former manager. Local mocked-Docker and loopback RESP qualification only, no managed AWS or native runtime claim.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* test(memorydb): share container naming fixtures
Move the two naming cases into MemoryDbContainerManagerTest and reuse its manager setup. Share the four loopback PONG responders through one helper, observing completion and propagating responder failures. Preserve naming, collision, cleanup and lifecycle assertions. No production change.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
---------
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
A failed stack update left AppSync entities changed or cleared by the update:
the provisioner had no rollbackUpdate, so the stack ended in
UPDATE_ROLLBACK_FAILED with "Rollback is not implemented".
Before an in-place update of a GraphQL API, data source, function, resolver or
API key, the provisioner records the members the update can change or clear.
The service applies an update member by containsKey, so replaying them puts
back both the changed and the cleared values. An update that fails part way
undoes itself through CfnRollback.guarded, and a failed undo keeps the
snapshot for ContinueUpdateRollback.
GraphQLSchema and a replaced AppSync resource are not covered.
tagResource, untagResource and putEnvironmentVariables change the stored API in place while updateGraphqlApi saves a copy, so a copy could overwrite a tag or variable written in between. Every method that writes a store now holds the service monitor, as startSchemaCreation does, and startSchemaCreation checks the API under it too. refreshGraphqlApiUris refreshes the stored API under the monitor instead of putting the instance it read earlier.
Returns a console log carrying the instance's SSH host public keys between the markers cloud-init prints, read from the running instance container, so clients can verify the host before connecting. An instance without a running container has an empty log.
Look the instance up in the request's region, read host keys only from a running container and treat a failed read as an empty log, build the response with XmlBuilder, and cover the SDK reading of the response.
AWS returns DryRunOperation for DryRun=true even for an empty or malformed instance id, so check the dry run first.
The key files are the guest's to write, so capture at most 16 KiB of stdout (and 1 KiB of stderr) through bounded streams, and answer an empty log, with a warning, when the output is larger than host keys can be.
* fix(cognito): offer configured providers in managed login
Preserve native authentication eligibility and request parameters for federated-only and mixed clients.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* fix(cognito): explain unavailable sign-in providers
Show an actionable managed-login error after every provider is removed, without enabling native credentials.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
---------
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Populate existing instance types with AWS-verified manufacturer values and expose them through DescribeInstanceTypes. Add SDK regression coverage for all 84 catalog entries.
Closesfloci-io/floci#7516
The controller read path parameters from the decoded JAX-RS path and
substituted them into the integration URI, so a path with an encoded space
threw from URI.create and answered 500 without reaching the backend. An
encoded ? or # cut the backend path short, %2F became a separator and %252F
lost a level of encoding.
Read the target URL's path parameters from the raw request path, for REST
HTTP_PROXY, REST HTTP and HTTP API HTTP_PROXY integrations. A value mapped
from elsewhere is percent-encoded. $request.path.X and header mappings keep
the decoded value. An integration URI that cannot be parsed now answers 502.
Routes match on the decoded path, so an encoded slash ahead of a parameter
shifts the segments read off the raw path. /a%2Fb/c/d on /a/b/{proxy+} called
the backend with /backend/d. A raw value that does not decode to the decoded
parameter is now ignored, and the decoded value is encoded instead. Comparing
values rather than literal segments also covers templates with no literals,
such as /{x}/{y}/{z+} and the HTTP API route /{x}/{y+}.
The table of request resources read only a request's body or Query
form, so no REST namespace was read: a REST request names its
resources in its path and its query. An OpenSearch Service request
naming its domain, DescribeDomain on
/2021-01-01/opensearch/domain/{DomainName}, was left unchecked by the
routes the previous change reads, as Floci could not check it on the
domain AWS checks it on.
- The generator reads a rest-json request's members in its path and
its query as members, under their botocore names, and records where
each one a resource reads is (`located`): a path label, `{Label}`, or
a query parameter, `?name`. RequestResources lays them over the body,
a label's value from the route the request matched in the vendored
routes (IamActionRegistry.pathLabels, IamRestRoutes now capturing
each label), a query parameter's from the query, so every kind of
resource reads them as it reads the body's. A located member is read
from where it is alone, as its handler reads it: one the body also
gives is dropped.
- A namespace read this way also takes the operations of each botocore
model Floci reads routes for under it (regen_rest_routes.MODELS) that
the reference lists for none of its clients, each the action of its
own name with that action's resource types, when the reference has
that action: the reference lists OpenSearch Service's `es` client
alone, while the `opensearch` client's operations are named after
`es` actions. --verify checks such an operation's action and types
against the reference's Actions, and reports one whose action AWS no
longer has.
- `es` moves from NOT_COVERED to NAMESPACES: 120 operations, both API
versions', 1505 over 34 namespaces. Every domain route Floci serves
reads its domain, from the path, the body or `?arn`, on
`domain/<DomainName>`, the ARN Floci mints. Those whose resource the
table does not find (outbound connections, applications, insights)
are routes Floci does not serve.
- Reading rest-json would also have read the Payment Cryptography data
plane's key from its path; Floci serves only the control plane, so
`payment-cryptography-data` joins CLIENTS_NOT_READ with its reason
and its operations stay as they were. No other entry changes.
With the domain operations in the table, the routes check them by the
resources-read half of the join rule. IamActionRegistryTest checks the
domain routes and the labels a request's path gives;
RequestResourcesTest reads a path label, a query parameter and a body
together; IamRestRouteEnforcementIntegrationTest checks DescribeDomain,
DescribeElasticsearchDomain and ListTags on the domain they name; the
generator tests cover the located members, a member two clients locate
apart, the REST models' operations and a round trip through --check and
--verify. iam.md says so.
* fix(ec2): associate elastic addresses with primary and detached interfaces
Signed-off-by: Andre Kurait <akurait@amazon.com>
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
(cherry picked from commit 28c17835d6e7dc480f5f5716e206fbbe5b81bee0)
Signed-off-by: Jackson Price <jxnprice@amazon.com>
* test(ec2): clean up partial address-association fixtures
Signed-off-by: Jackson Price <jxnprice@amazon.com>
* fix(ec2): serialize interface deletion and resolve managed interfaces
Signed-off-by: Jackson Price <jxnprice@amazon.com>
---------
Signed-off-by: Andre Kurait <akurait@amazon.com>
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Signed-off-by: Jackson Price <jxnprice@amazon.com>
Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
Add the missing virtual sizes in C6g, C6gn, C7g, C8g, M6g, M7g and M8g using captured AWS type metadata. Verify metadata and offerings through the Java SDK.
Closesfloci-io/floci#7500
* fix(lambda): validate VPC resources before configuration changes
Require declared subnets and security groups in the request account and region to belong to one VPC. Validate replacement settings before mutating the function. Preserve detachment, published-version snapshots and actual declared-resource fixtures.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* fix(lambda): preserve unknown VPC placeholder compatibility
Keep unknown subnet and security-group IDs in responses without inferring VpcId. Reject mixed known VPCs before mutation even when unknown IDs are also present. Restore placeholder EFS/CloudFormation fixtures and cover partial unknowns, updates and version snapshots. Addresses maintainer review 5766333414.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
---------
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* feat(ec2): report the service-network address as public IP when Floci runs in a container
Adds FLOCI_SERVICES_EC2_PUBLIC_IP_FROM_SERVICE_NETWORK (default false). When Floci itself runs as a container and the option is on, an instance's public IP is its address on Floci's own Docker network, so clients on that network reach the guest's real ports, port 22 included.
* fix(ec2): record the service-network address and follow protected guests to their helper
Resolve the address once at launch, start and restore instead of asking Docker on every public-address read, which DescribeAddresses does under a lock. A security-group protected guest shares its firewall helper's network namespace, so its address is the helper's.
* fix(ec2): share the helper lookup and retry a failed service-network lookup
Use one container: network-mode lookup for protectedNamespace and the service-network address. A lookup that fails on a Docker error is no longer recorded as the answer; the next address read retries it on the executor without waiting.
* fix(ec2): run service-network lookup retries off the launch pool
Retries ran on the bounded launch executor, whose blocking backpressure could leave launch workers waiting on each other. They now get their own virtual-thread executor, and a retry that cannot be scheduled is logged with the instance id.
* fix(ec2): publish a service-network lookup only for the container it read
A lookup records the container it starts for, asks Docker outside the instance lock, and publishes under the lock only while the instance still runs that container, so a lookup that outlives a replacement or a teardown cannot overwrite what came after it. The retry executor now comes in through the package-private constructor and is final.
* feat(sfn): apply the EventBridge connection to HTTP Tasks
An HTTP Task now resolves the connection named by InvocationConfig or
Authentication. Its authorization, headers, query parameters and body
parameters are merged over the task's, and the connection's value wins on
a duplicate key, as the AWS HTTP Task guide describes. The body is merged
before Transform encodes it. A string body with connection body
parameters fails with States.Runtime, and an unknown connection fails
with Events.ConnectionResource.ResourceNotFound.
The connection logic is the API destination's: EventBridgeInvoker exposes
it as connectionHttpParameters, so both callers share one implementation,
OAuth client credentials included.
* fix(sfn): keep case-distinct query parameters and bound OAuth by the HTTP Task timeout
A connection query parameter now replaces only a task parameter of the exact same name, since query names are case-sensitive. The connection's OAuth token exchange now spends the task's TimeoutSeconds, so the API request gets only the time left.
* chore: retrigger CI
* fix(apigateway): report the published regional hosted zones
A regional custom domain reported the invented Z2FDTNDATAQYL2 everywhere outside
GovCloud, so a Route 53 alias built from it pointed at a zone AWS does not have.
Vendor the data plane table of the API Gateway General Reference page into
region-facts.json, with the GovCloud guide kept as a cross-check. A region with no
row keeps the placeholder, now documented as one. Stored domains keep their id.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* test(apigateway): read the regional hosted zone through the SDK clients
Create and read the custom domains with ApiGatewayClient and ApiGatewayV2Client, so the test also shows both SDKs parse the zone fields.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Under IAM enforcement, a ProvisionPermissionSet for
ALL_PROVISIONED_ACCOUNTS is checked on each account the permission set
is provisioned to, which the permission check finds through
SsoAdminService.through. The handler then found those accounts again
and provisioned to each. Another request could provision the permission
set to one more account in between, with an account assignment of its
own, and a permission set change could leave that account
LATEST_PERMISSION_SET_NOT_PROVISIONED: this request then provisioned it
again, changing the account's state with no policy checked against it.
The accounts are now found once for the request and kept, in a
request-scoped SsoAdminRequestContext, as PaymentCryptographyRequestContext
keeps the key an alias named: the check and the provisioning use the
same accounts, and an account provisioned to since is left as the other
request left it. Each request finds them afresh, so the next one is
checked on it.
SsoAdminServiceTest replays the race: the check finds one account,
another account is assigned and a policy attached, and the provisioning
leaves the second account not provisioned. The IAM integration test
assigns a third account after a request was let through on two, and the
same grant no longer covers the next request. iam.md says so.
A REST request gets its IAM action from IamActionRegistry's
hand-written rules, and a route no rule maps gets none, which the
caller allows: under enforcement such a request runs unchecked.
IamRestRoutes (#7085) reads botocore's routes at runtime, but only for
the operations a hand-written list enrolls, ValidatePolicy alone, and
only by literal paths.
A request no rule maps is now the operation whose route in botocore's
model it matches, and it is checked as that operation's action
(IamAuthorizedActions), as a Query or JSON request naming its
operation is, when Floci checks it on the resources AWS does: those
its request names, which ResourceArnBuilder builds for its namespace
or the vendored request resources read for the operation, or none,
when the Service Reference gives the action no resource type, as AWS
authorizes such an action on `*`. An action AWS checks on a resource
Floci neither builds nor reads stays unchecked, as before: checked on
`*`, a grant scoped to its resource would be refused. That is the
reason #7085 gave for enrolling ValidatePolicy alone, now read from
generated data instead of a list.
- The actions of no resource type come from the Service Reference's
Actions, through regen_iam_authorized_actions.py, into
iam-authorized-actions.json, for each credential scope whose routes
rest-routes.json reads: 88 over 7 scopes. They are read from Actions,
not Operations, because the reference lists one SDK client's
operations per namespace, OpenSearch's `es` client alone. --check
fails until a scope rest-routes.json adds is listed, and --verify
fails when AWS gives a listed action a resource type.
- IamRestRoutes now matches every route of a model: literal segments,
a label taking one segment, a greedy label the rest of the path, and
the query a route names, which must be on the request. Of the routes
a request matches, the most specific wins, segment by segment from
the left a literal, then a segment mixing a literal and a label, then
a label, then a greedy label; then the route naming more of the
query. The path is the one the rules match, still percent-encoded and
without a trailing slash, and a segment may still end in a matrix
parameter, which the router ignores.
- The rules come first, so nothing they map changes. S3 and API Gateway
are listed as handRouted, with their reasons, and routed by their
rules alone: S3 tells apart the operations of one route by their
query and headers, and API Gateway is checked by HTTP method. The
route generator fails when one route names two operations of any
other scope.
- OpenSearch Service's models, both API versions, are read under `es`:
59 of their 147 operations are checked by their routes (29 of the
`es` model's 51, 30 of the `opensearch` model's 96), 53 of which ran
unchecked, ListDomainNames and ListVersions among them. The other six
are the VPC endpoint operations #7351 mapped by hand: their rules are
removed, as their routes give the same actions.
- Access Analyzer's 9 operations of no resource type are checked by
their routes, ListAnalyzers among those Floci serves, where
ValidatePolicy alone was; its analyzer operations are not.
Lambda's, EKS's, Scheduler's, Pipes' and DSQL's resources are built
by hand and their routes all mapped by their rules, so none is checked
differently. IamRestRouteCoverageTest checks every route of a scope
not hand-routed: by the vendored routes alone it is its own operation,
and through the registry it is its action when its resources are built
by hand or read, or its action has no resource type, and unmapped
otherwise.
iam.md and access-analyzer.md say which routes are checked.
In the docker runner mode a Hive step failed without running ("hive-script
and pig-script are not in the image steps run in"). On a cluster whose
Applications name Hive, a command-runner.jar step running hive-script, as
the AWS CLI writes a Type=Hive step ("hive-script --run-hive-script
--args" and the step's Args), or hive itself, now runs: the image's
hive-script runs hive with the arguments after --args, with Tez in local
mode, on the cluster's storage and Floci's S3.
- An EMR cluster's nodes hold every application it installs, so a
cluster with Hive bootstraps and runs every step in one image: the
release's EMR Serverless image with the Hive, Tez, HDFS, MapReduce and
YARN of its EMR Serverless Hive image (or the new hive-image-template).
EmrReleaseImages makes it the first time a release's cluster needs it:
a container of the EMR Serverless image, created and never started,
gets the Hive image's folders streamed in from a container of that
image, and is committed, as a bootstrap's container is, with no image
builder involved. The two images ship different builds of
emr-serverless-goodies-common under one name, so Tez keeps the Hive
image's in a folder of its own, its links rewritten to lead there, and
the Hive image's Hadoop configuration, which puts Tez on the class
path, goes to /etc/hadoop/conf.hive, which Hive runs with.
- The image is named after the release, the ids of the two images as a
container would run them (an image-registry-base included) and what
is copied, so a newer pull of either makes another; it is kept for the
release's next cluster, and made once at a time. The bootstrap and the
steps get its id, as they get a bootstrap image's, from their own
thread, which makes it first, unless the cluster has ended by then; a
failure to make it fails the step, or ends a bootstrapping cluster with
INTERNAL_ERROR.
- hive gets Floci's settings, then the cluster's core-site, tez-site and
hive-site properties as --hiveconf settings, then the step's own
arguments, so a step's --hiveconf wins as it does over hive-site.xml;
the cluster's hive-env exports are its environment.
- Its metastore is the cluster's own, as "Hive records metastore
information in a MySQL database on the primary node's file system": an
embedded Derby database in the cluster's /mnt, so a table one Hive step
makes is there for the next until the cluster ends. A hive-site naming
the Glue Data Catalog's client factory uses Floci's Glue instead.
- Hive reaches the cluster's HDFS through the same view of /mnt/hdfs
under the viewfs scheme: Hive looks up the HDFS encryption zone of any
hdfs:// path, which only an HDFS NameNode answers. A table without a
LOCATION is in /user/hive/warehouse there, which other steps read as
hdfs://.
- On a cluster without Hive, hive-script runs in the release's image, as
EMR's does without Hive ("Hive isn't installed."); NOT_RUN is
pig-script's alone.
The Docker-gated EmrHiveStepsDockerIntegrationTest runs the AWS CLI's
Hive steps on a cluster's metastore and HDFS, a hive-site for the Glue
Data Catalog, a cluster without Hive, and a bootstrapped cluster whose
installs a Hive step and a later step both find, in the emr-7.5.0
images, which the CI prefetch pulls for its shard.
EmrServerlessSparkRunner's hiveSettings now builds both services'
--hiveconf settings.
A violation inside a map entry's structure named the entry and then the
field, replacementValues.Department.values. An AWS-validated recording of
the same protocol writes a segment between the two: SNS answers a missing
DataType inside its MessageAttributes map as
1 validation error detected: Value null at
'messageAttributes.attr1.member.dataType' failed to satisfy constraint:
Member must not be null
and, inside a list's member,
publishBatchRequestEntries.1.member.messageAttributes.attr1.member.dataType.
So a map of structures is named the way a list of structures already is
here, the entry's key standing where a list's index stands, and the walk
now writes replacementValues.Department.member.values. AcquireRole is the
one operation that reaches it, its ReplacementValues being the only
structure-valued map these two services vendor.
What stays is the scalar-valued map. Nothing recorded covers one on this
protocol, and the only recording anywhere, Lambda's
routingConfig.additionalVersionWeights on REST-JSON, answers the map rather
than the entry with "Map value must satisfy constraint: [...]". A different
protocol and a different service is not evidence against the answer this
service already gave, so properties.Team/Owner stays as it is, with what
would move it written down beside it.
The core walk had no test for a structure under a map's key at all, every
case in that file holding a scalar, so one is added there rather than left
to the two IAM wire tests that quote the path.
docs/services/iam.md carries both halves, the recorded one and the open
one. The message's other half, the word null in the value slot, is IAM's
own and does not move: that service leaves it out and this is only the path.
* feat(ec2): EC2 Instance Connect Endpoint control plane
CreateInstanceConnectEndpoint, DescribeInstanceConnectEndpoints and
DeleteInstanceConnectEndpoint answered UnknownOperation, so Terraform's
aws_ec2_instance_connect_endpoint failed at create and the AWS CLI's
`ec2-instance-connect ssh --connection-type eice` could not look an
endpoint up. They now carry the fields, filters and errors Terraform and
the CLI use. Endpoint DNS names are <id>.localhost.floci.io, which public
DNS resolves to 127.0.0.1, and each endpoint takes a private address in
its subnet.
As on AWS, a live endpoint makes DeleteSubnet and DeleteVpc fail with
DependencyViolation (a destroy ordered wrongly would otherwise pass here
and fail on AWS, and the endpoint's address reservation leaked), and a
replayed ClientToken returns the first endpoint instead of creating a
duplicate on an SDK or Terraform retry.
The tunnel the endpoint serves is a separate change.
* fix(ec2): create an EC2 Instance Connect Endpoint under the subnet topology lock
Two creates with one ClientToken could both miss the replay scan and make
two endpoints, and a DeleteSubnet could land between the subnet check and
the save, leaving an endpoint on a subnet that is gone. The create now
holds the lock DeleteSubnet holds. The endpoint store is final and comes
through the constructor chain like the other stores, and the service test
is named Ec2InstanceConnectEndpointServiceTest.
* test(ec2): name the exceptions the endpoint race test expects
* fix(ec2): return a copy from instance connect endpoint reads
Create, Describe and Delete handed back the stored endpoint itself, with
its tags written onto it, and Delete then set delete-in-progress on that
object. A caller changing a returned endpoint changed the stored one.
They now return a copy carrying the current tags.
* fix(ec2): scan one region's instance connect endpoints by key on describe
Describe read every region's endpoints and kept those whose region field
matched, while the ClientToken replay scan picks a region by store key.
Describe now uses the key prefix too, so the two agree on what is in a
region and describe no longer reads other regions' records.
* fix(ec2): compare every creation parameter on an instance connect endpoint ClientToken replay
A replayed ClientToken compared only SubnetId, so a retry with other
security groups, IpAddressType, PreserveClientIp or tags returned the
first endpoint as if it matched. Each is now compared after defaults are
applied and a difference is IdempotentParameterMismatch, as the egress-only
internet gateway create does. Tags are compared as the create request
carried them, so a later CreateTags does not turn a retry into a mismatch.
* test(ec2): drive instance connect endpoints over the EC2 Query wire
The service test called Ec2Service directly, so nothing covered the query
handler: SecurityGroupId.N and TagSpecification.N parsing, the ClientToken
echo, and the Create, Describe and Delete response envelopes. The
integration test creates, replays, describes and deletes an endpoint
through the HTTP endpoint and reads each result back with a separate
Describe.
* fix(ec2): validate instance connect endpoint requests before answering DryRun
CreateInstanceConnectEndpoint answered DryRunOperation before checking the
subnet, IpAddressType or security groups, and Describe and Delete ignored
DryRun and acted on the request. Create now validates and then answers
DryRunOperation, as RunInstances and ReplaceRoute do, and Describe and
Delete check the IDs and filters first, then answer DryRunOperation
without deleting anything.
* fix(ec2): page DescribeInstanceConnectEndpoints by MaxResults and NextToken
MaxResults and NextToken were ignored and every match came back on one
page. Describe now returns at most MaxResults endpoints in ID order with a
nextToken for the rest, using the shared opaque-cursor pagination, and an
unreadable NextToken is InvalidParameterValue as DescribeDhcpOptions
answers it. MaxResults is not range-checked against the model's 1-50.
* fix(ec2): range-check MaxResults on DescribeInstanceConnectEndpoints and compare replayed security groups as a set
The model's InstanceConnectEndpointMaxResults allows 1 to 50, but a sent
0, negative or larger value was served. It is now InvalidMaxResults, as
DescribeTags and DescribeEgressOnlyInternetGateways refuse values outside
their own ranges; an omitted MaxResults still returns every match.
A test now pins that a ClientToken replay naming the same security groups
in another order returns the first endpoint.
* docs(ec2): name instance connect endpoints among the private address holders
privateIpsInUse and privateIpsHeldOnVpcNetwork count the addresses EC2 Instance Connect Endpoints hold, but their comments listed only instances, network interfaces and NAT gateways.
* test(ec2): refuse a NAT gateway the private address an instance connect endpoint holds
CreateNatGateway with a PrivateIpAddress an EC2 Instance Connect Endpoint holds answers InvalidIPAddress.InUse, and the address is free again once the endpoint is deleted. Nothing covered the endpoint's share of the in-use scan before.
* fix(ec2): copy each creation tag of an instance connect endpoint
The copy constructor copied the creationTags list but shared its Tag
objects with the stored endpoint, and the create stored the request's
own Tag objects. Changing a tag on a returned endpoint, or on the list
passed to the create, changed the saved creation parameters, so a
retry with the same ClientToken and the original tags failed with
IdempotentParameterMismatch. Copy each Tag when saving and when
returning a copy.
* fix(ec2): reject an unknown DescribeInstanceConnectEndpoints filter before scanning
An unknown filter name was rejected only while testing it against an
endpoint, so with no endpoints, or when an earlier filter excluded them
all, the bad name succeeded silently. Check every name up front through
requireSupportedFilters, as DescribeVpcs and DescribeVpnGateways do,
with the same InvalidParameterValue.
* fix(ec2): resolve an instance connect endpoint's interface in DescribeNetworkInterfaces
CreateInstanceConnectEndpoint published an interface ID in
networkInterfaceIdSet that DescribeNetworkInterfaces answered with
InvalidNetworkInterfaceID.NotFound, so a client could not read the
endpoint's private address or security groups from it. Build the
interface from the endpoint in the describe path, as the NAT gateway
and interface VPC endpoint arms already do: a requester-managed
ec2_instance_connect_endpoint interface with the endpoint's subnet,
VPC, private address and security groups, present while the endpoint
exists. Its address is already counted from the endpoint record, so
subnet address accounting is unchanged. DeleteInstanceConnectEndpoint
also drops the interface's own tags, as DeleteNatGateway does.
* fix(ec2): name an instance connect endpoint interface's groups from the account it is read for
The explicit-account DescribeNetworkInterfaces overload scanned the
named account's endpoints but looked their security group names up
under the ambient request account, so a caller in another account got
the groups back without names. Read the group for the same account,
as natNetworkInterfacesOf reads its subnet.
* test(ec2): keep another account's instance connect endpoint interface out of DescribeNetworkInterfaces
An endpoint created in one account is NotFound by NetworkInterfaceId
and absent from an unfiltered list for another account, and still
visible to its own.
* fix(ec2): accept exactly AWS's DescribeInstanceConnectEndpoints filters
The DescribeInstanceConnectEndpoints reference lists instance-connect-endpoint-id,
state, subnet-id, tag:<key>, tag-key, tag-value and vpc-id. Implement tag-value
(any tag's value in the filter values, as the other EC2 describe calls match it)
and stop accepting availability-zone and owner-id, which the reference does not
list; they are now refused as InvalidParameterValue like any unknown filter.
* refactor(ec2): build NAT gateway and instance connect endpoint interfaces once
natNetworkInterfacesOf and instanceConnectEndpointNetworkInterfacesOf set up the
same requester-managed interface with one primary address; both now call
requesterManagedInterface. Their two DescribeNetworkInterfaces arms, identical
but for the interfaces they walk, become one arm over NAT interfaces then
endpoint interfaces, the order the two arms ran in. No behaviour change.
* test(ec2): share a mock-mode Ec2Service builder in the test fixtures
Ec2ServiceFixtures.mockModeService() in the shared testing package builds the
mock-mode Ec2Service over in-memory storage that Ec2InstanceConnectEndpointServiceTest
built privately, and that class now uses it. The other classes with their own copy
move to it separately.
* docs(ec2): count the three InstanceConnectEndpoint operations in the service matrix
* fix(cloudformation): apply KinesisStreamSpecification on AWS::DynamoDB::Table
The property was accepted and ignored, so a stack that declared it got a
table whose item changes never reached the stream.
The declared stream becomes the table's active Kinesis streaming
destination on create and update. Removing a block the previous template
declared turns it off, and a stack that never declared it leaves
destinations set outside it alone. The in-place update snapshot of a
stack that manages the destinations records them, so a failed update
puts them back as they were.
A change of ApproximateCreationDateTimePrecision alone updates the active
destination in place, as CloudFormation does with one
UpdateKinesisStreamingDestination call, so forwarding never stops and
records already captured are still delivered.
A block that is not an object fails template validation, as
TimeToLiveSpecification does, rather than reading as a removed block
that turns forwarding off.
A StreamArn the destination cannot use fails the table as the AWS handler
does, and the table this attempt created is deleted. One under 37
characters fails EnableKinesisStreamingDestination's validation. One that
is not a Kinesis stream ARN, such as the stream name Ref returns, or one
naming a stream that does not exist fails as NotStabilized.
DynamoDbTableAccess gains enable, disable and update operations for the
destination. DynamoDB Local has no Kinesis forwarding, so that backend
leaves the table as it is and logs a warning. CloudFormation still checks
StreamArn there as AWS does; only the forwarding is skipped.
* fix(cloudformation): match Kinesis destinations by their whole stream ARN
A destination was looked up by the last segment of its StreamArn in the
table's account and region, so an ARN for another account, region or
resource type that ended in a local stream's name forwarded to that
stream. KinesisService.describeStreamByArn now finds a stream only by its
exact ARN. NativeDynamoDbTableService uses it, so the public
EnableKinesisStreamingDestination action reports such an ARN as not
found, and CloudFormation fails the table as NotStabilized.
The DynamoDB Local backend looks the stream up the same way before it
skips forwarding, so a template naming a missing stream fails there too.
A declared StreamArn the table already forwards to now goes through the
same template checks as a new one; only the rollback restore skips them.
* feat(redshift): prune external table partitions from query WHERE predicates
Load only the partitions selected by top-level AND predicates of the query WHERE clause for external tables, accumulating partitions across queries and avoiding full scans when specific partitions are requested.
* fix(redshift): handle CASE in partition pruner, overlapping refreshes, and isolate spectrum test schema
* fix(redshift): identify materialized rows by partition and share SQL lexer
Tell materialized external table rows apart by an internal partition identifier column so that refreshing or deleting a partition only deletes its exact rows and never removes rows belonging to partitions whose keys overlap when converted. Dropping a partition no longer reads or authorizes retained overlapping partitions, preventing unauthorized S3 access errors on unselected partitions.
Share tokenization rules between ExternalReferenceScanner and PartitionPruner in SpectrumSqlLexer.
* fix(redshift): hide the partition column behind a view and read strings as strings in the scanner
A partitioned external table kept the partition each row came from in a column of the public table,
so SELECT * returned an extra column and INSERT ... SELECT * could fail on the column count. The rows
now live in a backing table, _floci_spectrum_<table>, and the name the user queries is a view of the
declared columns only. DROP TABLE drops the view and the backing table, and the Data API ListTables
does not list the backing table.
ExternalReferenceScanner took a one-character string such as ';' for a statement separator, which
cleared the table context and let the query skip preparation and its S3 checks. It now reads the
structural characters by token kind.
The pruning integration test used the legacy catalog, whose parser does not read PARTITIONED BY, so
it now creates a Glue database.
* fix(redshift): keep the partition backing table in a schema of its own and send plain batches
The batches that drop and replace the relation of a partitioned external table started with a DO
block. PostgresExtendedBackendSession wraps only batches that start with CREATE or DROP, so an
extended query sent them unchanged and PostgreSQL refused several commands in one prepared
statement. A DO block nested in the wrapper is not valid either, and a schema or table name that
held the dollar-quote tag would have closed the body early. The relation is now dropped with
DROP VIEW or DROP TABLE as the last load made it, so every batch is plain statements.
The backing table was named after the table it backs in the user's schema, so a Glue table of the
same name could drop or reuse it, and the Data API ListTables hid every table with that prefix. It
now lives in the schema floci_spectrum under a name made from the external schema and table, and
ListSchemas and ListTables hide only that schema.
* fix(redshift): load the whole external table when partition keys overlap instead of keeping a backing table
Delete by key value is only safe when no two partitions cast to the same value. When they do (integer 1 and 01, decimal 1.0 and 1.00, boolean true and t), the query reads every partition and a change replaces the whole table. This drops the backing table, view and floci_spectrum schema, which broke dropping a table whose Glue definition gained partition keys, other users' loads, and DROP SCHEMA CASCADE.
* fix(redshift): expect 22P02 SQLSTATE on invalid partition data
Preserve the target's negative DNS answer while chasing a private CNAME. Cover missing and TXT-only targets, creation/deletion, and positive TTLs.
Signed-off-by: Andre Kurait <akurait@amazon.com>
(cherry picked from commit da2e197f93113312212d502ee303e94ac4aa87c7)
Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
USER 1001 made the image start unprivileged, so the entrypoint skipped the branch that adds the socket's group and honours FLOCI_RUN_AS_ROOT. With a socket owned by a non-root group and mode 660, Docker-backed services could not launch containers, and FLOCI_RUN_AS_ROOT=true had no effect.
The image now starts as root like the standard one, and the entrypoint drops to uid 1001. HOME is set to /app because that drop keeps the environment: hooks would otherwise run with HOME=/root, which uid 1001 cannot write to, and pip install would fail.
docker exec now defaults to root on this image, as it does on the standard one.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
In the docker runner mode a Hive application's job run failed without
running ("Floci runs Spark job runs only"). It now runs: Floci starts
hive in a container of the release's EMR Serverless Hive image
(public.ecr.aws/emr-serverless/hive/<release>, or the new
hive-image-template), with Tez in local mode in Hive's JVM, S3A on
Floci's S3 and the Glue Data Catalog client, the image's metastore, on
Floci's Glue in the run's account.
- hive gets the core-site, tez-site and hive-site classifications as
--hiveconf settings, the application's then the run's, a run's
classification replacing the application's; then -i initQueryFile
and -f query; then the run's parameters, whose --hiveconf settings
take priority, as the user guide ranks them.
- The run's hive.exec.scratchdir and hive.metastore.warehouse.dir are
used as it sets them, in S3. Tez in local mode copies a session's
staging folder, which Hive puts under the scratch folder, to the same
path in the container, a copy that silently does nothing where the
image's hadoop user cannot create that path. The container starts as
root, makes that path hadoop's, sets the Tez addresses EMR
Serverless's runtime would set, then runs hive as hadoop in its home
folder, with the groups Docker gives it. The scratch folder is the
last hive.exec.scratchdir setting, in any form Hive's CLI reads:
--hiveconf name=value, --hiveconf=name=value, with one dash or two,
or the value as the next argument.
- A Hive application's custom image is its HiveDriver worker type's,
else the application's; Tez's tasks run in the driver's container, so
a TezTask image is not used.
- The driver's stdout.gz and stderr.gz go to the run's HIVE_DRIVER log
folder, and its CloudWatch log streams are under HIVE_DRIVER, the
entry of logTypes it reads; Hive's own log stays in the container.
- A run whose driver is not its application's type, hive on a Spark
application or sparkSubmit on a Hive one, fails without running.
spark-defaults go through the same classification merge. The
Docker-gated EmrServerlessHiveDockerIntegrationTest runs the user
guide's Hive job and a failing query in the emr-7.5.0 Hive image, which
the CI prefetch pulls for its shard. EmrServerlessRequests'
createApplication takes the application's type, and S3TestClients'
deleteBucket empties and deletes a test's bucket.
Under IAM enforcement, DataSync, EMR, Rekognition and IAM Identity
Center requests were checked on `*`, so a grant scoped to a DataSync
agent, an EMR cluster, an Identity Center permission set or a
Rekognition custom model was refused, and a deny scoped to one never
applied.
The generated table of the resources requests name now reads them, 276
operations, from AWS's Service Reference and botocore as it reads the
earlier batches: their namespaces move from the generator's
NOT_COVERED to NAMESPACES and the table is regenerated, nothing in it
edited by hand; 1385 operations over 33 namespaces. Each resource
type Floci serves has the ARN format it mints: DataSync's
`agent/agent-<id>`, `location/loc-<id>` and `task/task-<id>`, EMR's
`cluster/<id>`, and IAM Identity Center's instances and permission
sets, with no Region or account. Of Rekognition, Floci serves the image
analyses alone, which act on no resource but a custom model.
Corrections, each with its reason:
- EMR requests naming a cluster by its job flow id, JobFlowId or
JobFlowIds (AddInstanceGroups, AddJobFlowSteps, DescribeJobFlows,
TerminateJobFlows and the four Set operations), are checked on that
cluster: a job flow's id is the cluster's.
- EMR's AddTags and RemoveTags are checked on the cluster their
ResourceId names, the one Floci tags, not on the one their ClusterId
gives, which only scopes a session-scoped resource's tags. Read as
generated, a ClusterId the grant covers would have let a request tag
another cluster.
- EMR's ModifyInstanceGroups may leave out its ClusterId ("Required:
No") and name each instance group by its id alone, which EMR then
finds the cluster of. Such a request is checked on the cluster each
group is in, where it was checked on `*`; a null ClusterId is read as
none, as the handler reads it. An InstanceGroups that is not a list
names no group to the check, and the handler now refuses it as naming
none, where it modified the groups an object's values named.
- Rekognition's stream processor operations are checked on
`streamprocessor/<Name>`: the Developer Guide's example gives a
processor named streamProcessorForCam the ARN
`...:streamprocessor/streamProcessorForCam`.
- IAM Identity Center's CreateAccountAssignment,
DeleteAccountAssignment and ProvisionPermissionSet are also checked on
the account their TargetId names, `account/<id>`, which the action
acts on beside the instance and the permission set. A
ProvisionPermissionSet for ALL_PROVISIONED_ACCOUNTS names no TargetId
and provisions the permission set to every account it is provisioned
to (the User Guide: up to 3,500 accounts that way, one with
AWS_ACCOUNT), so it is checked on each of them, where a grant on the
instance and the permission set alone let it through. Its TargetId
names the account only for AWS_ACCOUNT, so a null one with
ALL_PROVISIONED_ACCOUNTS names none.
The two lookups are the existing `through` entries, which named the
cluster or workgroup a Redshift Data session runs on: one may now read
each value of a list's field, and apply only `when` the request names
its resource no other way. StoredResourceArns.through gives a list of
ARNs, which EmrService and SsoAdminService now answer from what they
store, EmrService under the lock its handlers change clusters under.
Fixes the new formats needed:
- DataSync's ARN formats, and IAM Identity Center's applications' and
trusted token issuers', name their account `${AccountId}` where every
other format has `${Account}`. The generator now reads that slot as
`${Account}`, so the caller's account fills it; a new Identity Center
application was otherwise checked on `arn:aws:sso::*:application/*/*`,
which no account-scoped grant matches.
- Identity Center's application providers are AWS's own,
`arn:aws:sso::aws:applicationProvider/<id>`. An ARN of a type whose
format fixes the account as `aws` is now checked in that account
alone, not also as the caller's own copy, which does not exist and
which a grant on the provider did not cover. An ARN of any other type
giving the account `aws` is still checked as the caller's too.
- A permission set, an application or a trusted token issuer an
Identity Center create makes is in the instance its InstanceArn
names, whose id its ARN carries, `permissionSet/<instance id>/<id>`.
It was checked with both ids open, which no grant scoped to an
instance's permission sets matched. The generator now fills a variable
no member fills from the ARN of another type the action acts on whose
format is that variable alone, given by the ARN member named after it.
Left as generated, on `*`: Rekognition's CreateStreamProcessor and
StartMediaAnalysisJob, which name their collection or model two
structures deep, where the table reads none, and which Floci does not
serve.
Elastic Beanstalk and Redshift Serverless, which have as few resource
types, stay unread, each with its reason: an environment's ARN carries
an application name its requests do not give, and Redshift Serverless'
ARNs end in ids its requests name by name, so both need the stored
ARNs found first.
iam.md lists the four services, and AWS Payment Cryptography, which
the table already read, and gives the corrections, the rule for an
AWS-owned resource's ARN, and the cluster, accounts and instance the
lookups and the creates are checked on.
Captures from a real account on issue 6042 answer three refusals this
emulator had written for itself, each wrong in its code or its status
rather than only in its wording.
ChangePassword answered InvalidParameterValue 400 naming the user for a
wrong old password. AWS answers AccessDenied 403 and "Either the new
password does not conform to the account password policy or the old
password was incorrect.", which is now what it sends, as captured. The
sentence names both of the operation's causes without saying which one
refused the call, so a caller who cannot prove the current password
learns nothing about the policy either.
That it names the policy half does not settle the policy half. The
capture covers a wrong old password with a conforming new one, nothing
records AWS answering it for a password the policy refuses, and the
model declares PasswordPolicyViolation on this operation for exactly
that case, so a new password the account policy refuses keeps that error
and the rule it names, as it does on CreateLoginProfile and
UpdateLoginProfile. The old password is still read first, so a request
with both halves wrong answers the capture.
PolicySourceArn on SimulatePrincipalPolicy and
GetContextKeysForPrincipalPolicy resolved an entity out of whatever
followed the last slash, so arn:aws:iam:user/bob simulated as the user
bob. It is now held to AwsArnUtils.isArn before either simulator
resolves it, answering InvalidInput "Invalid ARN provided in the
request: <value>". A valid ARN that names neither a user nor a role
still answers the entity-type refusal it answered before.
GetAccessKeyInfo answered InvalidParameterValue quoting an id the
account never issued. AWS answers ValidationError "Access key ID is not
valid.", for an AKIA and an ASIA id alike, which also settles that it
refuses such an id rather than decoding the account out of it.
The wire and unit tests pin the two halves of the password refusal
answering differently and the order they are read in, both simulators
against three unparseable values and a well-formed one, and the key
refusal over both id formats. One enforcement test had pinned the
unparseable ARN resolving, which the capture overturns.
docs/services/iam.md and docs/services/sts.md carry the three answers,
what each capture covers, and what it leaves open.
Three comments that described these answers before the captures are
corrected with them: handleGetAccessKeyInfo's Javadoc, which still
called its old refusal a documented deviation,
StsAccessKeyInfoIntegrationTest's class comment, which said the same,
and validatedPolicySourceArn's, which said a value clearing 20
characters and parsing as no ARN is left alone and that what AWS answers
for one is not recorded.
CreateDomain and UpdateDomainConfig dropped the zone awareness count, the
dedicated master type and count, EBS IOPS and throughput, advanced
options and the address type, and Floci had no off-peak window or
software update options, so a domain created by
terraform-aws-modules/opensearch planned a change after every apply.
Store and report them, with AWS's defaults for a new domain.
CreateEventBus dropped KmsKeyIdentifier, DeadLetterConfig and LogConfig, which UpdateEventBus already stored, so a bus created with them read back without them. Store them on create and echo them in the response, as the model's CreateEventBusResponse does.
* feat(ec2): add Client VPN endpoints, associations, rules and routes
Store Client VPN endpoints with their target network associations,
authorization rules and routes, and export the OpenVPN client
configuration from the server certificate held in ACM. Fifteen EC2
Query actions; no VPN server runs.
* fix(ec2): apply Client VPN describe filters and pin associated subnets
Apply AWS's filters on the four Client VPN describe operations and refuse
unknown ones. Report selfServicePortalUrl for an endpoint with the portal
enabled. Require every requested security group to exist. Register
associations as subnet and VPC dependencies, saved under the subnet
reference lock. Compare rule and route CIDRs as networks. Replace the
endpoint's lists instead of changing them in place, and let only a
missing ACM certificate leave the export without its CA.
* refactor(ec2): share the Query protocol helpers and the id hex generator
Move the EC2 Query parameter and response helpers Ec2QueryHandler kept
private (getList, getFiltersList, boolParam, intParam, tagSetXml,
booleanResponse, xmlResponse) into Ec2QueryProtocol, which the Client VPN
handler now uses too, and replace the four randomHex copies in
Ec2Service, Ec2IpamService, FlowLogService and Ec2ClientVpnService with
Ec2Ids.randomHex. The Client VPN test builds its requests through
testing.Ec2Requests.
* style(ec2): brace the loop exits in Ec2QueryProtocol
The Podman docs and the web console's start-failure message told SELinux users to relabel the socket mount with :z. On a rootless podman machine (SELinux enforcing) that recipe fails: the web console cannot start and a Lambda invoke returns "Docker is not reachable (Permission denied)". :z fixes access to the socket file, but SELinux also denies connectto from the Floci container (container_t) to the Podman service (container_runtime_t), which a relabel can't fix; --security-opt label=disable avoids it. With it, the same recipe starts the console and invokes a Python Lambda.
* fix(ec2): support NAT gateway secondary addresses
* fix(ec2): update a NAT gateway's secondary addresses in place
A CloudFormation update that changed only a NAT gateway's Secondary*
properties replaced the gateway. The replacement was created while the old
gateway still held its Elastic IP or fixed private address, so it came back
failed with Resource.AlreadyAssociated (or InvalidIPAddress.InUse) and the
update failed. The schema does not mark the secondaries create-only, so AWS
changes them in place and the gateway keeps its id.
Ec2Service.updateNatGatewaySecondaryAddresses sets a gateway's secondaries
to the requested ones: kept ones stay, dropped Elastic IPs are handed back,
new ones are checked as CreateNatGateway checks them, and every check runs
before anything changes. The provisioner calls it instead of replacing, and
records the prior secondaries so a rolled-back update puts them back.
* fix(ec2): keep a NAT gateway's picked secondary when listed ones change
The counted slots of an in-place secondary update kept the first secondary
with no Elastic IP and an address the request does not list. With
SecondaryPrivateIpAddresses [A] and a count of 1 changed to [B] and 1, that
was the dropped listed A, while the address the subnet had picked was given
up. Counted addresses always follow the listed ones, so the counted slots now
keep the last such secondaries, in order.
Tests cover a count changed in place (an unrelated change keeps the same
addresses; 1 to 2 keeps the first; 2 to 1 keeps one of them), the picked
address surviving a listed change, and secondary Elastic IPs swapped between
listed addresses or moved to a new one, with DescribeAddresses showing each
held at its new address.
* test(ec2): pin which counted NAT gateway secondary an update keeps
The counted slots keep the last unlisted secondaries, so a count lowered
from 2 to 1 keeps the second address; the test now asserts that, and that
raising the count from 1 to 2 adds a new address in the subnet after the
kept one. The comment no longer claims counted addresses always follow the
listed ones: slot position is the only record of an address's origin, and
across updates a once-listed address can move behind a picked one.
* fix(ec2): read a NAT gateway under the allocation lock before updating its secondaries
The secondary-address update read the gateway before taking the lock that
DeleteNatGateway holds. A delete finishing in between left the update
holding a stale copy, which it then wrote back, re-associating the Elastic
IPs the delete had released and overwriting the association of a gateway
that had since taken the primary one. The gateway is now read again under
the lock, and one that is gone or deleted is refused with NatGatewayNotFound.
* test(cloudformation): read NAT gateway addresses through XmlParser
The secondary-address tests picked addresses out of DescribeNatGateways and
DescribeAddresses with a regular expression and substring checks that
depended on element order. They now select the non-primary items of
natGatewayAddressSet through XmlParser.
* test(ec2): cover a NAT gateway stored as deleted by a racing tag write
CreateTags writes a NAT gateway back under the gateway's tag lock, which
DeleteNatGateway does not take. A tag write that read the gateway before a
delete therefore stores the very record the delete marked deleted, so the
secondary-address update's deleted-state check is reachable. The test pauses
the tag write's put, deletes the gateway, lets the put finish, and asserts
the update refuses the record with NatGatewayNotFound and holds no Elastic
IP for it.
* refactor(ec2): fill a NAT gateway's address slots in one place
CreateNatGateway and the secondary-address update each walked the gateway's
slots the same way: take the listed Elastic IP and address at each
position, assign a free address where none is listed, build the address,
and give back what was assigned if a later slot fails. Both now call
fillNatGatewaySlots. Create passes its primary address as slot 0 and marks
it primary afterwards; the update passes the slots its kept secondaries
already fill. The order addresses are assigned in, the error codes and the
release on failure are unchanged.
* test(ec2): cover NAT gateway lease release and reuse the shared test helpers
No test covered the lease a NAT gateway gives back when its addresses run
out part way, so the shared slot-filling walk could lose its release with
every test green. Two tests now run a /28 subnet out of addresses, one
through CreateNatGateway and one through a secondary-address update, and
verify the lease taken on the VPC network is released and that the update
leaves the gateway as it was.
The concurrent-delete test now builds its service with mockModeService()
and waits for the blocked update with ThreadStates.awaitBlockedOrDone.
* test(ec2): build the small NAT subnet with privateSubnet
* fix(eks): let guest kubelet own worker node registration
Honor an explicit image catalog capability on initial join and replay. Preserve simulated registration by default and retain join bookkeeping and listeners.
Closesfloci-io/floci#7419
* test(eks): clean up the kubelet registration worker independently
Retain the launched instance ID and terminate it in the original account and region. Attempt worker, tracking and cluster cleanup independently and verify the worker reaches terminated state.