Commit f9ef9e0
committed
fix(security): full-escape admin log XSS, gate raw_json/error redaction on admin identity
H1: admin.html appendLog now uses escHtml() (escapes " and ') before the URL
linkifier, closing an attribute-breakout XSS from attacker-controlled URLs in
log lines. Entities inside href are inert, so linkification stays correct.
H2: /api/public/node/:addr and /:addr/errors strip raw_json (operator-internal
diag payload) for anonymous visitors only. raw_json is joined from results
(core/db.js:1111) and the admin failure-diagnostic drawer parses raw.diag/raw.type
from this same endpoint — stripping it unconditionally blanked the operator's
failure report. The strip is now gated on !req.admin.
M2: new _redactPublicError() (bech32 sent1…/sentnode1… → [addr]) applied to the
SSE error path AND the REST error_message on both public node endpoints, so
wallet/granter addresses in stored RPC rawLogs never reach public surfaces.
log_snippet is preserved (already sanitized, Failure-Log UX MUST).
auth: attachAdminFlag now mirrors adminOnly's local-mode bypass — when no
ADMIN_TOKEN is set (single-user install, the operator's primary deployment),
req.admin=true so the operator's own browser keeps raw_json. Previously the two
middlewares disagreed and the local operator was flagged non-admin.1 parent e316f12 commit f9ef9e0
3 files changed
Lines changed: 59 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2108 | 2108 | | |
2109 | 2109 | | |
2110 | 2110 | | |
2111 | | - | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
2112 | 2116 | | |
2113 | 2117 | | |
2114 | 2118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
77 | 82 | | |
78 | | - | |
| 83 | + | |
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1339 | 1339 | | |
1340 | 1340 | | |
1341 | 1341 | | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
1342 | 1363 | | |
1343 | 1364 | | |
1344 | 1365 | | |
| |||
1356 | 1377 | | |
1357 | 1378 | | |
1358 | 1379 | | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
1359 | 1394 | | |
1360 | 1395 | | |
1361 | 1396 | | |
| |||
1811 | 1846 | | |
1812 | 1847 | | |
1813 | 1848 | | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
1814 | 1860 | | |
1815 | 1861 | | |
1816 | 1862 | | |
| |||
1864 | 1910 | | |
1865 | 1911 | | |
1866 | 1912 | | |
1867 | | - | |
| 1913 | + | |
1868 | 1914 | | |
1869 | 1915 | | |
1870 | 1916 | | |
| |||
1889 | 1935 | | |
1890 | 1936 | | |
1891 | 1937 | | |
1892 | | - | |
| 1938 | + | |
1893 | 1939 | | |
1894 | 1940 | | |
1895 | 1941 | | |
| |||
0 commit comments