github cameri/nostream nostream@3.17.1

47 minutes ago

Patch Changes

  • #1242 d41c9fc Thanks @Priyanshubhartistm! - fix(cli): show control characters in nostream import error messages as escapes

    When a line of an import file could not be parsed, nostream import printed the parser's message as it is, and that message quotes part of the file. A file with a terminal escape sequence in a malformed record could therefore change the operator's display or, where the terminal allows it, replace the clipboard. The per-line errors, the failure message and an error that quotes the input path (for example a file that does not exist) now show control characters as visible escapes (for example \x1b), so the context stays readable and nothing is sent to the terminal.

  • #1284 7340237 Thanks @chappie-daemon! - fix(storage): stop invoices and vanish checks from overwriting a user's admission and vanish state

    Creating an admission or subscription invoice upserted its pubkey with is_admitted and is_vanished set to false, so it cleared both for an existing user. A renewal invoice, including the ones the relay creates itself, took a paying subscriber's admission away, so their events were refused once the admission cache expired, and an invoice anyone could request for a vanished pubkey lifted its request to vanish. An existing row now keeps the admission, vanish and terms fields the caller did not supply, and a new row created without a vanish state starts vanished when a request to vanish for the pubkey is stored. The vanish check for a pubkey without a row no longer overwrites a row another writer created in the meantime and returns that row's state. Both look for the stored request on the primary instead of a replica that may not have it yet. A deliberate limit: any undeleted stored request to vanish counts, as it already did when a user's first event created the row, so one that names only another relay also starts a new row vanished.

  • #1278 85d0481 Thanks @chappie-daemon! - fix(nip05): refuse a verification host that resolves to a private address

    NIP-05 verification fetched the domain from an author's kind-0 profile but only checked the text of a redirect URL, so a domain whose DNS points at loopback, a private network or a cloud metadata address was still fetched, on the first request and on its redirect. Each host is now resolved and refused before connecting when any of its addresses is on the private-address blocklist the NIP-11 probe already used (now shared, with fec0::/10 added), a redirect to an IPv4 literal is checked against the same list, and the request ignores HTTPS_PROXY and NODE_USE_ENV_PROXY, because a proxy would resolve the name itself and skip the check. A deliberate limit: a relay that reaches the internet only through a proxy can no longer verify NIP-05 identifiers.

  • #1274 ddcaafd Thanks @chappie-daemon! - fix(notifications): never buffer the response a notification delivery gets back

    A delivery is a POST whose only interesting part is the status code, but axios advertised every encoding it can decode, decompressed whatever a receiver sent back and buffered the whole result while nothing read it. A receiver answering with a small gzip body that decodes to hundreds of megabytes therefore spent the delivery worker's heap for a value nobody consumed (security issue #1257).

    Deliveries now ask for accept-encoding: identity, take the response as a stream so no body is buffered or parsed at all, and drain at most 8 KiB of it before dropping the socket. Success is the status and only the status: no response size can turn a notification the receiver accepted into a FAILED row the outbox then retries. The request side stays unbounded on purpose, because a settings.changed envelope carries the changed values and a blacklist edit alone can produce a body past any small cap.

  • #1270 8ee4974 Thanks @Ferryx349! - fix(peering): bound the buyer invoice queue

    A slow wallet can no longer let a peer grow the queued kind-402 invoice promise
    chain without limit. The queue is capped at 100 events or 2 MiB; exceeding
    either closes the peering connection and reconnects. Pending events are
    discarded on reconnect and only one wallet call can remain in flight. The
    handshake barrier is a fixed sequence, so later invoices cannot postpone the
    live feed, and its waiter is released when the connection closes. Invoice
    dedupe and the seller's re-issued open invoice make the reconnect safe.

  • #1279 0d07f6b Thanks @chappie-daemon! - fix(settings): keep the rest of a default array when one of its fields is set

    An array in settings.yaml replaces the default array as a whole. With a settings.yaml that has no payments.feeSchedules.admission, nostream config set payments.feeSchedules.admission[0].enabled true (also what the TUI and the admin dashboard write) saved admission: [{ enabled: true }], so the admission fee lost its default amount and whitelists. Setting limits.event.content[1].maxLength saved [null, { maxLength }], which no longer validated once the relay read it back, and is refused since the out-of-range index fix. PATCH /admin/settings and nostream config set now copy the effective array into settings.yaml before writing the field, so the other entries and fields keep their values.

  • #1279 6fffd86 Thanks @chappie-daemon! - fix(settings): reject an out-of-range array index instead of filling the gap

    Setting a path such as dvm.workers[2000000000] through PATCH /admin/settings or nostream config set grew the array one element at a time up to that index, inside the request and before the value was validated. A single request could hold the settings lock and fill the heap for as long as that took. A path may now name an array index only up to MAX_SETTINGS_PATH_INDEX (10,000), checked with the other path checks before the settings are read. Inside the array, a write must target an index that already exists or append one element at the end. Anything else is refused: the admin API answers with a 400 and a validation issue on the path, and the CLI prints the error. Updating an existing index and appending with array[<length>] work as before.

Don't miss a new nostream release

NewReleases is sending notifications on new releases.