Commit 09e0bac
authored
fix(security): stop leaking stack traces at API boundaries + least-privilege workflow permissions (#2236)
Any browser client of the Agent UI memory dashboard or the EMR dashboard
could see raw exception text — internal file paths, exception classes,
and error internals — whenever a scan, inference, or model load failed.
Responses now return a generic message with a short correlation id, and
the full exception (with traceback) is logged server-side, so debugging
stays possible without exposing internals. `test_eval_rag.yml` also
drops the default token grants in favor of an explicit `contents: read`.
Closes 8 of the 9 open medium-severity CodeQL alerts in these two rule
classes; the 9th is dismissed as a verified false positive.
| Alert | Rule | Location | Resolution |
|---|---|---|---|
| #249 | py/stack-trace-exposure | `src/gaia/ui/routers/memory.py`
stream-discovery SSE | Generic message + correlation id; full detail
logged server-side |
| #250 | py/stack-trace-exposure | `src/gaia/ui/routers/memory.py`
stream-inference SSE | Same |
| #346 | py/stack-trace-exposure | `src/gaia/ui/routers/memory.py`
settings `system_context_error` | Same |
| #347–#349 | py/stack-trace-exposure | EMR dashboard `/api/init` (3
sinks) | Removed `str(e)` from the returned `steps` payload; logged
instead |
| #323, #324 | actions/missing-workflow-permissions |
`.github/workflows/test_eval_rag.yml` | Top-level `permissions:
contents: read` (both jobs only checkout + run the eval) |
| #327 | py/stack-trace-exposure | EMR dashboard `/api/chat` |
**Dismissed (false positive)** — response already routed through
`_sanitize_response_text`, which strips tracebacks, `File` lines,
exception class names, and paths; CodeQL can't model the regex barrier |
## Test plan
- [x] `python util/lint.py --all` passes
- [x] `tests/unit/test_memory_router.py` — 768 passed (1 pre-existing,
unrelated failure also fails on clean main: expects faiss missing, but
it's installed locally)
- [x] EMR package tests — 67 passed
- [x] Workflow YAML parses; both jobs verified read-only (checkout +
eval run, no writes to repo/issues/checks)
- [ ] CodeQL on this PR reports no new alerts and closes the fixed ones
after merge1 parent 3df5a3d commit 09e0bac
3 files changed
Lines changed: 68 additions & 12 deletions
File tree
- .github/workflows
- hub/agents/python/emr/gaia_agent_emr/dashboard
- src/gaia/ui/routers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1513 | 1513 | | |
1514 | 1514 | | |
1515 | 1515 | | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
1516 | 1521 | | |
1517 | | - | |
| 1522 | + | |
1518 | 1523 | | |
1519 | 1524 | | |
1520 | 1525 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
29 | 41 | | |
30 | 42 | | |
31 | 43 | | |
| |||
1216 | 1228 | | |
1217 | 1229 | | |
1218 | 1230 | | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
1219 | 1234 | | |
1220 | | - | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
1221 | 1240 | | |
1222 | 1241 | | |
1223 | 1242 | | |
1224 | 1243 | | |
1225 | 1244 | | |
1226 | | - | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
1227 | 1253 | | |
1228 | 1254 | | |
1229 | 1255 | | |
| |||
1274 | 1300 | | |
1275 | 1301 | | |
1276 | 1302 | | |
| 1303 | + | |
1277 | 1304 | | |
1278 | 1305 | | |
1279 | 1306 | | |
1280 | | - | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
1281 | 1311 | | |
1282 | 1312 | | |
1283 | 1313 | | |
| |||
1413 | 1443 | | |
1414 | 1444 | | |
1415 | 1445 | | |
| 1446 | + | |
1416 | 1447 | | |
1417 | 1448 | | |
1418 | 1449 | | |
1419 | | - | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
1420 | 1454 | | |
1421 | 1455 | | |
1422 | 1456 | | |
| |||
1440 | 1474 | | |
1441 | 1475 | | |
1442 | 1476 | | |
| 1477 | + | |
1443 | 1478 | | |
1444 | | - | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
1445 | 1486 | | |
1446 | 1487 | | |
1447 | 1488 | | |
| |||
1460 | 1501 | | |
1461 | 1502 | | |
1462 | 1503 | | |
1463 | | - | |
1464 | | - | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
1465 | 1511 | | |
1466 | 1512 | | |
1467 | 1513 | | |
| |||
1637 | 1683 | | |
1638 | 1684 | | |
1639 | 1685 | | |
1640 | | - | |
1641 | | - | |
1642 | | - | |
| 1686 | + | |
1643 | 1687 | | |
1644 | | - | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
1645 | 1691 | | |
1646 | 1692 | | |
0 commit comments