Commit 458540d
committed
fix(events): strip unconsumed wallet internals (balanceUdvpn/spentUdvpn/runGranter) from all admin SSE state payloads
The admin SSE handler (GET /api/events) stripped runGranter only on
'state' events; 'result' and 'progress' events forwarded the FULL state,
leaking balanceUdvpn, spentUdvpn, and runGranter — none of which
admin.html reads. (It DOES read walletAddress + balance for the wallet
header, kept current via Object.assign(state, msg.state) on
progress/result events, so those must keep flowing.)
Add a top-level sanitizeAdminState(s) helper that rest-spreads a clone
with balanceUdvpn/spentUdvpn/runGranter removed (non-mutating — the global
state is never touched), and refactor the live-event handler so ANY event
carrying data.state is sanitized uniformly (state/result/progress).
trimRowDiag still applies to data.result (result events) and data.results[]
(state events). The init send is unchanged (its own 5-field destructure).
Tests: add sanitizeAdminState unit tests (strip the three, keep
walletAddress/balance/status/totalNodes, non-mutating, non-object
passthrough) plus a string-level wiring assertion that the /api/events
handler body references sanitizeAdminState and trimRowDiag on both the
result and results paths, so a future edit dropping a strip fails loudly.1 parent 83cbbdc commit 458540d
2 files changed
Lines changed: 96 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2291 | 2291 | | |
2292 | 2292 | | |
2293 | 2293 | | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
2294 | 2307 | | |
2295 | 2308 | | |
2296 | 2309 | | |
| |||
2310 | 2323 | | |
2311 | 2324 | | |
2312 | 2325 | | |
2313 | | - | |
2314 | | - | |
2315 | | - | |
2316 | | - | |
2317 | | - | |
2318 | | - | |
2319 | | - | |
2320 | | - | |
2321 | | - | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
2322 | 2331 | | |
2323 | 2332 | | |
2324 | | - | |
| 2333 | + | |
2325 | 2334 | | |
2326 | | - | |
2327 | | - | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
2328 | 2341 | | |
2329 | | - | |
| 2342 | + | |
2330 | 2343 | | |
2331 | 2344 | | |
2332 | 2345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
| |||
174 | 177 | | |
175 | 178 | | |
176 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
177 | 247 | | |
178 | 248 | | |
179 | 249 | | |
| |||
0 commit comments