docs(relay): mark NIP-FI mode=off rollbacks as emergency-only (#9981)

Makes the NIP-FI operator runbook (`docs/operator-nip-fi-bindings.md`)
consistent with its rule against rolling back with `mode=off`.

- **Shadow no-go:** the normal rollback is now to stay in `shadow` with
`BUZZ_NIP_FI_ENFORCE_PERCENT=0`, so stored-Required communities stay
required. `mode=off` is described as an emergency action that suspends
NIP-FI for stored-Required communities.
- **Snapshot too big or too slow:** the `mode=off` way out is labelled
emergency-only. It notes that it suspends stored-Required enforcement
and that `shadow` is no alternative, since it loads the snapshot too.
Coming from `enforce`, `BUZZ_NIP_FI_ACCEPT_SHADOW_DISCONNECTS` must be
unset or `false` in the same rollout, or the pods refuse to start.
- **Shed logins in shadow:** stored-Required and cohort communities get
503 (`authorization_unavailable`). Only optional communities just record
a would-deny.
- **Staged enforce:** a required admission is refused only by an active
deny that covers the assertion, matching `revoke_through` scoping in
NIP-FI: the deny does not cover an assertion issued after the cutoff,
and other admission checks still apply.

---------

Signed-off-by: Will Pfleger <wpfleger@block.xyz>
Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Co-authored-by: Paul <4a1bfa0013bc6d14a8d600d8bf6392efefbd2a26ac3c96c9b2a106b0d12297ca@buzz.block.builderlab.xyz>
This commit is contained in:
Will Pfleger
2026-11-25 17:52:39 -05:00
committed by GitHub
parent 6b0dfc1957
commit 3c71556ff3

View File

@@ -193,7 +193,10 @@ database-source records `community="bound"` or `"unmapped"`, never a host.
to deny; `community="unmapped"` comes only from hosts you do not serve.
- `stage="owner"` counts as would-deny: each is an agent enforce will refuse
for its token owner.
- No-go: any of these fails. Return to `off` and investigate.
- No-go: any of these fails. Stay in `shadow` with
`BUZZ_NIP_FI_ENFORCE_PERCENT=0` and investigate; stored-Required
communities stay required. Setting `mode=off` is an emergency action only:
it suspends NIP-FI for stored-Required communities.
### Staged enforce
@@ -216,9 +219,13 @@ rollout; a malformed or out-of-range value refuses startup.
`requires_nip_fi: true`, and open sockets without valid evidence are closed.
Its stored flag does not change.
- A required admission, stored Required or inside the cohort, is refused when
the receiving pod holds an active deny for the key. A revocation closes open
connections only in `enforce`; in `shadow` an open connection stays until its
deadline. Stored-Required communities already behave this way.
the receiving pod holds an active deny that covers the assertion: one for
the key without `revoke_through`, or one whose `revoke_through` is at or
after the assertion's verified `iat`. This deny does not cover an assertion
issued after the cutoff; other admission checks still apply. A revocation
closes open connections only in `enforce`; in `shadow` an open connection
stays until its deadline. Stored-Required communities already behave this
way.
- Denies are stored in Redis and restored on restart, but a healthy pod
learns of new ones through best-effort pub/sub and can miss one. See
[Revocation during a deploy](#revocation-during-a-deploy).
@@ -289,16 +296,22 @@ added, so they usually arrive during normal growth, not at a deploy.
(8 by default). Concurrent logins for the same host share one lookup, and a
login waits up to 50 ms for a free slot; how many are shed depends on login
load across distinct hosts and on lookup latency. In enforce, a shed login
gets 503 (`authorization_unavailable`); in shadow it
is only recorded as a would-deny.
gets 503 (`authorization_unavailable`). In shadow, a shed login for a
stored-Required or cohort community also gets 503; for an optional
community it is only recorded as a would-deny.
Ways out, in order:
1. Raise `BUZZ_NIP_FI_SNAPSHOT_MAX_ROWS` (up to 10,000,000) or
`BUZZ_NIP_FI_SNAPSHOT_REFRESH_TIMEOUT_MS` (under 30,000), whichever the
failure `reason` names, and roll out.
2. If that cannot land quickly, set `BUZZ_NIP_FI_MODE=off`. `off` loads no
snapshot, so pods boot and admit as they did before NIP-FI.
2. Emergency only, if that cannot land quickly: set `BUZZ_NIP_FI_MODE=off`.
`off` loads no snapshot, so pods boot and admit as they did before NIP-FI,
which suspends enforcement for stored-Required communities. `shadow` is
not a way out because it loads the snapshot too. Coming from `enforce`,
unset `BUZZ_NIP_FI_ACCEPT_SHADOW_DISCONNECTS` or set it to `false` in the
same rollout: `true` is invalid outside `enforce` and the pods refuse to
start.
## Revocation during a deploy