@striae-org/striae 5.1.1 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +41 -11
- package/app/utils/data/permissions.ts +4 -2
- package/package.json +5 -5
- package/scripts/deploy-config/modules/env-utils.sh +322 -0
- package/scripts/deploy-config/modules/keys.sh +404 -0
- package/scripts/deploy-config/modules/prompt.sh +372 -0
- package/scripts/deploy-config/modules/scaffolding.sh +344 -0
- package/scripts/deploy-config/modules/validation.sh +365 -0
- package/scripts/deploy-config.sh +47 -1572
- package/scripts/deploy-worker-secrets.sh +100 -5
- package/worker-configuration.d.ts +6 -3
- package/workers/audit-worker/package.json +1 -1
- package/workers/audit-worker/src/audit-worker.example.ts +188 -6
- package/workers/audit-worker/wrangler.jsonc.example +1 -1
- package/workers/data-worker/package.json +1 -1
- package/workers/data-worker/src/data-worker.example.ts +344 -32
- package/workers/data-worker/wrangler.jsonc.example +1 -1
- package/workers/image-worker/package.json +1 -1
- package/workers/image-worker/src/image-worker.example.ts +190 -5
- package/workers/image-worker/wrangler.jsonc.example +1 -1
- package/workers/keys-worker/package.json +1 -1
- package/workers/keys-worker/wrangler.jsonc.example +1 -1
- package/workers/pdf-worker/package.json +1 -1
- package/workers/pdf-worker/src/pdf-worker.example.ts +0 -1
- package/workers/pdf-worker/wrangler.jsonc.example +1 -5
- package/workers/user-worker/package.json +17 -17
- package/workers/user-worker/src/encryption-utils.ts +244 -0
- package/workers/user-worker/src/user-worker.example.ts +333 -31
- package/workers/user-worker/wrangler.jsonc.example +1 -1
- package/wrangler.toml.example +1 -1
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
validate_data_at_rest_encryption_settings() {
|
|
4
|
+
local enabled_normalized
|
|
5
|
+
enabled_normalized=$(printf '%s' "${DATA_AT_REST_ENCRYPTION_ENABLED:-false}" | tr '[:upper:]' '[:lower:]')
|
|
6
|
+
|
|
7
|
+
if [ "$enabled_normalized" != "1" ] && [ "$enabled_normalized" != "true" ] && [ "$enabled_normalized" != "yes" ] && [ "$enabled_normalized" != "on" ]; then
|
|
8
|
+
echo -e "${RED}❌ Error: DATA_AT_REST_ENCRYPTION_ENABLED must be true because data-at-rest encryption is mandatory${NC}"
|
|
9
|
+
exit 1
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
local has_legacy_private_key=false
|
|
13
|
+
local has_registry_keys_json=false
|
|
14
|
+
|
|
15
|
+
if [ -n "$DATA_AT_REST_ENCRYPTION_PRIVATE_KEY" ] && ! is_placeholder "$DATA_AT_REST_ENCRYPTION_PRIVATE_KEY"; then
|
|
16
|
+
has_legacy_private_key=true
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
if [ -n "$DATA_AT_REST_ENCRYPTION_KEYS_JSON" ] && ! is_placeholder "$DATA_AT_REST_ENCRYPTION_KEYS_JSON"; then
|
|
20
|
+
has_registry_keys_json=true
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
if [ "$has_legacy_private_key" != "true" ] && [ "$has_registry_keys_json" != "true" ]; then
|
|
24
|
+
echo -e "${RED}❌ Error: either DATA_AT_REST_ENCRYPTION_PRIVATE_KEY or DATA_AT_REST_ENCRYPTION_KEYS_JSON is required when data-at-rest encryption is enabled${NC}"
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
if [ -z "$DATA_AT_REST_ENCRYPTION_PUBLIC_KEY" ] || is_placeholder "$DATA_AT_REST_ENCRYPTION_PUBLIC_KEY"; then
|
|
29
|
+
echo -e "${RED}❌ Error: DATA_AT_REST_ENCRYPTION_PUBLIC_KEY is required when data-at-rest encryption is enabled${NC}"
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
if [ -z "$DATA_AT_REST_ENCRYPTION_KEY_ID" ] || is_placeholder "$DATA_AT_REST_ENCRYPTION_KEY_ID"; then
|
|
34
|
+
echo -e "${RED}❌ Error: DATA_AT_REST_ENCRYPTION_KEY_ID is required when data-at-rest encryption is enabled${NC}"
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
validate_user_kv_encryption_settings() {
|
|
40
|
+
local has_legacy_private_key=false
|
|
41
|
+
local has_registry_keys_json=false
|
|
42
|
+
local write_endpoints_enabled_normalized
|
|
43
|
+
|
|
44
|
+
if [ -n "$USER_KV_ENCRYPTION_PRIVATE_KEY" ] && ! is_placeholder "$USER_KV_ENCRYPTION_PRIVATE_KEY"; then
|
|
45
|
+
has_legacy_private_key=true
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
if [ -n "$USER_KV_ENCRYPTION_KEYS_JSON" ] && ! is_placeholder "$USER_KV_ENCRYPTION_KEYS_JSON"; then
|
|
49
|
+
has_registry_keys_json=true
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
if [ "$has_legacy_private_key" != "true" ] && [ "$has_registry_keys_json" != "true" ]; then
|
|
53
|
+
echo -e "${RED}❌ Error: either USER_KV_ENCRYPTION_PRIVATE_KEY or USER_KV_ENCRYPTION_KEYS_JSON is required${NC}"
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# Defaults to enabled to preserve current behavior unless explicitly set false for read-only deployments.
|
|
58
|
+
write_endpoints_enabled_normalized=$(printf '%s' "${USER_KV_WRITE_ENDPOINTS_ENABLED:-true}" | tr '[:upper:]' '[:lower:]')
|
|
59
|
+
|
|
60
|
+
if [ "$write_endpoints_enabled_normalized" = "1" ] || [ "$write_endpoints_enabled_normalized" = "true" ] || [ "$write_endpoints_enabled_normalized" = "yes" ] || [ "$write_endpoints_enabled_normalized" = "on" ]; then
|
|
61
|
+
if [ -z "$USER_KV_ENCRYPTION_PUBLIC_KEY" ] || is_placeholder "$USER_KV_ENCRYPTION_PUBLIC_KEY"; then
|
|
62
|
+
echo -e "${RED}❌ Error: USER_KV_ENCRYPTION_PUBLIC_KEY is required when USER_KV_WRITE_ENDPOINTS_ENABLED is true${NC}"
|
|
63
|
+
exit 1
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
if [ -z "$USER_KV_ENCRYPTION_KEY_ID" ] || is_placeholder "$USER_KV_ENCRYPTION_KEY_ID"; then
|
|
67
|
+
echo -e "${RED}❌ Error: USER_KV_ENCRYPTION_KEY_ID is required when USER_KV_WRITE_ENDPOINTS_ENABLED is true${NC}"
|
|
68
|
+
exit 1
|
|
69
|
+
fi
|
|
70
|
+
fi
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
# Validate required variables
|
|
74
|
+
required_vars=(
|
|
75
|
+
# Core Cloudflare Configuration
|
|
76
|
+
"ACCOUNT_ID"
|
|
77
|
+
|
|
78
|
+
# Shared Authentication & Storage
|
|
79
|
+
"USER_DB_AUTH"
|
|
80
|
+
"R2_KEY_SECRET"
|
|
81
|
+
"IMAGES_API_TOKEN"
|
|
82
|
+
|
|
83
|
+
# Firebase Auth Configuration
|
|
84
|
+
"API_KEY"
|
|
85
|
+
"AUTH_DOMAIN"
|
|
86
|
+
"PROJECT_ID"
|
|
87
|
+
"STORAGE_BUCKET"
|
|
88
|
+
"MESSAGING_SENDER_ID"
|
|
89
|
+
"APP_ID"
|
|
90
|
+
"MEASUREMENT_ID"
|
|
91
|
+
"FIREBASE_SERVICE_ACCOUNT_EMAIL"
|
|
92
|
+
"FIREBASE_SERVICE_ACCOUNT_PRIVATE_KEY"
|
|
93
|
+
|
|
94
|
+
# Pages Configuration
|
|
95
|
+
"PAGES_PROJECT_NAME"
|
|
96
|
+
"PAGES_CUSTOM_DOMAIN"
|
|
97
|
+
|
|
98
|
+
# Worker Names (required for config replacement)
|
|
99
|
+
"KEYS_WORKER_NAME"
|
|
100
|
+
"USER_WORKER_NAME"
|
|
101
|
+
"DATA_WORKER_NAME"
|
|
102
|
+
"AUDIT_WORKER_NAME"
|
|
103
|
+
"IMAGES_WORKER_NAME"
|
|
104
|
+
"PDF_WORKER_NAME"
|
|
105
|
+
|
|
106
|
+
# Worker Domains (required for proxy/env secrets and worker fallbacks)
|
|
107
|
+
"KEYS_WORKER_DOMAIN"
|
|
108
|
+
"USER_WORKER_DOMAIN"
|
|
109
|
+
"DATA_WORKER_DOMAIN"
|
|
110
|
+
"AUDIT_WORKER_DOMAIN"
|
|
111
|
+
"IMAGES_WORKER_DOMAIN"
|
|
112
|
+
"PDF_WORKER_DOMAIN"
|
|
113
|
+
|
|
114
|
+
# Storage Configuration (required for config replacement)
|
|
115
|
+
"DATA_BUCKET_NAME"
|
|
116
|
+
"AUDIT_BUCKET_NAME"
|
|
117
|
+
"FILES_BUCKET_NAME"
|
|
118
|
+
"KV_STORE_ID"
|
|
119
|
+
|
|
120
|
+
# Worker-Specific Secrets (required for deployment)
|
|
121
|
+
"KEYS_AUTH"
|
|
122
|
+
"PDF_WORKER_AUTH"
|
|
123
|
+
"IMAGE_SIGNED_URL_SECRET"
|
|
124
|
+
"BROWSER_API_TOKEN"
|
|
125
|
+
"MANIFEST_SIGNING_PRIVATE_KEY"
|
|
126
|
+
"MANIFEST_SIGNING_KEY_ID"
|
|
127
|
+
"MANIFEST_SIGNING_PUBLIC_KEY"
|
|
128
|
+
"EXPORT_ENCRYPTION_PRIVATE_KEY"
|
|
129
|
+
"EXPORT_ENCRYPTION_KEY_ID"
|
|
130
|
+
"EXPORT_ENCRYPTION_PUBLIC_KEY"
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
validate_required_vars() {
|
|
134
|
+
echo -e "${YELLOW}🔍 Validating required environment variables...${NC}"
|
|
135
|
+
for var in "${required_vars[@]}"; do
|
|
136
|
+
if [ -z "${!var}" ] || is_placeholder "${!var}"; then
|
|
137
|
+
echo -e "${RED}❌ Error: $var is not set in .env file or is a placeholder${NC}"
|
|
138
|
+
exit 1
|
|
139
|
+
fi
|
|
140
|
+
done
|
|
141
|
+
echo -e "${GREEN}✅ All required variables found${NC}"
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
assert_file_exists() {
|
|
145
|
+
local file_path=$1
|
|
146
|
+
|
|
147
|
+
if [ ! -f "$file_path" ]; then
|
|
148
|
+
echo -e "${RED}❌ Error: required file is missing: $file_path${NC}"
|
|
149
|
+
exit 1
|
|
150
|
+
fi
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
assert_contains_literal() {
|
|
154
|
+
local file_path=$1
|
|
155
|
+
local literal=$2
|
|
156
|
+
local description=$3
|
|
157
|
+
|
|
158
|
+
if ! grep -Fq -- "$literal" "$file_path"; then
|
|
159
|
+
echo -e "${RED}❌ Error: ${description}${NC}"
|
|
160
|
+
echo -e "${YELLOW} Expected to find '$literal' in $file_path${NC}"
|
|
161
|
+
exit 1
|
|
162
|
+
fi
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
assert_no_match_in_file() {
|
|
166
|
+
local file_path=$1
|
|
167
|
+
local pattern=$2
|
|
168
|
+
local description=$3
|
|
169
|
+
local matches
|
|
170
|
+
|
|
171
|
+
matches=$(grep -En "$pattern" "$file_path" | head -n 3 || true)
|
|
172
|
+
if [ -n "$matches" ]; then
|
|
173
|
+
echo -e "${RED}❌ Error: ${description}${NC}"
|
|
174
|
+
echo -e "${YELLOW} First matching lines in $file_path:${NC}"
|
|
175
|
+
echo "$matches"
|
|
176
|
+
exit 1
|
|
177
|
+
fi
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
validate_json_file() {
|
|
181
|
+
local file_path=$1
|
|
182
|
+
|
|
183
|
+
if ! node -e "const fs=require('fs'); JSON.parse(fs.readFileSync(process.argv[1], 'utf8'));" "$file_path" > /dev/null 2>&1; then
|
|
184
|
+
echo -e "${RED}❌ Error: invalid JSON in $file_path${NC}"
|
|
185
|
+
exit 1
|
|
186
|
+
fi
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
validate_domain_var() {
|
|
190
|
+
local var_name=$1
|
|
191
|
+
local value="${!var_name}"
|
|
192
|
+
local normalized
|
|
193
|
+
|
|
194
|
+
value=$(strip_carriage_returns "$value")
|
|
195
|
+
normalized=$(normalize_domain_value "$value")
|
|
196
|
+
|
|
197
|
+
if [ -z "$value" ] || is_placeholder "$value"; then
|
|
198
|
+
echo -e "${RED}❌ Error: $var_name is missing or placeholder${NC}"
|
|
199
|
+
exit 1
|
|
200
|
+
fi
|
|
201
|
+
|
|
202
|
+
if [ "$value" != "$normalized" ]; then
|
|
203
|
+
echo -e "${RED}❌ Error: $var_name must not include protocol, trailing slash, or surrounding whitespace${NC}"
|
|
204
|
+
echo -e "${YELLOW} Use '$normalized' instead${NC}"
|
|
205
|
+
exit 1
|
|
206
|
+
fi
|
|
207
|
+
|
|
208
|
+
if [[ "$value" == */* ]]; then
|
|
209
|
+
echo -e "${RED}❌ Error: $var_name must be a bare domain (no path segments)${NC}"
|
|
210
|
+
exit 1
|
|
211
|
+
fi
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
validate_env_value_formats() {
|
|
215
|
+
echo -e "${YELLOW}🔍 Validating environment value formats...${NC}"
|
|
216
|
+
|
|
217
|
+
validate_domain_var "PAGES_CUSTOM_DOMAIN"
|
|
218
|
+
validate_domain_var "KEYS_WORKER_DOMAIN"
|
|
219
|
+
validate_domain_var "USER_WORKER_DOMAIN"
|
|
220
|
+
validate_domain_var "DATA_WORKER_DOMAIN"
|
|
221
|
+
validate_domain_var "AUDIT_WORKER_DOMAIN"
|
|
222
|
+
validate_domain_var "IMAGES_WORKER_DOMAIN"
|
|
223
|
+
validate_domain_var "PDF_WORKER_DOMAIN"
|
|
224
|
+
|
|
225
|
+
if ! [[ "$KV_STORE_ID" =~ ^([0-9a-fA-F]{32}|[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$ ]]; then
|
|
226
|
+
echo -e "${RED}❌ Error: KV_STORE_ID must be a 32-character hex namespace ID (or UUID format)${NC}"
|
|
227
|
+
exit 1
|
|
228
|
+
fi
|
|
229
|
+
|
|
230
|
+
if [[ "$ACCOUNT_ID" =~ [[:space:]] ]]; then
|
|
231
|
+
echo -e "${RED}❌ Error: ACCOUNT_ID must not contain whitespace${NC}"
|
|
232
|
+
exit 1
|
|
233
|
+
fi
|
|
234
|
+
|
|
235
|
+
echo -e "${GREEN}✅ Environment value formats look valid${NC}"
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
validate_env_file_entries() {
|
|
239
|
+
local var_name
|
|
240
|
+
local escaped_var_name
|
|
241
|
+
local count
|
|
242
|
+
|
|
243
|
+
echo -e "${YELLOW}🔍 Verifying required .env entries...${NC}"
|
|
244
|
+
for var_name in "${required_vars[@]}"; do
|
|
245
|
+
escaped_var_name=$(escape_for_sed_pattern "$var_name")
|
|
246
|
+
count=$(grep -c "^$escaped_var_name=" .env || true)
|
|
247
|
+
|
|
248
|
+
if [ "$count" -lt 1 ]; then
|
|
249
|
+
echo -e "${RED}❌ Error: missing .env entry for $var_name${NC}"
|
|
250
|
+
exit 1
|
|
251
|
+
fi
|
|
252
|
+
done
|
|
253
|
+
echo -e "${GREEN}✅ Required .env entries found${NC}"
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
validate_generated_configs() {
|
|
257
|
+
echo -e "${YELLOW}🔍 Running generated configuration checkpoint validations...${NC}"
|
|
258
|
+
|
|
259
|
+
local required_files=(
|
|
260
|
+
"wrangler.toml"
|
|
261
|
+
"app/config/config.json"
|
|
262
|
+
"app/config/firebase.ts"
|
|
263
|
+
"app/config/admin-service.json"
|
|
264
|
+
"app/routes/auth/login.tsx"
|
|
265
|
+
"app/routes/auth/login.module.css"
|
|
266
|
+
"workers/audit-worker/wrangler.jsonc"
|
|
267
|
+
"workers/data-worker/wrangler.jsonc"
|
|
268
|
+
"workers/image-worker/wrangler.jsonc"
|
|
269
|
+
"workers/keys-worker/wrangler.jsonc"
|
|
270
|
+
"workers/pdf-worker/wrangler.jsonc"
|
|
271
|
+
"workers/user-worker/wrangler.jsonc"
|
|
272
|
+
"workers/audit-worker/src/audit-worker.ts"
|
|
273
|
+
"workers/data-worker/src/data-worker.ts"
|
|
274
|
+
"workers/image-worker/src/image-worker.ts"
|
|
275
|
+
"workers/keys-worker/src/keys.ts"
|
|
276
|
+
"workers/pdf-worker/src/pdf-worker.ts"
|
|
277
|
+
"workers/user-worker/src/user-worker.ts"
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
local file_path
|
|
281
|
+
for file_path in "${required_files[@]}"; do
|
|
282
|
+
assert_file_exists "$file_path"
|
|
283
|
+
done
|
|
284
|
+
|
|
285
|
+
validate_json_file "app/config/config.json"
|
|
286
|
+
validate_json_file "app/config/admin-service.json"
|
|
287
|
+
|
|
288
|
+
assert_contains_literal "wrangler.toml" "\"$PAGES_PROJECT_NAME\"" "PAGES_PROJECT_NAME was not applied to wrangler.toml"
|
|
289
|
+
|
|
290
|
+
assert_contains_literal "workers/keys-worker/wrangler.jsonc" "$KEYS_WORKER_NAME" "KEYS_WORKER_NAME was not applied"
|
|
291
|
+
assert_contains_literal "workers/user-worker/wrangler.jsonc" "$USER_WORKER_NAME" "USER_WORKER_NAME was not applied"
|
|
292
|
+
assert_contains_literal "workers/data-worker/wrangler.jsonc" "$DATA_WORKER_NAME" "DATA_WORKER_NAME was not applied"
|
|
293
|
+
assert_contains_literal "workers/audit-worker/wrangler.jsonc" "$AUDIT_WORKER_NAME" "AUDIT_WORKER_NAME was not applied"
|
|
294
|
+
assert_contains_literal "workers/image-worker/wrangler.jsonc" "$IMAGES_WORKER_NAME" "IMAGES_WORKER_NAME was not applied"
|
|
295
|
+
assert_contains_literal "workers/pdf-worker/wrangler.jsonc" "$PDF_WORKER_NAME" "PDF_WORKER_NAME was not applied"
|
|
296
|
+
|
|
297
|
+
assert_contains_literal "workers/keys-worker/wrangler.jsonc" "$ACCOUNT_ID" "ACCOUNT_ID missing in keys worker config"
|
|
298
|
+
assert_contains_literal "workers/user-worker/wrangler.jsonc" "$ACCOUNT_ID" "ACCOUNT_ID missing in user worker config"
|
|
299
|
+
assert_contains_literal "workers/data-worker/wrangler.jsonc" "$ACCOUNT_ID" "ACCOUNT_ID missing in data worker config"
|
|
300
|
+
assert_contains_literal "workers/audit-worker/wrangler.jsonc" "$ACCOUNT_ID" "ACCOUNT_ID missing in audit worker config"
|
|
301
|
+
assert_contains_literal "workers/image-worker/wrangler.jsonc" "$ACCOUNT_ID" "ACCOUNT_ID missing in image worker config"
|
|
302
|
+
assert_contains_literal "workers/pdf-worker/wrangler.jsonc" "$ACCOUNT_ID" "ACCOUNT_ID missing in pdf worker config"
|
|
303
|
+
|
|
304
|
+
assert_contains_literal "workers/data-worker/wrangler.jsonc" "$DATA_BUCKET_NAME" "DATA_BUCKET_NAME missing in data worker config"
|
|
305
|
+
assert_contains_literal "workers/audit-worker/wrangler.jsonc" "$AUDIT_BUCKET_NAME" "AUDIT_BUCKET_NAME missing in audit worker config"
|
|
306
|
+
assert_contains_literal "workers/image-worker/wrangler.jsonc" "$FILES_BUCKET_NAME" "FILES_BUCKET_NAME missing in image worker config"
|
|
307
|
+
assert_contains_literal "workers/user-worker/wrangler.jsonc" "$KV_STORE_ID" "KV_STORE_ID missing in user worker config"
|
|
308
|
+
|
|
309
|
+
assert_contains_literal "app/config/config.json" "https://$PAGES_CUSTOM_DOMAIN" "PAGES_CUSTOM_DOMAIN missing in app/config/config.json"
|
|
310
|
+
assert_contains_literal "app/config/config.json" "$EXPORT_ENCRYPTION_KEY_ID" "EXPORT_ENCRYPTION_KEY_ID missing in app/config/config.json"
|
|
311
|
+
assert_contains_literal "app/config/config.json" "\"export_encryption_public_key\":" "export_encryption_public_key missing in app/config/config.json"
|
|
312
|
+
assert_contains_literal "app/routes/auth/login.tsx" "const APP_CANONICAL_ORIGIN = 'https://$PAGES_CUSTOM_DOMAIN';" "PAGES_CUSTOM_DOMAIN missing in app/routes/auth/login.tsx canonical origin"
|
|
313
|
+
|
|
314
|
+
assert_contains_literal "app/config/firebase.ts" "$API_KEY" "API_KEY missing in app/config/firebase.ts"
|
|
315
|
+
assert_contains_literal "app/config/firebase.ts" "$AUTH_DOMAIN" "AUTH_DOMAIN missing in app/config/firebase.ts"
|
|
316
|
+
assert_contains_literal "app/config/firebase.ts" "$PROJECT_ID" "PROJECT_ID missing in app/config/firebase.ts"
|
|
317
|
+
assert_contains_literal "app/config/firebase.ts" "$STORAGE_BUCKET" "STORAGE_BUCKET missing in app/config/firebase.ts"
|
|
318
|
+
assert_contains_literal "app/config/firebase.ts" "$MESSAGING_SENDER_ID" "MESSAGING_SENDER_ID missing in app/config/firebase.ts"
|
|
319
|
+
assert_contains_literal "app/config/firebase.ts" "$APP_ID" "APP_ID missing in app/config/firebase.ts"
|
|
320
|
+
assert_contains_literal "app/config/firebase.ts" "$MEASUREMENT_ID" "MEASUREMENT_ID missing in app/config/firebase.ts"
|
|
321
|
+
|
|
322
|
+
assert_contains_literal "workers/audit-worker/src/audit-worker.ts" "https://$PAGES_CUSTOM_DOMAIN" "PAGES_CUSTOM_DOMAIN missing in audit-worker source"
|
|
323
|
+
assert_contains_literal "workers/data-worker/src/data-worker.ts" "https://$PAGES_CUSTOM_DOMAIN" "PAGES_CUSTOM_DOMAIN missing in data-worker source"
|
|
324
|
+
assert_contains_literal "workers/image-worker/src/image-worker.ts" "https://$PAGES_CUSTOM_DOMAIN" "PAGES_CUSTOM_DOMAIN missing in image-worker source"
|
|
325
|
+
assert_contains_literal "workers/keys-worker/src/keys.ts" "https://$PAGES_CUSTOM_DOMAIN" "PAGES_CUSTOM_DOMAIN missing in keys-worker source"
|
|
326
|
+
assert_contains_literal "workers/pdf-worker/src/pdf-worker.ts" "https://$PAGES_CUSTOM_DOMAIN" "PAGES_CUSTOM_DOMAIN missing in pdf-worker source"
|
|
327
|
+
assert_contains_literal "workers/user-worker/src/user-worker.ts" "https://$PAGES_CUSTOM_DOMAIN" "PAGES_CUSTOM_DOMAIN missing in user-worker source"
|
|
328
|
+
|
|
329
|
+
local placeholder_pattern
|
|
330
|
+
placeholder_pattern="(\"(ACCOUNT_ID|PAGES_PROJECT_NAME|PAGES_CUSTOM_DOMAIN|KEYS_WORKER_NAME|USER_WORKER_NAME|DATA_WORKER_NAME|AUDIT_WORKER_NAME|IMAGES_WORKER_NAME|PDF_WORKER_NAME|KEYS_WORKER_DOMAIN|USER_WORKER_DOMAIN|DATA_WORKER_DOMAIN|AUDIT_WORKER_DOMAIN|IMAGES_WORKER_DOMAIN|PDF_WORKER_DOMAIN|DATA_BUCKET_NAME|AUDIT_BUCKET_NAME|FILES_BUCKET_NAME|KV_STORE_ID|MANIFEST_SIGNING_KEY_ID|MANIFEST_SIGNING_PUBLIC_KEY|EXPORT_ENCRYPTION_KEY_ID|EXPORT_ENCRYPTION_PUBLIC_KEY|YOUR_FIREBASE_API_KEY|YOUR_FIREBASE_AUTH_DOMAIN|YOUR_FIREBASE_PROJECT_ID|YOUR_FIREBASE_STORAGE_BUCKET|YOUR_FIREBASE_MESSAGING_SENDER_ID|YOUR_FIREBASE_APP_ID|YOUR_FIREBASE_MEASUREMENT_ID)\"|'(PAGES_CUSTOM_DOMAIN|DATA_WORKER_DOMAIN|IMAGES_WORKER_DOMAIN)')"
|
|
331
|
+
|
|
332
|
+
local files_to_scan=(
|
|
333
|
+
"wrangler.toml"
|
|
334
|
+
"workers/audit-worker/wrangler.jsonc"
|
|
335
|
+
"workers/data-worker/wrangler.jsonc"
|
|
336
|
+
"workers/image-worker/wrangler.jsonc"
|
|
337
|
+
"workers/keys-worker/wrangler.jsonc"
|
|
338
|
+
"workers/pdf-worker/wrangler.jsonc"
|
|
339
|
+
"workers/user-worker/wrangler.jsonc"
|
|
340
|
+
"workers/audit-worker/src/audit-worker.ts"
|
|
341
|
+
"workers/data-worker/src/data-worker.ts"
|
|
342
|
+
"workers/image-worker/src/image-worker.ts"
|
|
343
|
+
"workers/keys-worker/src/keys.ts"
|
|
344
|
+
"workers/pdf-worker/src/pdf-worker.ts"
|
|
345
|
+
"workers/user-worker/src/user-worker.ts"
|
|
346
|
+
"app/config/config.json"
|
|
347
|
+
"app/config/firebase.ts"
|
|
348
|
+
"app/routes/auth/login.tsx"
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
for file_path in "${files_to_scan[@]}"; do
|
|
352
|
+
assert_no_match_in_file "$file_path" "$placeholder_pattern" "Unresolved placeholder token found after config update"
|
|
353
|
+
done
|
|
354
|
+
|
|
355
|
+
echo -e "${GREEN}✅ Generated configuration checkpoint validation passed${NC}"
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
run_validation_checkpoint() {
|
|
359
|
+
validate_required_vars
|
|
360
|
+
validate_env_value_formats
|
|
361
|
+
validate_env_file_entries
|
|
362
|
+
validate_data_at_rest_encryption_settings
|
|
363
|
+
validate_user_kv_encryption_settings
|
|
364
|
+
validate_generated_configs
|
|
365
|
+
}
|