test(grpc-data): #922 review r1 — batch, crowd-out, slow-origin, revoked/removed/invalidated; docs + evidence

This commit is contained in:
Joseph Doherty
2026-11-28 10:58:12 -05:00
parent 7e924deda9
commit e076ceae64
3 changed files with 49 additions and 8 deletions
@@ -68,3 +68,21 @@ the fresh-lease control and both idle legs (20 s and 40 s, i.e. past the lease)
the next read, with **no `BadUserAccessDenied` anywhere**. With the CLI's default `--max-age 0`, every projected read (lapsed or
not) stays `BadWaitingForInitialData`, because the v1 Read path never serves `maxAge = 0` from cache. That is separate from this
fix and is filed as a follow-up. `rig.py down` ⇒ 0 containers / volumes / networks / images.
## Security review round 1 (no auth bypass; two availability findings + lows) — fixes
Merged local master first (incl. #916/#917, DataConnections), clean, build 0 errors.
| # | Finding | Resolution | Red/green |
|---|---|---|---|
| 1 | A renewal reserved `MaxUnaryBytes` in the unary budget: (A) a batch of N lapsed nodes renewed only the first, (B) while one ran, every cold read / write / subscription renewal was refused | renewals left the unary budget: own resolver pool `max(1, maxConcurrentFetches/2)` (never `_fetchSlots`), a bounded queue (64), 256 KiB each, 3 s end to end including the pool wait | `A_read_batch_of_several_lapsed_nodes_renews_every_node…`, `A_history_batch_of_several_lapsed_nodes…`, `A_renewal_in_flight_does_not_crowd_out_a_cold_read…`: all **red** on the pre-review fix, green now |
| 2 | `AuthorizeHistoryRead` waited 5 s before the history batch limiter and ignored the request token, so concurrent HistoryReads against a slow origin pinned SDK threads past the 16-batch cap. The wait also equalled the renewal budget | the wait first takes a non-local history slot with `Wait(0)` (none free ⇒ no wait, retryable), honours `OperationContext.CancellationToken`, and lasts 4 s (≤ `HistoryReadDeadline`) against a 3 s renewal | `Concurrent_history_reads_against_a_slow_origin…`: 24 reads against a silent origin, ≥ 24 − RemoteSlots answer in < 2.5 s, all `BadResourceUnavailable`, origin untouched, Good after release. **Red** on the pre-review fix (all 24 waited ~5 s) |
| 3 | Two authorities (policy classifies, `DataPlaneAuthorizer` vetoes) | a renewal that completed `true` and is still vetoed ⇒ `BadUserAccessDenied` | by construction; the grant-revoked test below covers the revoked case |
| 4 | Renewals keyed by node only, though each requests its operation's bit | keyed by (realm, id, operation), back-off too | — |
| 5 | Back-off map cleared wholesale at 4096; browse refresh deduped per (caller, MaxResults) | expired entries are evicted first, otherwise the one expiring first; one background refresh per parent node | — |
| 6 | Write / CreateMonitoredItems on a lapsed node | documented in `docs/DataConnections.md` as not covered (still `BadUserAccessDenied` until a read/browse renews); reported as a follow-up | — |
New safety controls, green on both the pre-review fix and now: an `Invalidate`d lease ⇒ `BadUserAccessDenied`, no renewal, no origin
call. A grant revoked while the renewal is parked at the origin ⇒ nothing served, the renewal never commits, then
`BadUserAccessDenied`. A mapping removed while renewing ⇒ not revived, not answered as a lapse. 13 #922 tests, 5 consecutive green
runs.