Enforce the relay scheme policy in the Rust relay pool, not only in the add-relay dialog
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Ambito
- networking, security
Direzione di ricerca
Start in rust/src/api/nostr.rs, where initialize_in, add_relay and apply_relay_list_event reach RelayPool::sync_discovered, and read _validateRelayUrl in lib/features/settings/screens/relays_screen.dart to see the current Dart-only check. The issue asks for one scheme policy in the Rust pool, applied at all three entry points, with persisted ws:// rows deactivated rather than deleted. Done means a release-mode cargo test case shows a ws:// relay is neither connected nor added, while debug and Mortsom behaviour is unchanged.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
The wss:// requirement for relays is enforced only by the add-relay dialog in Dart (_validateRelayUrl in lib/features/settings/screens/relays_screen.dart). The Rust relay pool never checks the scheme:
initialize_in(rust/src/api/nostr.rs) reconnects every persisted active URL.add_relaypersists whatever URL it is given.apply_relay_list_event→RelayPool::sync_discoveredauto-adds whatever a Mostro node announces in its kind 10002 list.
So a release build connects over plaintext ws:// to any relay a node announces, and keeps any ws:// row already in its database. #833 makes the dialog accept ws:// in debug builds, which adds one more way for such a row to exist (a release build reusing a debug build's data directory on the same machine), but the gap predates it. Raised by Codex on #833: https://github.com/MostroP2P/app/pull/833#discussion_r4295512614
Per AGENTS.md, Rust owns relays, so the policy belongs in the pool, not in a dialog.
Proposal
- Define the scheme policy once in the Rust core: which schemes a build accepts. Release and profile builds accept
wss://only; debug builds (cfg(debug_assertions)) and the Mortsom test environment acceptws://as well. - Pass the test-environment allowance down from Dart at
initialize(the Mortsom entry point is the only one that can grant it), so a Mortsom release build keeps itsws://relays fromMORTSOM_RELAYS. - Apply the policy at every entry point:
initialize_in(persisted rows and seeds),add_relay, andsync_discovered(announced relays). A rejected announced relay is logged, not blacklisted, so a node that later announces it overwss://is still picked up. - Rows that no longer qualify on load: deactivate them rather than delete them, and log it, so a developer switching back to a debug build gets them back.
- The dialog keeps its early check for the error message, but the Rust result is what decides.
Acceptance
- A release build with a persisted
ws://row does not connect to it and marks the row inactive. - A release build whose node announces a
ws://relay in its kind 10002 does not add it. - A debug build and a Mortsom build behave as today.
- Tests at the pool level for the three entry points, and a
cfg(debug_assertions)-independent seam so the release case is testable undercargo test.
- Lingua principale
- Dart
- Stelle
- 11
- Fork
- 9
- Merge medio
- 2g 1h
- PR unite (30g)
- 16
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di MostroP2P/app
-
documentation priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
-
area: ui bug priority: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
area: ui bug priority: high
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Bug: Button "Share logs" does nothingForse già presa @Luquitasjeffrey l’ha presa 8 giorni fa. Aperta
Difficoltà 2/5 Mezza giornata Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
area: rust-core bug priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di MostroP2P/app
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
invoiceninja/app#229 ·
-
Python example: list a model's scenes and their camerasForse già presa @rudraparmar76 l’ha presa oggi. Apertadocumentation good first issue python
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
iamahsanmehmood/openskp#796 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
Plural rendering: first matching part wins, but gen-l10n lets the last one win (=1 shadows one)Apertabug help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
crowdin/flutter-sdk#97 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
MrSpideyNihal/lockfeed#16 ·