* fix(cloudfront): store and return a distribution's ConnectionMode
* test(cloudfront): deploy the ConnectionMode stack with CfnRequests and check refusals store nothing
Every Service Matrix row now has its operation count checked, or a stated
reason it cannot be. The REST rows map their JAX-RS controllers in
action_count_sources, with:
- rename_actions for a method not named after its AWS action, and a list
for a method that answers several actions by query parameter
(CreateRestApi and ImportRestApi on POST /restapis?mode=import)
- route_prefix and skip_route_prefix on a REST source, so API Gateway's v1
and v2 rows split the one controller that serves both
- a tag_handler source mode: a TagHandler class is what gives a service the
three tagging actions the shared /tags controllers serve
- exclude_actions for operations that always fail (InvokeModelWithResponseStream
answers 501, ExecuteSql BadRequestException, Amazon MQ's user calls
BadRequestException for RabbitMQ brokers)
A new coverage gate fails when a row is neither checked nor listed under
hand_counted with its reason, when two rows share a link target, or when a
row has no numeric count. It replaces the required-sources list. S3 is the
one hand-counted row: its handlers pick most operations by query string.
Most REST rows were undercounted, EKS by the most (7, served 35). IoT Data
gets its own anchor, as it shared iot.md with IoT Core and its count was
never read. The AppSync, CloudFront, EKS, Lambda and Pipes pages now list
the operations their controllers serve: AppSync's listed names that do not
exist, and CloudFront's called stored-only operations unsupported.
Closes#4999
UpdateKeyValueStore and DeleteKeyValueStore answered every If-Match that
did not match the store's control-plane ETag with InvalidIfMatchVersion
(400). A stale version Floci issued, one that a comment update has since
rotated, now fails with PreconditionFailed (412); a missing or malformed
version keeps InvalidIfMatchVersion. A refused request leaves the store
and its data plane unchanged, and the CloudFront overview and the
key-value-store section of the docs describe the same statuses.
Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
UpdateOriginAccessControl was routed without the /config suffix, so the
SDK's PUT /2020-05-31/origin-access-control/{Id}/config answered 405
before reaching configuration validation. It now takes that route,
authorized through the generated CloudFront metadata.
SDK and IAM integration tests cover the configuration readback, a missing
If-Match, a scoped grant and another control's denial, encoded
identifiers and misleading action hints, and share
CloudFrontOriginAccessControlFixtures for the configuration and the
ETag-aware delete.
Signed-off-by: Jackson Price <jxnprice@amazon.com>
Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
A distribution could name a certificate in ACMCertificateArn and in
IAMCertificateId at once, and could name one in either of them without the
MinimumProtocolVersion and SSLSupportMethod that go with it. It could also
carry a security policy or a viewer support method outside the values those
members admit, carry SSLv3 alongside sni-only, and claim
CloudFrontDefaultCertificate while naming a certificate of its own. The
ViewerCertificate entry states every one of those rules, and nothing here
read any of them, so a configuration AWS refuses was taken and the
distribution went on to serve it.
They are read now on the distribution create and the distribution update,
and the shape of the protocol members before any of it, so a request that
breaks a rule is refused for the rule and not for a certificate nothing
matches. A member carried blank counts as no value, the way a blank location
member already names no certificate, and a distribution on the CloudFront
domain name needs neither location member.
Two of the refusals are published. A MinimumProtocolVersion outside its
enumeration is InvalidMinimumProtocolVersion, whose own sentence is that the
minimum protocol version specified is not valid. SSLv3 alongside sni-only is
InvalidProtocolSettings, whose sentence names that pair and nothing else and
which is the same rule as the floor the member states for SNI, "you must
specify TLSv1 or higher", SSLv3 being the only value below TLSv1. That code
is declared on CreateDistribution, CreateDistributionWithTags and
CopyDistribution and has never been declared on UpdateDistribution, which
has declared InvalidMinimumProtocolVersion since 2015, so the update answers
the pair with the code it declares and keeps the pair's published sentence.
The declared code is the one a caller's SDK can map, an undeclared one
reaching it as a generic error, and the sentence keeps the two causes the
update answers under that one code apart.
The others are readings. An SSLSupportMethod outside its enumeration has no
code of its own and answers InvalidArgument, what this service already
answers a member outside its shape with. The three rules about the
certificate itself answer InvalidViewerCertificate 400: InvalidArgument and
InvalidMinimumProtocolVersion are modelled on both writes as well and no
sentence says which one a caller gets, and the Developer Guide page that
enumerates what InvalidViewerCertificate answers reaches none of those
cases, naming the certificate's own trust, its chain, its format and the
names it covers. That code's own documentation is that a viewer certificate
specified is not valid, which is what each of the three carries.
One rule in the group replaces a value instead of refusing the request.
MinimumProtocolVersion's entry says that when CloudFrontDefaultCertificate
is true CloudFront "automatically sets the security policy to TLSv1
regardless of the value that you set here", so the policy such a request
asks for is overwritten and the config reads back TLSv1. A distribution
created with no ViewerCertificate at all already read as the default
certificate and reads TLSv1 with it now, where it had been answering
TLSv1.2_2021.
Two more readings go with the group. The claim itself is a member declared
boolean, so it is held to the four forms XML gives a boolean, true, false, 1
and 0, rather than read for the word true alone: taken for false, a request
saying yes would dodge every rule the member governs, the refusal beside a
named certificate and the replaced policy alike. Anything else answers the
InvalidArgument this service answers a member outside its shape with,
CloudFront modelling no error for a malformed document. And the SSLv3 pair
is read for a distribution on a certificate of its own alone, since on the
CloudFront certificate the policy is replaced and the value that would make
the pair is discarded, so refusing the request for it would contradict the
override. Both enumerations are read either way.
The us-east-1 restriction AWS states for ACM certificates is left
unenforced, as is the /cloudfront upload path before it: refusing either
here could meet a distribution somebody already built. All of the above,
that included, is set out in docs/services/cloudfront.md.
CloudFront resolves ViewerCertificate.IAMCertificateId by id alone, and two
questions about that have sat open. A server certificate meant for CloudFront
must be uploaded under /cloudfront, which nothing here enforces, and a blank
value is read as naming no certificate at all.
The blank is settled by AWS's own text, twice over. The member is declared with
a minimum length of 0, so an empty string breaks no bound it carries, and the
ViewerCertificate entry tells a caller on the CloudFront domain name to set
CloudFrontDefaultCertificate and leave all other fields empty. An element left
empty arrives as a blank on this REST XML protocol, so reading it as an id
would refuse the very request the reference asks for.
The path is a published obligation on the caller, in IAM's
UploadServerCertificate note and again in CloudFront's own procedure for
uploading a third-party certificate to IAM, and this emulator does not hold
callers to it. That is a deliberate divergence rather than a reading of what
AWS accepts. What is published is the obligation on the upload rather than a
refusal on the write: the Developer Guide's InvalidViewerCertificate page
enumerates what CloudFront verifies when an alternate domain name is added, in
the order it verifies them, and the certificate's path is not among those
checks. Holding a distribution to the path would refuse a write on a rule
published for the upload, so the id alone decides until something records
otherwise, and a capture of such a refusal moves the reader, the page and the
test.
The reasoning lives in docs/services/iam.md, with the CloudFront page and the
reader's javadoc pointing at it, and two tests pin what each case does: a
distribution created through the API with an empty IAMCertificateId element is
accepted and holds no certificate, and a certificate uploaded outside
/cloudfront serves a distribution and cannot be deleted while it does.
* docs(cloudfront): add a runnable private S3 origin example
* docs(cloudfront): keep the private origin example's cleanup running
Set the CLI output format so a text or table default cannot break jq and
leave a distribution behind. Guard the cleanup steps that could stop it
under set -e, including the empty distribution list on Bash before 4.4.
Move the guide's pointer from Supported Operations to CLI Examples.
* fix(cloudfront): tunnel WebSocket upgrades to custom origins as AWS does
CloudFront forwards WebSocket handshakes to the origin on every distribution, but
Floci's serving path is a JAX-RS resource that strips Upgrade and Connection and
fetches the origin with a blocking client, so a socket.io client behind a
distribution never left long-polling.
A Vert.x route ahead of JAX-RS now catches an HTTP/1.1 WebSocket handshake to a
distribution host, resolves the behavior and custom origin as the GET path does
(allowed methods, signed requests, origin request policy, origin custom headers,
private-address guard), sends the handshake with its upgrade fields and splices
the two connections once the origin answers 101. Any other answer is relayed as
an ordinary response, and handshakes the distribution would not tunnel fall
through to the existing GET handling. Handshake detection and the byte relay are
shared with the ALB data plane.
* fix(cloudfront): honor disabled service and origin timeouts on WebSocket refusals
The WebSocket route runs ahead of ServiceEnabledFilter, so it now checks that
CloudFront is enabled before taking a handshake and otherwise falls through to
the disabled-service answer.
An origin answer that refuses the upgrade is no longer piped without limits: its
body is streamed within the origin's response timeout between packets and its
response completion timeout in all, counting only the origin's time, and an
origin that stalls past them ends the viewer connection.
* test: share the ALB fixture between the WebSocket integration tests
CloudFrontWebSocketIntegrationTest repeated ElbV2WebSocketIntegrationTest's load
balancer, target group, listener and WebSocket exchange helpers. Both now use
AlbFixtures.
* refactor(cloudfront): have the WebSocket origin clock spend a shared CompletionBudget
* fix(cloudfront): serve custom origins that name Floci itself in-process
* fix(cloudfront): keep self-origin requests inside the origin path and accept the TLS AWS port
Resolve the viewer's dot segments before prepending the origin path, as
CloudFront does, so a path like /x/../../other-bucket/key can no longer
reach another bucket. Recognize the extra listener the TLS proxy binds on
floci.tls.aws-https-port as Floci's own port.
* docs(cloudfront): explain why self-origin dot segments are resolved first
CloudFront forwards the raw path; the guard is needed because Floci's
listener resolves dot segments. Give the ignored exception in selfHost
its reason.
* feat(cloudfront): serve execute-api custom origins of this Floci in-process
A custom origin whose domain is an execute-api endpoint of an HTTP or
REST API in this Floci is now served through Floci's own listener, as
Lambda Web Function endpoints are, with the execute-api domain as Host.
Before, the origin went through DNS and the viewer got 502.
ApiGatewayExecuteApiHostFilter.routes() says whether the host filter
rewrites a host and path onto an API. A request that it does not route
(a WebSocket API, a disabled endpoint, a missing stage, another region)
answers 404 and never reaches Floci's other endpoints. Dot segments in
the forwarded path are resolved before that check. A forwarded viewer
Host answers 502. Every other origin is unchanged.
* refactor(cloudfront): share the execute-api routing decision with the host filter
ApiGatewayExecuteApiHostFilter.decide() returns the routing decision
without touching the request, with its lookups under the API owner's
account. filter() applies the decision and routes() reuses it, so the
two cannot drift.
This fixes two cases where routes() differed from filter(): an HTTP API
owned by another account than the viewer is now served through
CloudFront, and a REST API origin whose region label is not the API's
region now answers 404. The 404 body is one constant.
* refactor(apigateway): keep Optional out of the route decision record
RouteDecision stores the API owner as a nullable value, and the decision
helpers take it as a plain parameter. Optional stays the return type of
the owner lookup only, as AGENTS.md asks.
* refactor(cloudfront): name the ignored host parse failure and drop the Optional test field
---------
Co-authored-by: liRONCO11 <7966063+liRONCO11@users.noreply.github.com>
* feat(cloudfront): model AWS managed cache policies
Serve the 7 AWS managed cache policies that AWS documents with full
settings through GetCachePolicy, GetCachePolicyConfig and
ListCachePolicies, by their AWS IDs. ListCachePolicies honors
Type=managed|custom. UpdateCachePolicy and DeleteCachePolicy refuse a
managed policy with IllegalUpdate and IllegalDelete, as for managed
origin request policies. A cache behavior that references a managed
policy now forwards what that policy selects.
The 4 Amplify-only policies are not modeled: AWS publishes their IDs
but not their settings.
Closes#6691
* refactor(cloudfront): share the policy list merge and the managed ETag
listCachePolicies, listOriginRequestPolicies and listResponseHeadersPolicies
now call one helper for the Type check, the merge of custom and managed
policies, and the sort by name. Each method keeps its own paging, so the
response headers list still rejects an unknown marker.
The managed policy ETag is one constant beside the managed policy maps.
---------
Co-authored-by: liRONCO11 <7966063+liRONCO11@users.noreply.github.com>
* feat(cloudfront): sign requests to a Lambda Web Function origin under OAC
CreateOriginAccessControl now takes always-amz-auth for the lambda origin
type and sigv4a for s3 and lambda, with the AWS validation messages.
Distributions check the origin access control of a Lambda origin as AWS
does, and refuse a Lambda@Edge origin trigger in front of an origin signed
with always-amz-auth or sigv4a.
Under always-amz-auth, CloudFront signs its requests to a Web Function
endpoint of this Floci for the distribution. An IamAuth endpoint lets them
through, or under IAM enforcement evaluates the function policy for
cloudfront.amazonaws.com with aws:SourceArn and aws:SourceAccount.
* fix(cloudfront): refuse unknown and in-use OAC changes as AWS does
A distribution naming an origin access control that does not exist is
InvalidOriginAccessControl. A control an origin uses can no longer change
its origin type, its signing protocol, or whether it is always-amz-auth,
which AWS answers with IllegalUpdate.
* fix(cloudfront): match a Lambda origin by the end of its hostname
CloudFront takes a Lambda origin only from a hostname under on.aws, and it matches the fixed labels case sensitively. Floci also takes one under its own host.
The CloudFront check and the caller check now share the endpoint condition keys. The docs say when CloudFront forwards the viewer Authorization.
* fix(cloudfront): read the Floci host for Lambda origins from the authority
URI.getHost is null for a host with an underscore, such as a Compose service name, which broke CloudFront at startup. The Web Function endpoints are named from the authority, so the match reads it the same way.
* fix(cloudfront): serve a Lambda Web Function endpoint origin from Floci itself
A custom origin whose domain is an endpoint this Floci minted now goes to
the listener the viewer reached, with the endpoint domain as Host. Before,
the endpoint host did not resolve, and loopback failed the private address
check.
As on AWS, a forwarded viewer Host is a 502, because the endpoint's
certificate does not name it.
* fix(cloudfront): fetch the endpoint origin over plain HTTP for TLS viewers
A viewer over TLS reached the HTTPS port, and Floci sent plain HTTP to it.
The request now goes to the plain HTTP port at the same address.
The endpoint domains are also indexed by the host a CloudFront origin
names, so a base URL host with upper case or a trailing dot still matches.
* fix(partitions): source the China CloudFront suffix and GovCloud API Gateway zones
Two values listed as open questions have a published source in the China and
GovCloud user guides, so they become vendored facts in aws/region-facts.json
instead of a commercial constant.
A generated CloudFront distribution domain name ended in cloudfront.net in
every partition. The China guide's CloudFront page names the default domain
there as *.cloudfront.cn
(https://docs.amazonaws.cn/en_us/aws/latest/userguide/cloudfront.html), and
the commercial suffix is the one in the example name of the botocore
CloudFront model (Distribution$DomainName, DistributionSummary$DomainName).
floci.services.cloudfront.domain-suffix loses its cloudfront.net default and
becomes optional: unset, the suffix follows the request's partition, with the
commercial one where a partition has no CloudFront; set, it applies in every
partition as before. CloudFront distributions and streaming distributions,
Cognito and AppSync custom domains and edge-optimized API Gateway domains all
resolve it through CloudFrontEdgeDomain.domainSuffix.
A regional API Gateway custom domain reported one placeholder hosted zone id in
every region. The GovCloud guide's API Gateway page states the regional
endpoint zone for us-gov-west-1 (Z1K6XKP9SAGWDV) and us-gov-east-1
(Z3SE9ATJYCRCZJ)
(https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-abp.html);
those two regions now report it, and the generator resolves each region
through its description in partitions.json. No source gives the zone for any
other region, which keeps the placeholder and stays an open question.
The generator reads both sentences from either rendering of a guide page: the
page text, or the Markdown AWS serves at the same URL with .md, which escapes
the asterisk in the CloudFront sentence.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(partitions): require each sourced fact and resolve edge domains in the request's partition
The GovCloud API Gateway page parser accepted a page stating only one
region's regional hosted zone, so an edited guide would have dropped the
other zone from region-facts.json without failing. It now requires a zone
for every aws-us-gov region.
The region-facts self check validated cloudfrontDomainSuffix only when it
was present. It now requires the suffix for aws and aws-cn, and the
regional hosted zone for both GovCloud regions, as it already requires
consoleHost; a missing commercial suffix would otherwise have reached
the orElseThrow in CloudFrontEdgeDomain.domainSuffix at runtime.
CloudFrontEdgeDomain.create resolved its partition from the region alone,
falling back to the commercial one, so an AppSync or API Gateway custom
domain in a region no partition publishes (allowed under
allow-unknown-regions) took the commercial suffix and hosted zone in a
China deployment. It now takes the partition the caller's RegionResolver
resolves, which falls back to the deployment's partition, as the
CloudFront and Cognito paths already do.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
A distribution ignored a viewer's Range header: an S3 origin answered
every GET with the whole object and 200, while advertising
Accept-Ranges: bytes, and a custom origin behind a cache or origin
request policy never saw the header, so seeking in a video or resuming
a download read the object from the start.
An S3 origin now serves the one byte range asked for as 206 with its
Content-Range, read from the snapshot GetObject serves, and answers 416
when the range starts past the end of the object. Any other Range gets
the whole object, as CloudFront answers a Range it does not accept and
as S3 does not serve several ranges in one request. A custom origin gets
the viewer's Range and If-Range on every GET or HEAD with a Range
whatever the forwarding settings, as CloudFront forwards a range GET to
the origin and a HEAD can then report the range's length, and its answer
is passed on. A custom error page is served whole.
A Range now applies only while the If-Range sent with it, if any, still
describes the object: a strong ETag equal to the object's, or an
HTTP-date equal to its Last-Modified, matched exactly as RFC 9110
section 13.1.5 requires. Otherwise the whole object is served. This
holds for GetObject, HeadObject and the S3 origin. A presigned URL that
signs Range must also sign an If-Range the request carries, as the S3
User Guide requires.
HeadObject honors Range as the API Reference describes: a satisfiable
range sets Content-Length to the length of the range, leaving out the
whole-object checksum as a ranged GetObject does, and one past the end
answers 416, while a Range that is not one valid range is ignored, as
before. An S3 origin answers a HEAD the same way.
A ranged GetObject is now recorded in CloudTrail like any other, with
the bytes of the range sent, and a range past the end of the object,
for GetObject or HeadObject, is recorded as InvalidRange.
The range parsing GetObject did is now ByteRange, which both use, and
UploadPartCopy's range stream becomes ByteRangeInputStream. GetObject
now matches the range unit in any case, as RFC 9110 section 14.1 has
it, and its InvalidRange error is the one S3 sends, as an AWS-validated
LocalStack capture records it: the message "The requested range is not
satisfiable", with no trailing period, and the RangeRequested and
ActualObjectSize fields.
A distribution read every origin response whole before answering the
viewer: an S3 origin's object through getObject, a custom origin's body
through the HTTP client into a byte array. A viewer's POST, PUT, PATCH
or DELETE body was likewise read whole before it was forwarded. So an
object or upload of about 2 GiB or more failed, and a smaller one could
run the heap out of memory.
S3 origins now open the object as a stream, the snapshot GetObject
serves, and custom origins return their response before its body is
read; either body is written to the viewer as it arrives, with its
Content-Length, or chunked as the origin sent it. A viewer's body is
streamed to the custom origin with its Content-Length, or chunked when
the viewer sent it chunked or, as HTTP/2 allows, with no length.
An origin response closed before its end, as when the viewer goes away
or a custom error page replaces it, cancels its request instead of
reading the rest of the body to reuse the connection. Since a streamed
response holds its connection for the whole transfer, one origin may
now use the whole connection pool, as CloudFront sets no per-origin
limit.
Custom origins only ever received the origin custom headers: the serving
controller built each origin request from them alone and dropped the
query string, whatever cache policy, origin request policy or legacy
ForwardedValues the matched cache behavior carried.
CloudFrontOriginRequestBuilder now decides what reaches the origin. With
a cache policy it forwards the union of the cache policy's
ParametersInCacheKeyAndForwardedToOrigin and the origin request policy
(every HeaderBehavior, CookieBehavior and QueryStringBehavior value).
Without one it applies legacy ForwardedValues, including the headers
CloudFront forwards by default. It also adds what CloudFront always
sends: Host for the origin unless the viewer Host is forwarded,
User-Agent "Amazon CloudFront", X-Forwarded-For, Via and X-Amz-Cf-Id.
Authorization is kept on the methods CloudFront does not cache, and
CloudFront-Forwarded-Proto, -Viewer-Address and -Viewer-Http-Version are
generated when a policy asks for them. Origin custom headers now replace
every same-named viewer header, and signing parameters are still never
forwarded.
The eight AWS managed origin request policies are served by their AWS
IDs and cannot be updated or deleted. With no origin request policy and
nothing selected by the cache policy, no cookies or query strings are
forwarded, as before.
Closes#4217
The serving controller only declared GET, HEAD and OPTIONS, so a write
method on a distribution host matched the resource class but no method
and fell through to a bare 405, even when the cache behavior allowed all
seven methods.
POST, PUT, PATCH and DELETE are now served under the same AllowedMethods
check (403 "Invalid method." otherwise) and the same trusted key group
enforcement as the read methods. Custom origins receive the method, the
viewer request body, its Content-Type and its Authorization header, with
Content-Length taken from the body; GET and HEAD still reach the origin
without Authorization, as on CloudFront. In-process S3 origins answer
these methods with 403 Access Denied instead of forwarding them, which
is documented.
Closes#4216
* fix(core): route by the Host header on HTTP/2 requests
HTTP/2 carries the authority in :authority and sends no Host header, so every
lookup that reads Host fell through when a client negotiated HTTP/2. curl, the
AWS SDK for Java and Go, and browsers all do that over HTTPS, which left
CloudFront distribution domains, API Gateway execute-api and custom domains,
Lambda function URLs and Cognito custom domains unreachable over https://.
Copy the authority into a Host header before routing. S3 already covered this in
its own filter.
* feat(cloudfront): serve distributions over HTTPS on local hostnames
A distribution's assigned domain name resolves to nothing local, so a signed URL
could not be downloaded over https:// the way a viewer downloads one from
CloudFront.
Serve every distribution under <id>.cloudfront.localhost.floci.io and
<id>.cloudfront.localhost as well, and add both to the SANs of the generated
server certificate. The first resolves to 127.0.0.1 through public DNS on Linux,
macOS and in containers. The second needs no DNS at all but only resolves where
the runtime handles .localhost itself, which macOS and browsers do and
Debian-based images do not.
* fix(cloudfront): assign lower-case distribution domain names
AWS writes a distribution's domain name in lower case and keeps the id upper
case. Floci put the upper-case id straight into the host name, and a browser
lower-cases the authority it sends, so the rebuilt resource never matched the
one a signed URL was signed for and the download failed with 403.
* refactor(cloudfront): derive the local delivery hosts from the DNS suffixes
The suffix list was a fourth hardcoded copy of the emulator host suffixes, so a
configured FLOCI_HOSTNAME or FLOCI_DNS_EXTRA_SUFFIXES resolved and was covered by
TLS but did not route, and localhost.localstack.cloud did not either. Build it
from the same source the embedded DNS uses.
Match the host inside the scan findByHost already does, by comparing the host to
<id><suffix>, which drops a store read per request and the assumption that the
store keys distributions by an upper-case id. The tests read the default SAN list
from TlsConfigSource rather than copying it.
* fix(cloudfront): issue AWS-shaped public key ids
CreatePublicKey answered a UUID where AWS answers K followed by 13 characters,
the value a signed URL carries as Key-Pair-Id. Verified on AWS us-east-1
2026-09-18: a public key is K2VKB3XV74876Q, while key groups, cache policies,
origin request policies and response headers policies are UUIDs, which Floci
already matches.
* refactor(core): resolve the HTTP/2 authority in each host routing filter
The global Http2HostHeaderFilter made every service depend on a Host
header it wrote, and no service file showed that. RequestHost now returns
the Host header, or the HTTP/2 :authority when there is none. Each filter
that routes by host calls it. S3 and Cognito had their own copy of this
fallback and now use the helper.
* test(core): check host routing over HTTPS and HTTP/2 against the real SANs
The HTTP/2 routing test now boots with a CA-issued leaf that carries the
default SANs. The client trusts only the Floci CA and checks each
CloudFront local delivery host against that leaf. This replaces the
HTTP/1.1 local delivery test, which only set a Host header and never
reached TLS.
S3 drops three resolveHost tests that RequestHostTest now covers. Its
HTTP/2 bucket tests still guard the call to the helper.
* feat(cloudfront): serve distribution requests from S3 and custom origins
* feat(cloudfront): forward origin custom headers
* fix(cloudfront): omit Allow-Credentials and Vary for wildcard S3 CORS rules
withS3CorsHeaders emitted Access-Control-Allow-Credentials: true for every matched
rule, including one whose AllowedOrigin is "*" (where evaluateCors echoes "*").
The CORS specification forbids that pairing and browsers reject it for credentialed
requests, so the emulator produced a response that fails in a browser while passing
against Floci.
Verified against real S3 rather than inferred. Bucket with AllowedOrigins ["*"]:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET
Access-Control-Max-Age: 3000
and with a concrete AllowedOrigin it additionally returns
Access-Control-Allow-Credentials: true
Vary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method
Both preflight and actual GET behave identically. Vary is now also conditional: the
wildcard response is byte-identical for every origin, so there is nothing to vary on,
and real S3 omits it there too.
* 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(ec2): wire managed prefix list storage in public IP test
* fix(cloudfront): allow authorization origin custom headers
* fix(cloudfront): preserve S3 preflight CORS headers
* 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
* feat(cloudfront): serve distribution requests from S3 and custom origins
* feat(cloudfront): enforce signed private content
* 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(cloudfront): match wildcards in signed policy queries
* feat(cloudfront): serve distribution requests from S3 and custom origins
* 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