mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
fee688bd051a5bde4e2e8a4d5e0f5d75c7ffe00a
89
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a6cf29ea86 |
fix(cloudformation): copy a SAM function's VersionDescription to its version (#6770)
With AutoPublishAlias, SAM passes a function's VersionDescription to the Description of the AWS::Lambda::Version it generates. The transform dropped it, so a version published from a SAM template never had the description the template gave it. The version now takes it as written, leaving an intrinsic function for CloudFormation to resolve. As in SAM, it stays out of the hash that names the version, and Globals cannot set it: the transform refuses it there, as it already refuses AutoPublishCodeSha256. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> |
||
|
|
d10db3ce9b |
feat(ecr): repository creation templates (#5955)
* feat(ecr): repository creation templates CreateRepositoryCreationTemplate, DescribeRepositoryCreationTemplates, UpdateRepositoryCreationTemplate and DeleteRepositoryCreationTemplate store templates per account and Region, keyed by prefix, with each field checked against the service model. An update replaces the fields it sets, and an empty string or list clears one. Templates are recorded, not applied, as nothing in Floci creates repositories through replication, pull through cache or create-on-push. Closes #5804 * refactor(ecr): check repository creation templates against the vendored model The four template actions join the registry settings in ecr-request-shapes.json, so the handler checks their requests against the ECR model's types, lengths, patterns and enums and answers in ECR's "failed to satisfy constraint" form. The handwritten copies of those rules go. What the model can't state stays in the service: appliedFor naming at least one value, and policy text being a JSON object. The model gives imageTagMutabilityExclusionFilters at least one entry, so an update sending an empty list is now refused rather than clearing the filters. Terraform omits the member when the filters are removed and moves to a mode without exclusions, so an update that leaves the template in such a mode now drops the filters. Before, they stayed, and every plan showed them again. * fix(ecr): lock creation template writes, share one JSON object check and fold a trailing slash Create, update and delete each read a template and then wrote it without a lock, so two creates of one prefix could both succeed and an update racing a delete wrote the deleted template back. They now take the registry lock the registry settings use. The template policies and the registry policy share one JSON object check that also refuses text after the object, such as {}{}. ECR assumes a / after every prefix, so prod and prod/ are now one template. The test helper imports Executable. * fix(ecr): describe each template once when prefixes differ only by a slash Describe removed duplicate prefixes before folding the trailing slash, so prefixes prod and prod/ returned the template twice, and with maxResults 1 a token followed by an empty page. It now removes duplicates by template key. The lock tests use the shared testing ParkingStore instead of their own copy. |
||
|
|
ec21cf38c7 |
feat(rds): DescribeCertificates, ModifyCertificates and an instance's CA certificate (#6106)
* feat(rds): DescribeCertificates, ModifyCertificates and an instance's CA certificate DescribeCertificates lists the Region's RDS certificate authorities with the thumbprint and validity AWS reports, vendored from the certificate bundles AWS publishes by tools/aws/regen_rds_ca_certificates.py, and pages them. ModifyCertificates sets or removes the account's default for new instances. CreateDBInstance, ModifyDBInstance, the two instance restores and CreateDBInstanceReadReplica take CACertificateIdentifier, and instances report it with CertificateDetails. AWS::RDS::DBInstance takes the property and resolves the two CertificateDetails attributes. The identifier is metadata: the auth proxy keeps presenting Floci's own CA. Closes #5806 * fix(rds): follow the user guide on CAs and leave a blank CA alone - An instance stored without a CA reports rds-ca-rsa2048-g1, since an override applies only to instances created after it. - ap-south-1, ap-southeast-4, ca-west-1, eu-central-2, eu-south-2 and il-central-1 offer only rds-ca-rsa2048-g1, as the user guide says. - A blank CACertificateIdentifier on modify leaves the instance's CA. - --download skips a Region only on 403 or 404 and exits 1 on other failures. - Reuse regionFromArn, add a createDbInstance stub helper and import Executable in the tests. |
||
|
|
3438a00daf |
feat(lambda): version network connectors as AWS does (#6595)
* feat(lambdamicrovms): version network connectors as AWS does * fix(lambda): lock connector versions and refresh them after a CFN rollback Updates, deletes and version reads hold one lock, so two updates cannot take the same version number. A CloudFormation rollback restores the connector through an update. On AWS that makes the next version, and a later Fn::GetAtt returns it. The resource now keeps that version in LatestVersion and LatestVersionArn. Read the connector ARN through AwsArnUtils.parse. AWS refuses LatestVersion, an integer, as a string Output, so the stack test reads LatestVersionArn only. * fix(lambda): type the connector LatestVersion attribute as an integer AWS::Lambda::NetworkConnector declares LatestVersion as an integer. On AWS a stack whose string Output reads it fails with "Template format error: Every Value member must be a string.", and Fn::Sub refuses it with "variable Connector.LatestVersion in Fn::Sub expression does not resolve to a string". * chore(lambda): share the connector version ARN and integer attribute helpers |
||
|
|
cd2dac708d | feat(lambdaweb): check the code bucket versioning and policy as AWS does (#6479) | ||
|
|
7e6439cf86 |
feat(lambdaweb): check the execution role as AWS does (#6347)
* feat(lambdaweb): check the execution role as AWS does
AWS refuses a revision whose execution role is in another account with
403 AccessDeniedException. It refuses a role that does not exist or does
not trust lambda.amazonaws.com with 400 ValidationException, and that
check gives no aws:SourceAccount or aws:SourceArn. An environment
assumes the role with the function as its source, and a request gets
502 Platform.CannotAssumeRole when Lambda can no longer assume it.
* fix(iam): match a wildcard principal and the service keys in service trust
{"AWS": "*"} lets Lambda assume a role, and a Deny on it refuses the role.
Lambda sets aws:PrincipalIsAWSService to true and aws:PrincipalServiceName
to its principal when it checks the role and when an environment assumes it.
* fix(lambdaweb): answer CannotAssumeRole when the role goes during a start
A role deleted after the trust check gave the container the account's
placeholder credentials. AWS answers 502 Platform.CannotAssumeRole for a
deleted role.
|
||
|
|
62972c91bf |
feat(lambdaweb): fail a revision whose code is not a zip (#6141)
* feat(lambdaweb): fail a revision whose code is not a zip
A revision whose code is not a zip is Failed, as on AWS, and cannot be
deployed. The endpoint CreateWebFunction makes on such a revision is
Failed too and answers 409 Platform.EndpointNotActive. An empty object
is a 500 InternalServerException with an empty body, as on AWS.
* fix(lambdaweb): remove a code copy that cannot be read and name the {} body
* test(lambdaweb): upload a real zip in the compatibility tests
|
||
|
|
1108bc75dc |
feat(rds): DB proxy endpoints (#6062)
* feat(rds): DB proxy endpoints CreateDBProxyEndpoint, DescribeDBProxyEndpoints, ModifyDBProxyEndpoint and DeleteDBProxyEndpoint store endpoints per account and Region, checked against the service model. Each endpoint reports its proxy's own host, so a client connects through it as through the proxy. DescribeDBProxyEndpoints lists each proxy's default endpoint first; it cannot be modified or deleted. Deleting a proxy deletes its endpoints, and endpoint ARNs take tags. Closes #5805 * fix(rds): report each proxy endpoint at the proxy's current host A custom endpoint kept the proxy's host from when it was created, so after a restore gave the proxy a new host, every custom endpoint still reported the old one while default reported the new one. The host is no longer stored with the endpoint: create, describe, modify and delete take it from the proxy when they answer. A missing DBProxyName, DBProxyEndpointName or VpcSubnetIds is now MissingParameter, checked before the proxy is looked up. * test(rds): import Executable and assertTrue instead of naming them inline |
||
|
|
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. |
||
|
|
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. |
||
|
|
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> |
||
|
|
3cb1643d30 |
fix(cloudformation): publish content-hashed versions for SAM AutoPublishAlias (#5744)
* fix(cloudformation): publish content-hashed versions for SAM AutoPublishAlias
Point the alias AutoPublishAlias generates at the Version attribute of
the generated AWS::Lambda::Version, as SAM does, instead of $LATEST,
and name that version as SAM names it: <Function>Version plus the
first ten hex digits of the SHA-1 of the function's code, with
template parameters resolved as a Ref or as ${Name} in an Fn::Sub,
merged with its Environment and MemorySize, as sorted compact JSON
escaped the way Python's json.dumps escapes it. Under
AutoPublishAliasAllProperties the hash covers every property floci
gives the function. A string AutoPublishCodeSha256 takes the hash's
place with its first ten characters. As in SAM, the version is
retained (DeletionPolicy: Retain) unless the function says otherwise,
and version properties of the wrong type are refused.
With the alias on the published version, a template change to the
code names a new version resource, which publishes, and the alias
moves to it, while changes made to $LATEST outside the stack no longer
reach the alias. The $LATEST pin worked around #1987 and #1988: a cold
invoke of a published version timed out, and a warm $LATEST container
served version-qualified invokes. Both are fixed on main.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(cloudformation): hash an applied SnapStart into the SAM version id
SAM adds a function's SnapStart to the hash behind the AutoPublishAlias
version's logical id when its ApplyOn is anything but None, so turning
SnapStart on names a new version, which publishes and gets its
snapshot. Without it a SnapStart function got a different id than SAM
gives it, and changing SnapStart published nothing. Under
AutoPublishAliasAllProperties SnapStart is hashed like the other
properties.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* refactor(cloudformation): resolve SAM destination types with parameterValue
destinationType repeated the parameter lookup parameterValue already
does for the version hash: the stack's value, else the Default. Use the
one helper. A non-string Default still names no destination type.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* docs(cloudformation): describe the SAM version hash in SAM terms
Reword the comments and test names around the AutoPublishAlias version
id to state what SAM and CloudFormation do, rather than how another
project or language implements it.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(cloudformation): hash a null SnapStart ApplyOn and state what it changes
SAM leaves SnapStart out of the version hash only when ApplyOn is
missing or "None"; a null ApplyOn is hashed. The check read a null as
"None".
floci does not pass SnapStart to the function, so turning it on
changes the version's logical id but publishes no new version, and
no snapshot is taken.
|
||
|
|
6e01216f88 |
feat(lambdaweb): serve endpoint domains from a Node.js environment per revision (#5760)
* feat(lambdaweb): serve endpoint domains from a Node.js environment per revision A request whose Host is an endpoint's domainName goes over HTTP/1.1 to a container that Floci starts from the revision's S3 code on the first request: public.ecr.aws/lambda/nodejs:24 with the code in /var/task, index.js or AWS_LAMBDA_NODEJS_ENTRYPOINT as the entry file, the node flags and the environment variables AWS sets, ten seconds to listen, SIGTERM and one second when idle, and a fresh environment after the process exits between requests. The forwarded request carries the headers AWS adds and loses the ones AWS drops. The response carries lambda-web-request-id and lambda-web-logstream and streams as the app writes it. Two revisions in revisionWeights split the traffic by weight. The platform pages for an unsupported method, an unknown domain, HTTP/1.0, a server that does not listen, a timeout, a crash and a disabled endpoint are the AWS pages. Part of #5699 * fix(lambdaweb): index endpoint domains and claim only the minted host shapes A request looked its domain up by scanning every stored function across accounts and iterating live endpoint maps outside the function lock. The service now keeps a domain index, filled from storage at start and kept by the create and delete paths, and copies the function under its lock. The data plane claims only hosts shaped like the domains Floci mints, in any case and with any port, so a dotted S3 bucket with a lambda-web label still reaches S3. * fix(lambdaweb): reserve environments against the idle reaper and track exits acquire now reserves the environment under the same lock the idle reaper takes, so a request cannot start on a container the reaper is about to stop. Docker faults in the reaper and in discard are contained so one error does not end the periodic run or skip the removal. The exit watcher records the exit time and arms itself again when its stream drops, and a request that found a dead process is replayed only when that recorded exit came first, never because the container is gone. The unpacked code directory is removed on every path. The container gets the execution role's session credentials when the role exists, and the function account's credentials otherwise, as the Lambda launcher does. * fix(lambdaweb): bound the whole exchange by timeoutSeconds and forward chunked bodies timeoutSeconds is a deadline on the whole request, as recorded against AWS: a response that has not started by then is the 504 page, one that is still streaming is cut, and a slow upload gets its 504 once the body is in, since the edge takes the body before it answers. A body without a Content-Length is sent chunked instead of carrying the client's Transfer-Encoding header. A failure of the upload stream ends the exchange and releases the environment once. * test(compat): probe the unknown Lambda Web domain in the shape Floci mints The data plane claims only hosts shaped like the domains it mints, so the unknown-domain check needs a 16 character id to reach it. |
||
|
|
ea45f81a81 |
fix(s3): reject undersized multipart upload parts (#5718)
* fix(s3): reject undersized multipart upload parts Signed-off-by: boulea7 <zln1905391059@163.com> * fix(s3): reuse multipart size error helper Signed-off-by: boulea7 <zln1905391059@163.com> --------- Signed-off-by: boulea7 <zln1905391059@163.com> |
||
|
|
6f78083080 |
feat(lambdaweb): Lambda Web Functions control plane (#5706)
* feat(lambdaweb): Lambda Web Functions control plane The lambda-web service model (apiVersion 2025-03-07) signs as lambda, so it is served under the lambda service at /2025-03-07/... with the AWS wire shapes, state words and error wording of the 20 operations on web functions, revisions, endpoints, tags and the resource policy. Revisions and endpoints converge at once. They are stored Active and an endpoint update is stored Successful, while the create and update responses report the transitional state AWS reports, so a CLI waiter settles on its first poll. Code comes from an S3 object that must exist. IamAuth, the resource policy and the endpoint domain are stored but not served yet. Part of #5699 * fix(lambdaweb): carry the page position in the token The nextToken of a list operation was a UUID keyed into an in-memory anchor map that only grew and was not scoped to the account. The token is now a core Pagination cursor that encodes the request (operation, region, account, function, filters and page size) and the cursor of the item the page ended on. A token reused with other parameters gets the AWS "does not match the request" error and any other token the AWS "invalid or has expired" error. AWS issues UUID tokens and rejects any other shape, so Floci no longer reproduces the pattern error for a malformed token. * fix(iam): resolve a Lambda Web revision or endpoint named by its ARN The route resource for IAM enforcement took the path segment after revisions or endpoints as the id. A revision or endpoint ARN in that position carries slashes, so the resource ARN ended in the ARN's first segment and a policy scoped to the revision or endpoint did not apply. The id is now the last segment of such an ARN. * fix(lambdaweb): add the values of a repeated state filter AWS lists a function when any state filter in the request names its state. A later state filter replaced the earlier one, so a request with state=Active followed by state=Failed listed nothing. * fix(lambdaweb): refuse empty arrays in a resource policy AWS answers an empty Action or Resource array with the policy syntax error and an empty principal array with the invalid principal error, which wins when all three are empty. Floci stored such a policy. * fix(lambdaweb): judge a wildcard principal by the operator and value of its condition A trusted condition key alone kept an Allow for every principal out of the public check. AWS blocks the policy unless a positive operator pins the key: StringNotEquals and the IfExists forms do not count, nor does a wildcard in an account value or in the account field of an ARN value, while a wildcard elsewhere in an ARN and a literal * under StringEquals do. |
||
|
|
e023ae9ff4 |
fix(s3): refuse DeleteBucket while versions or delete markers remain (#5548)
* fix(s3): keep versioned buckets until history is purged Reject DeleteBucket while any account-scoped object metadata remains under the bucket prefix. Cover hidden versions and markers through service, HTTP, and persistent storage tests, and purge them in CLI and Java compatibility cleanup. * test(s3): purge versioned enforcement fixtures Delete every listed object version and marker before removing fixture buckets, repeating the first page so deletions do not invalidate continuation markers. Cover null versions, mixed history, and a page boundary inside one key with a direct bucket absence assertion; register the formerly exempt versioned fixture for cleanup. * test(s3): assert fixture purge removes a null version Seed an untouched object before enabling versioning and assert that ListObjectVersions reports its literal null version ID. This makes the direct purge guardrail exercise the null-version branch as intended. * test(s3): encode versioned fixture keys during purge * test(s3): share SDK bucket cleanup helper |
||
|
|
e22bd2c59a |
feat(ec2): support transit gateway peering attachments (#5122)
* feat(ec2): support transit gateway peering attachments Add CreateTransitGatewayPeeringAttachment, DescribeTransitGatewayPeeringAttachments, AcceptTransitGatewayPeeringAttachment and DeleteTransitGatewayPeeringAttachment, the calls the Terraform provider's aws_ec2_transit_gateway_peering_attachment and _accepter resources make. Previously each answered UnsupportedOperation. An attachment is created in pendingAcceptance and moves to available when accepted from the accepter's region. One attachment id serves both sides, so a cross-region peering is visible from either region and the transit-gateway-id filter matches either side's gateway, which is how the accepter finds it. Tags come from the shared tag store, so CreateTags on the accepter side round-trips through describe. * style(ec2): order the TransitGatewayPeeringAttachment import * fix(ec2): hold peered transit gateways and accept peerings only as the peer DeleteTransitGateway now refuses with IncorrectState while a non-deleted peering attachment names the gateway at either end, as it already does for VPC attachments; creation takes the same topology lock so neither lands in between. A peering is stored under the requester's account, so lookups search every account's partition and admit only the two parties, as VPC peering does. Accept requires the caller to be the accepter's account in the accepter's region, so a requester can no longer accept its own cross-account request, and the peer account can now see and accept it. The local-owner-id and remote-owner-id filters are relative to the viewer's side. * test(ec2): cover transit gateway peering attachments in the AWS CLI compatibility suite * style(ec2): drop em dashes from the peering attachment comments * refactor(ec2): make the peering attachment store final and pass it through the constructor The StorageFactory constructor now hands the factory-backed store to the terminal constructor, and the hermetic overload passes an InMemoryStorage, the same way the other EC2 stores are wired. * fix(ec2): clear both sides' tags when a cross-account peering attachment is deleted Tags are per account: each party to a peering sees the tags its own account set. Deleting the attachment cleared only the caller's, so the other party's tags outlived it. * fix(ec2): let a pending peering's accepter delete its transit gateway Anyone can name any gateway as their peer, so a peering that has not been accepted no longer holds the accepter's gateway. Deleting that gateway declines the peering, leaving it rejected. Accepted peerings still hold both ends, and a pending one still holds its requester's. * fix(ec2): accept a transit gateway peering only for a gateway the accepter owns The peer gateway is recorded unresolved at create, so an account could name another account's gateway as the peer with its own account as PeerAccountId, accept it, and pin that gateway against its real owner's DeleteTransitGateway. Accepting now requires the peer gateway to exist in the caller's account and region, the same lookup create makes for the requester's gateway. * fix(ec2): route transit gateway peering actions to ec2 without a credential scope |
||
|
|
436c15ca38 |
fix(sts): reject AssumeRole for roles that do not exist (#4463)
* fix(sts): từ chối AssumeRole khi role không tồn tại trong IAM AssumeRole trước đây cấp credential cho mọi role ARN, kể cả role chưa từng được tạo (iam:GetRole trả NoSuchEntity). Giờ trả AccessDenied như AWS, bất kể enforcement có bật hay không; trust policy vẫn chỉ được đánh giá khi enforcement bật. Các test cũ assume role chưa tạo được sửa để tạo role trước. Closes #4392 * fix(sts): so sánh chính xác role ARN và cập nhật compatibility tests - StsQueryHandler: kiểm tra roleArn khớp chính xác role.getArn() để tránh chấp nhận role cùng tên khác path - StsQueryHandlerTest: đổi tham số helper sang IamRole thay vì Optional, bổ sung test case từ chối role khác path - AssumeRoleTrustPolicyIntegrationTest: sửa Javadoc mô tả đúng hành vi từ chối unknown role - Cập nhật compatibility tests (Java, Node, Python, AWS CLI) để tạo role trước khi assume và kiểm tra lỗi 403 khi role không tồn tại * fix(sts): accept partition-correct role ARNs and strictly catch cleanup exceptions - StsQueryHandler: match role ARN structurally using AwsArnUtils to admit valid noncommercial partition ARNs - StsQueryHandler: preserve caller partition when generating assumedRoleArn - StsTest, test_sts.py, sts.test.ts: only ignore NoSuchEntity/EntityAlreadyExists in cleanup, re-raising unexpected errors per AGENTS.md - StsQueryHandlerTest, AssumeRoleTrustPolicyIntegrationTest: add unit and integration coverage for partition-correct role ARNs * fix(sts): preserve role partition in resolved session caller ARN * fix(sts): preserve stored role partition in assumed identity * fix(sts): validate web identity role ARN * fix(sts): require role existence in AssumeRoleWithWebIdentity and reuse path helpers * fix(sts): keep IAM ARN partition behavior unchanged * fix(sts): derive trust caller account from identity ARN * fix(iam): migrate legacy credential reports by partition * fix(iam): serialize legacy credential report migration * test(iam): make credential report race deterministic * fix(sts): address review feedback * fix(sts): reuse IAM role path normalization |
||
|
|
f48bc2aa40 |
fix(rds): accept the master usernames each engine really allows (#3730)
The 16 character cap was applied to every engine, but RDS accepts 63 on PostgreSQL and 32 on MySQL, so an instance whose master username is longer could not be created at all. The bound now comes from DatabaseEngine, using the engine createDbInstance already resolves; the character rule and the error message are unchanged. Closes #3729 |
||
|
|
8921ca1118 |
feat(ec2): answer MonitorInstances and UnmonitorInstances (#3319)
* feat(ec2): answer MonitorInstances and UnmonitorInstances
Both actions returned UnsupportedOperation. Detailed monitoring is a CloudWatch
billing switch with no behaviour an emulator can meaningfully model, which is
presumably why it was left out -- but declining the call is more costly than
answering it, because one unsupported action fails an entire deployment regardless
of how much of the rest of it succeeded. An aws_instance declared with
monitoring = true
calls MonitorInstances immediately after RunInstances, so the whole configuration
is discarded over a flag with no state behind it.
Acknowledge the requested state and echo every instance the caller named. Nothing
is stored: there is no monitoring data to serve, and DescribeInstances does not
report a monitoring state today, so persisting one would only create a second
place for it to be wrong.
Reference: the MonitorInstances response shape -- instancesSet of
InstanceMonitoring, each with instanceId and monitoring.state, plus requestId --
https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_MonitorInstances.html
https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_UnmonitorInstances.html
One deliberate deviation: AWS reports state "pending" because the change is applied
asynchronously, then settles on "enabled". The emulator has nothing to settle, so it
reports the terminal state directly. Reporting "pending" for a transition that would
never complete would be worse for any client that polls.
* fix(ec2): reject monitoring for an instance that does not exist, and store the state
Two problems, both of which made the action answer confidently about something it
had not done.
The handler echoed every InstanceId back with a 200 without resolving it, and did
not even take a region to resolve it with. Naming an instance that does not exist
got a success response saying its monitoring was enabled. Every other instance
operation raises InvalidInstanceID.NotFound; this now does too, by delegating to
the service and resolving each id through getRequiredInstance, which is the same
shape stopInstances and the rest already use.
The state was also never stored. Instance already carries a monitoring member and
DescribeInstances already emits it, so MonitorInstances reported "enabled" while
every subsequent read still said "disabled". The state now persists, so the round
trip agrees with itself.
The previous tests asserted the old behaviour: they passed a made-up instance id and
expected 200. They are rewritten to launch a real instance, and two cases are added
for the not-found path plus one that reads the state back through DescribeInstances.
* test(ec2): name the monitoring suite for what it is, an integration test
It is a @QuarkusTest driving the HTTP endpoint, and the repository's dominant
convention for those is *IntegrationTest: 607 of the 736 @QuarkusTest classes on
main follow it. Renaming rather than arguing, since the evidence here points at
the convention.
* test(ec2): cover monitoring through the SDK path, not only the Query wire
AGENTS.md asks for management APIs to be validated with SDK clients and "not only
handcrafted HTTP requests". The Java test drives the Query endpoint with RestAssured,
which is right for pinning exact XML but does not exercise the path aws_instance
actually takes: monitoring = true calls MonitorInstances through the SDK, which parses
the response rather than reading whatever XML we happen to emit.
Three cases in the awscli suite, which is where EC2 SDK coverage already lives:
enable and read back through DescribeInstances, disable and read back, and reject an
instance that does not exist. The read-backs are the point rather than padding: the
bug this guards against was the handler answering "enabled" while every later read
still said "disabled", which asserting on the mutating call's own response cannot see.
Verified as far as this machine allows. run-instances, the teardown and the harness
plumbing all work against a local emulator; the three assertions themselves cannot
pass here because the released 2.0.1 image predates MonitorInstances, which is the
gap this PR closes. They run against the branch build in CI.
|
||
|
|
6345c37bad |
fix(rds): populate MasterUserSecret for Aurora clusters with ManageMasterUserPassword (#3148)
* fix(rds): populate MasterUserSecret for Aurora clusters with ManageMasterUserPassword CreateDBCluster ignored ManageMasterUserPassword, so aws_rds_cluster with manage_master_user_password=true always returned an empty master_user_secret, breaking any Terraform reference to master_user_secret[0]. The instance path already generates the managed secret; the cluster path never parsed the option. Mirror the instance behavior on the cluster path: - CreateDBCluster / ModifyDBCluster parse ManageMasterUserPassword and MasterUserSecretKmsKeyId and generate a Secrets Manager secret (rds!<clusterResourceId>, OwningService=rds, tagged aws:rds:primaryDBClusterArn) - DescribeDBClusters and the other cluster responses render <MasterUserSecret> - ModifyDBCluster enables the secret on demand and removes it when the option is turned off with a caller-supplied password - DeleteDBCluster deletes the managed secret - Startup ownership backfill also covers persisted clusters Closes #3061 * fix(rds): roll back cluster managed secret on failed create and honor KMS re-key Addresses review feedback on the cluster managed-master-user-password path: - doCreateDbCluster now deletes the just-created managed secret if proxy startup or persistence fails afterwards. The cluster is never stored in that case, so DeleteDBCluster could not otherwise reach the orphaned secret. - ModifyDBCluster with MasterUserSecretKmsKeyId on a cluster that already has a managed secret re-keys the existing secret via updateSecret instead of silently dropping the request. |
||
|
|
724be0a6a7 |
fix(s3): return composite multipart checksums and match S3 on UploadPart, GetObjectAttributes and CopyObject responses (#3093)
* fix(s3): return composite checksums for multipart uploads CompleteMultipartUpload stored the checksum of the whole object but labelled it COMPOSITE, so clients that recompute the composite value from the part checksums, as the AWS documentation describes, never matched it. Follow the AWS checksum type rules, verified against real S3: - SHA1/SHA256 are always COMPOSITE, CRC32/CRC32C default to COMPOSITE and CRC64NVME is always FULL_OBJECT. x-amz-checksum-type on CreateMultipartUpload selects FULL_OBJECT for CRC32/CRC32C; incompatible combinations fail with InvalidRequest, and the response echoes x-amz-checksum-algorithm/-type. - The composite value is the algorithm applied to the concatenated binary part checksums, Base64 encoded, with a "-<part count>" suffix. It is returned by CompleteMultipartUpload, HeadObject and GetObject (with x-amz-checksum-type), while GetObjectAttributes omits the suffix, as AWS does. - A checksum sent on CompleteMultipartUpload is validated against the stored type: a mismatching value is a BadDigest (the composite is accepted with or without its suffix), a checksum type different from the one the upload was created with is an InvalidRequest, per-part checksums in the request body that do not match the uploaded parts are an InvalidPart, and a COMPOSITE upload completed without the checksum of every part is an InvalidRequest (FULL_OBJECT uploads need none, as on S3). A non-numeric PartNumber is a MalformedXML instead of a 500. - UploadPart echoes the part checksum (x-amz-checksum-<algorithm>) when the upload declared an algorithm, as S3 does; without one no header is returned. - CopyObject writes a single object without a part manifest; a composite source gets a full-object checksum recomputed with its algorithm, and CopyObjectResult carries the checksum elements, matching AWS. - GetObjectAttributes lists part-level checksums only for COMPOSITE objects: a FULL_OBJECT multipart object reports its PartsCount alone and a single-part object has no ObjectParts element. The algorithm and type rules live in two new enums, ChecksumAlgorithm and ChecksumType, parsed once from the request headers; S3Checksum builds the full-object, composite and GetObjectAttributes views of a checksum. The boto3 compatibility suite gains multipart upload_file cases for SHA256 and for the SDK's default CRC32, asserting the composite value and the part list. The S3 docs drop the stale note that checksum responses focus on SHA-1 and SHA-256 (CRC32, CRC32C and CRC64NVME have been supported since #877) and list the AWS algorithms Floci rejects. * fix(s3): return the GetObjectAttributes ETag without quotes S3 returns the ETag element of GetObjectAttributes without the surrounding quotes that HeadObject, ListParts and CompleteMultipartUpload keep. Verified against real S3 with the same object: head_object gives "af3c...-3" while get_object_attributes gives af3c...-3, and the AWS CLI reference shows the same in its get-object-attributes example. Floci echoed the quoted value, so a client comparing both saw different strings on Floci and equal ones nowhere. * fix(s3): give a copied object its own ETag CopyObject kept the ETag of the source, so the copy of a multipart object carried the "<md5-of-md5s>-N" value of its parts. S3 writes a copy as a single object and returns the MD5 of the whole content as its ETag, in CopyObjectResult and HeadObject alike (verified against real S3: source "af3c...-3", copy "a5f04f..."). The copy now keeps the ETag storeObject computes. * fix(s3): send CopyObjectResult as application/xml The CopyObject response carried Content-Type: text/plain;charset=UTF-8 for an XML body. S3 labels it application/xml like every other XML response. * test(s3): cover multipart checksums in every SDK compatibility suite Each SDK implements flexible checksums differently, so the multipart flows are exercised per client rather than once: the Go transfer manager (what terraform-provider-aws uses), @aws-sdk/lib-storage for Node, the Java SDK v2 both low-level and through S3TransferManager on the multipart-enabled async client, the AWS CLI (s3api, aws s3 cp --checksum-algorithm and a plain aws s3 cp that goes multipart on its own) and boto3. Every case asserts the composite or full-object value computed in the test itself, the UploadPart echo, the suffix-less GetObjectAttributes checksum and unquoted ETag, the rejected Complete without part checksums, and the copy of a multipart object as a single full object with its own ETag. The default algorithm cases accept whatever the SDK version declares (CRC32 composite or full object, or none) and check the stored value against it. * test(terraform): upload a large aws_s3_object with Terraform and OpenTofu The IaC suites created buckets but never an object, so the code path that surfaced the composite checksum bug, an aws_s3_object above the provider's part size uploaded through the SDK transfer manager, was not covered. Both suites now upload a 12 MiB file generated by the test setup with checksum_algorithm SHA256 and check that HeadObject reports a COMPOSITE checksum equal to the composite computed locally over the part sizes GetObjectAttributes lists, that the state attribute holds the same value, and that re-planning the object shows no drift. compat-opentofu moves to the same aws-cli image as compat-terraform (2.34.32): 2.15 predates the S3 checksum type and cannot show ChecksumType in its output. * fix(s3): reject x-amz-checksum-type without a checksum algorithm CreateMultipartUpload only parsed x-amz-checksum-type when an algorithm was declared, so a type sent on its own, valid or not, was silently ignored. S3 validates the header regardless: an unknown value is InvalidRequest "Value for x-amz-checksum-type header is invalid." and a valid one without an algorithm is InvalidRequest "The x-amz-checksum-type header can only be used with the x-amz-checksum-algorithm header." (both verified against real S3). * test(s3): log cleanup failures in the multipart checksum compat tests The Java, Node and Go cases swallowed errors while deleting their objects and bucket. They now report what could not be deleted and why, so a leftover is diagnosable instead of silent. --------- Co-authored-by: Mihai Blidaru <mihai.blidaru@lynxfctech.com> |
||
|
|
91d7ab8935 |
fix(docdb): accept an existing security group on CreateDBCluster and ModifyDBCluster (#2991)
* fix(docdb): accept an existing security group on CreateDBCluster and ModifyDBCluster The security group lookup passed null for group names, which Ec2Service.describeSecurityGroups does not accept, so any existing group id answered an internal error while a made-up one was refused correctly before that filter ran. Closes #2990 * test(docdb): clean up the EC2 fixtures of the security-group bats case * test(docdb): tear down the security-group case's EC2 fixtures even when it fails * test(docdb): delete the case's VPC even when its security group was never created |
||
|
|
96d16de998 |
feat(s3): add Intelligent-Tiering configuration CRUD (#2997)
* feat(s3): add Intelligent-Tiering configuration CRUD Add AWS S3 Intelligent-Tiering configuration management through the real REST XML subresource (?intelligent-tiering), mirroring the existing metrics configuration pattern. Operations: - PutBucketIntelligentTieringConfiguration (PUT, 204) - GetBucketIntelligentTieringConfiguration (GET by id) - ListBucketIntelligentTieringConfigurations (GET without id) - DeleteBucketIntelligentTieringConfiguration (DELETE, 204) The parser validates Id, Status (Enabled/Disabled), optional Filter (Prefix/Tag/And), and one or more Tiering entries (AccessTier + positive Days), re-serializing through XmlBuilder/XmlParser/AwsNamespaces.S3 so responses are built by floci rather than echoing the request body. Malformed bodies return MalformedXML; missing configurations return NoSuchConfiguration. Configurations are stored on the Bucket model keyed by id (nullable map for backward-compatible deserialization of older snapshots), persisted through StorageFactory, and synchronized on the bucket monitor with the same requireSameRecord guard as metrics to survive concurrent puts and bucket delete/recreate races. Tests: - S3IntelligentTieringConfigurationTest: parser unit tests - S3ServiceTest: service lifecycle, isolation, persistence, concurrency - S3IntelligentTieringConfigurationIntegrationTest: REST integration - compatibility-tests/sdk-test-awscli: AWS CLI bats coverage * refactor(s3): rename METRICS_XML_DECLARATION to S3_XML_DECLARATION The XML declaration constant is shared by both metrics and intelligent-tiering configuration responses, so the name should reflect its S3-wide scope rather than implying it is metrics-specific. * fix(s3): enforce auth and validate Days overflow on intelligent-tiering Address review feedback on PR #2997: - PUT and DELETE ?intelligent-tiering now enforce S3 authorization via a new authorizeBucketWrite method, closing the bypass where mutations skipped the auth applied to reads. - Days values above Integer.MAX_VALUE no longer throw NumberFormatException and return 500 InternalError; they are rejected as 400 MalformedXML. - A PUT without a request body returns 400 MalformedXML instead of NPE/500. Tests: unit coverage for Days overflow, integration coverage for empty body. * fix(s3): enforce tier-specific Days range on intelligent-tiering AWS enforces a tier-specific Days range for S3 Intelligent-Tiering: - ARCHIVE_ACCESS: 90 to 730 days - DEEP_ARCHIVE_ACCESS: 180 to 730 days Out-of-range values now return InvalidArgument with ArgumentName and ArgumentValue in the XML error body, matching the real S3 error shape. Add unit and integration tests covering below-minimum, above-maximum, boundary acceptance, and the full XML error response. * refactor(s3): extract Days range constants in intelligent-tiering Replace repeated magic numbers (90, 180, 730) with named constants ARCHIVE_ACCESS_MIN_DAYS, DEEP_ARCHIVE_ACCESS_MIN_DAYS, and MAX_DAYS. Pass min into daysOutOfRange instead of recomputing it, and use an import for LinkedHashMap. |
||
|
|
5033ace772 |
fix(rds): store and return the encryption and backup settings given on create (#2617)
* fix(rds): store and return the encryption and backup settings given on create DescribeDBInstances never returned StorageEncrypted, KmsKeyId, BackupRetentionPeriod or CopyTagsToSnapshot, and wrote both windows as constants. Store the six values from CreateDBInstance, apply the backup settings and windows from ModifyDBInstance, and emit them from the instance XML. A record persisted without them reads as AWS defaults. KmsKeyId is resolved against the KMS store in the request's region — a key ARN, key id, alias ARN or alias name — and stored as the key ARN, as a live account reports it; a key that does not exist or is not enabled is KMSKeyNotAccessibleFault. Validation follows a live account: KmsKeyId needs StorageEncrypted, window times are checked with AWS's wording, windows are at least 30 minutes and may not overlap; the retention period is not range-checked since AWS accepted 40 days. Closes #2611 * fix(rds): check window overlap against the windows that will be in effect A window given alone was not checked at all: the request's other window was null, so validate() skipped the overlap check although the instance kept its stored counterpart on modify and got a default on create. Check the pair that results from the request — on modify the stored other window, on create the default, swapped for an alternate default when the given window overlaps it, since AWS picks a random window clear of the given one. Verified on a live account: a modify overlapping the stored window is refused either way, replacing both at once checks only the new pair. * fix(rds): detect window overlap across the week boundary in both directions A Sunday backup window running past midnight lies beyond the end of the week, so comparing it with a Monday maintenance window needs the maintenance interval shifted forward as well as back. * fix(rds): derive the default counterpart window from the given one's end A fixed alternate default cannot be clear of every window a request can give — a 00:00-07:00 backup window covers it. When the window given on create overlaps the usual default, pair it with a 30-minute window that starts the minute the given one ends, which is clear of a daily window by construction; the overlap check stays as the backstop. * fix(rds): refuse a window given alone that leaves no room for the other, in AWS's words The derived counterpart is clear of any window that leaves a 30-minute gap (swept over every start and length in DbInstanceSettingsTest); a window longer than that has no clear counterpart, and a live account refuses it: "The specified backup window overlaps all available default maintenance windows. Shrink the backup window or specify a non-overlapping maintenance window." (mirrored for maintenance), and a maintenance window of 24 hours or more is "Maintenance window must be less than 24 hours." * refactor(rds): share the window checks with BackupWindows |
||
|
|
46d2f4e70f |
fix(docdb): refuse an engine version a live account does not list (#2682)
* fix(docdb): refuse an engine version a live account does not list CreateDBCluster and ModifyDBCluster derived a parameter group family from any engine version string and assigned "default.<family>" without checking that the family exists. The versions a live account lists for docdb are now the catalogue: 3.6.0, 4.0.0, 5.0.0, 5.0.1, 8.0.0, 8.0.1 and the major.minor form of one; anything else is refused before any change with "Cannot find version X for docdb". default.docdb8.0 joins the managed cluster parameter groups. Closes #2681 * test(docdb): refuse an unlisted engine version through the CLI |
||
|
|
f019573bf1 |
fix(docdb): store and return cluster and instance settings (#2651)
* fix(docdb): store and return cluster and instance settings CreateDBCluster and ModifyDBCluster dropped DBSubnetGroupName, DBClusterParameterGroupName, VpcSecurityGroupIds, StorageEncrypted, KmsKeyId, BackupRetentionPeriod, both windows, DeletionProtection and tags; instances dropped AutoMinorVersionUpgrade, PreferredMaintenanceWindow, CopyTagsToSnapshot and PromotionTier. Describe now returns what was given, or the defaults a live account assigns, and refuses what a live account refuses before any container is started: an unknown subnet group, parameter group, security group or KMS key, a KMS key on an unencrypted cluster, a retention period outside 1..354, malformed or overlapping windows. Records persisted before these fields existed are filled in with the defaults on read. Port is not taken from the request: the port a cluster reports is the one it is reachable on. Closes #2614 * fix(docdb): enforce deletion protection, parameter group family and undrivable windows DeleteDBCluster refuses a cluster with DeletionProtection, before any state changes. A named parameter group must belong to the family of the engine version the cluster will run, judged on modify against the requested version rather than the stored one; a cluster on a default group follows an engine version change to the new family's default. A window given without its counterpart that leaves no daily half hour for the derived one is refused with the live wording instead of a derived window that overlaps. * fix(docdb): refuse an engine version change that keeps a custom group of the old family * fix(docdb): judge a retained parameter group by its stored family, not its name * fix(docdb): classify a retained parameter group through the RDS catalogue, not its name --------- Co-authored-by: Priamo Germosen <6233424+pgermosen@users.noreply.github.com> |
||
|
|
3b0e31b888 |
fix(rds,docdb): list DocumentDB clusters and instances in the RDS-family list form (#2623)
* fix(rds,docdb): list DocumentDB clusters and instances in the RDS-family list form The list form of DescribeDBClusters and DescribeDBInstances answered from one store: on the rds scope from RDS, on the docdb scope from DocumentDB, so a DocumentDB cluster was invisible to every list while its identifier form worked. A live account lists the whole family from either endpoint. RdsQueryHandler now assembles the list from both stores, honouring the db-cluster-id / db-instance-id filters in each and an engine filter across them (case-insensitive, OR over values, refused for a name outside the family's engine list as on AWS), and the controller sends the docdb-scope list form there too. The identifier form keeps routing to the store that owns the identifier. Both halves list the region the request is signed for. Closes #2613 * fix(rds): report and filter an Aurora member instance by its Aurora engine name DbInstance collapsed aurora-postgresql and aurora-mysql onto the community engine enum, so a cluster member reported Engine postgres and the engine filter matched it as postgres, where a live account says and matches aurora-postgresql. Keep the engine name the request gave (or the cluster's, for a member created without one) on the instance, and read it for both the Engine element and the filter; a record persisted before the field existed falls back to the enum. * fix(rds): give a persisted instance its engine name on restore An instance written before engineIdentifier existed deserializes with it null, and a runtime fallback to the enum would keep reporting an Aurora member as postgres. Backfill it in restorePersistedRuntime from the state that knows: the member's cluster for a member, the enum for a standalone instance. * fix(rds): never persist a guessed engine name for a member of a nameless cluster A cluster persisted before its own engineIdentifier existed (#1829) has none to hand down, and writing the member's enum in that case would store postgres for what may be an Aurora member — a guess that outlives the code able to tell. The backfill writes only what is certain: the cluster's stored name for a member, the enum for a standalone instance; a member of a nameless cluster is left unset. * fix(rds,neptune): list Neptune clusters and instances in the RDS-family list form too A live account lists a Neptune cluster from the rds, docdb and neptune endpoints alike and selects it with engine=neptune. The list form now merges Neptune rows the way it merges DocumentDB ones, and the neptune scope's list form goes to the same assembly. The Neptune store is not keyed by region, so its rows are scoped to the request's region by ARN. * fix(rds): close the subnet-group tags test in rds.bats --------- Co-authored-by: Priamo Germosen <6233424+pgermosen@users.noreply.github.com> |
||
|
|
75f8f42d5f |
fix(elasticache): keep a replication group's encryption, snapshot settings, tags and ARN (#2632)
* fix(elasticache): keep a replication group's encryption, snapshot settings, tags and ARN DescribeReplicationGroups wrote AtRestEncryptionEnabled and SnapshotRetentionLimit as constants and never emitted KmsKeyId, SnapshotWindow or ARN, so a group created with them drifted on the next Terraform plan (kms_key_id forces replacement) and its tags, given at create, could not even be asked for without an ARN. Store the four settings and the tags on the group, resolve KmsKeyId through the KMS store in the request's region to the key ARN a live account reports, apply the snapshot settings from ModifyReplicationGroup, emit them with the ARN, and answer ListTagsForResource for replicationgroup ARNs — for the record the ARN names, since the store keys groups by id alone. Delete and modify of a group now share one monitor, so a modify cannot write the group back after a delete removed it. Validation and wording follow a live account. Closes #2615 * fix(elasticache): refuse a KMS key with encryption at rest omitted, and change nothing on a refused modify An omitted AtRestEncryptionEnabled is false on a live account and a KmsKeyId is refused with it the same way as with an explicit false. ModifyReplicationGroup applied the snapshot settings to the store's own object before validating the user ids, so a request refused for an unknown user had already changed the group; every check now runs before any change. * fix(elasticache): read AtRestEncryptionEnabled as a live account does, and refuse an empty snapshot window A live account reads any AtRestEncryptionEnabled value that is not "false" as true — banana, yes and "TRUE " all created an encrypted group — so the flag is read the same way rather than parsed strictly. A snapshot window whose end equals its start was measured as a full day; a live account refuses it as shorter than an hour. |
||
|
|
20ecb89155 |
fix(rds): keep the tags given to CreateDBSubnetGroup (#2627)
The handler never read Tags.Tag.N, so a group created with tags answered an empty list to ListTagsForResource — which terraform-provider-aws calls right after the create — although the model already carried a tag map and AddTagsToResource on the group's ARN worked. Store the tags with the group in the same write. DocumentDB subnet groups are the same records through the same scope. Closes #2612 |
||
|
|
04d120fdd5 |
feat(fis): add AWS FIS support (#2435)
* feat(fis): add AWS FIS support * refactor: add typed FIS persistence models * ci(fis): retrigger timed-out build * fix(fis): reject trailing JSON request bodies |
||
|
|
520c0f4da2 |
feat(cloudfront): apply response-headers policies when serving (#1833)
* feat(cloudfront): serve distribution requests from S3 and custom origins * feat(cloudfront): add response headers policy support * chore: re-run CI The Build and Test failure on the previous head was RuntimeApiServerTest's extension/stop race, a pre-existing flake unrelated to this change — it also failed on #1820, #1823 and on #2131's own branch (the PR that tried to de-flake it). Reproduced locally under `--cpus=1` and fixed separately. * fix(cloudfront): wildcard aliases match exactly one subdomain level wildcardAliasMatches did a plain suffix check, so "*.example.com" also matched a.b.example.com. AWS is explicit that a wildcard alternate domain name replaces the wildcard at that level only: "you can't add alternate domain names that are at levels higher or lower than the wildcard. For example, you can't add the alternate domain names example.com or marketing.product.example.com." https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html Practical effect: a distribution owning "*.example.com" would answer for a.b.example.com, which on AWS belongs to whoever owns "*.b.example.com" — or to nobody. Require the label standing in for the wildcard to contain no dot. wildcardAliasesMatchSubdomainsAndPreferMoreSpecificNames asserted the old behaviour (a.b.example.test resolving to the *.example.test distribution); it now asserts no match, plus the same for a deeper wildcard. * test(dynamodb): retain Quarkus port for cleanup * fix(cloudfront): isolate mocked storage backends * fix: validate credentialed CloudFront CORS headers * fix: log ignored CloudFront policy parse errors * fix(ec2): wire managed prefix list storage in public IP test * fix(cloudfront): preserve custom CORS-like headers |
||
|
|
7b83bd5283 |
feat(rds,docdb): tag DocumentDB clusters and parameter groups (#2408)
* fix(rds): tag DB and DB cluster parameter groups The tag resolver handled db, cluster, subgrp, db-proxy and og, so tagging a parameter group answered that Floci does not implement the type — a live account tags both, and the terraform provider reads a group's tags as part of its read. DocumentDB's cluster parameter groups are these records too, so the same read fails for aws_docdb_cluster_parameter_group. Neither model carried tags, and neither carried the ARN a caller tags by: the create response omitted it, leaving nothing to address the group with. Both are stored and reported now, and tags given at create are kept, as a live account keeps them. * feat(docdb): tag clusters and instances aws_docdb_cluster reads a cluster's tags as part of every read, so a cluster that created fine failed its apply on DBClusterNotFoundFault — created, but not readable. DocumentDB signs with the rds credential scope, and on that scope it is told apart by Engine or a cluster/instance identifier. The tag actions carry neither, only the ARN of the resource they address, so they reached the RDS handler, which does not hold DocumentDB's records. The router reads that ARN now, and an ARN naming something DocumentDB does not have still goes to RDS. Clusters and instances store tags, keep the ones given at create, and answer the three tag actions. Behaviour follows a live account: an existing key is overwritten, removing a key that is not present is not an error, and an ARN in another region or account is rejected with the one message AWS gives for both — storage is keyed by identifier alone, so without that check an ARN naming another region would be answered with this caller's cluster. A tag update is a read-modify-write, so it takes the record's monitor and the other writers take the same one; otherwise tagging a cluster while it is being deleted stores it again. Paths that hold both take the instance's monitor before the cluster's. Filters on ListTagsForResource are accepted without validation: a live account rejects an unrecognised name, but Floci carries no list of the ones it accepts, and the tags of one named resource are the same answer either way. * fix(rds,docdb): store an empty value for a tag given without one A tag whose Key arrived without a Value was stored with a null, and the read hands the tags back as an immutable copy, which rejects nulls — so one such tag made every subsequent read of that resource fail with an internal error, not just the tag that caused it. A live account stores an empty value and reads it back. Both handlers parse tags the same way and both had it. * fix(rds,docdb): match the whole ARN when routing tags, and give legacy groups one Two things reported on review. Routing read the trailing name of the ResourceName ARN and looked it up in DocumentDB storage, but RDS and DocumentDB share one ARN space: an RDS resource whose name a DocumentDB record happens to share was answered — and mutated — out of the wrong store, and an RDS parameter group or option group could be resolved as a cluster. The whole stored ARN is matched now, which settles region, account, type and name at once, as the db-cluster-id filter already does. And only creation assigned a parameter group's ARN, so a group persisted by an earlier version read back without one, leaving describe with no ARN to report and the caller nothing to tag by. The read that backfills a missing region backfills the ARN too. The service keeps rejecting an ARN from another region or account: the router no longer sends it one, but the check guards its own contract, and it is covered directly rather than through the endpoint. * fix(rds,docdb): keep one identifier space across the RDS family Matching the whole ARN still left one ambiguity: an RDS cluster and a DocumentDB cluster of the same name in the same account and region produce the same ARN, and a tag call naming it could only reach one of them. A live account settles it — creating an Aurora cluster named like an existing DocumentDB one is refused with DBClusterAlreadyExistsFault, because the RDS family shares one identifier space. Floci already refused that direction, since a create naming an identifier DocumentDB holds is routed to DocumentDB, which answers AlreadyExists; the other direction was open, so a docdb create could take a name RDS already had. A create naming an identifier RDS holds now goes to RDS whatever engine it names, so it answers AlreadyExists too and the two stores cannot both hold one identifier — which is what makes an ARN unambiguous. * fix(rds,docdb): report a persisted identifier held by both services Creates can no longer put one identifier in both stores, but state written before that can, and a restart loads it. For such a record the identifier checks in the router already send every action to DocumentDB — describe, modify and delete included — and have long before tags existed, so tags answer from there too: one identifier keeps one answer, rather than a tag call reaching a record no describe can show. The collision is logged once per ARN, since the RDS record behind it cannot be reached on this scope at all and only deleting one of the two records fixes it. * fix(docdb): build cluster and instance ARNs from the caller's region The ARN was built from the configured default region, so a caller signing for anywhere else got back an ARN naming somewhere they were not — and since a tag call is checked against the region it is made from, that caller could not tag the cluster the create had just answered with. It also reopened the identifier collision from the other side: the create-time check looked for an RDS record in the request region while the ARN landed in the default one, so signing the create for another region got past the check and produced two records under one ARN. DocumentDB keys records by bare identifier, so the check now covers every region — narrower than AWS, which allows one name per region, but Floci cannot hold both and answer either correctly. The check also asked about the wrong identifier for instances: CreateDBInstance names its parent cluster, and that cluster existing in RDS is the normal case, not a clash. Only the identifier being created is checked, and the clash is answered with AlreadyExists directly rather than by handing the create to a service that rejects the engine first. * fix(rds): scope the create-time identifier check to the request's region Widening it to every region broke what RDS actually does: names are scoped by region, so the same instance name in two regions is two resources, and RdsControlPlaneTest.sdkScopesTheSameDbInstanceNameBySignedRegion pins exactly that. The second create answered DBInstanceAlreadyExists. The cross-region case that widening was meant to cover is closed by the ARNs instead: each carries the region it was created in, so two records of one name in different regions never share an ARN and no tag call has to choose between them. What must not exist is one identifier in both services in one region, and that is what the check now asks about. * fix(docdb): decide ownership of an identifier per region The routing checks asked whether DocumentDB holds an identifier at all, and its records are keyed by identifier alone, so a name DocumentDB held in one region was taken away from RDS in every other one: the create was refused as already existing, and a describe, modify or delete answered from the wrong region's record. The region now comes from the one place a record carries it — the ARN — so DocumentDB claims an identifier only in the region it was created in. Records written before ARNs carried the caller's region read as the configured default, which is the region they were in fact created under. This was true before tags existed; it becomes reachable in a way worth fixing now that a create in another region records that region rather than the default. * fix(docdb): check the identifier on every route into DocumentDB The create-time check lived in the rds credential scope's branch, but DocumentDB is reachable under its own scope too, and that one dispatches straight to its handler — which knows only its own store. A create signed that way could take an identifier RDS already held in the region, which is the state the ARN matching relies on being impossible. The check is one method now, called from both routes. Neptune shares the same identifier space and its scope is not checked either; that is untouched here, since this PR's invariant is about the ARN a tag call resolves and Neptune holds no tags. * fix(docdb): resolve a tag ARN to the record it names, not to the identifier resolveTagTarget checked the ARN's region against the caller's and then loaded the record by identifier, and records are keyed by identifier alone — so an ARN whose region matched the request but named a record stored in another region resolved to that other record, and tagged it. Reachable on the docdb credential scope, which dispatches to this service directly rather than through the routing that matches the whole ARN. The stored ARN is now compared with the one asked for, and anything else is not found. |
||
|
|
06d58aad36 |
feat(elasticache): support cache subnet groups (#2401)
* feat(elasticache): support cache subnet groups CreateCacheSubnetGroup was unsupported, so aws_elasticache_subnet_group could not be created and no Redis or Valkey module placing a cluster in a VPC could apply. DescribeCacheSubnetGroups already answered with an empty list, so the read half existed with nothing behind it. Adds Create, Modify and Delete, and makes the describe return what was created. A group's VpcId and each subnet's availability zone come from the subnets rather than the request, because that is where AWS reads them: resolving the subnets against EC2 is part of answering, not an optional check. The service follows the RDS DB subnet group, which faces the same problem. Taken from a live account: the create response and its ARN, SupportedNetworkTypes on both the group and each subnet, and the error for each rejection — subnets that do not exist, subnets spanning two VPCs, a duplicate group, and a name that breaks the identifier rule. Describe and delete word their not-found differently from one another, and both are reproduced as AWS words them. Tags given at create are stored and readable through ListTagsForResource, rather than accepted and dropped. A modify naming no subnets keeps the stored ones as they are instead of resolving them again, which would fail a description-only change if a subnet had since been deleted. * fix(elasticache): resolve subnet group subnets in the caller's region CreateCacheSubnetGroup and a subnet-changing ModifyCacheSubnetGroup looked the subnet ids up in the configured default region. A caller in any other region had its own subnets rejected as invalid, and the group was reported under an ARN built from the caller's region while its VPC and availability zones came from somewhere else. Resolve against the request's region, which is the region the ARN already uses. * fix(elasticache): report a subnet group's subnets in the order they were given describeSubnets answers in the subnet store's own scan order, and the group was built by iterating that answer, so the order a group reported its subnets in was arbitrary between calls — the model documents the order the caller gave. Build the zone map from the requested ids. Adds a CLI case covering the region the subnets are resolved in, which is what caught this: it read Subnets[0] and disagreed with itself between runs. * fix(elasticache): answer a missing cache subnet group with 400, not 404 The service model declares CacheSubnetGroupNotFoundFault a 400, where the parameter-group fault a few hundred lines up is a 404 — the two really differ, in the wire code as well as the status, and the status was carried across from the parameter-group code. All three sites answered 404, and the integration test pinned it there, so a client reading the status saw the wrong one. The difference is now stated where the copy would be made, since either fault looks like a mistake beside the other. |
||
|
|
29b0d600c6 |
feat(rds,docdb): answer DescribeGlobalClusters (#2402)
* feat(rds,docdb): answer DescribeGlobalClusters aws_docdb_cluster reads global cluster information as part of every cluster read, so a cluster that created successfully failed its apply on UnsupportedOperation — created, but not readable. DocumentDB's signing name is rds and the action carries no engine or cluster identifier to route on, so the request reaches RdsQueryHandler whichever service the caller has in mind; the docdb scope Floci also accepts is answered the same way. Global clusters are not modelled, so the list is empty, which is what a live account with none answers. Behaviour follows a live account: MaxRecords outside 20-100 is rejected before the identifier is looked up, a named identifier that does not exist is GlobalClusterNotFoundFault, and a marker is rejected after the identifier. The response is in the RDS namespace, which is the namespace DocumentDB answers in. Filters are accepted without validation: every name AWS accepts answers empty here, and a partial list of accepted names would refuse filters a live account allows. * fix(rds): infer rds for DescribeGlobalClusters on unsigned requests Without a credential scope the service is inferred from the action name, and an action the RDS handler serves but the inference list does not name is dispatched to SQS, which answers UnsupportedOperation for it. * fix(rds): infer rds for every action the RDS handler serves The inference list that routes unsigned Query requests named 32 of the 43 actions RdsQueryHandler dispatches. The other eleven — the cluster parameter groups, the option groups, and both snapshot describes — were dispatched to SQS, which answers UnsupportedOperation for them. The two sets now match exactly: every dispatched action is inferable, and nothing inferable is undispatched. None of the added names appear in another service's inference list, so no existing routing changes. |
||
|
|
6b628179f3 |
feat(elasticache): support cache parameter groups (#2392)
* feat(elasticache): support cache parameter groups CreateCacheParameterGroup was unsupported, so a Redis module that sets any parameter could not apply at all — most set at least maxmemory-policy. The describe was a stub that answered with an empty list whatever was asked of it. Adds the group surface over the Query protocol: - CreateCacheParameterGroup, DescribeCacheParameterGroups, ModifyCacheParameterGroup, DescribeCacheParameters, DeleteCacheParameterGroup - ListTagsForResource for a parameter group ARN, without which the tags a create carries would be stored and never readable - the default.* groups AWS publishes for all 13 families, derived rather than stored: nothing can modify or delete them, so persisting them would only add records to migrate and a writer to race Taken from a live account: the create response and its ARN, IsGlobal, and the error each rejection carries — CacheParameterGroupAlreadyExists for a duplicate, CacheParameterGroupNotFound for an unknown group, and the identifier rule that rejects a name containing a dot, which is also how AWS refuses to delete a default group. Each writer takes one monitor keyed by the group name before it reads. Guarding the record cannot serve a create, which has no record yet, so two of them would both pass the existence check; and a modify that resolved its record before locking would write back a group a concurrent delete had removed. floci does not carry AWS's per-family catalogue of parameter names, so it stores what a caller sets and reports it with source "user". Rejecting names missing from a partial catalogue would refuse configurations AWS accepts, so nothing is rejected on that basis, and a request for system parameters returns none rather than reporting user parameters under another source. * fix(elasticache): answer tags for the ARN that was asked about ListTagsForResource read the trailing name out of the ARN and ignored the rest, so an ARN naming another account or region was answered with this caller's group of the same name — a response describing a different resource than the request identified. The ARN is now checked before it is used, with the errors AWS gives for each: InvalidARN for a string that is not seven components, "Unauthorized call. Please check the region or customer id" for another region, "The resource ARN does not belong to the caller's account." for another account, and "<name> is not present" for a group that does not exist, which is worded differently from the describe's not-found. Tightening the tolerated exception in the race test, as review asked, turned up a second problem: a modify whose group had been deleted reported "is a default group and cannot be modified", because absence from the store was read as proof of a published default. The two are now told apart, and both errors are asserted directly rather than only when the race happens to expose them. * fix(elasticache): check every component of a tag ARN, not only region and account An ARN in another service's namespace was accepted as long as its region and account matched, so arn:aws:rds:<region>:<account>:parametergroup:<name> was answered with the ElastiCache group of that name — tags for a resource the caller did not ask about. The partition and service are checked too, with the errors AWS gives: "partition field is wrong. Expected value is aws" and "service field is wrong. Expected value is elasticache". * fix(elasticache): word each parameter group not-found the way AWS words it Three actions, three sentences on a live account. Delete omits the space after the type name — that is verbatim, and the line now says so, because it reads like a typo and the next person to tidy it would silently stop matching AWS. Modify was the one that was actually wrong: it answered with describe's sentence. A live account words it "CacheParameterGroup not found: <name>", which is neither describe's nor delete's. Pinned by a test that asserts all three, so the odd one cannot be quietly aligned with the others. |
||
|
|
8d33c65129 |
feat(s3): support bucket metrics configurations (#2382)
* feat(s3): support bucket metrics configurations PutBucketMetricsConfiguration was not routed, so a metrics call fell through to the unqualified CreateBucket and came back as BucketAlreadyOwnedByYou, which tells the caller nothing about what happened. The DELETE was worse: it fell through to DeleteBucket and silently removed the whole bucket while reporting success, so delete-bucket-metrics-configuration destroyed the bucket it was called on. Adds the four actions, stored per bucket and keyed by id: - PutBucketMetricsConfiguration, GetBucketMetricsConfiguration, ListBucketMetricsConfigurations, DeleteBucketMetricsConfiguration - the body is parsed and re-serialized rather than echoed back, so responses are built by floci and a filter survives the round trip in AWS's shape: repeated Tag elements inside And, with no wrapping element - an id in the body that disagrees with the query string is MalformedXML, and an unknown id is NoSuchConfiguration on both get and delete, neither of which AWS treats as a no-op - put and delete take the bucket monitor the other bucket-scoped mutations use, so concurrent puts of different ids cannot drop one another Behaviour taken from a live AWS account: the status codes (204 on put and delete, 404 for an unknown id), both error codes, and the exact XML of the single-configuration and list responses. floci records the configurations and returns them; no metrics are produced from them, and the listing is unpaged, so a continuation token is neither issued nor honoured. * fix(s3): validate metrics filters, use the shared XML utilities, guard the delete Three problems in the previous commit. The filter was normalized rather than validated, so bodies AWS rejects were accepted: a filter naming more than one predicate or none, an And of fewer than two conjuncts, an unknown predicate, and a tag missing its key or value. Verified against a live account that each is MalformedXML, and the parser now answers the same. Parsing and response building went around XmlParser and XmlBuilder, which AGENTS.md requires, and the S3 namespace was declared again rather than taken from AwsNamespaces. The bespoke DocumentBuilderFactory carried its own security configuration, where XmlParser disables DTDs and external entities for everyone in one place. The controller branches now delegate to handler methods like their siblings instead of inlining the work. A metrics mutation resolved the bucket record before writing it back, while DeleteBucket took no monitor, so a delete landing in between was undone by the write and the bucket returned. DeleteBucket now takes the same bucket monitor as the bucket-scoped mutations, and those re-read the record under it, so a mutation that lost the race reports NoSuchBucket rather than restoring the bucket. Its test forces that interleaving rather than racing for it. * fix(s3): reject malformed metrics bodies and stale writes over a recreated bucket Re-reading the record for presence was not enough. A bucket deleted and then recreated under the same name leaves a different record in the store, so a mutation that had resolved the old one passed the presence check and wrote it back, replacing the new bucket with the old one's state. The check now compares the record itself, and a mutation holding a superseded one reports NoSuchBucket. The parser also accepted bodies whose elements were duplicated or misplaced: a second Id or Filter, or a stray element under the root, was normalized away rather than refused, so what was stored was not what was sent. The root now has to be exactly one Id and at most one Filter, in either order. The concurrency tests wait on thread state rather than sleeping, so they observe the interleaving instead of hoping for it: instant on a fast machine and not flaky on a slow one. DeleteBucket taking the bucket monitor is asserted directly, since the window it closes — a delete between a mutation's re-read and its write — is too narrow to force from a test. |
||
|
|
23015a7475 |
fix(secretsmanager,rds): rotate secrets that an AWS service manages (#2378)
* fix(secretsmanager): rotate secrets that an AWS service manages RotateSecret required a rotation Lambda for every secret, so a secret RDS manages through ManageMasterUserPassword could never enable rotation: InvalidRequestException: You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. AWS rotates those secrets itself, so they carry no Lambda at all. It accepts RotateSecret with rotation rules alone, and refuses a Lambda ARN outright: "Rotation Lambda ARN is not supported for a service-managed secret." Key the behaviour off ownership rather than the rds! name prefix, since anyone may create an ordinary secret called rds!something and that must not grant it managed-rotation semantics: - Secret carries an owningService, set by floci services only and never settable over the wire - RDS marks the master user secret it creates as owned by rds, with the two tags AWS attaches to it - RotateSecret needs no Lambda for an owned secret, rejects one, and skips the Lambda rotation lifecycle that has nothing to invoke - DescribeSecret and ListSecrets report OwningService, and the owning-service ListSecrets filter matches on it instead of always returning nothing Covered by unit tests and by a CLI compatibility test that walks the whole path: create the instance with --manage-master-user-password, describe the secret it produced, then rotate it with rules and no Lambda ARN. Behaviour confirmed against a live AWS account: a db.t3.micro postgres instance created with --manage-master-user-password, then describe-secret and rotate-secret against the secret it produced. * fix(secretsmanager): keep managed rotation across restarts, report a real version Two problems in the previous commit: A secret persisted before ownership tracking deserializes without an owning service, so after an upgrade RotateSecret went on rejecting the Lambda-free call these secrets are rotated with. RDS backfills ownership at startup from the instances that name those secrets: RDS state is what makes a secret managed, so that is what the backfill reads, never the secret's name. RotateSecret answered a service-managed rotation with the request token as VersionId, while nothing stages a version for that token, so reading the advertised version failed with "can't find the specified secret version". Report the current version instead, which exists and holds the value a caller reads back. * fix(secretsmanager): back-fill ownership per account, stop claiming a rotation The startup backfill ran outside any request, so the secrets store resolved the default account while the instances it read span every account. Secrets owned by another account were left unmarked, and a same-named default-account secret could be written instead. The secret's ARN names its own account and region, so markOwnedByService takes the ARN and addresses that account's store directly. RotateSecret also recorded LastRotatedDate for a service-managed secret while neither the master password nor the stored value changed, so the secret claimed a rotation that GetSecretValue and the database would contradict. floci does not re-issue the credential, so it no longer reports one: rotation is enabled and scheduled, and NextRotationDate still follows from the rules. * fix(rds): never fail startup on the master user secret backfill The backfill reads persisted state at StartupEvent, so a storage error while scanning instances would have stopped the emulator from starting over work that is not needed to serve requests. It now logs and moves on, per instance and for the scan as a whole. * fix(rds): run the secret ownership backfill after storage is loaded The backfill observed StartupEvent, as does EmulatorLifecycle.onStart, which calls storageFactory.loadAll(). Two observers of one event have no ordering between them, so under hybrid or WAL storage the backfill could write ownership into memory that the reload then replaced with the older on-disk secret, leaving rotation rejected exactly where the backfill exists to help. It now hangs off restorePersistedRuntime(), which the lifecycle already calls after loadAll() for the same reason, alongside the other persisted-state fixups. |
||
|
|
bc0f88c9b1 |
feat(ec2): support transit gateway route tables, associations and routes (#2348)
* feat(ec2): support transit gateway route tables, associations and routes CreateTransitGatewayRouteTable, DescribeTransitGatewayRouteTables and DeleteTransitGatewayRouteTable; Associate, Disassociate and GetTransitGatewayRouteTableAssociations; Enable, Disable and GetTransitGatewayRouteTablePropagations; CreateTransitGatewayRoute, DeleteTransitGatewayRoute and SearchTransitGatewayRoutes. Part three of #2308, on top of the gateway in #2329 and the attachments in #2347. Backs aws_ec2_transit_gateway_route_table and the association, propagation and route resources beside it. Behaviour taken from a live account rather than the reference: - a table asked for by name is neither default; only the one a gateway mints for itself is - an attachment associates with exactly one table, so a second attempt is Resource.AlreadyAssociated rather than a move - association reports the transitional associating and disassociating, while propagation reports the settled enabled and disabled at once - enabling propagation twice is TransitGatewayRouteTablePropagation.Duplicate - a blackhole is a static route in the blackhole state rather than a type of its own, and carries no attachment - deleting a table is refused while it is a gateway's default association table, and again while attachments are associated, both IncorrectState with their own messages - an id that does not exist is InvalidRouteTableID.NotFound while one of the wrong shape is InvalidRouteTableId.Malformed, casing included Associations live on the attachment record rather than in a store of their own, since an attachment has at most one; propagations are their own records, since an attachment may propagate into several tables. Propagated routes are derived when routes are searched, from each enabled propagation joined to the attached VPC's CIDR blocks, rather than written down. Storing them would go stale the moment a VPC's CIDR associations changed, and would need invalidating from every VPC and attachment path. Deleting an attachment removes its propagations and leaves a static route that named it as a blackhole, which is what the live API does: the destination stays configured with nowhere to go. Deleting a gateway takes its tables' propagations, routes and tags with them, so nothing outlives the table it belongs to. Every mutation runs under the region-scoped topology lock introduced in #2347. * fix(ec2): keep route table operations within one gateway and one lock Three gaps found sweeping the new surface before review rather than after it, each checked against a live account. A route table reached attachments of any gateway. Associating, propagating or routing to another gateway's attachment was accepted and recorded, leaving a table pointing at something outside its own gateway. AWS refuses all three as though the attachment did not exist, which is the same shape a subnet from another VPC gets, and all five call sites now do the same. modifyTransitGateway writes route tables through its default-table markers but held only the gateway's striped lock, so a modify racing a route table delete could put the deleted table back. It and createTransitGateway now take the topology lock as well, which makes the rule exceptionless: every write to a gateway, route table, attachment, propagation or route happens under that one lock, acquired before any striped one. Deleting an attachment left its propagations and any static route naming it behind. On AWS the propagations go and the route survives as a blackhole - the destination stays configured with nowhere to go - and that is now what happens here. Deleting a gateway takes its tables' propagations, routes and tags with it, so nothing outlives the table it belongs to. * feat(ec2): support ReplaceTransitGatewayRoute Completes the route surface beside create, delete and search. Backs a provider moving a route between an attachment and a blackhole without recreating it. Verified on a live account: replacing a destination the table has never held writes it rather than reporting it missing, so this is an upsert rather than an update. The target moves as a unit - a route turned into a blackhole keeps no attachment, and one pointed back at an attachment regains its id, resource and resource type together. It carries the same rules as the rest of the route table surface: the attachment has to belong to the table's own gateway, the write happens under the topology lock, and a route it wrote is blackholed like any other when its attachment is deleted. * fix(ec2): apply the route search filters instead of ignoring them SearchTransitGatewayRoutes handled four filter names and let every other one through a default arm that matched everything, so a search by route-search.supernet-of-match, subnet-of-match or longest-prefix-match returned the whole table. A plausible wrong answer rather than an error. The three take different value forms, which the reference does not spell out. Observed on a live account, against a table holding 10.0.0.0/8, 10.1.0.0/16, 10.1.1.0/24 and 192.168.0.0/16: supernet-of-match 10.1.1.0/24 -> /8, /16 and /24, the exact match included subnet-of-match 10.1.0.0/16 -> /16 and /24, the exact match included longest-prefix-match 10.1.1.5 -> /24 longest-prefix-match 10.1.9.9 -> /16 longest-prefix-match 8.8.8.8 -> nothing So the containment filters take a CIDR and match inclusively in either direction, while longest-prefix-match takes a bare address and returns the one most specific route covering it. Handing either the other's form returns nothing there, and now here. An unrecognised filter name is rejected rather than ignored, matching InvalidParameterValue: Value (nonsense) for parameter Filter is invalid. Silently accepting one answers a question that was never asked. |
||
|
|
74e43a4632 |
feat(ec2): support transit gateway VPC attachments (#2347)
* feat(ec2): support transit gateway VPC attachments CreateTransitGatewayVpcAttachment, DescribeTransitGatewayVpcAttachments, DescribeTransitGatewayAttachments, ModifyTransitGatewayVpcAttachment and DeleteTransitGatewayVpcAttachment. Part two of #2308, on top of the gateway itself. The two describes are separate shapes rather than one being a superset: the VPC-specific form carries the subnets and options, while the resource-agnostic form drops both, types the VPC as a resource, and is the only place the route table association appears. Behaviour taken from a live account rather than the reference. The attachment's option defaults are its own: dnsSupport and securityGroupReferencingSupport enabled, ipv6Support and applianceModeSupport disabled. The second of those is enabled here while the gateway that owns the attachment defaults it to disabled, which is not something the documentation calls out. An attachment associates with the gateway's default route table only when the gateway asks for it, and an association already made survives the gateway later disabling that default: the association belongs to the attachment from creation, and only later attachments are affected. Rejections, all as observed: a VPC attached twice to one gateway is DuplicateTransitGatewayAttachment, two subnets in one zone are DuplicateSubnetsInSameZone, a subnet from another VPC is reported missing rather than mismatched, removing a subnet that is not attached is InvalidSubnetID.NotFound with its own wording, and removing the last one is InsufficientSubnetsException. A malformed attachment id is rejected before the lookup, with the terse message the real API uses. Two changes reach outside the new surface, both deliberate: DeleteTransitGateway now refuses while attachments exist, reporting IncorrectState and naming them. Part one could not have hit this, since nothing could attach then. parseTagsForResource reads TagSpecifications as well as TagSpecification. CreateTransitGatewayVpcAttachment declares no locationName on that member and so serializes the plural, unlike its neighbours; every tag sent by the AWS CLI was being dropped. The change only adds a spelling, so actions using the singular are untouched. State is reported settled rather than transitional, as for the gateway. Ipv6Support is accepted without checking that the subnets carry IPv6 CIDRs, which real AWS rejects; Floci does not model subnet IPv6 allocation, and inventing that state to enforce it seemed worse than documenting the gap. * fix(ec2): make attachment uniqueness atomic and guard attached resources Two defects in the VPC attachment work, both found in review. The one-attachment-per-VPC rule scanned for an existing attachment and then stored the new one without holding a lock between the two, so concurrent creates for the same VPC could all find nothing and all persist. Reproduced by disabling the fix: eight threads, eight attachments, where the API promises one. The check and the write now share the gateway's lock, and the test asserts one winner, the right error for every loser, and one stored attachment, over forty trials. Deleting a VPC or a subnet that an attachment uses left the attachment naming resources that no longer existed, which surfaced later as a modify failing on a subnet the caller never touched. Checked on a live account: both refuse, with the same code and shape of message. DependencyViolation: The subnet 'subnet-…' has dependencies and cannot be deleted. DependencyViolation: The vpc 'vpc-…' has dependencies and cannot be deleted. Both deletes now refuse the same way. A subnet of the attached VPC that the attachment does not use still deletes, so the guard is no wider than the dependency it protects. * test(ec2): lighten the attachment concurrency harness Forty trials of eight threads was heavier than the race needs — without the lock it shows on the first trial — and the extra load disturbed two thread-timing-sensitive tests elsewhere in the suite, PostgresProtocolHandlerTest and ElbV2HealthCheckerTest, neither of which this branch touches. Ten trials of six still reproduces it and leaves those alone. * fix(ec2): guard everything an attachment depends on under one lock The previous fix locked the uniqueness check alone, which was too narrow twice over. The gateway was resolved before the locked section, so a concurrent DeleteTransitGateway could see no attachments, delete the gateway, and let the create persist against the object it had already read. The VPC and subnet checks were outside any shared lock at all, and lockFor is striped, so a gateway's monitor never guarded a VPC or subnet delete regardless. Everything an attachment depends on now resolves and writes under one region-scoped monitor: the gateway, the VPC, the subnets, and the uniqueness rule. Deleting a gateway, a VPC or a subnet takes the same monitor across its dependency check and its delete. Where a gateway lock is also taken it is acquired inside this one, so the two cannot interleave in opposite orders. The test races a create against each delete and asserts the invariant rather than a winner: whoever wins, the store must never hold an attachment naming a gateway, VPC or subnet that is gone. It reproduces both holes — with the create-side lock removed, "attachment outlived its gateway" fails on the first trial. * fix(ec2): stop a tag write restoring a deleted transit gateway resource Tagging is a read-modify-write, so a tag call overlapping a delete could read the record, lose the race, and put it back afterwards. A resurrected attachment goes on blocking the VPC and subnets it names; a resurrected gateway goes on refusing its own deletion. The gateway and route table branches were as exposed as the attachment one, so all three moved together rather than only the case reported. Ordering matters as much as the lock here. The deletes take the topology lock and then a striped resource lock, so the tag paths have to take them the same way round; taking the topology lock further down the stack, with the resource lock already held, deadlocks against a concurrent delete. That is what the first attempt did, and the race test caught it as a pool that never drained. createTags and deleteTags now take the topology lock outermost for tgw- resources and updateResourceTags relies on its callers for it. The test races tagging against deletion for an attachment and for a gateway, asserting neither comes back. |
||
|
|
20470b7f4a |
feat(ec2): support transit gateways (#2329)
* feat(ec2): support transit gateways CreateTransitGateway, DescribeTransitGateways, ModifyTransitGateway and DeleteTransitGateway, as EC2 Query actions alongside the existing VPC and route table ones. Metadata only: nothing routes packets, and the value is in ids later resources can reference and describes that round-trip so plans converge. Option defaults come from a live AWS account rather than the reference: amazonSideAsn 64512, dnsSupport, vpnEcmpSupport and both default route table options enabled, autoAcceptSharedAttachments, securityGroupReferencingSupport and multicastSupport disabled. The last of those is the one worth stating, since disable is easy to assume the other way round. transitGatewayCidrBlocks is omitted entirely when unset rather than sent empty. Creating a gateway with either default route table option enabled also mints the route table AWS mints, and reports its id as both associationDefaultRouteTableId and propagationDefaultRouteTableId. Both name the same table, and it is already on the create response rather than appearing later, so a caller reading either id sees what AWS shows. The actions that operate on route tables directly are not implemented; nor are attachments. State is reported settled rather than transitional. AWS returns a new gateway as pending and reaches available in about 50 seconds, and reports deleting for about a minute before deleted; nothing here is slow, so the settled state is what the caller sees, matching how createManagedPrefixList already compresses create-in-progress. Modify and delete echo the gateway without its tagSet while create and describe include it, which is what the live API does. Part one of #2308. * fix(ec2): keep a transit gateway's default route table options coherent ModifyTransitGateway changed the DefaultRouteTableAssociation and DefaultRouteTablePropagation flags without touching their route table ids, so a gateway created with both disabled could be modified into reporting an option enabled while carrying no id for it. AWS does not create a route table on that request; it rejects it unless an existing table is named, and rejects an id supplied alongside a disable. An unknown table comes back as InvalidRouteTableID.NotFound rather than a transit-gateway-specific code. Checked on a live account: enable DefaultRouteTableAssociation conflicts with AssociationDefaultRouteTableId null disable DefaultRouteTableAssociation conflicts with AssociationDefaultRouteTableId tgw-rtb-0123456789abcdef0 Transit Gateway Route Table tgw-rtb-0123456789abcdef0 was deleted or does not exist. Validate instead: the flag and its id have to move together in both directions, and a named table has to exist. The divergent state is now unreachable and a rejected call leaves the gateway untouched. * fix(ec2): carry a default route table change through to what it governs Disabling DefaultRouteTableAssociation or DefaultRouteTablePropagation changed the flag alone, leaving the id it governs on the gateway and the matching marker on the route table. A describe then reported the option disabled while still naming a table, and the table still claimed to be the default for it. Checked on a live account. Disabling association on a gateway created with both defaults enabled drops AssociationDefaultRouteTableId from the options entirely rather than blanking it, clears DefaultAssociationRouteTable on the table, and leaves the table itself in place with its propagation marker and the gateway's PropagationDefaultRouteTableId untouched: DefaultRouteTableAssociation disable (no AssociationDefaultRouteTableId) DefaultRouteTablePropagation enable PropagationDefaultRouteTableId tgw-rtb-… tgw-rtb-… available defAssoc False defProp True Apply the same: the id follows its flag, the table's marker follows with it, and the table survives. Enabling with a named table marks that table instead. * fix(ec2): require a default route table to belong to the gateway naming it The route table named on a ModifyTransitGateway request was only checked for existence in the region, so a gateway could take another gateway's table as its default. Worse than a bad reference: applying the change then rewrote the foreign table's own default marker, leaving the gateway that actually owns it describing a table that no longer claims to be its default. AWS rejects this, under the same code as a table that exists nowhere but with the gateway named in the message. Checked on a live account, gateway A naming gateway B's default table: Transit Gateway Route Table tgw-rtb-0381f… was deleted or does not exist in Transit Gateway tgw-0438f… Both wordings are now reproduced: unqualified when the table exists nowhere, gateway-qualified when it exists but belongs elsewhere. The three rules governing these options - flag and id agreeing in both directions, and the named table existing and belonging to the gateway - now sit in one validation block rather than accumulating as separate guards. * fix(ec2): judge a default route table change against the stored gateway Validation looked only at the request, so a route table id arriving without its flag skipped the coherence check entirely: the id was stored while the table's default marker was left alone, and a disabled option could end up naming a table. AWS judges the pair against the gateway as it stands. Probed the whole combination surface on a live account rather than the one case reported: id alone, option enabled accepted id alone, option disabled InvalidParameterCombination, and the message quotes the stored flag, not the request enable alone, table named accepted, keeps that table enable alone, no table InvalidParameterCombination disable with an id InvalidParameterCombination disable with an unknown id the combination is reported, not the lookup So the flag defaults to the stored one when the request omits it, enabling without an id keeps the table already named rather than dropping it, and an id on its own marks its table. The lookup still runs after the combination check, which is the order AWS reports them in. Two other behaviours from the same pass, both already correct and now covered: removals apply before additions, so a CIDR added and removed in one call survives, and removing a CIDR that is not present is accepted. * fix(ec2): serialize transit gateway CIDR blocks as the string list they are transitGatewayCidrBlocks is a plain string list, so each item carries the CIDR as its own text. The items wrapped it in a cidrBlock element instead, which the AWS CLI parsed as an empty string: a caller that added a block got it back as "" from create, describe and modify alike. Caught by the CLI compatibility suite, not by the integration test, which asserted the same wrong shape the handler produced and so agreed with it. The bats case now reads the list back through describe as well as modify, since one helper serializes all three responses. * fix(ec2): apply tag changes to a transit gateway, not just to the tag store CreateTags and DeleteTags on a tgw- id updated the tag store but left the gateway object alone, because updateResourceTags had no branch for it. DescribeTags saw the change and DescribeTransitGateways did not, so a gateway kept serving whatever tags its TagSpecification carried at creation. That is the path a Terraform tag update takes: the provider sends CreateTags, then re-reads with DescribeTransitGateways and compares. With the two disagreeing, aws_ec2_transit_gateway would never converge. Route tables get the same branch, so their tags behave once part three can create them. The AWS CLI cases now cover the tag round trip and CIDR blocks supplied at creation, both of which were only asserted against shapes this branch produced itself. |
||
|
|
dfcd492198 |
feat(ec2): allow a security group rule to take a prefix list as its source (#2271)
* feat(ec2): allow a security group rule to take a prefix list as its source AuthorizeSecurityGroupIngress and AuthorizeSecurityGroupEgress now read IpPermissions.N.PrefixListIds.M, so a rule can name a managed prefix list instead of a CIDR. The rule carries prefixListId in place of cidrIpv4 and DescribeSecurityGroups nests the reference under the permission, matching the shapes AWS returns. AWS emits one rule per source, so createRules expands a permission across its CIDRs and its prefix lists rather than treating the two as alternatives; a permission naming neither still yields the single bare rule it did before. An unknown list is rejected with InvalidPrefixListID.NotFound before the rule is stored, so a typo cannot leave a rule pointing at nothing. Closes #2269 * fix(ec2): resolve every prefix list before writing any security group rule createRules stored the CIDR rules of a permission before validating its prefix lists, so a permission naming a valid CIDR alongside an unknown list returned InvalidPrefixListID.NotFound while leaving the CIDR rule behind. AWS persists neither, checked against a live account, and rejects the call as a whole rather than per permission. Resolve every reference a request names before the first write, across all of its permissions, so a later bad permission cannot leave an earlier good one applied. Also brace the new parsing conditional, as AGENTS.md requires. * style(ec2): brace the conditionals in parseIpPermissions AGENTS.md is unconditional about braces, and the method held five unbraced conditionals around the line this branch added. Bracing the whole method rather than only the new line keeps it internally consistent. * fix(ec2): scope security group revocation to the sources it names Revocation compared only protocol and ports, so revoking one source removed every permission sharing that tuple: revoking a prefix list also dropped a CIDR rule on the same port. AWS scopes it to the source, verified against a live account, and leaves the others in place. Subtract the named sources instead, dropping a permission only once it had sources and has lost them all. A request naming no source at all still removes the whole matching permission, which is how a bare protocol and port revoke behaves. The permission a revoke names can be the very object authorize stored on the group, so the source values are snapshotted before either list is mutated. * fix(ec2): validate prefix lists once per request rather than per permission Resolving the prefix lists again inside createRules reopened the window the request-wide check had closed: a list can be deleted between the two, since the group lock and the prefix list lock are different monitors, so a later permission could fail after earlier ones had already stored their rules. Authorize resolves every reference before the first write, so the repeat is removed. createRules keeps no validation of its own; its other callers pass the CIDR-only default egress permission. * fix(ec2): resolve group references when revoking too Scoped revocation compares the sources a request names against the ones stored on the permission. Authorize resolves a reference made by group name to its group id before storing it, so a revoke naming the same source by name alone carried no id and matched nothing: the rule survived the revoke that named it. Resolve on the revoke path as well, mirroring authorize. This only surfaces once both source-scoped revocation and group references as a source exist, so the gap is between this branch and #2266 rather than in either alone. --------- Co-authored-by: Michal Schreiber <michal.schreiber@benefitsystems.pl> |
||
|
|
12154297b5 |
feat(iam): support account aliases (#2103)
* feat(iam): support account aliases Implement ListAccountAliases, CreateAccountAlias and DeleteAccountAlias. An account holds at most one alias: creating a second returns EntityAlreadyExists, and deleting requires the current alias by name so a stale value cannot silently clear it. FLOCI_SERVICES_IAM_ACCOUNT_ALIAS seeds an alias at startup for callers that expect to read one without creating it first. Closes #2101 * fix(iam): make account alias create and delete atomic Concurrent CreateAccountAlias calls could all pass the emptiness check and write, reporting success to every caller while keeping only one value. Unlike a named resource, where racing creates carry the same name and either winner is equivalent, racing alias creates carry different values, so a loser is told their alias was set when another is stored. Guard the check-then-write on both create and delete, and cover it with a concurrency trial asserting exactly one winner. Also track the alias created by the bats delete case in ACCOUNT_ALIAS so teardown clears it if the test fails midway. * fix(iam): match verified AWS account alias semantics and unbreak the test fixture IamServiceTestHelper resolves the package-private IamService constructor reflectively against a hardcoded parameter list, so the extra storage backend broke it at run time with no compile-time signal. Every test using that fixture errored, and one of them hangs on a socket read rather than failing, which is what exhausted the CI job. Extend both lookups to the new arity. Checking the error message against a live AWS account showed the operation itself was modelled wrongly: CreateAccountAlias does not reject a second alias, it replaces the current one. EntityAlreadyExists means the requested name is taken, which for a single-account store is only the alias already held. Create now replaces and rejects just that case, which also makes the message name the alias the caller asked for. DeleteAccountAlias applies the same pattern constraint as create, so a malformed value is a ValidationError. Concurrent creates therefore all succeed with last-write-wins; the trial now asserts the store settles on one of the requested values. Seeding logs when it skips because an alias is already stored, which is otherwise invisible under persistent storage. * fix(test): repair iam.bats after the merge fused test bodies Resolving the merge by keeping both sides concatenated the OIDC and account alias cases as text, which left the create_oidc_provider helper nested inside an alias test and dropped a closing brace, so bats could not parse the file and produced no report at all. Rebuild it from main plus the alias cases, with the alias tracked in setup and teardown. * test(iam): pin account alias isolation, and document the two-dash rule The alias is the only IAM entity keyed by a constant rather than a caller-supplied name, so every account shares one storage key and the separation rests entirely on AccountAwareStorageBackend prefixing. Every integration test here signs as the same account, so that prefixing was never exercised for aliases. The new case pins it: handing both services the store unwrapped fails it. The docs still described the pre-fix constraint. They now carry the consecutive-hyphen rule and note that the ValidationError message, reproduced from AWS verbatim, does not itself mention it. --------- Co-authored-by: Michal Schreiber <michal.p.schreiber@gmail.com> Co-authored-by: Michal Schreiber <michal.schreiber@benefitsystems.pl> |
||
|
|
a6f5f12295 |
fix(ec2): keep the source on security group rules (#2266)
* fix(ec2): keep the source on security group rules AuthorizeSecurityGroupIngress and -Egress read only IpPermissions.N.IpRanges.M.CidrIp, so a rule whose source is another security group was accepted and then silently stripped: it came back with no source at all on the authorize response, on DescribeSecurityGroups and on DescribeSecurityGroupRules. "Allow traffic from security group X" is how an ALB is wired to its backend tasks, so that whole class of wiring could be created against Floci but never asserted afterwards. Parse the source types the permission actually carries: group references, which the EC2 Query protocol serializes under the wire name Groups rather than the SDK-facing UserIdGroupPairs, and IPv6 ranges. A reference made by group name resolves to its group id within the target group's VPC, since names are unique per VPC and ReferencedSecurityGroup has no name field. Flatten one SecurityGroupRule per source entry, each keeping its own description, matching the AWS invariant that a rule holds exactly one source. A permission with no source at all still yields a single sourceless rule, as before. The reference is returned as referencedGroupInfo on DescribeSecurityGroupRules and as UserIdGroupPairs on DescribeSecurityGroups. An IPv6-only TCP ingress rule now publishes its host port, which it could not do while the ranges were dropped at the parse; Ec2PortForwardManager already treats IPv6 ranges as a CIDR source, and group references stay unpublished. Revoke still matches on protocol and port range alone and ignores sources, unchanged by this. Closes #2190 * style(ec2): brace the conditionals in the new source parsing AGENTS.md requires braces on every conditional. The new IPv6 and group source loops and the group-reference resolution used the unbraced form the surrounding parse loop happens to use. |
||
|
|
f17dd1ed81 |
feat(iam): support OIDC identity providers (#2106)
* feat(iam): support OIDC identity providers Implement CreateOpenIDConnectProvider, GetOpenIDConnectProvider, DeleteOpenIDConnectProvider, AddClientIDToOpenIDConnectProvider, RemoveClientIDFromOpenIDConnectProvider, UpdateOpenIDConnectProviderThumbprint and the provider tag actions, and back ListOpenIDConnectProviders with real data instead of a fixed empty list. A provider is identified by its URL, so the ARN is derived from it and the scheme is stripped: GetOpenIDConnectProvider reports the URL without https://, matching AWS. Creating the same URL twice returns EntityAlreadyExists. Thumbprints are stored and echoed back but never validated against the remote endpoint, since nothing here performs the TLS handshake they describe. Closes #2102 * test(iam): cover OIDC provider persistence and cap the provider URL Add IamServicePersistenceTest: IAM state is persisted through StorageFactory, so a restart must preserve providers along with their client IDs, thumbprints, tags and creation time. The model carries an Instant and two lists, so a broken serialization round trip would surface here first. Also enforce the documented 255-character limit on the provider URL, which was otherwise unchecked and would have produced an oversized ARN. * fix(iam): match verified AWS behaviour for OIDC providers Checked the emulated surface against a live AWS account and corrected where it diverged: AddClientIDToOpenIDConnectProvider and RemoveClientIDFromOpenIDConnectProvider are idempotent on AWS. Adding a client ID that is already present, and removing one that was never added, both succeed and change nothing; they previously raised EntityAlreadyExists and NoSuchEntity. Exceeding the thumbprint limit reports InvalidInput, not LimitExceeded. The client ID quota and duplicate-provider messages now use the AWS wording, and DeleteOpenIDConnectProvider reports its own not-found phrasing. Confirmed unchanged: the ARN is derived from the scheme-less URL, Get echoes the URL without its scheme, the URL is capped at 255 characters, the client ID quota is 100 with LimitExceeded, and URLs are not normalized, so a trailing slash or a case difference yields a separate provider. * fix(iam): reject missing required parameters on OIDC mutators A null ClientID read as "not in the client ID list", so RemoveClientIDFromOpenIDConnectProvider reported a no-op success for a request that never named one. DeleteOpenIDConnectProvider had lost its ARN check when it stopped routing through getOpenIDConnectProvider to report the not-found wording AWS uses for that action, so a request with no ARN came back as NoSuchEntity rather than a required-parameter error. Route every OIDC mutator through shared ARN and client ID checks so a malformed request fails as ValidationError before any lookup. * fix(iam): unbreak the reflective test fixture for the new constructor arity IamServiceTestHelper resolves the package-private IamService constructor reflectively against a hardcoded parameter list, so the extra storage backend broke it at run time with nothing failing at compile time. Every test using the fixture errored, and one of them blocks on a socket read rather than failing, which exhausted the CI job before it could report. Extend both lookups and both newInstance calls to the new arity. * fix(iam): reject empty tag collections on OIDC providers TagOpenIDConnectProvider with no Tags and UntagOpenIDConnectProvider with no TagKeys performed a no-op mutation and returned 200. AWS rejects both, as InvalidInput rather than ValidationError, with distinct messages for the map and the key list; checked against a live account. Validate the ARN on the tag path too, so a missing one fails before the lookup like the other mutators. --------- Co-authored-by: Michal Schreiber <michal.p.schreiber@gmail.com> Co-authored-by: Michal Schreiber <michal.schreiber@benefitsystems.pl> |
||
|
|
40e8aad55a |
feat(lambdamicrovms): AWS Lambda MicroVMs service module and its CloudFormation types (#2079)
* feat(lambdamicrovms): AWS Lambda MicroVMs service module Adds the Lambda MicroVMs control plane, a service AWS took GA on 2026-06-22: MicroVM images with a version and build lifecycle, the managed base-image catalog, MicroVM CRUD, and VPC egress network connectors. Two service models rather than one. Lambda Microvms (apiVersion 2025-09-09) carries images and MicroVMs under /2025-09-09; Lambda Core (2026-04-30) carries network connectors under /2026-04-04. Both sign as lambda, so their requests arrive under the existing lambda claim in ResolvedServiceCatalog and route by path. Neither prefix collides with anything LambdaController serves, and both are enabled by the lambda service rather than adding a toggle. Tagging rides the classic /2017-03-31/tags/ routes, so LambdaTagController learns the MicroVM ARN forms. Resources are stored per account and region. Floci resolves a per-request account in AccountContextFilter and these ARNs carry it, so region-only storage would let two accounts sharing a region read and mutate each other's images, MicroVMs and connectors. Wire shapes come from the vendored service models and, where the models are silent or disagree with the service, from responses recorded against live AWS. Several members the models mark optional are enforced in practice — a connector needs ClientToken, OperatorRole, NetworkProtocol and AssociatedComputeResourceTypes despite all four being optional in Smithy — and several resources are returned in a different projection per operation: an image in four shapes, a connector in four, with only the list summaries carrying Type. Builds converge instantly rather than on a timer, the usual emulator trade. Where that would otherwise produce an inconsistent body it is handled explicitly: a create or update reports the transitional state and does not name the version it is minting as active, because a client reading otherwise would launch a MicroVM off a version that does not exist yet. Auth tokens, the per-VM endpoint, and the idle and suspend timers are deliberately out of scope here; they belong to a full-fidelity MicroVMs emulator rather than to CloudFormation provisioning. Verified against a suite of responses recorded from live AWS (https://github.com/INTENTIUS/m80): 26 checks over the image, MicroVM and connector lifecycles, 0 failures. * feat(cloudformation): provision AWS::Lambda::MicrovmImage and AWS::Lambda::NetworkConnector Registers a CfnResourceProvisioner for the two MicroVM CloudFormation types against the LambdaMicrovmsService added alongside, so a template declaring either provisions and deletes rather than being skipped. Uses the CloudFormationResourceRegistry interface rather than the switch in CloudFormationResourceProvisioner, following SqsCfnProvisioner. * test(lambdamicrovms): AWS CLI compatibility coverage for images, MicroVMs and connectors * fix(lambdamicrovms): wire service state through StorageFactory Images, MicroVMs and connectors were held in plain in-memory maps, so in persistent mode a restarted Floci lost them while the CloudFormation stacks that created them survived. Those stacks then referenced resources that no longer existed and DeleteStack failed on the 404. The three stores are now StorageBackedMap over StorageFactory backends, keyed region/id. MicroVMs are delivered as part of the lambda service, so they share its storage key and therefore its configured mode and flush interval rather than declaring their own. The account half of the key is dropped from the service and left to the backend, which prefixes and strips the same account the RegionResolver returns, so region and account isolation are unchanged. StorageBackedMap only marks the backend dirty on put and remove, so every path that mutated a stored object in place now writes it back: image update, version status, version delete, rebuild, MicroVM settle and terminate, connector settle and update, and both tag paths. * style(core): import the lambda microvms controllers in the service catalog * fix(lambdamicrovms): register the persisted types for reflection Moving images, microvms and connectors into StorageBackedMap made their model classes persisted types, and PersistedModelReflectionTest fails on any that lack @RegisterForReflection because native-image persistence cannot rebuild them on restart. |
||
|
|
0cfffbea00 |
fix(kms): reject mismatched keys in decryption requests (#1893)
* fix(kms): reject mismatched keys in decryption requests * fix(kms): reject mismatched keys in reencryption requests * fix(kms): verify if key is usable for cryptographic operations |
||
|
|
ac4b865a34 |
feat(ec2): support managed prefix lists (#2105)
* feat(ec2): support managed prefix lists Implement CreateManagedPrefixList, DescribeManagedPrefixLists, GetManagedPrefixListEntries, ModifyManagedPrefixList and DeleteManagedPrefixList. Entries are versioned: a list starts at version 1 and every modification that changes entries stores a new version, so GetManagedPrefixListEntries can serve an earlier TargetVersion. Renaming or raising MaxEntries does not create a version, CurrentVersion makes a modification conditional, and removals apply before additions so one call can replace an entry's description. The AWS-managed gateway-endpoint lists are now built once and served by both DescribeManagedPrefixLists and the existing DescribePrefixLists, so the two surfaces cannot report different CIDRs for the same list. They are read-only. Closes #2100 * fix(ec2): validate prefix list input and keep tag copies in sync Three defects in the managed prefix list surface: ModifyManagedPrefixList only checked the resulting entry count against MaxEntries, so a zero or negative MaxEntries on an empty list passed the check and persisted an impossible capacity. CreateTags and DeleteTags update the generic tag store and then mirror the result onto the resource, but updateResourceTags had no arm for prefix lists, leaving the copy on the model stale for describe responses and tag filters. MaxEntries and TargetVersion were converted with Integer/Long.valueOf, so malformed input escaped as an unchecked NumberFormatException and became a 500 rather than a structured EC2 client error. * fix(ec2): reject a missing PrefixListId and infer the prefix-list tag type A null PrefixListId reached List.of() inside describeManagedPrefixLists and threw NullPointerException, so DeleteManagedPrefixList, GetManagedPrefixListEntries and ModifyManagedPrefixList answered a request that never named a list with a 500 rather than a client error. Guard the lookup and raise MissingParameter. inferResourceType had no pl- arm, so tags on a prefix list were stored but reported as resourceType "unknown" and were invisible to a DescribeTags filter on resource-type. The existing test only covered describe and tag: filters, which is why this went unnoticed. Also cover the accepting branch of the address-family check, which until now was only reached by the rejecting case. * fix(ec2): treat a blank numeric parameter as malformed rather than absent intOrNull and longOrNull returned null for a present but blank value, which the callers read as "parameter not supplied". For CurrentVersion that silently downgraded a conditional ModifyManagedPrefixList to an unconditional one, so a request that asked to be gated on a version was applied anyway. Only an absent parameter is null now; a blank one reaches the parse and surfaces as InvalidParameterValue. * fix(ec2): report PrefixListVersionMismatch for a stale CurrentVersion A conditional ModifyManagedPrefixList that loses the version check returns PrefixListVersionMismatch on AWS, not IncorrectState; verified against a live account, which also supplies the message. The Terraform provider keys its retry handling on that code, so the previous one would have left a caller unable to recognise a losing conditional update. --------- Co-authored-by: Michal Schreiber <michal.p.schreiber@gmail.com> |
||
|
|
c0522593e5 | fix(dynamodb): resolve nested document paths in ADD and DELETE update actions (#1908) | ||
|
|
bf53ff71d8 |
fix(secrets-manager): return partial result for missing secrets in batch (#1591)
* fix(secrets-manager): return partial result for missing secrets in batch * fix(secrets-manager): remove hardcoded errorCode mapping * fix(secrets-manager): report deleted and missing current version secrets in BatchGetSecretValue errors |