Commit Graph
3 Commits
Author SHA1 Message Date
Alex Banna 5657e35007 feat(cloudfront): enforce signed private content (#1831)
* 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
2026-08-13 23:32:24 -04:00
Alex Banna 82f80165fb feat(cloudfront): serve distribution requests from S3 and custom origins (#1820)
* 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
2026-08-12 19:34:18 -04:00
Hector Ventura b200280a83 feat(cloudfront): implement CloudFront service emulation (#969)
* feat(cloudfront): implement CloudFront service emulation

Adds full CloudFront emulation covering both core and extended operations using the REST XML protocol (2020-05-31 API).

Core resources:
- Distributions (CRUDL, copy, enable/disable, ETag concurrency)
- Cache Behaviors (default + ordered)
- Invalidations (create, get, list)
- Origin Access Controls and Origin Access Identities
- CloudFront Functions (create, update, publish, test, describe)

Extended resources:
- Continuous Deployment Policies
- Public Keys and Key Groups
- Realtime Log Configs (non-standard POST-based get/delete)
- Streaming Distributions (legacy RTMP, enforces disabled before delete)
- Field-Level Encryption Configs and Profiles
- Monitoring Subscriptions

Infrastructure:
- Registers CloudFrontController in ResolvedServiceCatalog as REST_XML
- Adds CloudFrontServiceConfig and CloudFrontStorageConfig to EmulatorConfig
- Adds CLOUDFRONT namespace constant to AwsNamespaces
- Registers CloudFrontService for GraalVM runtime initialization to avoid SecureRandom heap-baking in native builds
- Wires storage through StorageFactory with per-resource JSON files
- Adds cloudfront.md documentation page

* docs: revert docker-compose.yml
2026-05-20 23:12:03 -05:00