Skip to content

Commit 2b88ae8

Browse files
etewiahclaude
andcommitted
Add always-valid subdomains list for TLS certificate verification
Adds ALWAYS_VALID_SUBDOMAINS constant with demo sites and city-themed instances that should always pass TLS verification: - City instances: beijing, bangkok, buenos-aires, bangalore, bogota, baghdad, berlin, barcelona, boston, brisbane, birmingham, brasilia, brussels, budapest, bristol, baltimore, baku, beirut, biarritz, busan - Demo/infra: dedo, dedo-1, demo, htz-2, demo-1 These subdomains bypass the normal website/subdomain pool lookup and are immediately approved for certificate issuance. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0607136 commit 2b88ae8

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

app/controllers/pwb/tls_controller.rb

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,35 @@ module Pwb
33
#
44

55
class TlsController < ApplicationController
6+
# Subdomains that are always valid for TLS certificates.
7+
# These are demo sites, city-themed instances, and infrastructure subdomains.
8+
ALWAYS_VALID_SUBDOMAINS = %w[
9+
beijing
10+
bangkok
11+
buenos-aires
12+
bangalore
13+
bogota
14+
baghdad
15+
berlin
16+
barcelona
17+
boston
18+
brisbane
19+
birmingham
20+
brasilia
21+
brussels
22+
budapest
23+
bristol
24+
baltimore
25+
baku
26+
beirut
27+
biarritz
28+
busan
29+
dedo
30+
dedo-1
31+
demo
32+
htz-2
33+
demo-1
34+
].freeze
635
# Skip authentication - this is called by the TLS proxy, not users
736
skip_before_action :authenticate_user!, raise: false
837
skip_before_action :verify_authenticity_token, raise: false
@@ -71,21 +100,28 @@ def verify_platform_subdomain(domain)
71100
return { status: :ok, reason: "Platform domain" }
72101
end
73102

103+
normalized_subdomain = subdomain.downcase
104+
105+
# Check if subdomain is in the always-valid list (demo sites, city instances)
106+
if ALWAYS_VALID_SUBDOMAINS.include?(normalized_subdomain)
107+
return { status: :ok, reason: "Always-valid subdomain" }
108+
end
109+
74110
# Check if subdomain is reserved (admin, www, api, etc.)
75-
if Website::RESERVED_SUBDOMAINS.include?(subdomain.downcase)
111+
if Website::RESERVED_SUBDOMAINS.include?(normalized_subdomain)
76112
return { status: :ok, reason: "Reserved subdomain" }
77113
end
78114

79115
# Look up the website first
80-
website = Website.find_by_subdomain(subdomain)
116+
website = Website.find_by_subdomain(normalized_subdomain)
81117

82118
if website.present?
83119
# Check website status
84120
return validate_website_status(website)
85121
end
86122

87123
# No website yet - check if subdomain is in the pool (available, reserved, or allocated)
88-
subdomain_record = Subdomain.find_by(name: subdomain.downcase)
124+
subdomain_record = Subdomain.find_by(name: normalized_subdomain)
89125

90126
if subdomain_record.present?
91127
# Subdomain is in the pool - allow certificate issuance

0 commit comments

Comments
 (0)