keep-desktop: enforce relay cert pinning on nostrconnect bunker start#828
Conversation
|
Warning Review limit reached
Next review available in: 56 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
The nostrconnect-approve flow (
handle_nostrconnect_approve) started a NIP-46 bunkerServeragainst the relay URLs carried in thenostrconnect://request without any TLS certificate pinning, while the interactive bunker-start path (bunker_service.rs) gates onverify_relay_certificatesfirst. 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
verify_relay_certificatesat the start of the bunker-start task, before the server is created, mirroringbunker_service.rs. Pin context (certificate_pins,keep_path, and thestrict_cert_pinningpolicy) 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.