mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
b8d87df05413ea8c4f9497fa05f388c19d4124ec
3425
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b8d87df054 |
fix(cloudwatch): reject PutMetricData datums without a MetricName (#6072)
* fix(cloudwatch): reject PutMetricData datums without a MetricName MetricName is the one required member of MetricDatum. The JSON handler stored a nameless datum under an empty name, and the Query handler treated a member without MetricName as the end of the list, silently dropping it and every later datum while still storing the earlier ones. Both handlers now reject a missing or empty MetricName in top-level MetricData and in EntityMetricData[].MetricData with MissingParameter (400), the error PutMetricData declares for a missing required input, naming the offending member. A whitespace name is still accepted, since AWS constrains MetricName only to 1 to 255 characters. Every datum is validated before any is stored, so a rejected request leaves no state behind. On Query, a member index with no keys at all still ends that MetricData list. * fix(cloudwatch): return MissingRequiredParameterException on JSON and CBOR CloudWatch is awsQueryCompatible. MissingParameter is the awsQueryError code of the MissingRequiredParameterException shape, so it belongs in the Query <Code> and the x-amzn-query-error header, while a JSON 1.0 or CBOR body's __type names the shape. With the code in __type the AWS SDK v2 raised a generic CloudWatchException instead of the modelled one. A package-private CloudWatchMetricsException keeps the Query code as its error code and overrides jsonType() with the shape name, the same split SwfException makes. The shared query-code table in AwsException is left alone because SQS reports MissingParameter as its JSON type. |
||
|
|
1f96bf42f1 |
feat(ecr): registry policy, replication and scanning configuration (#5817)
* feat(ecr): registry policy, replication and scanning configuration PutRegistryPolicy, GetRegistryPolicy, DeleteRegistryPolicy, PutReplicationConfiguration, DescribeRegistry, PutRegistryScanningConfiguration and GetRegistryScanningConfiguration store the registry's own settings per account and Region and return them as written. Floci does not replicate or scan images or evaluate the policy, as with repository policies. - The policy must be a JSON object; a missing one is RegistryPolicyNotFoundException. - Replication destinations, filters and rule counts are checked against the service model, and an empty rules list clears the configuration. - Scanning defaults to BASIC with no rules, and CONTINUOUS_SCAN is refused with BASIC. Closes #5803 * fix(ecr): put the registry setting writes under one lock PutRegistryPolicy, DeleteRegistryPolicy, PutReplicationConfiguration and PutRegistryScanningConfiguration read the registry's one settings record, change a field and write it back. Terraform applies the three resources in parallel, so two writers could start from the same record and the later write dropped the other's setting. The read, change and write now happen under a lock per account and Region. * refactor(ecr): check registry setting requests against the vendored model The Resource Groups request walker moves to core.common as RequestConstraintCheck, so a service can check a JSON request against botocore's constraints: member types, required members, lengths and counts, number ranges, patterns and enums, each answered in the service's own words. Resource Groups keeps its BadRequestException messages. - tools/aws/request_shapes.py gains build_constraints, which regen_resource_groups_shapes.py now calls; its vendored file is unchanged. - tools/aws/regen_ecr_shapes.py vendors ecr-request-shapes.json for the seven registry setting actions, and aws-data-sync and aws-data-check run it. - EcrJsonHandler checks those requests first, answering InvalidParameterException in ECR's form. The hand-written checks the model states are gone; a policy that is not a JSON object and CONTINUOUS_SCAN with BASIC stay, as the model cannot say them. |
||
|
|
9f9c16a181 |
fix(ec2): honor IncludePublicKey when describing key pairs (#6055)
* fix(ec2): honor IncludePublicKey when describing key pairs DescribeKeyPairs ignored IncludePublicKey. With IncludePublicKey=true each key pair now carries its OpenSSH public key, with the key-pair name as the comment in place of any comment an imported key had; omitted or false leaves it out. Imported material that is not a whole OpenSSH key, such as PEM or RFC 4716 text, a blob missing a field its type needs, a line that names another type than its blob, or a key type other than RSA, ED25519, ECDSA and their security-key forms, is kept as given and described without a public key. SshPublicKeys.carriesAKey checks the fields each type needs. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): describe a key pair's key only when it is exactly one key DescribeKeyPairs with IncludePublicKey=true still described a blob with bytes after its key, which OpenSSH and Go's ssh package refuse, and the first of several key lines, although an instance launched with the key pair trusts every line. Both are now described without a public key. A key pair stored before KeyName was required gets no comment instead of "null". carriesAKey reads the RSA fields once through the reader. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): leave a key-pair name that cannot be a comment off the key ImportKeyPair accepts a key-pair name with a line break, and as the comment of the described key such a name split it into lines that authorized_keys reads as further keys. A name holding a control character is now left off. carriesAKey names each ECDSA curve's coordinate size and reads a security key's application field directly, and its docs say it checks the format only. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * docs(ec2): name the key types and formats a described key pair needs The Key Pairs section now names DER beside PEM and RFC 4716, and the two security-key types OpenSSH has, instead of a security-key form for every type. The SshPublicKeys class comment covers the whole-key check, and a test comment no longer says a tab would split the described key. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * docs(ec2): list the described key types by their wire names The Key Pairs section lists the key types a key pair is described with by their OpenSSH names, which reads one way only, and the SshPublicKeys comments name the two security-key types instead of implying a security-key form for every key type. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> --------- Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> |
||
|
|
cbdeb0c8dc |
fix(codebuild): retry source archive uploads (#6060)
* fix(codebuild): retry source archive uploads * fix(codebuild): preserve build state on source upload failure * test(codebuild): make source upload retries deterministic |
||
|
|
689201122f |
fix(ec2): add opt-in Standard On-Demand vCPU admission (#6058)
* feat(ec2): enforce Standard On-Demand vCPU limits Keep EC2 launches and restarts within regional account limits. * fix(ec2): preserve quota lifecycle and launch semantics Keep Spot launches independent and pending restarts recoverable. Report incomplete CloudFormation restoration accurately. * fix(ec2): make vCPU admission opt-in and running-only |
||
|
|
8bff1ba0f3 |
feat(cloudfront): sign requests to a Lambda Web Function origin under OAC (#6037)
* feat(cloudfront): sign requests to a Lambda Web Function origin under OAC CreateOriginAccessControl now takes always-amz-auth for the lambda origin type and sigv4a for s3 and lambda, with the AWS validation messages. Distributions check the origin access control of a Lambda origin as AWS does, and refuse a Lambda@Edge origin trigger in front of an origin signed with always-amz-auth or sigv4a. Under always-amz-auth, CloudFront signs its requests to a Web Function endpoint of this Floci for the distribution. An IamAuth endpoint lets them through, or under IAM enforcement evaluates the function policy for cloudfront.amazonaws.com with aws:SourceArn and aws:SourceAccount. * fix(cloudfront): refuse unknown and in-use OAC changes as AWS does A distribution naming an origin access control that does not exist is InvalidOriginAccessControl. A control an origin uses can no longer change its origin type, its signing protocol, or whether it is always-amz-auth, which AWS answers with IllegalUpdate. * fix(cloudfront): match a Lambda origin by the end of its hostname CloudFront takes a Lambda origin only from a hostname under on.aws, and it matches the fixed labels case sensitively. Floci also takes one under its own host. The CloudFront check and the caller check now share the endpoint condition keys. The docs say when CloudFront forwards the viewer Authorization. * fix(cloudfront): read the Floci host for Lambda origins from the authority URI.getHost is null for a host with an underscore, such as a Compose service name, which broke CloudFront at startup. The Web Function endpoints are named from the authority, so the match reads it the same way. |
||
|
|
1a598b7f0c |
fix(rds): retry grant and snapshot archive uploads (#6069)
* fix(rds): retry master grant archive uploads * fix(rds): retry snapshot restore archive uploads |
||
|
|
9d1565fda3 |
test: move seven more single-setting test classes onto the shared profile (#6068)
Slice 16 of #4542. Seven classes each declared a profile for the settings of one service: the RDS Data resuming error with the Aurora resume delay, the Firehose flush record count, the Lambda python3.12 runtime image, the MQTT broker off, real EC2 instances with volume block devices, SageMaker GPUs, and a Bedrock Runtime proxy with an invalid URL. They now share IndependentServiceSettingsProfile, and their seven nested profiles are removed. Each class is the only one in the group that calls its service. Route53 and RDS do look VPCs and subnets up in EC2, but only read what EC2 has stored, which does not change with EC2 mocked or not. The Lambda image is set under a quoted YAML key, "python3.12", which a flat override cannot express, so the profile adds it through a YamlConfigSource, as the class's own profile did. Since the classes now share an application, each deletes what it creates. The Firehose class ends with a test that deletes its delivery stream, the object it delivered and the bucket Firehose created for it; an @AfterAll cannot make those calls, since Quarkus has reset RestAssured's port by then. In the EC2 class, the test attaching a volume to an instance whose container is gone never removed that instance, and the cluster node test cleared its instance provider before the cleanup detached its volume, which left the volume attached and undeletable. Both are fixed. SageMaker has no way to delete a training job, so the GPU class's jobs stay; no other class calls SageMaker, and the profile's javadoc says so. The Bedrock invalid URL test only checked the error type, which a missing URL or an unmapped model id also returns. It now checks the message, so it fails without the URL or the passthrough setting. DynamoDbLocalBackendIntegrationTest stays out. Its profile points DynamoDB at an external DynamoDB Local, whose endpoint CI does not set, and the local backend throws without one, so sharing it would break DynamoDB for the whole group. CI skips the class, so its profile costs an augmentation but no application start. The profile's javadoc lists each new override, the class that relies on it, and why it is inert for the others. |
||
|
|
08d5a9c742 |
fix(rds): retain requested storage types (#6057)
* fix(rds): retain requested storage types Keep database storage settings across updates, copies and restarts. * fix(rds): retain Provisioned IOPS storage types |
||
|
|
03f5730396 |
fix(cloudwatch): store datums sent in PutMetricData EntityMetricData (#6070)
The CloudWatch Agent sends PutMetricData with an empty top-level MetricData and every datum nested under EntityMetricData[].MetricData. Both the JSON 1.0 handler (also reached by Smithy RPC v2 CBOR) and the Query handler read only the top-level list, so the agent's metrics were silently dropped. Both handlers now append each EntityMetricData entry's datums to the top-level ones and store them under the request Namespace, with the same parsing as top-level datums. Entity and StrictEntityValidation are accepted and ignored. The per-request INFO logs of the raw request and parsed datums are lowered to a DEBUG count. Fixes #6066 |
||
|
|
ae53c4b352 |
fix(emr): preserve request-level step execution role (#6061)
* fix(emr): preserve request-level step execution role * test(emr): keep integration test order unique * fix(emr): align step roles with AWS response shapes |
||
|
|
c6551a47bc |
feat(ecr): PutImage and the layer API (#5784)
* feat(ecr): PutImage and the layer API PutImage, BatchCheckLayerAvailability, GetDownloadUrlForLayer, InitiateLayerUpload, UploadLayerPart and CompleteLayerUpload now go through the registry:2 container that docker push already writes to, so an image written through the API is the image docker pull and BatchGetImage return. - PutImage writes the manifest under its tag, or under its digest. It answers ImageDigestDoesNotMatchException, ImageAlreadyExistsException, ImageTagAlreadyExistsException and LayersNotFoundException as the model lists them. - Layer uploads map onto registry upload sessions, held in memory. Parts must follow each other, be at most 20 MiB, and all but the last at least 5 MiB. - GetDownloadUrlForLayer returns the blob's address on Floci's registry endpoint. - The immutable-tag guard moves into EcrService, so a docker push and a PutImage of one tag cannot both succeed. Closes #5735 * fix(ecr): refuse mixed layer digests, keep push time on retag, expire idle uploads CompleteLayerUpload refuses a second, different layer digest instead of ignoring it. PutImage keeps an image's first push time when it retags it. A layer upload idle for a day is refused even when no other upload opens, and dropping one cancels its registry upload session. * fix(ecr): check PutImage tags, require a manifest media type, share registry error handling - PutImage checks imageTag against the OCI tag grammar and answers InvalidParameterException otherwise. The tag goes into the registry's manifest URL, so v1?x wrote v1 and a slash wrote into another repository. - A manifest with no mediaType needs imageManifestMediaType, as on AWS, instead of Floci guessing one from the manifest's shape. - PutImage and the layer API reach the registry through one helper, callRegistry, in place of five copies of the same failure handling. * fix(ecr): answer ECR's own message for a tag outside its rule PutImage refuses a tag outside ECR's rule, [a-zA-Z0-9-_.]+ up to 300 characters, with ECR's message. A tag ECR takes but the backing registry cannot hold, one starting with '.' or '-' or longer than 128 characters, is refused with a message naming that limit, which docs/services/ecr.md now notes. |
||
|
|
d0dac9814f | fix(redshift): check the extra IAM actions GetClusterCredentials needs (#6067) | ||
|
|
fa4bacd0d1 |
fix(timestream-influxdb): retry restore archive uploads (#6064)
Reopen each backup tar for transient Docker upload retries without wrapping or buffering it. Keep restore commands outside the retry boundary and preserve cleanup on failure. Refs #5096. |
||
|
|
9b59b8997e |
feat(dynamodb): add on-demand backups (#6052)
* feat(dynamodb): add on-demand backups Add CreateBackup, DescribeBackup, ListBackups, DeleteBackup and RestoreTableFromBackup. A backup keeps a copy of the table settings and items from the time of the call, and it outlives the table. The restored table keeps the keys, indexes, billing mode, throughput and encryption. It drops the stream, TTL, point-in-time recovery, tags, deletion protection and table class, as on AWS. A GSI or LSI override must match a source index by key schema and projection, and a vector index override must match one by name. Error wording and check order follow AWS. A restore finishes before the response is sent. The response still says CREATING with RestoreInProgress true, as on AWS. Part of #4521. * feat(dynamodb): check the throughput members of a restore override * test(dynamodb): tolerate only missing resources in the backup test cleanup * feat(dynamodb): follow the AWS rules for on-demand restore overrides |
||
|
|
35ddd5c59d |
fix(redshift): retry snapshot and catalog uploads (#6065)
Rebuild host-resource uploads and catalog tar streams for transient Docker I/O retries. Keep SQL outside the retry boundary and preserve snapshot failure and optional bootstrap behavior. Refs #5096. |
||
|
|
9f99c7c2c2 |
fix(ec2): report image creation provenance and its three filters (#6059)
* fix(ec2): report image creation provenance and its three filters DescribeImages never returned SourceImageId, SourceImageRegion or SourceInstanceId, and the source-image-id, source-image-region and source-instance-id filters matched every image. - A CreateImage AMI reports the instance it captured, and the AMI that instance was launched from with its region. - A CopyImage AMI reports the AMI it copied and its SourceRegion, and no instance. - Both name the source by its AMI id, also when the request used a catalog alias, and keep naming it after the source is deregistered. - Registered and catalog AMIs report none. The filters match only images that carry the field, so the image DescribeImages makes up for a CDK lookup or an unknown launchable id no longer passes them. The fields are stored apart from the flattened ancestor Floci launches from, so a copy of a copy names its immediate source and still boots the right base image. Images saved before this change load without provenance. Split out of #5663 at review. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): accept a catalog alias in the source-image-id filter An instance launched by a catalog alias such as ami-amazonlinux2 keeps the alias as its ImageId, while the AMI captured from it records the AMI id the alias names. Filtering on the instance's ImageId therefore found nothing, where on AWS the two are always the same id. source-image-id now matches the recorded id or any alias of it, as image-id already does for catalog images. Review follow-ups in the same area: - a test pins the catalog branch of source-image-region, and the restart test names the flattened ancestor it expects; - the detached-storage test double copies the provenance fields; - the provenance test cleans up each resource independently, and the compatibility test deletes the copy's snapshot; - the AMI docs list CopyImage and DeregisterImage and say the filter takes an alias. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(ec2): pin wildcard alias matching in source-image-id The provenance test now checks that a wildcard on a catalog alias finds a capture, as it does for image-id, and reads the source-image-region result once. The DeregisterImage row in the AMI docs says a snapshot another AMI still uses is kept even with DeleteAssociatedSnapshots. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> --------- Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> |
||
|
|
aeb798939b |
fix(eks): replace a surviving k3s container left on another Docker network (#6063)
When Floci runs in a container and restarts on a different Docker network (FLOCI_SERVICES_DOCKER_NETWORK changed, or Floci moved from host networking to a bridge), restoreCluster adopted the surviving k3s container where it was. Docker isolates bridge networks from each other, so Floci could not reach the API server, the readiness poller never marked the cluster ACTIVE, and every add-on, access entry and access policy call kept failing with "Cluster must be ACTIVE". A survivor that is not on the network Floci now starts clusters on is replaced, the way a survivor whose node capacity changed already is: the data volume is kept, so the workloads come back. Floci on the host reaches k3s through the published port, so there a survivor is kept wherever it is. Co-authored-by: Robin Baeckman <27041454+RobinBaeckman@users.noreply.github.com> |
||
|
|
47f570a821 |
feat(cognito): hand email codes to the CustomEmailSender trigger (#6031)
* feat(cognito): hand email codes to the CustomEmailSender trigger
* test(cognito): decrypt CustomEmailSender codes with the AWS Encryption SDK
* docs(cognito): document the CustomEmailSender trigger
* fix(cognito): fail a CustomEmailSender delivery as Cognito does
Measured on Cognito (eu-west-1, 2026-10-16), with the events a real sender
received:
- CreateUserPool and UpdateUserPool refuse a custom sender trigger without
a KMSKeyID ("KMSKeyId parameter is required when Custom SMS/Email Lambda
trigger is used."), and CreateUserPool a key that does not exist
("Encountered error when CreateGrant was attempted on the input KMS key -
Key '<id>' does not exist"), both InvalidParameterException.
- A disabled key fails the request with CodeDeliveryFailureException
"Caller needs to enable the configured KMS Key", a key pending deletion
with "Unable to encrypt CustomEmailSender/CustomSMSSender code using the
configured KMS Key". The sign-up is kept, unlike a failed SES delivery,
and InitiateAuth answers the same error rather than InternalErrorException.
- A function that is gone, or that Cognito may not invoke, answers
UnexpectedLambdaException "CustomEmailSender invocation failed due to
error AccessDeniedException."
- request.clientMetadata is null for every source, InitiateAuth's
ClientMetadata included, so the parameter that carried it is gone.
The branch also follows main since it was written: CognitoService takes
enforceTokenValidityLimits, and signUp ValidationData and ClientMetadata.
* fix(cognito): withdraw a code the CustomEmailSender could not take
Review of #6031: when the handover failed, the code issued for it stayed
live in SignUp, ForgotPassword and both attribute flows, so asking for a
code again within 30 seconds answered LimitExceededException. Measured
on Cognito (eu-west-1): it hands out a code again at once, on a healthy
pool and once a key that could not encrypt is enabled again, for
ResendConfirmationCode and ForgotPassword alike.
sendThroughCustomEmailSender now withdraws the code before it fails, for
every flow, and the two catches that withdrew it by hand (resend and the
sign-in OTP) leave that to it.
* fix(cognito): hand the CustomEmailSender the request's ClientMetadata
Review of #6031: the developer guide lists ClientMetadata for the
sign-up, forgot-password and sign-in sources, and the branch passed null
for every one on the strength of InitiateAuth alone. Measured on Cognito
(eu-west-1): SignUp, ResendConfirmationCode, ForgotPassword,
GetUserAttributeVerificationCode and UpdateUserAttributes each hand the
function the request's ClientMetadata; only the sign-in code's event has
none, even when InitiateAuth sends one. A request without ClientMetadata
gives null, as measured before.
ResendConfirmationCode, ForgotPassword and the two attribute calls now
take the request's ClientMetadata through the service, with overloads
that keep their previous signatures. resolveTriggerArn's custom sender
branch gets its braces.
---------
Co-authored-by: outof-place <contact@outofplace.space>
|
||
|
|
0e6db1f2b3 |
fix(route53): serve stored public TXT and delegation records (#6034)
Signed-off-by: Andre Kurait <akurait@amazon.com> |
||
|
|
be2cb677d0 |
feat(resourcegroups): support EC2 capacity reservation pools (#6011)
Signed-off-by: Andre Kurait <akurait@amazon.com> |
||
|
|
691499d335 |
feat(sqs): opt-in AWS QueueUrl form via endpoint strategy (#5517)
* feat(sqs): opt-in AWS QueueUrl form via endpoint strategy FLOCI_SERVICES_SQS_ENDPOINT_STRATEGY=standard returns queue URLs in the AWS form, https://sqs.<region>.<dnsSuffix>/<account>/<name>. The default, path, keeps the current form. Every input form resolves under either setting. * fix(sqs): endpoint strategy accepts path or standard * refactor(sqs): queue URL forms are floci and aws, with shared round-trip tests * test(sqs): strategy names in tests and config comments read floci and aws * docs(sqs): list endpoint-strategy on the application.yml page The yml block and the env var table both list the setting, and the base-url comment names the aws strategy. |
||
|
|
88b0522168 |
fix(config): answer ResourceNotFoundException for tags on a missing resource (#6047)
TagResource, UntagResource and ListTagsForResource were plain map operations keyed by ARN. Tagging a deleted conformance pack's ARN returned 200 and re-created an orphan tag entry, and listing it returned an empty list. The Config model lists ResourceNotFoundException for all three operations. For the kinds Floci stores (config rules, conformance packs, aggregation authorizations) the ARN must now match an existing resource in the caller's account and request Region, so a deleted resource, or an ARN from another account, Region or partition, is not found. The check and the write run under the lock the resource's delete takes, so a delete cannot land between them and leave tags for a resource that is gone. ARNs of kinds Floci does not model are still accepted unchecked. |
||
|
|
0da0c80824 |
feat(elbv2): terminate HTTPS with ACM and IAM certificates (#5959)
* feat(elbv2): serve HTTPS listeners with ACM and IAM certificates Route HTTPS traffic with SNI and refresh certificates when they change. * fix(elbv2): preserve attached ACM certificates Refuse revocation while a listener uses the certificate and keep certificate listings responsive when many listeners are configured. |
||
|
|
73da37b90e |
fix(ec2): reject tag writes on missing, malformed or absent resources (#5996)
* fix(ec2): reject tag writes on missing, malformed or absent resources CreateTags and DeleteTags stored tags for any id. Both now answer MissingParameter when no resource is named and InvalidID for an id that is not a known EC2 prefix followed by hex digits. CreateTags also checks each resource exists in the request region and answers with that type's own NotFound error, as moto does; a well-formed id of a type Floci does not model is still tagged. CreateTags enforces the documented limits: at most 50 user tags per resource (aws: tags do not count) with TagLimitExceeded, and keys up to 128 and values up to 256 Unicode characters with InvalidParameterValue. Every resource and limit is checked before any tag is written. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * fix(ec2): match tag targets in full and resolve them by their prefix A tag target id is now matched in full with an 8 or 17 hex suffix, and an id Floci seeds without hex digits (a default VPC resource, a catalog AMI alias) passes only when the region holds it. The resource type comes from the matched prefix, so eni-attach-, vpce-svc- and the cidr-assoc ids reach the unmodelled arm, and an AMI is checked against the catalog and the region's registered images instead of DescribeImages, which answers an unknown id with a launchable fallback. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * fix(ec2): accept fleet and IPAM tag targets and check the tag limit under the write's locks EC2 Fleet and Spot Fleet request ids are UUIDs and an IPAM pool allocation id has 33 hex digits, so a tag target id now takes 8 or more hex digits or a UUID, and the ipam, ipam-scope, ipam-pool and ipam-pool-alloc prefixes are known. The 50-tag check ran before the write took its resource locks, so concurrent CreateTags requests at 49 tags could all pass it; the check and the write now run holding every named resource's lock, taken in stripe order after the topology lock. Signed-off-by: Hector Ventura <hectorvent@gmail.com> --------- Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
7504d71e76 |
fix(ec2): require IMDSv2 tokens when HttpTokens is required (#5966)
* fix(ec2): probe IMDS proxy readiness with an IMDSv2 token The proxy start script checked readiness with a tokenless read of the instance ID. Once IMDS enforces HttpTokens=required, that read gets 401 and the proxy reports a failed start after twelve attempts. The probe now fetches a 60-second token and reads with it; a refused or empty token fails the attempt rather than falling back to a tokenless read. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): refuse tokenless metadata reads when HttpTokens is required IMDS answered every request without a token through IMDSv1, whatever the instance's HttpTokens said. On AWS, when token usage is required, requests without a valid token get 401 Unauthorized. Floci now does the same for every metadata endpoint, before it looks up the data, using the options the instance was launched with or last modified to. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): clear application library paths in IMDS helper shells docker exec gives the proxy's install and start shells the image's environment. An application image that sets LD_LIBRARY_PATH, PYTHONPATH or PYTHONHOME can then make the package manager, socat and curl load its libraries or Python instead of the system's. Both shells now unset those three first; only the helper shell changes, so the container's configuration and the application's processes keep them. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): refuse metadata option changes on EKS cluster nodes IMDS serves a cluster node from the instance its EKS cluster registered, while EC2 hands out a copy of it. ModifyInstanceMetadataOptions changed and stored that copy, so DescribeInstances reported HttpTokens=required while the node's IMDS kept answering tokenless reads, and the stored copy no longer counted as a cluster node. The action now answers OperationNotPermitted for cluster nodes, as their stop, start, reboot and terminate actions do. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): publish metadata option changes to the IMDS event loop IMDS now reads an instance's metadata options on its Vert.x event loop, while ModifyInstanceMetadataOptions replaces them from a request thread. Without a happens-before edge the event loop could keep serving the old options, or see the new object before its fields. The field is now volatile, as the instance's state already is. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): keep the IMDS readiness probe off HTTP proxies The probe's curl calls honored an image's http_proxy or ALL_PROXY, so a proxy configured for the application received the link-local requests, every attempt failed and the start reported a failure although socat was running. Both calls now pass --noproxy '*'. The helper-shell test support moves to a shared HelperShellFixture, and a new test runs the real token probe inside the generated start script, whose set -eu loop must retry after a refused token. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): clear application library paths in the sshd install probe The sshd install probe runs dnf, yum or apt-get through docker exec with the image's environment, the failure the IMDS helper shells now avoid: with an application's PYTHONHOME or LD_LIBRARY_PATH, dnf could not start, so sshd was never installed. The probe now unsets the same three variables first, through the IMDS proxy's shared constant. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): keep refusing cluster nodes once EC2 has stored a copy The cluster-node check counted an instance as a node only while EC2's own store had no record of it, but ModifyInstanceAttribute, monitoring and other actions store EC2's copy of a node. After one of them, ModifyInstanceMetadataOptions was accepted without reaching the node's IMDS, and TerminateInstances and StopInstances were no longer refused. A node is now recognized by its cluster's provider alone. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): keep the pod identity relay probe off HTTP proxies The EKS pod identity relay's readiness probe shares the IMDS proxy's start script and environment, but its curl still honored the image's http_proxy: a proxy that answered passed the probe whether or not socat relayed, and an unreachable one failed the start. It now passes --noproxy '*' like the IMDS probe, from a podIdentityProbeCommand the test runs. The shared unset's Javadoc now names the shells that run it. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): refuse tokenless reads of every path when tokens are required The HttpTokens=required check ran inside the handlers of the paths IMDS serves, so a tokenless read of any other path, such as the /latest/meta-data/ listing that IMDSv1 detection probes, answered 404 where AWS answers 401. The check now runs ahead of every GET route; with a token, or on an instance that allows IMDSv1, such a path is still 404. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): keep IMDS answers for methods it does not serve The required-token check was registered as a GET route for every path, and Vert.x answers 405 to any other method on a path some route matches, so POST /latest/meta-data/ began to answer 405 instead of 404, and a tokenless HEAD on a required-token instance got 405 instead of 401. The check is now a route for every method that acts on GET and HEAD only. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(ec2): check that the pod identity probe reaches its relay The probe treats any answer but 000 as ready, so the test passed even when curl was missing and nothing reached the relay. It now counts the relay's requests, and both stand-in servers start inside its try. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * docs(ec2): say that IMDS refuses a tokenless HEAD but serves none The required-token check's Javadoc called HEAD a read, but no IMDS route serves HEAD, so one with a token still gets the router's 405. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * docs(ec2): say what IMDS answers a HEAD that has a token No route serves HEAD, so the router answers 405 on a path a GET route serves and 404 elsewhere. A test pins both. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(ec2): check IMDS refuses tokenless reads on Fleet and Auto Scaling launches Since #5964, Auto Scaling launches carry a launch template's MetadataOptions and CreateFleet forwards them. The test of template options on Fleet and Auto Scaling launches now also checks that IMDS refuses the launched instance a tokenless read and serves it with a token. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * docs(ec2): say where HttpTokens comes from and what IMDS refuses The IMDS notes said HttpTokens could be set "at launch". They now name its sources: RunInstances, directly or through a launch template, EC2 Fleet and Auto Scaling launches, and ModifyInstanceMetadataOptions. They say that a tokenless GET or HEAD is refused on every path, and that EKS cluster nodes refuse the change, in the notes, the EKS lifecycle-protection list and the action table. They also say that the readiness probe bypasses the image's HTTP proxy, that the helper shells keep an application's library search path and Python installation from the system tools rather than promising more, and that the sshd install shell clears them too. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> --------- Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> |
||
|
|
2f6f3a8f86 |
feat(route53resolver): add TagResource, UntagResource and ListTagsForResource (#6035)
* feat(route53resolver): add TagResource, UntagResource and ListTagsForResource The Terraform provider lists tags after creating any aws_route53_resolver_* resource, and Route 53 Resolver had no tagging operations, so the apply failed right after the create succeeded. Tags are kept per ARN in their own store, because none of the modelled resource shapes carries a Tags member. Resolver endpoints, resolver rules and custom firewall domain lists are taggable; tags passed to their Create calls are stored, and validated before anything is allocated. Lookup resolves the id in the caller's account and requires the stored ARN to match exactly, so an ARN naming another account, region or partition is ResourceNotFoundException. ListTagsForResource pages with MaxResults (1-100, default 100) and NextToken. * fix(route53resolver): scope tagging lookups to the caller and type-check tag input TagResource, UntagResource and ListTagsForResource now require the ARN to name the caller's own partition, region and account before reading any store, and fetch the resource with getForAccountMigratingLegacy, so an unprefixed pre-multi-account entry is migrated only into the account its stored ARN names. Before, a plain get() moved such an entry into whichever account looked it up first, and that account could then tag it by naming its original ARN. Tag Key and Value, and each UntagResource TagKeys entry, must be JSON strings (TagKey/TagValue are string shapes) instead of being coerced with asText(). MaxResults must be an integral number before its 1-100 range is checked, so 1.5 or true is InvalidParameterException rather than 1. ListTagsForResource copies the stored tag node under the monitor that TagResource and UntagResource mutate it under, so a concurrent tag change can no longer break the iteration or show a half-applied page. * fix(route53resolver): page tags through Pagination and cap tag lists at 200 ListTagsForResource now pages through the shared Pagination.paginate with an opaque, namespaced cursor on the tag key instead of a raw offset, so a forged or stale offset token is InvalidNextTokenException. MaxResults stays type-checked against the JSON value (integer 1-100, InvalidParameterException). TagResource Tags, UntagResource TagKeys and the Tags on CreateResolverEndpoint, CreateResolverRule and CreateFirewallDomainList are capped at the modelled 200 entries per request (TagList/TagKeyList max 200). Over the cap is the operation's parameter error: InvalidParameterException, or ValidationException on CreateFirewallDomainList. No per-resource total is enforced; the model does not state one. |
||
|
|
37717537a4 |
fix(iam): record a denied browser PostObject in CloudTrail (#6030)
Under IAM enforcement a denied S3 request is recorded in CloudTrail as the operation that was refused, but a browser POST upload left no record. Its credential is only in the form fields, so S3Controller authorizes it through IamEnforcementFilter.authorizeAdditionalResource, which threw AccessDenied without going through the denial emitter. The POST path now calls a new authorizePostObject, which checks s3:PutObject as before and, when IAM refuses it, records the denial as PostObject before refusing. AWS's S3 developer guide lists PostObject among the object-level API actions logged as CloudTrail events; the current user guide's data events table no longer names it. The emitter's recording half is split out so both paths share it, and a record it cannot write is logged as a warning. The denial is recorded in the Region the form's credential names, as a presigned URL's is in the one its query credential names, so a trail that logs only that Region gets it. |
||
|
|
24a960a599 |
fix(iam): check the API Gateway and Lambda routes the action map names, and test them (#6036)
Under IAM enforcement a REST request is checked as the action its route maps to, and a route no rule maps is let through unchecked. On #5604 the S3 and API Gateway entries of iam-authorized-actions.json were noted as never read, since those requests are authorized by route, with a test comparing them with the route table asked for. This adds that test, against each operation's real route, and fixes what it found. - IamRestRouteCoverageTest builds a request on each operation's route, as botocore's model gives it, and checks that the registry resolves every S3, API Gateway and Lambda entry of iam-authorized-actions.json to the action the entry names. The routes are vendored, one operation to a line, in src/test/resources/aws/rest-routes.json by the new tools/aws/regen_rest_routes.py, which make aws-data-sync and aws-data-check now run. - API Gateway: only /account and /restapis were mapped, so API keys, usage plans, client certificates, base path mappings, domain names and all of the v2 API went unchecked. The management API is now checked as apigateway:<method> on any route, as AWS authorizes it, and RejectDomainNameAccessAssociation and PutRoutingRule as their own actions. The v2 operations AWS checks only as actions of their own names, routing rules and portals, are not served by Floci. - Lambda: InvokeWithResponseStream went unchecked; it is now checked as lambda:InvokeFunction, against the qualified function as an invoke is. GetLayerVersionByArn is checked as lambda:GetLayerVersion. It shares its path with ListLayers, so a rule can now require a query parameter. - S3: the two bucket metadata configuration entries are not applied. Floci serves no metadata configuration, and such a request falls through to ListObjects or DeleteBucket, so it stays checked as the operation that runs. |
||
|
|
39a164cd19 |
test: share one real EKS profile across the two k3s cluster classes (#6038)
Slice 15 of #4542. EksRegistryHostsDockerIntegrationTest and EksStorageClassDockerIntegrationTest each declared a profile setting only floci.services.eks.mock=false. Both now share RealEksProfile, so two nested profiles become one. The registry hosts class creates its cluster and node group through the EKS API, which starts no container while EKS is mocked, so it relies on the override. The storage class test starts its cluster through EksClusterManager directly and passes with EKS mocked; it shares the profile because it runs a real cluster too. The profile's javadoc says which class relies on the override and why. The registry hosts class deleted its cluster after the test but left its node group and launch template behind, since deleting a cluster does not delete its node groups. It now registers deletes for all three with PartitionCleanup as it creates them. EksIrsaDockerIntegrationTest also turns the mock off, but keeps a profile of its own: it turns on IAM enforcement as well, which would decide every request the other classes send. |
||
|
|
e38ec02d44 |
fix(cloudformation): register an ECS task definition's containers with their LinuxParameters (#6027)
* fix(cloudformation): register an ECS task definition's containers with their LinuxParameters An AWS::ECS::TaskDefinition dropped its containers' LinuxParameters, so a container CloudFormation registered ran without the init process, capabilities, devices, shared memory, swap or tmpfs mounts the template asked for, and the Fargate rules on them never applied. They are now read from the task definition as the ECS handler converts it and kept where RegisterTaskDefinition keeps them, among the container's unparsed members under linuxParameters, so DescribeTaskDefinition returns them in the API's shape and the same validation, normalisation and Fargate checks apply as for a definition registered through the API. As CloudFormation's handler does (measured), the devices and tmpfs lists are sent empty when the template has none. * test(compat): wait for the LinuxParameters stacks through TestFixtures Review of #6027: the test's private waitForTerminal and waitForDeleted repeated TestFixtures.awaitStackTerminal. It now waits through that, and deletes its two stacks with a plain DeleteStack after the class, as CloudFormationEcsTaskDefinitionModelTest does. * test(compat): give the ECS CloudFormation stacks Floci's and AWS's own timeouts Review of #6027: DEPLOY_TIMEOUT was 30 seconds against both targets. These stacks finish in milliseconds on Floci, so it is now 10 seconds there and 10 minutes on real AWS, as CloudFormationEventsRuleTargetTest splits it. CloudFormationEcsTaskDefinitionModelTest, from #6018, had the same single 60 seconds and splits the same way. |
||
|
|
0517a7a936 |
fix(cloudformation): enforce SAM REST authorization defaults (#6021)
Signed-off-by: Andre Kurait <akurait@amazon.com> |
||
|
|
e520166170 |
fix(ec2): protect subnets and VPCs that load balancers use (#5663)
* fix(elbv2): protect subnets and VPCs that load balancers use DeleteSubnet and DeleteVpc returned success while an Application or Network Load Balancer still used the subnet, and DescribeLoadBalancers went on listing a subnet that no longer existed. EC2 now asks each VpcDependencyProvider, implemented by ELBv2, before deleting a subnet or VPC, under the lock CreateLoadBalancer and SetSubnets hold while they record their subnets, and refuses with DependencyViolation. Covered end to end through CloudFormation, including updates, rollbacks and stack deletes that move or delete load balancers, subnets and VPCs. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(cloudformation): record the subnets a load balancer is on A load balancer's attributes named none of its subnets, so once a template stopped naming it, the stack walks had nothing to order it by and deleted it after them, which EC2 now refuses. The provisioner keeps one hidden uses attribute per subnet, refreshed when an update moves the balancer and when a rollback moves it back. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(cloudformation): delete removed resources dependents first The update cleanup deleted removed and condition-disabled resources in reverse map order, before the replacement cleanup. A subnet an earlier update added sits after the load balancer it moved onto it, so removing both deleted the subnet first, and a renamed balancer's old entity still used a subnet the same update dropped. Both now end DELETE_FAILED, since EC2 refuses to delete a subnet a load balancer uses. The removed resources are now walked in dependency order, and a failed delete is tried once more after the replacement cleanup before it is reported. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * docs(ec2): name every ELBv2 load balancer type as a subnet dependency The DeleteSubnet and DeleteVpc rows named only Application and Network Load Balancers, while the check counts every ELBv2 type. The SDK lifecycle test now deletes its subnets and VPC even when an assertion fails. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(cloudformation): pin the order of the removed-resource deletes The removal test passed through the retry alone, so it now checks that the load balancer is deleted before its subnet is tried, and that the replaced balancer's old entity goes before the dropped subnet. The provisioner attribute test reads only what Fn::GetAtt can see, with the balancer on subnets. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> --------- Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> |
||
|
|
0f4f59bbbb |
fix(elbv2): require an HTTPS default certificate (#5989)
* fix(elbv2): require an HTTPS default certificate Refuse HTTPS listener changes until a default certificate is supplied. * docs(elbv2): keep certificate checks documented correctly |
||
|
|
eb968b0b69 |
fix(redshift): reject foreign-account or foreign-region ARNs in tagging (#6026)
* fix(redshift): reject foreign-account or foreign-region ARNs in tagging resolveTagHandle checked only that the ARN's service was redshift, then looked the resource up by id. CreateTags, DeleteTags, DescribeTags and the tag listing therefore acted on the caller's local resource of the same name when given another account's or another region's ARN, for every resource type in the switch: cluster, snapshot, parametergroup, subnetgroup, snapshotcopygrant and snapshotschedule. The ARN's account and region are now compared with the caller's (RegionResolver.getAccountId / getRegion, the same values the service uses to mint these ARNs) before the lookup. Error choice: ResourceNotFoundFault (404). It is the not-found fault the Redshift model lists for all three tag operations (CreateTags, DeleteTags, DescribeTags), and the snapshotcopygrant branch already uses it for a missing resource. The per-type faults (ClusterNotFound etc.) are not modelled on these operations. What real AWS returns for a foreign-account or foreign-region ARN was not confirmed against the live service. * fix(redshift): reject foreign-partition ARNs in tagging resolveTagHandle compared an ARN's account and region with the caller's but not its partition, so arn:aws-cn:redshift:<local-region>:<local-account>:... still resolved to the local resource. Reject it with ResourceNotFoundFault like the other foreign-scope ARNs. * refactor(redshift): use AwsArnUtils.isForeignAccount for the tag ARN account check Pairs it with isForeignPartition the way LambdaLayerService does, per review. |
||
|
|
7fb649715c |
fix(cloudfront): serve a Lambda Web Function endpoint origin from Floci itself (#6022)
* fix(cloudfront): serve a Lambda Web Function endpoint origin from Floci itself A custom origin whose domain is an endpoint this Floci minted now goes to the listener the viewer reached, with the endpoint domain as Host. Before, the endpoint host did not resolve, and loopback failed the private address check. As on AWS, a forwarded viewer Host is a 502, because the endpoint's certificate does not name it. * fix(cloudfront): fetch the endpoint origin over plain HTTP for TLS viewers A viewer over TLS reached the HTTPS port, and Floci sent plain HTTP to it. The request now goes to the plain HTTP port at the same address. The endpoint domains are also indexed by the host a CloudFront origin names, so a base URL host with upper case or a trailing dot still matches. |
||
|
|
2fd6f43836 |
test(lambda): run the binary bootstrap case on Ubuntu 26.04 (#6032)
On Ubuntu 26.04, /bin/echo is the Rust coreutils multicall binary. It picks the utility from argv[0], so a symlink named bootstrap exits 1. Use /bin/sh instead, which does not depend on its name. |
||
|
|
ec6f8a9d81 |
fix(opensearch): apply only supplied fields on partial UpdateDomainConfig (#6028)
* fix(opensearch): apply only supplied fields on partial UpdateDomainConfig
UpdateDomainConfig overwrote DedicatedMasterEnabled and ZoneAwarenessEnabled
unconditionally, and the ClusterConfig/EBSOptions parsers filled omitted
fields with model defaults. A partial block such as {"InstanceCount":5} or
{} reset dedicated master, zone awareness, instance type and count; a
partial EBSOptions reset VolumeType to gp2 and EBSEnabled to true.
The model fields are now boxed, the parsers leave omitted fields null, and
create and update share one merge that copies only non-null fields, so an
explicit false still turns a setting off. The legacy 2015-01-01 ES API
delegates to the same controller and is covered by the same fix.
* test(opensearch): drop internal tracker id from test comment
|
||
|
|
4b3681eb90 |
fix(apigateway): preserve API ownership across integration invocations (#6001)
Signed-off-by: Andre Kurait <akurait@amazon.com> |
||
|
|
456ae15684 |
fix(ec2): apply the AWS public address rules and displace earlier Elastic IPs (#5963)
* fix(ec2): assign mock public addresses and displace earlier Elastic IPs In mock mode an instance never received a public IPv4 address, whatever its subnet's MapPublicIpOnLaunch or its launch's AssociatePublicIpAddress said, and an associated Elastic IP never reached DescribeInstances. - A mock instance that asks for a public address gets one when it reaches running, whether DescribeInstances, DescribeInstanceStatus or StartInstances completes the launch. Stop and termination release it. An associated Elastic IP replaces it and survives a stop; disassociating it gives a running instance a new automatic address when its launch asked for one. - AssociateAddress disassociates the Elastic IP an instance already has, including one a retained interface carried onto it, as the AssociateAddress reference describes. - Launches from a template take AssociatePublicIpAddress from its device-index-0 interface (RunInstances, CreateFleet, Auto Scaling), and RunInstances and CreateFleet also take that interface's subnet. - RunInstances refuses an instance-level SubnetId combined with network interfaces, on the request or in its launch template, with InvalidParameterCombination. Split out of #5671 at review. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): scope Elastic IP displacement and automatic addresses as AWS does - AssociateAddress ignored PrivateIpAddress, so an Elastic IP meant for a secondary private address displaced the one on the primary. The address is now recorded on the private address it names, only an address already on that private address is displaced, the interface shows it there, and in mock mode only the primary's address becomes the instance's public address. - An instance launched on an existing network interface got an automatic public address; AWS assigns one only to an interface the launch creates. - A released automatic address was replaced while a second interface was attached; AWS does not replace it then. - An Elastic IP that a retained interface carried to a new instance stayed without an instance. It now names that instance, which shows the address and keeps it across a stop. - A mock launch could complete over a concurrent stop or termination, and DescribeAddresses could write back an address disassociated meanwhile; both now re-check under the instance's lock. The tests also cover a request's own network interfaces with an instance-level SubnetId, and the template interface docs now say which launches take the subnet. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): settle second-review findings on mock public addresses - DescribeAddresses re-points associated addresses under the allocation lock, and a mock launch, start or stop reads the instance's Elastic IP under it, so none of them acts on an association written halfway or changed meanwhile. - An Elastic IP that a retained interface carries is found through that interface, also when it is disassociated, instead of being rebound to the next instance at launch, which left a dead InstanceId behind when a container launch failed. - StartInstances leaves a running mock instance alone. - In container mode too, an address on a secondary private address no longer becomes the instance's public address. - The second-interface test associates its address before attaching the interface, since AssociateAddress by InstanceId needs exactly one. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): keep terminated mock instances down and address reads unblocked - StopInstances leaves a terminated or shutting-down mock instance as it is, re-checked under the lock, so terminate, stop and start no longer revives it with a public address. - DescribeAddresses waits for the allocation lock only when an address is associated with an instance, and the container re-point no longer rewrites an unchanged instance. - A mock start treats a state without a name as settled instead of throwing. Tests now cover the terminated instance and, with a reachable container address, an Elastic IP on a secondary private address leaving the instance's public address alone. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): settle Qodo findings on mock public addresses - AssociateAddress refuses a PrivateIpAddress that is neither the instance's primary private address nor a secondary address of its primary interface, with InvalidParameterValue and before any association changes, instead of treating it as the primary and displacing the Elastic IP already there. - RunInstances from a launch template whose device-index-0 interface names an existing NetworkInterfaceId launches on that interface, in its subnet and without an automatic public address, as a request naming it would, instead of on a new interface in the default subnet. - The SubnetId-with-interfaces refusal test now launches against a real subnet and checks that the refused request leaves no instance or interface behind. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): accept a container instance's launch address in AssociateAddress In container mode without AWS-faithful private addresses, the container manager replaces the instance's reported private address with its Docker bridge address once the container runs, and nothing keeps the subnet address RunInstances returned. The new PrivateIpAddress check therefore refused that address with InvalidParameterValue, though callers may still name it. Only mock mode and the AWS-faithful mode, which keep the launch address, now refuse a stray PrivateIpAddress; elsewhere any value means the primary address, as before. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): decide automatic public addresses the same way with containers The public IPv4 rules were applied to mock instances only. A container-backed instance kept its address after a stop and a termination, got one on an existing network interface, kept its reachable address after its Elastic IP was disassociated even when the launch never asked for one, and had a released address replaced while a second interface was attached. One rule, AutomaticPublicAddress, now decides whether an instance has an automatic address in both modes: the launch asked for one on an interface the launch created (recorded when the instance is built), a stop, a termination or a disassociated Elastic IP releases it, and a replacement is held back while a second interface is attached. An Elastic IP on the primary private address still takes precedence. Only the value differs by mode: the container's reachable address, or an invented one where there is no container. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): settle review findings on the shared public address rule - DisassociateAddress decides by the association, not by comparing addresses: only an Elastic IP on the instance's primary private address gives way to another one left there, or to an automatic address when one is due. With a container, every Elastic IP points at the one reachable address, so disassociating a secondary one no longer clears the instance's public address, and one a restart moved no longer survives its disassociation. - StartInstances on a stopped container instance releases an automatic address that a stop outside StopInstances, such as Floci's shutdown, left in place, so the start decides afresh. - With a container, these writes no longer wait on the instance's lock while holding the allocation lock, since the port-forward manager holds that lock across Docker calls. - A start test case now keeps an address distinct from the one it expects, and two comments describe the flag as it now is. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): release only the primary interface's Elastic IP on disassociation - DisassociateAddress treats an Elastic IP as the instance's public one only when it sits on the primary interface, not on a retained interface attached at another device index, so disassociating that one no longer clears the instance's automatic address. - With a container, DescribeAddresses no longer writes a re-pointed address back onto a terminated or shutting-down instance. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): show a carried Elastic IP on a container instance's launch - An instance launched on a retained interface that still carries an Elastic IP records that address at RunInstances, and the container launch re-points it once the container runs. With containers, such an instance had no public address until a stop and start, since the shared rule gives an existing interface no automatic address. - With a container, TerminateInstances clears the public address under the allocation lock, so a DescribeAddresses re-point already under way cannot write it back onto the terminated instance. - The secondary-interface disassociation test checks the address was still associated before the call and is not after it. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): re-point a carried Elastic IP at its new instance - DescribeAddresses re-points an Elastic IP that a retained interface carries at the instance that interface is now the primary interface of. With containers, the address otherwise kept the previous container's address for good, since termination clears its instance id. - With a container, StopInstances leaves a terminated or shutting-down instance alone, as mock mode does, instead of stopping it into a startable state and writing its Elastic IP back. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): give mock instances no invented public address by default Mock instances due an automatic public IPv4 address got a random 54.x.x.x one, a real AWS range, so a tool that connected to it reached someone else's host. The new floci.services.ec2.mock-public-addresses setting (FLOCI_SERVICES_EC2_MOCK_PUBLIC_ADDRESSES) chooses the address: none (the default) gives none, documentation draws distinct addresses from 203.0.113.0/24 as Lightsail and EMR do, and fixed gives every instance mock-public-address (default 127.0.0.1), an address the caller can reach. Only the value changes. The launch still records whether it asked for an address, so the shared rule and Elastic IP precedence work as before, and instances with containers keep reporting their reachable address. Elastic IP allocation still draws from 54.x.x.x, as on main. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): settle review findings on the mock public address setting A configured mock-public-address with surrounding spaces was reported as is; it is now stripped. The docs and the AutomaticPublicAddress Javadoc no longer describe every mock instance as getting an address, and the test configurations that launch mock instances name the setting instead of leaving it null. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): allocate Elastic IPs from the documentation range AllocateAddress handed out random 54.x.x.x addresses, a real AWS range, and this branch shows an associated Elastic IP as a mock instance's public address, so even with mock-public-addresses at none a client could reach someone else's host through one. Elastic IPs now come from 203.0.113.0/24 in every mode, distinct from the account's other Elastic IPs and its instances' public addresses; once all 254 are taken AllocateAddress fails with AddressLimitExceeded rather than repeat one, since callers name an Elastic IP by its address. Under mock-public-addresses: fixed, an Elastic IP on a mock instance's primary private address is re-pointed at the configured address, as one on a container instance is at the container's reachable address, and disassociation restores the allocated address. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): settle review findings on documentation-range Elastic IPs An Elastic IP re-pointed at the fixed address kept it after a restart under another setting; the next read now shows its allocated address again. The re-point Javadoc and the Elastic IP docs no longer claim a 54.x.x.x allocation or addresses that never repeat, the docs say that earlier allocations keep their address until released, and a test now proves an allocation skips the addresses instances hold. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> --------- Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> |
||
|
|
34d904fde5 |
feat(iot): search fleet things by connectivity status (#6025)
* feat(iot): search fleet things by connectivity status SearchIndex refused every connectivity field and its documents carried no connectivity, so an application that finds its things by connection state got InvalidQueryException. With connectivity indexing on, a thing now reports the MQTT broker session whose client id is its name, and connectivity.connected, connectivity.clientId and connectivity.disconnectReason can be searched. The other connectivity fields are still refused with InvalidQueryException. A thing whose client id never connected reports connected false and timestamp 0, as on AWS. The broker now records the account, region, connect time, keep alive and clean session of each session, and keeps in memory how the last one of each client id ended in each account and region, until a state reset. The reason is the one the session's disconnected lifecycle event carries, recorded by the same single endSession under the session lock, so the late end of a displaced session cannot overwrite its successor's. A plaintext session counts in the default account and region, a TLS session in its certificate's. Closes #4912 * fix(iot): serialize connectivity reads and resets with session ends A connectivity lookup read the live session without the session lock, so a search racing DeleteConnection could see the session connected after its disconnect was recorded. A state reset cleared the history without the lock too. Both now run under the session lock; the lookup tests the session's ended flag instead of the endpoint, as the lock is never held across endpoint calls. Tests cover the reset contract, a lookup and a reset racing a held DeleteConnection, and a TLS session counting in its certificate's account and region. |
||
|
|
1eb402d623 |
fix(ec2): keep tags in the region of the resource they label (#5973)
* fix(ec2): keep tags in the region of the resource they label DescribeTags listed every region's tags because the tag store was keyed by the bare resource id. Tags are now stored per region, so DescribeTags, DeleteTags, CreateTags and the aws:ResourceTag IAM condition only see the request region's tags. Each side of a cross-region transit gateway or VPC peering connection keeps its own tags in its own region. Tags stored by bare id are moved under their resource's region at startup, for every account; a tag whose resource no region holds is dropped. DescribeTags now reports image, volume, snapshot, network-acl, vpc-peering-connection and spot-instances-request instead of "unknown". Tags given when a volume or peering connection is created reach the store, and DescribeVolumes, DescribeSnapshots and DescribeSpotInstanceRequests show later CreateTags and DeleteTags changes. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * fix(ec2): remove tags with their resource and keep node and catalog AMI tags on upgrade Deleting a volume (directly or as a delete-on-termination volume of a terminated instance), a snapshot with its image or a VPC peering connection, and pruning a terminated instance, now removes the resource's tags, both peering sides included. The startup migration no longer drops tags it cannot place in a store: a catalog AMI's tags move to the default region, and an instance's are kept until its EKS node is found in a region, which then claims them. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * fix(ec2): file a cluster node's legacy tags under its own region A region-less findInstanceById reaches the EKS provider, which answers from any region, so the claim moved the node's legacy tags under a null region where DescribeTags never finds them. The claim now uses the instance's own region, and with no region known it reads the legacy tags in place for a regional lookup to claim. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * fix(ec2): pass the region in the query GET resource-tag stub Signed-off-by: Hector Ventura <hectorvent@gmail.com> --------- Signed-off-by: Hector Ventura <hectorvent@gmail.com> |
||
|
|
1b89d5da39 |
fix(storage): skip keys deleted mid-iteration in StorageBackedMap views (#6017)
* fix(storage): skip keys deleted mid-iteration in StorageBackedMap views The entry iterator walks a key snapshot and each entry's getValue() re-read storage, so a key deleted after the snapshot made values()/entrySet() yield null. Callers streaming values() (AutoScaling was patched per-site in #5751; many other services do the same) then hit NullPointerExceptions. Fix it once in the map: the iterator looks one element ahead and skips keys whose value is gone, and entries carry the value read at iteration time. Because size() is a separate snapshot, the entrySet/keySet/values views now report unknown-size spliterators; a SIZED stream would otherwise throw "End size N is less than fixed size M" when a key disappears mid-stream. * test(storage): cover iterator remove after lookahead, exhaustion and entry setValue * fix(storage): bind view spliterators lazily at first traversal The view spliterators wrapped iterator() at spliterator() time, so the key snapshot was taken when stream() was called rather than when the terminal operation ran. Collection.spliterator()'s default, which these views used before, is late-binding. Defer taking the iterator to the first tryAdvance or split, still reporting unknown size. |
||
|
|
5774e7db8d |
feat(cloudformation): support S3 Vectors resources (#5853)
* feat(cloudformation): support S3 Vectors resources * fix(cloudformation): validate S3 Vectors encryption settings * fix(cloudformation): align S3 Vectors provisioning contracts * fix(cloudformation): restore S3 Vectors properties on rollback |
||
|
|
eba0f72255 |
fix(iam): check iam:PassRole for ECS, Step Functions, EventBridge and CloudFormation (#5971)
Under IAM enforcement, a request that handed one of these services a role needed no iam:PassRole on it. A user allowed only ecs:RegisterTaskDefinition and ecs:RunTask could start a task with any role in the account, and with ECS task-role credentials on, the task got that role's credentials. The IAM user guide requires the permission for every role passed to a service. AWS's Service Reference names the service each operation passes its role to, and the check now covers these operations as it already covers Lambda and EC2: - ECS: RegisterTaskDefinition passes its task and execution roles to ecs-tasks.amazonaws.com. RunTask and StartTask pass the task definition's roles and any role override, and CreateService, UpdateService and CreateTaskSet pass the roles of the task definition they name. The infrastructure roles go to ecs.amazonaws.com: a managed EBS volume's role, the service role, the load balancer, lifecycle hook, Service Connect TLS and VPC Lattice roles, and a Managed Instances provider's infrastructure role. A role given by name is the role of that name in the caller's account. - Step Functions: CreateStateMachine and UpdateStateMachine pass roleArn to states.amazonaws.com, in a JSON or a CBOR body, gzip-encoded or not, since the CBOR endpoint decompresses a body before running it. - EventBridge: PutRule passes RoleArn, and PutTargets each target's RoleArn, to events.amazonaws.com. - CloudFormation: CreateStack, UpdateStack, DeleteStack, CreateChangeSet and ContinueUpdateRollback pass RoleARN when the request names one. A later operation that names none reuses the stack's role without the check, as CloudFormation does. CreateStackSet and UpdateStackSet pass AdministrationRoleARN, or the default AWSCloudFormationStackSetAdministrationRole for a self-managed StackSet, as the CloudFormation user guide says. An update goes by the StackSet's own permission model, which Floci keeps whatever PermissionModel the request names. A role override on RunTask is checked as well as the task definition's roles, not instead of them, because Floci runs a task with the definition's task role. The task definition and the StackSet's permission model are looked up through a new PassedRoleLookup interface, which ECS and the StackSet service implement, so the filter does not depend on either service. Three services are left out. Floci authorizes Cloud Control as cloudcontrolapi:*, where AWS uses cloudformation:*, so its RoleArn waits until that namespace is fixed. EventBridge Scheduler and Pipes are REST services that no IAM route rule maps to an action yet, so enforcement does not check their requests at all, iam:PassRole included. |
||
|
|
ee795d644c |
test: run the Cognito user pool domain class on the default application (#5975)
Slice 14 of #4542. CognitoUserPoolDomainIntegrationTest declared an empty profile, so Quarkus built an application for it alone. The profile was there to keep the class's last test, which posts /_floci/state/reset, from clearing other classes' state. Test classes run one at a time, though, so the reset only clears what this class and the ones before it created, and every service restores its bootstrap state as it clears. Classes already on the default application post the same reset, EmulatorInfoControllerIntegrationTest among them. The class now runs on the default application, and its javadoc says why the reset does no harm there. |
||
|
|
5787dac5e8 |
fix(kinesisanalytics): retry Flink configuration uploads (#6020)
Rebuild archive streams for transient daemon failures using the shared tar copier. Preserve required and optional copy handling, and cover consumed streams, retry exhaustion and startup order without sleeping in tests. |
||
|
|
fb390968d5 |
feat(guardduty): support publishing destinations (#6016)
* feat(guardduty): support publishing destinations
Add CreatePublishingDestination, DescribePublishingDestination,
UpdatePublishingDestination, DeletePublishingDestination and
ListPublishingDestinations under /detector/{detectorId}/publishingDestination.
Previously these returned UnknownOperationException, which broke
Terraform's aws_guardduty_publishing_destination.
Destinations are stored per detector through StorageFactory, so they follow
the detector's account and region scoping, survive a persistent-storage
reload, and report PUBLISHING on create (the state Terraform's create waiter
targets). A missing destination returns BadRequestException with the message
the Terraform provider matches for not-found. Deleting a detector removes its
destinations.
clientToken makes create idempotent and is capped at the model's 64
characters, measured in code points as the model's length constraint is.
destinationArn stays optional on create: the GuardDuty model marks
DestinationProperties.DestinationArn and KmsKeyArn as not required
(botocore guardduty/2017-11-28 service-2.json).
The service gains a five-store constructor; the existing three- and
four-store (malware protection plan) constructors delegate to it.
Closes #4983
* docs(guardduty): update the service matrix operation count
* test(guardduty): cover the publishing destination lifecycle through the SDK
Create, describe, update, list and delete an S3 publishing destination
with the AWS SDK v2 GuardDuty client, asserting the shapes as the SDK
reads them, including the required publishingFailureStartTimestamp.
|
||
|
|
28799ed352 |
fix(apigatewayv2): answer an HTTP API's Lambda proxy body it cannot read with 500 (#6012)
* fix(apigatewayv2): answer an HTTP API's Lambda proxy body it cannot read with 500 Review of #5985: the catch at the end of buildProxyResponse still answered an HTTP API with 502 and the function's output, for example when isBase64Encoded is set on a body that is not base64. Measured on HTTP APIs (eu-west-1), with payload formats 1.0 and 2.0: API Gateway answers 500 with {"message":"Internal Server Error"} a body that is an object or a list, an isBase64Encoded it cannot read as a boolean, and a body said to be base64 that does not decode. It reads isBase64Encoded's text as Go's strconv.ParseBool does: "True", "TRUE", "t" and 1 are true, "F" and 0 false, and "tRuE", "yes", 2 and 1.5 are not read. Floci read true, the text "true" and any integer but 0 as true, so it relayed "True" and "t" bodies undecoded, "yes" ones as plain text, decoded a body under 2, and answered an object body 200 with an empty body. A number or a boolean body is still its text. The catch now answers an HTTP API with the same 500 for a result Floci cannot parse at all; a REST API keeps its 502. * refactor(apigatewayv2): decode an HTTP API's base64 body once Review of #6012: the readability check decoded a base64 body that the response then decoded again, a second decode and array for every encoded reply. The catch at the end of buildProxyResponse already answers an HTTP API with 500 and the generic message, so the check now looks only at the body's shape, and a body said to be base64 that does not decode fails where it is decoded and reaches that catch. |
||
|
|
65e35adf54 |
feat(backup): add CreateLogicallyAirGappedBackupVault (#6015)
* feat(backup): add CreateLogicallyAirGappedBackupVault
Route PUT /logically-air-gapped-backup-vaults/{name}. The vault shares the
standard vault namespace and ARN shape; DescribeBackupVault reports VaultType
LOGICALLY_AIR_GAPPED_BACKUP_VAULT, VaultState and the retention days. Both
retention values are required, MinRetentionDays >= 7, MaxRetentionDays >= Min.
The vault is locked at creation so the existing retention enforcement applies,
vault-lock put/delete are rejected on it, and ListBackupVaults honours the
vaultType filter.
Closes #4986
* docs(backup): correct the service matrix operation count
* fix(backup): fail a job whose vault was replaced before it completed
A backup job resolved its vault by name at completion. Deleting a
logically air-gapped (or locked) vault while a job was in flight is
allowed, since it holds no recovery point yet; recreating the name as a
standard vault then received the old job's recovery point, which the
unlocked replacement let be deleted inside the original vault's minimum
retention.
Completion now checks, under the vault-name monitor, that the vault
holding the name is the incarnation the job started in. If not, the job
ends FAILED with no recovery point, as it cannot land in a vault that no
longer exists.
* fix(backup): air-gapped vault LockDate at creation; standard vault VaultType BACKUP_VAULT
CreateLogicallyAirGappedBackupVault now sets LockDate to the creation
date, so the vault's lock reads as compliance mode (immutable) rather
than a governance lock with no LockDate. DescribeBackupVault and
ListBackupVaults report VaultType BACKUP_VAULT for standard vaults,
filled at read time so vaults stored with no VaultType are covered.
|