Commit e0c87b4
fix(ai): remote-only output must open nothing; document the real local bound (PR #35 review)
1. The SECURITY test allowed sniffPreviewUrl to return a localhost URL for the
remote-only fixtures, so it was weaker than the sentence above it claimed —
and it was permitting a real leak, not a theoretical one. sniffPort's first
pattern matches ANY http(s) URL, so after refusing a remote host the fallback
re-extracted the port out of that same refused address:
"Local: http://evil.example.com:3000/" -> "http://localhost:3000"
A preview conjured entirely out of a line we had deliberately ignored. The
fallback now blanks remote URLs first, so remote-only output yields null. The
assertion is strict equality against null, matching its stated contract.
A bare port with no host ("running on port 3000") still works — that is the
Express-boilerplate case the fallback exists for — and mixed Local/Network
output still picks the local one.
2. The setting description understated the bound: it said localhost / 127.0.0.1,
while the implementation also accepts the IPv6 loopback [::1] and treats the
bind addresses 0.0.0.0 and [::] as local (rewriting them to localhost, which a
browser can actually resolve). Now says so.
Verified: 23 suites, 0 failures. Mutation-checked — restoring the raw-text
fallback reproduces the leak above and fails the suite.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 81d7614 commit e0c87b4
3 files changed
Lines changed: 16 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
442 | | - | |
| 442 | + | |
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
128 | 134 | | |
129 | 135 | | |
130 | 136 | | |
| |||
0 commit comments