Skip to content

safeRelayUrl: reject concatenated multi-relay junk (embedded scheme / whitespace / length) #31

@melvincarvalho

Description

@melvincarvalho

The sweep surfaced a junk class that passes the current screen: broken clients pack a whole relay list into one `r` tag, e.g. `wss://adre.su/wss://ae.purplerelay.com/...` or `wss://atlas.nostr.land/+wss://eden.nostr.land/+...`. `new URL()` parses these (host = first token, the rest becomes the path), so `safeRelayUrl` accepts them and the host-cap misses them (each is a unique "host").

Fix

Tighten `safeRelayUrl`: reject when the raw string has more than one `://` (embedded scheme), whitespace, or length > 120 — all signatures of concatenation junk; real relay URLs are short and single-scheme. Applies everywhere (harvest, prober, sweep).

After

Re-run `sweep-relays.js --apply` — these now classify as `bad` and get removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions