Skip to content

keep-desktop: enforce relay cert pinning on nostrconnect bunker start#828

Merged
kwsantiago merged 2 commits into
mainfrom
fix/nostrconnect-cert-pinning
Jul 16, 2026
Merged

keep-desktop: enforce relay cert pinning on nostrconnect bunker start#828
kwsantiago merged 2 commits into
mainfrom
fix/nostrconnect-cert-pinning

Conversation

@kwsantiago

Copy link
Copy Markdown
Contributor

The nostrconnect-approve flow (handle_nostrconnect_approve) started a NIP-46 bunker Server against the relay URLs carried in the nostrconnect:// request without any TLS certificate pinning, while the interactive bunker-start path (bunker_service.rs) gates on verify_relay_certificates first. Because the relay list is attacker-influenceable (it comes from the request), this path did no SPKI pinning at all, even with a healthy pin store, and could not fail closed on a corrupt store or a pin mismatch.

Change

  • Route the nostrconnect relay list through verify_relay_certificates at the start of the bunker-start task, before the server is created, mirroring bunker_service.rs. Pin context (certificate_pins, keep_path, and the strict_cert_pinning policy) is captured before the async block.

This makes pin enforcement/establishment consistent across both bunker-start paths: a corrupt pin store or a mismatched certificate now fails the connection closed, and un-pinned relays record a TOFU pin (or are rejected under strict mode).

Verification

  • cargo test -p keep-desktop: 68 passed. cargo clippy -p keep-desktop --all-targets: clean.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kwsantiago, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 56 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4abaed43-667a-4110-bd96-b904f0a8debc

📥 Commits

Reviewing files that changed from the base of the PR and between 89ee825 and 9cf2649.

📒 Files selected for processing (1)
  • keep-desktop/src/nostrconnect.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/nostrconnect-cert-pinning

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kwsantiago kwsantiago merged commit 6437b44 into main Jul 16, 2026
9 checks passed
@kwsantiago kwsantiago deleted the fix/nostrconnect-cert-pinning branch July 16, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant