Commit 10c3f17
authored
feat(configGuard): block dev-host/port leak into production config (#4235)
* feat(configGuard): promote DEV_HOSTS/DEV_PORTS leak detection from trawl
Adds DEV_HOSTS (localhost, 127.0.0.1) and DEV_PORTS (3000-8888 range)
sets to assertConfigLoaded so any downstream that misconfigures api.host
or api.port will get a hard build-time error instead of a silent prod
outage. Guard is a no-op outside production mode.
Adds 6 new unit tests covering localhost/127.0.0.1 host rejection,
dev-port rejection (3010, 3000), and valid-config pass-through.
Incident reference: trawl_vue #949 (signin-broken :3010 outage).
Closes #4234. Partially closes pierreb-projects/infra#38 (T11).
* ci: set DEVKIT_VUE_api_host on build step so configGuard passes in devkit CI
Devkit Vue doesn't deploy, so no real API host is set. The new configGuard
rejects a localhost default at production build time — add a placeholder
value so the guard is satisfied without weakening the downstream check.
* ci: also clear DEVKIT_VUE_api_port for configGuard build
configGuard rejects the dev-default port "3000" too. Set it to empty so
the production-build guard passes in devkit CI (no real deploy target).
* fix(configGuard): normalize host/port before DEV set membership check
- Trim + lowercase api.host before DEV_HOSTS.has() — "LOCALHOST" no longer bypasses the guard
- Trim api.port string before DEV_PORTS.has() — " 3000 " no longer bypasses
- Fix error message: npm run config → npm run generateConfig (matches package.json)
- Fix issue ref: #949 → trawl_vue#949 (cross-repo clarity)
- Fix error copy: "real API URL" → "host/hostname" (api.host is hostname, not full URL)
- Add regression tests for LOCALHOST (uppercase) and " 3000 " (padded) bypass attempts1 parent a00caa5 commit 10c3f17
3 files changed
Lines changed: 93 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
12 | 24 | | |
13 | 25 | | |
14 | 26 | | |
15 | 27 | | |
16 | | - | |
| 28 | + | |
17 | 29 | | |
18 | 30 | | |
| 31 | + | |
| 32 | + | |
19 | 33 | | |
20 | 34 | | |
21 | 35 | | |
22 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
23 | 54 | | |
24 | | - | |
| 55 | + | |
| 56 | + | |
25 | 57 | | |
26 | 58 | | |
27 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
43 | 95 | | |
0 commit comments