Commit 350bb92
fix(ui): replace manual SPA dispatch with spaFS wrapper
Sonar's go-security taint engine kept flagging the explicit
distFS.Open(rel) call in the SPA-fallback handler even after path.Clean
+ ".." check. The pattern is structurally safe (embed.FS rejects ".."
on its own) but the engine can't model it.
Restructure: wrap the dist sub-FS with spaFS — when http.FileServer
hits ErrNotExist on an extensionless path, the wrapper transparently
serves index.html so the React router can claim the URL. Asset-shaped
paths (anything with ".") still 404 normally, so a missing favicon
doesn't surprise the browser with an HTML body.
Net result: the user-controlled URL never crosses our own Open() call —
http.FileServer is the only caller, and Sonar trusts that boundary.
Verification
* go vet ./... clean
* go test ./... — 516 pass / 27 packages
* go build ./... clean
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 4b1ef70 commit 350bb92
1 file changed
Lines changed: 33 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | | - | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
17 | 44 | | |
18 | 45 | | |
19 | 46 | | |
| |||
47 | 74 | | |
48 | 75 | | |
49 | 76 | | |
50 | | - | |
51 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
52 | 81 | | |
53 | 82 | | |
54 | 83 | | |
55 | 84 | | |
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 | | - | |
| 85 | + | |
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
0 commit comments