Commit d765a90
committed
multi-tenant: belt-and-suspenders hardening on agent + attach paths
Audit-driven tightenings. No real cross-org leak vectors today, but
all four are cheap defence-in-depth around the boundaries where a
leaked agent key, a future schema change, or a TOCTOU race could
turn a benign assumption into a real leak.
- require_sentinel_agent: switch from `!=` to hmac.compare_digest so
a timing side-channel can't reveal prefix matches against the
configured secret. Empty-header short-circuit preserved (avoids
type-mismatch issues with compare_digest on len-zero in some
Python builds).
- /complete: cross-check that body.incident_id belongs to the run's
org before stamping it on the row. Today the agent is trusted
single-tenant infrastructure; this prevents a leaked-key holder
from writing a foreign org's incident id into another org's run
drawer.
- attach_snapshot / attach_clip: pin org_id on the second-session
Incident touch (the parent-row updated_at bump). The first
session already verified ownership and Incident.org_id is
functionally immutable in this codebase, so this is a benign
TOCTOU today — but the touch silently no-ops instead of mutating
if anything ever changes.1 parent 7234173 commit d765a90
2 files changed
Lines changed: 46 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
134 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
135 | 142 | | |
136 | 143 | | |
137 | 144 | | |
| |||
445 | 452 | | |
446 | 453 | | |
447 | 454 | | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
448 | 473 | | |
449 | 474 | | |
450 | 475 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1426 | 1426 | | |
1427 | 1427 | | |
1428 | 1428 | | |
1429 | | - | |
1430 | | - | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
1431 | 1440 | | |
1432 | 1441 | | |
1433 | 1442 | | |
| |||
1541 | 1550 | | |
1542 | 1551 | | |
1543 | 1552 | | |
1544 | | - | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
1545 | 1561 | | |
1546 | 1562 | | |
1547 | 1563 | | |
| |||
0 commit comments