mirror of
https://github.com/block/buzz.git
synced 2026-11-27 19:52:31 +00:00
feat(nip-fi): scope disconnects to tokens issued through revoke_through, stored durably (#9917)
## Summary Builds on #9860 (merged as `c0932db19c`). A NIP-FI disconnect command can now carry `revoke_through` (C), an integral NumericDate. With C, the relay refuses and closes only assertions whose verified signed `iat` is at or before C, until `until`. Tokens issued after C are admitted straight away. Without C, the deny covers the whole key, as before. - **Spec:** `docs/nips/NIP-FI.md` adds the `revoke_through` claim and a Deny scope section (admission, close scope, merging, records, the issuer's duty) with a behavioral oracle. The existing deny, command-algorithm, oracle and security text now carry scope. The deny set's storage text is #9860's (shared storage, restored before admission); this PR adds no wire claim or storage schema to the spec. - **Parsing:** a `revoke_through` that is `null`, nonnumeric, fractional or unrepresentable is rejected as `evidence_rejected` before any state changes. - **Verified `iat`:** `VerifiedAssertion::issued_at()` comes from the time-checked `iat`, not from profile evidence. `NipFiSession` records it at registration. - **One predicate:** `DenyScope::covers` compares the full verified instant (fractional `iat` included) against C. It decides admission (WebSocket and HTTP, with asserted key and owner checked separately) and every close scan (root and audio registries, the command route, cross-pod delivery, shadow accounting). - **Merge:** `DenyEntry::merge` takes the later `until`. Whole-key beats a cutoff, two cutoffs merge to the larger C, and expired entries contribute nothing. Activity is read from a clock sampled inside the issuer shard lock, so an entry that expires while a merge waits contributes nothing. A past-`until` command still does its scoped close without changing an active entry. The close scope widens to any stronger active entry, and a poisoned shard closes the whole key. - **Bus:** `NipFiDisconnect.revoke_through` is optional. A message without it means whole-key. - **Durable cutoff (Redis):** the cutoff lives in its own per-issuer hash, `<deny prefix>-revoke-through:<sha256(iss)>`, field `pubkey_hex`, value C. The exact-`until` hash keeps only `secs:nanos`. One accept script merges `until` and scope by the same rule as `DenyEntry::merge` and gives all three keys one expiry. It judges whether the command and the stored entry are still active by Redis `TIME` as it runs, not by the authentication clock. Before any write it checks the target's stored cutoff by restore's rule: a disconnect over an unreadable one returns `unreadable`, `try_claim` fails (`503`), the claim stays unused and nothing is recorded. Restore judges expiry when it merges. Restore reads both hashes in one script and joins them before merging, looking deny keys up in a set (linear at capacity), so a missing cutoff field is a whole-key deny. A cutoff that isn't an integer, or names no deny, is `reason="unreadable"`. As in #9860, one bad record does not hide the others: restore still applies every readable deny (a deny under a malformed cutoff as the whole key; an orphan cutoff adds nothing) and then fails, so admission stays closed. `LoadDenies` and `LoadDeniesError::Unreadable { readable }` now carry `DenyEntry`, and a restore counts a same-`until` scope widening as changed, so it closes the sessions it newly covers. - **Runbook:** `docs/operator-nip-fi-bindings.md` names the cutoff hash and how to clear a bad cutoff. It warns that deleting an orphaned cutoff leaves no deny at all, and that a disconnect over a bad stored cutoff fails until it is cleared. ## Deploy and rollback Deploy this to every relay pod before any issuer sends `revoke_through`. Until then, a pod still on the old build ignores the claim and blocks the whole key, so the agent stays locked out until its old token expires. Rolling a relay back to #9860 is safe. That build reads only the exact-`until` hash, which this PR writes in the same format, so it restores every cutoff as a whole-key deny and never fails its restore on this data. It ignores `revoke_through` in commands and bus messages, and every accept it makes clears the target's stored cutoff, so its whole-key revokes are never narrowed by a cutoff this build stored. All of this only over-blocks: agents wait for their old tokens to expire instead of getting back in at once. ## Testing Behavior tests cover old and fresh tokens at admission and in close scans, redelivery leaving fresh root and audio sessions open, cross-pod delivery, an owner whole-key deny blocking a fresh agent token, same-deadline scope changes in both orders, an expired whole-key entry followed by a cutoff, past-`until` commands, invalid `revoke_through` values, legacy bus messages, fractional `iat` at C and C + 0.5 through real verification, replay-claim waits that cross an entry's expiry, and root/audio handler straddle cases where the signed `iat` differs from registration time. Each of these was checked to fail when the code it guards is broken: - the route's published bus message keeps the cutoff on another pod (fails if `nip_fi_disconnect_message` drops `revoke_through`); - a cutoff command over an active whole-key entry closes a fresh session (fails if the route skips close-scope widening); - a poisoned shard's close scope is whole-key; - shadow `would_close` ends only sessions issued at or before C; - a cutoff in Redis restores as a cutoff (fails if the accept script stops writing the cutoff hash), and #9860's reader, taken from its final head `02627cce`, decodes the same record as a whole-key deny; - #9860's writer, copied verbatim from `02627cce`, writing over a stored cutoff with an equal or shorter `until`, then a fresh restore by this build, gives a whole-key deny; - a full revoke that expires between authentication and its Redis write neither widens a cutoff nor, once stored and expired, overrides one (fails with the authentication clock); - a whole key that is live when restore reads and expired when it merges gives way to the stored cutoff (the load is gated, not slept; fails if restore merges at the pre-read time); - the Redis merge matches `DenyEntry::merge` for whole-over-cutoff, cutoff-over-whole, two cutoffs under a shorter or longer `until`, and an expired whole key (fails if a whole-key write stops clearing the cutoff); - pruning clears an expired entry's cutoff, from a fixture seeded already expired in one atomic step; - a same-`until` scope widening is `Merged`, not `Unchanged` (fails if the change test compares `until` only); - a cutoff that isn't an integer, is out of range or has no deny fails the restore as `unreadable`; - a malformed cutoff leaves its deny restorable as the whole key, an orphan cutoff adds nothing, and a good cutoff still scopes its key, while the load still fails as `unreadable`; - a disconnect over a complete active deny whose stored cutoff is fractional or out of range fails with the claim unused and the index (with scores), exact and cutoff hashes unchanged (fails with the accept script's check removed); the script's bounds are pinned to chrono's range. - through the real Redis load and restore, a readable deny next to a bad record keeps its cutoff: a session issued at C is closed, one issued after C stays open, and admission stays fenced (fails if the partial payload drops scope). --------- Signed-off-by: Will Pfleger <wpfleger@block.xyz> Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
This commit is contained in:
@@ -351,8 +351,9 @@ On WebSocket upgrade:
|
||||
this registered connection before step 8; cancellation is terminal, so a
|
||||
cancelled connection MUST NOT be admitted.
|
||||
7. Check the deny set for `(iss, k)` and, if `verified.owner` is present, for
|
||||
`(iss, verified.owner)`. Either active entry (`now < until`) denies
|
||||
`authorization_denied`.
|
||||
`(iss, verified.owner)`. Either entry denies `authorization_denied` when
|
||||
it covers the assertion (see Deny scope); each key is checked
|
||||
independently and either denial wins.
|
||||
[FI-TRACE-DENY-SET]
|
||||
8. Admit the connection only if it remains live and uncancelled. The session's
|
||||
authority deadline is the minimum of all `authority_deadlines`; see Session
|
||||
@@ -411,22 +412,69 @@ A disconnect call causes the relay to:
|
||||
|
||||
1. Insert a **deny entry** keyed by `(iss, target_pubkey)` into the relay's
|
||||
in-memory deny set, with an absolute expiry of `until` (a Unix timestamp
|
||||
carried in the signed command JWT; see Command JWT). If an entry for
|
||||
`(iss, target_pubkey)` already exists, the relay MUST retain
|
||||
`max(existing_until, command.until)` — an accepted disconnect MUST NOT
|
||||
shorten an active deny. A past-`until` command still closes sessions but
|
||||
MUST NOT clear or shorten an independently active entry. Any subsequent
|
||||
connection or admission attempt for that pubkey under the same issuer is
|
||||
denied `authorization_denied` until `now >= until`. If the deny set is at
|
||||
carried in the signed command JWT; see Command JWT) and the command's scope
|
||||
(see Deny scope). If an entry for `(iss, target_pubkey)` already exists, the relay
|
||||
MUST merge them under the Deny scope merge rule — an accepted disconnect
|
||||
MUST NOT shorten an active deny. A past-`until` command still performs its
|
||||
scoped close but MUST NOT clear, shorten or strengthen an independently
|
||||
active entry. Any subsequent connection or admission attempt for that
|
||||
pubkey under the same issuer whose assertion the entry covers is denied
|
||||
`authorization_denied` until `now >= until`. If the deny set is at
|
||||
capacity and a new entry cannot be inserted, the relay MUST reject the command
|
||||
`503`; no sessions are closed and no replay state is consumed.
|
||||
2. Close all live WebSocket connections registered under the command's issuer
|
||||
whose proven `k` equals the target pubkey or whose recorded owner equals
|
||||
the target pubkey, whether or not admission has completed, synchronously.
|
||||
the target pubkey, whether or not admission has completed, synchronously,
|
||||
limited to the close scope (see Deny scope).
|
||||
Disconnect cancellation is terminal: a cancelled in-progress connection
|
||||
MUST NOT be subsequently admitted. Connections
|
||||
registered under another issuer are not affected.
|
||||
|
||||
### Deny scope
|
||||
|
||||
A command MAY carry `revoke_through` (C). Without C, its deny entry covers
|
||||
the whole key. With C, it covers only assertions whose verified signed `iat`
|
||||
is at or before C.
|
||||
|
||||
- **Admission.** An entry `(iss, key, until, C?)` denies an otherwise-valid
|
||||
assertion exactly when `now < until` and either C is absent or the
|
||||
assertion's verified signed `iat <= C`. The `iat` is the verified claim,
|
||||
never optional profile evidence. This holds for WebSocket and HTTP
|
||||
admission, for `(iss, k)` and `(iss, verified.owner)` alike. Every other
|
||||
authorization check still applies.
|
||||
- **Close scope.** A command with C closes only matching sessions whose
|
||||
admitting assertion's verified `iat <= C`, including in-progress ones; a
|
||||
command without C closes all matching sessions. The close scope is the
|
||||
union of the command's scope and the scope of any active entry for the
|
||||
same key after merging, so a stronger active denial also applies. A
|
||||
session registers its verified `iat` before the post-registration deny
|
||||
check, so a session straddling a disconnect is caught by the close scan or
|
||||
the deny check. A past-`until` command still performs its scoped close but
|
||||
MUST NOT create, shorten or strengthen an active entry.
|
||||
- **Comparison.** `iat <= C` compares the full verified instant, including
|
||||
any fractional part, against the integral C.
|
||||
- **Merging.** Merging an incoming entry into an active one takes the later
|
||||
`until`; a whole-key scope beats a cutoff; two cutoffs merge to the larger
|
||||
C. An expired entry contributes nothing: an active entry ignores an
|
||||
expired incoming one, and an incoming entry replaces an expired one.
|
||||
Activity is judged at the instant the merge is applied. These rules hold
|
||||
identically for local state, any shared or durable store, inter-process
|
||||
propagation and restore.
|
||||
- **Records.** A stored or propagated entry without C means whole-key.
|
||||
Unreadable revocation state MUST NOT be treated as allowed.
|
||||
- **Issuer duty.** An issuer that sends C MUST ensure that every still-valid
|
||||
assertion it released under the revoked authority has `iat <= C`. While
|
||||
a cutoff is active, it MUST NOT release a recovery assertion for that key
|
||||
whose `iat <= C`. It MUST record the revocation, C and the queued
|
||||
delivery atomically, and retries MUST resend the recorded policy rather
|
||||
than a new one.
|
||||
|
||||
Oracle: with an active entry `(iss, k, until, C)`, an assertion for `k`
|
||||
signed with `iat = C` is denied and closed by every disconnect for `k`, an
|
||||
assertion signed with `iat = C + 0.5` is admitted and survives every
|
||||
redelivery of that command, and a whole-key entry for its owner still denies
|
||||
it. [FI-TRACE-DENY-SET]
|
||||
|
||||
The relay holds the deny set in memory and MAY also keep it in shared storage
|
||||
that outlives a relay process, with each entry expiring at its `until`. A
|
||||
relay that keeps such storage MUST record an accepted command there before
|
||||
@@ -504,6 +552,7 @@ The command JWT MUST carry the following claims:
|
||||
| `cmd` | Exactly `"disconnect"` (literal string). Operation selector. |
|
||||
| `target_pubkey` | Lowercase hexadecimal encoding of the target 32-byte Nostr public key — the same encoding required for the assertion `nostr_pubkey` claim. |
|
||||
| `until` | Unix timestamp (NumericDate) at which the deny entry expires. MUST NOT exceed `now + skew + maximum_assertion_age` for this issuer policy. The relay validates this ceiling; a value that exceeds it rejects `400`. |
|
||||
| `revoke_through` | OPTIONAL. Integral NumericDate C limiting the deny to assertions with `iat <= C` (see Deny scope). Absent means the whole key. A present value that is `null`, nonnumeric, fractional or unrepresentable rejects `evidence_rejected` before any state changes. |
|
||||
|
||||
The `maximum_command_age` policy knob is a required positive finite
|
||||
configuration per authorized issuer, with a normative upper bound of
|
||||
@@ -536,6 +585,14 @@ VerifyCommandJwt(token, request_method, request_path, request_body_pubkey):
|
||||
assert claims.cmd == "disconnect" or DENY(evidence_rejected)
|
||||
target_k := ParseHexKey(claims.target_pubkey) or DENY(evidence_rejected)
|
||||
until := claims.until or DENY(evidence_rejected)
|
||||
// Optional cutoff: absent → whole key. Present but null, nonnumeric,
|
||||
// fractional or unrepresentable → deny before any state changes.
|
||||
if "revoke_through" in claims:
|
||||
assert IsIntegralRepresentableNumericDate(claims.revoke_through)
|
||||
or DENY(evidence_rejected)
|
||||
scope := IssuedThrough(claims.revoke_through)
|
||||
else:
|
||||
scope := WholeKey
|
||||
|
||||
// 4. Validate until ceiling
|
||||
deny_ceiling := now + policy.skew + policy.maximum_assertion_age
|
||||
@@ -560,19 +617,21 @@ VerifyCommandJwt(token, request_method, request_path, request_body_pubkey):
|
||||
// capacity failure, making the 503 contract unimplementable. Capacity
|
||||
// is checked against the per-issuer bound for claims.iss; a different
|
||||
// issuer's capacity exhaustion does not produce a 503 here.
|
||||
// On same-key collision: retain max(existing_until, until) — never shorten
|
||||
// an active deny. A past-until command merges as max(existing, past) which
|
||||
// preserves any active entry; a fresh entry with a past-until inserts with
|
||||
// an already-expired value (immediately inactive for future admissions).
|
||||
// On same-key collision: merge under the Deny scope merge rule, judging
|
||||
// activity at the moment of this mutation — never shorten an active deny.
|
||||
// A past-until command leaves any active entry unchanged; a fresh entry
|
||||
// with a past-until inserts an already-expired value (immediately inactive
|
||||
// for future admissions).
|
||||
effective_expiry := min(claims.exp, claims.iat + policy.maximum_command_age)
|
||||
AtomicReserveJtiAndDenyEntry(
|
||||
iss=claims.iss, jti=claims.jti, effective_expiry=effective_expiry,
|
||||
target_pubkey=target_k, until=until
|
||||
target_pubkey=target_k, until=until, scope=scope
|
||||
) or DENY(authorization_denied) // replay: jti already reserved
|
||||
or REJECT(503) // capacity: deny set full; neither mutation applied
|
||||
or REJECT(authorization_unavailable) // shared storage outcome unknown: jti and deny entry may be recorded; no sessions closed
|
||||
|
||||
return CommandResult(target_pubkey=target_k, caller=(claims.iss, claims.sub))
|
||||
return CommandResult(target_pubkey=target_k, caller=(claims.iss, claims.sub),
|
||||
until=until, scope=scope)
|
||||
```
|
||||
|
||||
Any failure at any step is fail-closed: no sessions are closed and the relay
|
||||
@@ -597,7 +656,8 @@ inserts the deny entry — both or neither. A capacity failure at that step rej
|
||||
retry the same signed command. A relay that keeps the deny set in shared storage and cannot learn whether its write applied MUST reject `503` `authorization_unavailable` and close no sessions. The `jti` and deny entry may already be recorded, so the caller retries with a freshly signed command (new `jti`), not the same one. On success, the relay MUST close every live connection
|
||||
registered under the command's issuer (`claims.iss`) whose proven key equals
|
||||
`CommandResult.target_pubkey` or whose recorded owner equals
|
||||
`CommandResult.target_pubkey`, whether or not admission has completed.
|
||||
`CommandResult.target_pubkey`, and whose admitting assertion falls in the
|
||||
close scope (see Deny scope), whether or not admission has completed.
|
||||
Disconnect cancellation is terminal: a cancelled in-progress connection MUST NOT
|
||||
be subsequently admitted. This close scan matches the deny
|
||||
entry's `target_pubkey` against each connection's proven key and recorded
|
||||
@@ -606,7 +666,7 @@ another issuer are not affected. The `until` expiry is taken exclusively from
|
||||
the signed command JWT claim; the request body carries no `until` field. An
|
||||
unknown or unprovable pubkey is not an error; the relay responds `200`
|
||||
with `{"disconnected": true}`. An `until` value in the past is not an error;
|
||||
sessions are closed. Absent an active same-key deny entry the past-`until`
|
||||
sessions in the close scope are closed. Absent an active same-key deny entry the past-`until`
|
||||
creates no future denial; if an active entry already exists it remains unchanged
|
||||
under the merge rule.
|
||||
|
||||
@@ -826,8 +886,9 @@ On each protected HTTP request:
|
||||
5. Assert `verified.asserted_key == k`; mismatch → deny `authorization_denied`.
|
||||
[FI-TRACE-ASSERTION-KEY-MISMATCH]
|
||||
6. Check the deny set for `(iss, k)` and, if `verified.owner` is present, for
|
||||
`(iss, verified.owner)`. Either active entry (`now < until`) denies
|
||||
`authorization_denied`.
|
||||
`(iss, verified.owner)`. Either entry denies `authorization_denied` when
|
||||
it covers the assertion (see Deny scope); each key is checked
|
||||
independently and either denial wins.
|
||||
[FI-TRACE-DENY-SET]
|
||||
7. Admit the request.
|
||||
|
||||
@@ -958,8 +1019,8 @@ deployment-local identifiers. [FI-TRACE-DISCOVERY-PRIVATE]
|
||||
| `FI-TRACE-JWKS-REMOVE` | Connections verified under a removed key deny on next revalidation or reconnect. |
|
||||
| `FI-TRACE-DEPENDENCY-FAIL-CLOSED` | An unreadable JWKS snapshot denies `authorization_unavailable`; no degraded Nostr-only access. |
|
||||
| `FI-TRACE-LEASE-BOUND` | A session closes at its earliest deadline; equality at any deadline is expired. |
|
||||
| `FI-TRACE-DENY-SET` | A pubkey in the deny set is denied `authorization_denied` on admission until `now >= until`; an expired or absent entry does not deny; a past-`until` command closes sessions — absent an active same-key entry it creates no future denial, while an active entry remains unchanged under the merge rule; a deny-set-full command is rejected `503` without closing sessions and without removing any existing entry; capacity is evaluated per issuer — one issuer's capacity exhaustion MUST NOT reject another issuer's command; a connection that passes the deny-set check before a concurrent deny-entry insertion but completes admission after MUST still be terminated (the session's proven `k` and admitting issuer are registered before the deny-set check, ensuring the close scan catches it); a registered-but-not-admitted connection caught by the close scan MUST be cancelled terminally and MUST NOT later be admitted; a disconnect command from one issuer MUST NOT close a same-key connection registered under a different issuer, whether or not admission has completed; two overlapping commands for the same `(iss, pubkey)` in either delivery order result in `until = max(until_A, until_B)` — delivery order does not shorten the longer deny; a past-`until` command arriving over an active entry leaves the active entry's `until` unchanged; a successful disconnect responds `{"disconnected": true}` regardless of how many sessions were closed; the deny entry applies across all communities served by the relay under that issuer. |
|
||||
| `FI-TRACE-HTTP-INGRESS` | A protected HTTP request with both valid headers and matching pubkeys is admitted; absent, mismatched, or invalid assertion or NIP-98 event denies; a request presenting only one of the two denies; an active deny-set entry denies; a route that cannot be classified as exempt is treated as protected; repeated, comma-combined, wrong-scheme, or alternative-credential `Authorization` fields deny `evidence_rejected`; a missing `Authorization` field denies `missing_evidence`; an authorization-relevant body without exactly one matching `payload` tag denies; the NIP-FI administrative API is not a protected surface. For kind-24242 (Blossom) proofs on media routes: a `t=upload` proof with valid `x`, `server`, `expiration`, and freshness is admitted on `PUT /upload`; a `t=get` proof with valid `server`, `expiration`, and freshness is admitted on `GET\|HEAD /media/{hash…}`; a kind-24242 proof on any other route denies; an upload proof with absent or mismatched `server` tag denies; a read proof with absent or mismatched `server` tag denies; a proof with a duplicate, missing, or out-of-range `expiration` tag denies; a proof dated more than 120 seconds in the future denies; a proof older than 120 seconds denies; key mismatch between assertion `nostr_pubkey` and the kind-24242 event pubkey denies; an active deny-set entry denies. |
|
||||
| `FI-TRACE-DENY-SET` | A pubkey in the deny set is denied `authorization_denied` on admission until `now >= until` when the entry covers the assertion — a whole-key entry covers every assertion, a cutoff entry only those with verified `iat <= C`, so `iat = C` denies and `iat = C + 0.5` admits; an expired or absent entry does not deny; a disconnect with C closes only sessions with `iat <= C`, and a session with `iat > C` survives every redelivery unless a stronger active merged entry widens the close scope (see Deny scope); a whole-key entry beats a same-deadline cutoff and the later of two cutoffs wins, in either order; an entry that expires before a merge is applied contributes nothing to it; a past-`until` command performs its scoped close — absent an active same-key entry it creates no future denial, while an active entry remains unchanged under the merge rule; a deny-set-full command is rejected `503` without closing sessions and without removing any existing entry; capacity is evaluated per issuer — one issuer's capacity exhaustion MUST NOT reject another issuer's command; a connection within the effective close scope that passes the deny-set check before a concurrent deny-entry insertion but completes admission after MUST still be terminated (the session's proven `k` and admitting issuer are registered before the deny-set check, ensuring the close scan catches it); a registered-but-not-admitted connection caught by the close scan MUST be cancelled terminally and MUST NOT later be admitted; a disconnect command from one issuer MUST NOT close a same-key connection registered under a different issuer, whether or not admission has completed; two overlapping commands for the same `(iss, pubkey)` in either delivery order result in `until = max(until_A, until_B)` — delivery order does not shorten the longer deny; a past-`until` command arriving over an active entry leaves the active entry's `until` unchanged; a successful disconnect responds `{"disconnected": true}` regardless of how many sessions were closed; the deny entry applies across all communities served by the relay under that issuer. |
|
||||
| `FI-TRACE-HTTP-INGRESS` | A protected HTTP request with both valid headers and matching pubkeys is admitted; absent, mismatched, or invalid assertion or NIP-98 event denies; a request presenting only one of the two denies; an active deny-set entry that covers the assertion denies; a route that cannot be classified as exempt is treated as protected; repeated, comma-combined, wrong-scheme, or alternative-credential `Authorization` fields deny `evidence_rejected`; a missing `Authorization` field denies `missing_evidence`; an authorization-relevant body without exactly one matching `payload` tag denies; the NIP-FI administrative API is not a protected surface. For kind-24242 (Blossom) proofs on media routes: a `t=upload` proof with valid `x`, `server`, `expiration`, and freshness is admitted on `PUT /upload`; a `t=get` proof with valid `server`, `expiration`, and freshness is admitted on `GET\|HEAD /media/{hash…}`; a kind-24242 proof on any other route denies; an upload proof with absent or mismatched `server` tag denies; a read proof with absent or mismatched `server` tag denies; a proof with a duplicate, missing, or out-of-range `expiration` tag denies; a proof dated more than 120 seconds in the future denies; a proof older than 120 seconds denies; key mismatch between assertion `nostr_pubkey` and the kind-24242 event pubkey denies; an active deny-set entry that covers the assertion denies. |
|
||||
| `FI-TRACE-DENIAL-ORACLE` | Each public-class row produces its exact fixed bytes; all private-state rows compare byte-identical. |
|
||||
| `FI-TRACE-DISCOVERY-PRIVATE` | Complete discovery bytes do not expose issuer, audience, or deployment-private state. |
|
||||
| `FI-TRACE-CROSS-DOMAIN-COLLISION` | Equal `sub` values under different `iss` values remain distinct identities. |
|
||||
@@ -989,15 +1050,18 @@ assertions. If the issuer continues issuing assertions, access continues.
|
||||
|
||||
For the deny-until-TTL disconnect model (issuer issues a successful disconnect
|
||||
call with an `until` timestamp), the relay inserts a deny entry for the target
|
||||
pubkey with expiry `until` and then closes all matching connections synchronously.
|
||||
pubkey with expiry `until` and the command's scope, then closes all matching
|
||||
connections synchronously.
|
||||
Here, matching means connections registered under that issuer whose proven `k`
|
||||
equals that target pubkey or whose recorded owner equals the target pubkey,
|
||||
whether or not admission has completed; disconnect
|
||||
and whose admitting assertion falls in the close scope, whether or not
|
||||
admission has completed; disconnect
|
||||
cancellation is terminal, so a cancelled in-progress connection MUST NOT be
|
||||
subsequently admitted. Connections registered under another issuer are not
|
||||
affected. Any subsequent admission attempt for that pubkey under the same issuer
|
||||
is denied `authorization_denied`
|
||||
until `now >= until`. The `until` ceiling enforced by the relay is
|
||||
whose assertion the entry covers is denied `authorization_denied`
|
||||
until `now >= until`. A cutoff entry lets assertions issued after C in at
|
||||
once; its security rests on the issuer duty in Deny scope. The `until` ceiling enforced by the relay is
|
||||
`now + skew + maximum_assertion_age`; this limits how long a deny entry may last —
|
||||
it does not ensure denial outlasts all live assertions. A short or past
|
||||
`until` is valid, and if the issuer continues issuing after the entry
|
||||
|
||||
@@ -276,6 +276,20 @@ What this covers, and what it does not:
|
||||
(`buzz:nip-fi:shadow-deny-until:…` in shadow mode), with `HGETALL`, then
|
||||
`HDEL` that field. The pod retries on its own. Removing the record drops
|
||||
that revocation, so send the disconnect again if it is still needed.
|
||||
A disconnect with `revoke_through` stores its cutoff in a second hash,
|
||||
`buzz:nip-fi:deny-revoke-through:<sha256(issuer) hex>`, under the same
|
||||
field (`buzz:nip-fi:shadow-deny-revoke-through:…` in shadow mode). A
|
||||
cutoff is also unreadable when it is not an integer, or when its field has
|
||||
no entry in the deny hash. Recover with `HDEL` on the cutoff hash, but the
|
||||
two cases differ:
|
||||
- The cutoff is malformed and its field is also in the deny hash: after
|
||||
the `HDEL`, that entry still refuses every token for the key until its
|
||||
`until`.
|
||||
- The cutoff is orphaned (its field is not in the deny hash): there is no
|
||||
deny underneath it, so after the `HDEL` that key is not revoked at all.
|
||||
Send the disconnect again if the revocation is still needed.
|
||||
A new disconnect for a key whose stored cutoff is unreadable also fails
|
||||
with `503` and records nothing until that `HDEL`; then send it again.
|
||||
- **Deny set over capacity on a pod:** if a revocation this pod receives does
|
||||
not fit its `deny_set_capacity`, the pod closes admission the same way and
|
||||
restores until its active entries fit.
|
||||
|
||||
Reference in New Issue
Block a user