| index 17b90d41d..8b3f5e182 100644 |
| --- a/internal/edge/wildcard_test.go |
| +++ b/internal/edge/wildcard_test.go |
| @@ -12,6 +12,7 @@ import ( |
| "math/big" |
| "reflect" |
| "slices" |
| + "sort" |
| "strings" |
| "testing" |
| "time" |
| @@ -408,24 +409,37 @@ func TestOnReloadHookFires(t *testing.T) { |
| } |
| |
| // TestCurrentHostsPlatformOnly guards the wildcard-safety filter: only |
| -// PLATFORM-minted routes (Platform==true) contribute to currentHosts, since |
| -// parentsFor derives wildcard parents from that list. A custom domain |
| -// shaped like <x>.<y>.<apps-domain> that somehow landed in the route table |
| -// (Platform==false) must never mint a wildcard parent and burn an ACME |
| -// issuance for it — only the routes the domains-reconcile pass itself |
| -// minted are trusted for that. |
| +// platform-minted routes contribute to currentHosts — console-minted |
| +// (Platform==true) or records-provisioned (Provisioned==true) — since |
| +// parentsFor derives wildcard parents from that list. A host shaped like |
| +// <x>.<y>.<apps-domain> that landed in the route table by neither path |
| +// must never mint a wildcard parent and burn an ACME issuance for it. |
| +// |
| +// Provisioned rows joined the set on 2026-08-24: a box holding ONLY |
| +// provisioned rows (every multi-region edge) derived no parents and served |
| +// no mirrored wildcard. A provisioned custom domain is listed here but |
| +// mints nothing — parentsFor's two-labels-under-the-apps-domain rule is the |
| +// bound, pinned below. |
| func TestCurrentHostsPlatformOnly(t *testing.T) { |
| e := &Edge{} |
| e.upstreams.Store(&map[string]upstream{ |
| - "app.acct.oncarlos.com": {route: registry.Route{Host: "app.acct.oncarlos.com", Platform: true}}, |
| - "custom.example.com": {route: registry.Route{Host: "custom.example.com", Platform: false}}, |
| - "evil.acct2.oncarlos.com": {route: registry.Route{Host: "evil.acct2.oncarlos.com", Platform: false}}, |
| + "app.acct.oncarlos.com": {route: registry.Route{Host: "app.acct.oncarlos.com", Platform: true}}, |
| + "review.acct3.oncarlos.com": {route: registry.Route{Host: "review.acct3.oncarlos.com", Provisioned: true}}, |
| + "story.example.com": {route: registry.Route{Host: "story.example.com", Provisioned: true}}, |
| + "custom.example.com": {route: registry.Route{Host: "custom.example.com", Platform: false}}, |
| + "evil.acct2.oncarlos.com": {route: registry.Route{Host: "evil.acct2.oncarlos.com", Platform: false}}, |
| }) |
| got := e.currentHosts() |
| - want := []string{"app.acct.oncarlos.com"} |
| + sort.Strings(got) |
| + want := []string{"app.acct.oncarlos.com", "review.acct3.oncarlos.com", "story.example.com"} |
| if !reflect.DeepEqual(got, want) { |
| t.Fatalf("currentHosts = %v, want %v", got, want) |
| } |
| + parents := parentsFor(nil, "oncarlos.com", got) |
| + wantParents := []string{"acct.oncarlos.com", "acct3.oncarlos.com"} |
| + if !reflect.DeepEqual(parents, wantParents) { |
| + t.Fatalf("parents = %v, want %v (a provisioned custom domain mints no parent; the unowned evil row never reaches here)", parents, wantParents) |
| + } |
| } |
| |
| func TestDelegatedParentsJoinTheSet(t *testing.T) { |