Skip to content

chore(db): drop Phase-A NIP-FI relay-side authority ledger - #7221

Merged
wpfleger96 merged 2 commits into
mainfrom
duncan/nip-fi-ledger-removal
Sep 2, 2026
Merged

chore(db): drop Phase-A NIP-FI relay-side authority ledger#7221
wpfleger96 merged 2 commits into
mainfrom
duncan/nip-fi-ledger-removal

Conversation

@wpfleger96

Copy link
Copy Markdown
Member

Removes the dead relay-side authority ledger introduced by migrations 0041 and 0042, and the dead require_attested_key verifier knob from buzz-auth. Both are unreachable by design under NIP-FI spec v2 (#7214, squash d4420eb47), which makes OSS Buzz stateless for identity: the relay neither stores nor verifies an authority chain.

What changes

migrations/0044_drop_nip_fi_ledger.sql
Drops all fifteen NIP-FI ledger tables and their trigger functions using CASCADE to resolve the circular deferred FK between identity_bindings and identity_lifecycle_history. Drops proceed in FK dependency order: selectors → history/bindings → enrollment_policies/receipts → parallel drop of auth tables. Restores community_write_fence_excluded_table to its pre-0041 body (removes NIP-FI table names from the exclusion array).

schema/schema.sql
Removes the NIP-FI section (~1885 lines of tables, functions, and triggers) and updates community_write_fence_excluded_table to match.

crates/buzz-db/src/runtime/migration.rs

  • Updates the embedded_migrator_contains_consolidated_initial_schema sanity check: count 43→44, adds 0044 assertion block (verifies DROP TABLE statements and absence of NIP-FI names from schema.sql).
  • Removes ~2580 lines of NIP-FI Postgres integration tests (all #[tokio::test] #[ignore = "requires Postgres"] from the 0041/0042 behavioral coverage).
  • Removes the extract_excluded_table_array drift check (0042 body no longer matches schema.sql by design).
  • Adds migration_0044_drops_populated_nip_fi_ledger_cleanly: runs migrations to 0042, seeds rows in authorization_operation_receipts and authorization_invalidation_domains, then runs to 0044 and verifies all fifteen NIP-FI tables are absent.

crates/buzz-auth/src/nip_fi/config.rs
Removes require_attested_key: bool from IssuerPolicy — field, constructor parameter, accessor, and its contribution to derive_assertion_policy_id.

crates/buzz-auth/src/nip_fi/verifier.rs
parse_nostr_pubkey_claim no longer takes a policy parameter. The None (absent claim) arm now returns Err(VerifierError::ClaimRejected) unconditionally instead of conditionally on policy.require_attested_key().

crates/buzz-auth/src/nip_fi/verifier/tests.rs

  • Removes missing_nostr_pubkey_denies_under_attested_key_policy (the sole require_attested_key: true call site).
  • Removes false, from all eleven IssuerPolicy::new call sites.
  • Injects nostr_pubkey by default in mint_signed_by (spec v2 requires it unconditionally).
  • Updates valid_access_token_verifies to assert asserted_key().is_some().

crates/buzz-auth/src/nip_fi/startup/tests.rs + jwks/tests.rs
Removes false, from all IssuerPolicy::new call sites and adds nostr_pubkey to all token-minting helpers.

Verification

  • Fresh-DB migration run to head: all migrations apply cleanly in sequence.
  • Populated-0041/0042-DB migration through 0044: seeds rows in live NIP-FI tables, verifies all fifteen are dropped without error.

Closes the dead-code inventory item from the spec-v2 cleanup plan (channel 48374f48). Follows #7214.

OSS Buzz is stateless for identity (Will+Tyler, 2026-09-01: "Buzz speaks
Nostr, nothing else"). NIP-FI spec v2 merged on main (#7214, d4420eb)
requires the nostr_pubkey claim + NIP-42 proof unconditionally. The
relay-side authority ledger introduced by migrations 0041 and 0042 is
dead code.

Migration 0044 drops the fifteen NIP-FI ledger tables and their trigger
functions (using CASCADE to handle the circular deferred FK between
identity_bindings and identity_lifecycle_history), and restores
community_write_fence_excluded_table to its pre-0041 body so the
deletion catalog no longer references the removed relations.

Also removes the require_attested_key knob from buzz-auth IssuerPolicy:
the false-branch (allowing absent nostr_pubkey claim) is unreachable
by design under spec v2. parse_nostr_pubkey_claim now rejects a missing
claim unconditionally.

Verified: fresh-DB migration and populated-0041/0042-DB migration both
pass the live Postgres tests.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
…aim regression test

Remove the per-issuer require_attested_key knob (NIP-FI v2): the
nostr_pubkey claim is now unconditionally required.  This changes a
non-field-encoded verifier semantic, so VERIFIER_CONTRACT_VERSION must
advance from 1 to 2 so that AssertionPolicyIds derived under the old
knobless rule are invalidated.

Add mint_no_pubkey helper and absent_nostr_pubkey_claim_denies test: the
standard mint_signed_by helper always injects nostr_pubkey via or_insert,
so there was no test path that could remove the None => Err arm from
parse_nostr_pubkey_claim and turn the suite red.  The new helper
intentionally omits the claim; the test asserts ClaimRejected at the exact
production arm.

Update docs/nips/NIP-FI.md: remove two stale require_attested_key /
follow-on paragraphs that described the knob as a not-yet-integrated
enforcement primitive; the unconditional enforcement is live in this PR.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
@wpfleger96
wpfleger96 deployed to codex-review September 2, 2026 02:21 — with GitHub Actions Active
@github-actions github-actions Bot added the codex-security-review-current The posted Codex security review matches its recorded range. label Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

🔐 Codex Security Review

Note: This is an automated, security-focused review generated by Codex.
Use it as a supplement to human review; false positives are possible.

Scope

  • Exact PR diff: 1c8321cd08feb597f8bcff5195c21148fb3e98ed...47e90958888e80a86190c813dd45836d00bfae0f
  • Model: gpt-5.6-sol

💡 Click "edited" above to see earlier reviews for this PR.


Review Summary

Overall Risk: NONE

No concrete security, correctness, or reliability regressions found. The verifier now rejects missing nostr_pubkey claims unconditionally and changes the policy fingerprint. The database migration removes only the unused NIP-FI ledger objects and restores the prior community-fence exclusion set.

Findings

No concrete security, correctness, or reliability findings were identified.

Notes

  • No additional limitations were reported.

Generated by Codex Security Review |
Requested by: @wpfleger96 |
Workflow run

@wpfleger96
wpfleger96 merged commit 04babf0 into main Sep 2, 2026
68 of 70 checks passed
@wpfleger96
wpfleger96 deleted the duncan/nip-fi-ledger-removal branch September 2, 2026 17:56
wpfleger96 added a commit that referenced this pull request Sep 2, 2026
… comments

S2 (PR #7221) removed the per-issuer `require_attested_key` parameter from
`IssuerPolicy::new`. Update the three sites in the S3 branch that referenced it:

- `nip_fi_config.rs`: drop the now-invalid 10th positional argument (`true`)
  from the `IssuerPolicy::new` call and remove the surrounding block comment
  that described the rationale for hard-wiring it.
- `nip_fi_config.rs` doc comment: replace "silently ignored by serde" phrasing
  with accurate wording — the field is simply not part of the schema.
- `connection.rs` doc comment: update "S2 deletes" to past tense "S2 deleted".

No logic change; S3's structural enforcement of key pairing is unchanged.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
wpfleger96 pushed a commit that referenced this pull request Sep 2, 2026
* origin/main:
  feat(agents): harness-agnostic effort write path and spawn bridge (#4625)
  chore(db): drop Phase-A NIP-FI relay-side authority ledger (#7221)
  fix(acp): replace real user name in base prompt mention example (#7250)
  ci: split CI into reusable workflows (#7168)
  fix(desktop): retain automatic mentions only in threads (#7144)
  feat: add databricks fable 5.1 model capabilities (#7213)
  docs(nip-fi): rewrite NIP-FI as stateless OSS Buzz spec v2 (#7214)
  feat(relay): add detailed readiness metrics (#7149)
  feat(desktop): add Pi agent preset (#7208)

Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>

# Conflicts:
#	desktop/src-tauri/src/commands/agent_models_update.rs
#	desktop/src-tauri/src/commands/agents_deploy.rs
#	desktop/src-tauri/src/managed_agents/types/requests.rs
#	desktop/src/features/agents/ui/AgentInstanceEditDialog.tsx
#	desktop/src/shared/api/types.ts
wpfleger96 added a commit that referenced this pull request Sep 2, 2026
… comments

S2 (PR #7221) removed the per-issuer `require_attested_key` parameter from
`IssuerPolicy::new`. Update the three sites in the S3 branch that referenced it:

- `nip_fi_config.rs`: drop the now-invalid 10th positional argument (`true`)
  from the `IssuerPolicy::new` call and remove the surrounding block comment
  that described the rationale for hard-wiring it.
- `nip_fi_config.rs` doc comment: replace "silently ignored by serde" phrasing
  with accurate wording — the field is simply not part of the schema.
- `connection.rs` doc comment: update "S2 deletes" to past tense "S2 deleted".

No logic change; S3's structural enforcement of key pairing is unchanged.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
wpfleger96 pushed a commit that referenced this pull request Sep 2, 2026
…agent-edit

* origin/main:
  feat(desktop): add persistent Bestie experience (#7223)
  fix(desktop): harden profile batch and thread-reply fetches against relay slowness (#7188)
  docs(nip-fi): adopt deny-until-TTL and extend enforcement to HTTP ingress (#7254)
  fix(composer): align wrapped inline chip fragments (#7242)
  Add operation-aware database pool acquisition metrics (#7195)
  fix(desktop): keep explicit agent profiles bound to their exact key (#7131)
  fix(desktop): discover authenticated owned relay agents (#7122)
  feat(agents): harness-agnostic effort write path and spawn bridge (#4625)
  chore(db): drop Phase-A NIP-FI relay-side authority ledger (#7221)
  fix(acp): replace real user name in base prompt mention example (#7250)
  ci: split CI into reusable workflows (#7168)
  fix(desktop): retain automatic mentions only in threads (#7144)
  feat: add databricks fable 5.1 model capabilities (#7213)
  docs(nip-fi): rewrite NIP-FI as stateless OSS Buzz spec v2 (#7214)
  feat(relay): add detailed readiness metrics (#7149)
  feat(desktop): add Pi agent preset (#7208)

Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>

# Conflicts:
#	desktop/src/features/agents/ui/AgentInstanceEditDialog.tsx
#	desktop/src/features/agents/ui/agentInstanceEditPinning.test.mjs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex-security-review-current The posted Codex security review matches its recorded range.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants