Skip to content

v0.4.0

Latest

Choose a tag to compare

@github-actions github-actions released this 23 Nov 16:30
· 3 commits to main since this release
d7893c8

This release went through the release dry run, the 60-cycle crash tests
and the fuzz targets, but not the 72-hour soak that CONTRIBUTING.md
asks for: the one run started on a release candidate shared its host
with other workloads and was stopped. Treat long-run memory and latency
behaviour as unverified until a soak on a dedicated host is recorded in
bench/SOAK.md.

Upgrading

  • Blossom (new, off by default) keeps its own store under
    [blossom] dir (blob files plus a metadata LMDB environment at
    format version 1); the relay's [db] is untouched. Back up both
    parts of dir (guides/blossom.md).

  • The on-disk format stays at version 4 (unchanged since 0.2.0): to
    upgrade from 0.2.x or 0.3.x, replace the binary and restart. No
    export and import is needed.

  • The Linux release binaries now need glibc 2.31 or newer (Debian 11,
    Ubuntu 20.04, RHEL 9 and newer). The 0.3.0 binaries needed glibc
    2.38 and did not start on Debian 12 or Ubuntu 22.04.

  • The listener and per-address limit keys moved (native), with no
    aliases.
    A 0.3 configuration that sets [relay] bind, port,
    real_ip_header or max_connections_per_ip, or has a
    [relay.rate_limits] table, stops the relay at startup with an
    unknown field error. Move them by hand; a configuration that sets
    none of them needs no change. Before (0.3):

    [relay]
    bind = "127.0.0.1"
    port = 7777
    real_ip_header = "X-Forwarded-For"
    max_connections_per_ip = 128
    
    [relay.rate_limits]
    events_per_second = 20

    After (0.4):

    [[relay.listen]]
    address = "127.0.0.1:7777"
    real_ip_header = "X-Forwarded-For"
    
    [relay.profiles.default]
    max_connections_per_peer = 128
    
    [relay.profiles.default.rate_limits]
    events_per_second = 20

    Every [relay.rate_limits] key keeps its name and default under
    [relay.profiles.default.rate_limits]. A listener may also be a
    Unix-domain socket with its own profile, for a proxy on the same
    host or a torrc HiddenServicePort 80 unix:/run/nosfry/onion.sock
    (see guides/tor.md):

    [[relay.listen]]
    address = "unix:/run/nosfry/onion.sock"
    profile = "onion"
    
    [relay.profiles.onion]
    max_connections_per_peer = 10000

    nosfry.example.toml lists every key. The Workers edition keeps
    [relay] max_connections_per_ip and [relay.rate_limits].

  • [relay] service_url_aliases is new (both editions).

  • The [relay.auth] table is gone, with no aliases. A config
    that sets [relay.auth], restricted_read_kinds or
    restrict_read_to_involved stops the relay at startup with an
    unknown field error; the Workers edition rejects it the same
    way. Move the settings to [relay.access] rules, which cover the
    old kinds (now including 21059) plus write gates and the NIP-86
    allow list:

    • restricted_read_kinds = K with
      restrict_read_to_involved = true becomes
      [[relay.access.rules]] with kinds = K and
      read = ["author", "recipient"] — also the new built-in default
      for K = [4, 1059, 21059], so a config that never listed the
      key needs nothing.
    • restrict_read_to_involved = false becomes
      read = ["authenticated"].
    • restricted_read_kinds = [] becomes [relay.access] with
      rules = [].

    A config whose max_websocket_payload_size is smaller than
    max_event_size + 10 is refused at load and at reload — check
    this pair if you raised max_event_size.

  • [relay] max_connections is always finite. max_connections = 0
    (the old "unlimited" default) now stops the relay at startup, as
    does a value above limit - 64 - limit/8 of the soft open-file
    limit: delete the line to get that ceiling as the default (874,936
    at the default nofiles = 1000000), or set a value sized to the
    host's memory. A reload carrying either is refused.

  • Under load the relay now refuses work it used to queue: a REQ or
    COUNT can be answered CLOSED rate-limited: relay busy or
    rate-limited: too many pending queries, and a NEG-OPEN or NEG-MSG
    the same NEG-ERR. Malformed frames past the REQ rate budget get no
    NOTICE.

  • nosfry export now also writes the persisted NIP-86 management
    state and NIP-62 vanish points as versioned
    {"nosfry_state":1,…} lines that nosfry import applies;
    export --events-only writes events only, for piping into strfry
    or another relay.

  • Behaviour an operator may notice: NIP-86 bans and allow lists now
    also hide events stored before the entry was added; only the newest
    request to vanish per author is kept; AUTH events are accepted within
    10 minutes of the relay's time in both directions.

  • Breaking behaviour: with AUTH disabled (empty service_url),
    publishes of the access-gated kinds are refused with
    restricted: — set [relay.access] rules = [] to accept and
    serve them openly.
    ids, authors, #e and #p filter values must be 64 lowercase
    hex characters (anything else is invalid:; strfry accepts
    uppercase and a 0x prefix). nostr_events_total{kind} now counts
    events persisted to the store with at most 256 own kind series —
    dashboards built on the old verified-publish numbers change.

Security

  • The cargo deny advisories and licence exceptions added for Arti's
    dependency tree are tracked in #116.

  • NIP-86 banpubkey, disallowkind and the allow lists only refused
    new publishes: events stored before the entry was added were still
    served to every REQ, COUNT and NEG-OPEN. They are now hidden at
    read time, in both editions, and stay hidden after a Workers
    hibernation restore. The events stay in the database and reappear
    when the entry is removed; banevent still deletes the event.

  • Kind 21059 (NIP-59 ephemeral gift wraps) was broadcast to every
    matching subscriber, including unauthenticated ones, because no
    rule covered it. The default [relay.access] rule covers it now:
    with AUTH on it is delivered only to authenticated involved
    readers, and with AUTH off it is refused on write.

  • The Workers edition keyed its per-IP connection cap and shared
    per-address rate buckets by the exact client address, so an IPv6
    client could bypass both by rotating addresses inside its /64. It now
    groups IPv6 by /64 and folds IPv4-mapped addresses, as the native
    edition does. The NIP-86 IP block list still matches exact addresses.

  • The per-reader query queues were unbounded (audit C-14), so a REQ
    flood could grow memory without limit. Each reader now admits at
    most 4,096 queries and each connection at most twice
    max_subs_per_connection waiting ones. Beyond that a REQ or COUNT
    is answered CLOSED with rate-limited: too many pending queries
    (that connection's own limit) or rate-limited: relay busy (the
    shared one), and a NEG-OPEN or NEG-MSG with the same NEG-ERR.

  • A stored scan crossing one created_at shared by many events
    buffered every match in that tie group, so a client that
    published many events with one timestamp could make each query of it
    allocate without bound. The buffer is now bounded by the filter's
    remaining limit.

  • A NEG-OPEN scan was charged against max_sync_memory_bytes only
    once its session sealed, so concurrent syncs could collect past the
    budget. The scan is now charged while it collects and refused with
    blocked: sync capacity exhausted when the budget is spent.

  • Live matches buffered while a subscription's stored scan runs sat
    outside every byte budget (audit C-13). They now reserve their bytes
    against max_pending_outbound_bytes and count in the process-wide
    outbound total; a subscription whose buffer no longer fits is closed
    with error: subscription fell behind, as at the 4,096-event buffer
    limit, and the connection stays open. A connection holds at most
    twice max_pending_outbound_bytes: queued frames plus reservations.

  • [relay] max_connections defaulted to 0, unlimited. It is now
    always finite: omitted, it is derived from the soft open-file limit
    after nofiles raised it, limit - 64 - limit/8 (64 descriptors
    for the process itself, one eighth for HTTP requests and handshakes
    the cap does not count), e.g. 874,936 at the default
    nofiles = 1000000. 0 and any value above the derived limit are
    refused at startup and on reload. The effective cap is logged at
    startup. It bounds descriptors, not memory: memory-bound deployments
    should still set a lower value.

  • Frames that fail to parse were answered with a NOTICE each and
    charged to no rate bucket (audit C-01). They now spend the
    connection's and address's REQ rate tokens, and past the budget get
    no reply, so a junk flood no longer buys one NOTICE per frame. The
    unknown-verb NOTICE quotes at most 32 bytes of the verb.

  • The HTML landing page now sends Content-Security-Policy,
    X-Content-Type-Options and Referrer-Policy
    (site::LANDING_HEADERS), in both editions.

Added

  • Blossom media server (native, off by default). With
    [blossom] enabled = true the relay process also serves Blossom
    blobs (BUD-01 retrieval with single-range requests, BUD-02 and
    BUD-13 PUT /upload and PUT /<sha256>, BUD-06 preflight, BUD-11
    kind 24242 tokens in standard or URL-safe base64, BUD-12 list and
    delete) on its own [[blossom.listen]] sockets and its own
    public_url host; the relay refuses to start if either is shared
    with the relay. Uploads are limited to the NIP-86 admins and allow
    list unless blossom.upload = "everyone", NIP-86 bans apply, and
    per-pubkey quotas (quota_bytes, quota_blobs), a global
    max_total_bytes, max_blob_size and an optional mime_types
    list bound the store. Blobs are streamed to disk while hashed,
    fsynced and renamed into place before their metadata commits and
    the client gets 201. Every blob response is nosniff with a
    sandbox Content-Security-Policy, and HTML, SVG and other
    scriptable types are sent as attachments. nosfry blob list|stat|delete|ban|unban|gc|verify administers the store;
    /metrics gains nosfry_blossom_* series. Built in by the default
    blossom cargo feature. See guides/blossom.md.

  • [relay.access] per-kind rules, in both editions, replacing the
    old restricted-kinds settings: each [[relay.access.rules]] entry
    names explicit kinds (omit it once for a catch-all; no
    wildcards), a read set of principals (authenticated, author,
    recipient, allowed — the NIP-86 allow list), and a write
    gate (open, authenticated, author). The same rules govern
    stored scans, live delivery, COUNT, NEG and publishes; a non-open
    write gate marks NIP-11 limitation.restricted_writes.
    anonymous_kinds exempts single-use-key kinds such as 445 from
    the allow-list author check so allow-list relays can carry Marmot
    content.

  • Embedded Tor onion service (native, opt-in). A [[relay.listen]]
    address of onion:<nickname> serves the relay as a Tor onion service
    embedded in the process through Arti 0.48, behind the new onion
    cargo feature — off by default and shipped as -onion release
    archives and image tags (build from source instead with cargo install nosfry --locked --features onion). Each rendezvous circuit is a connection on the
    shared HTTP/WebSocket path, all circuits of a listener share the
    listener-wide peer identity (so its profile's
    max_connections_per_peer and per-peer buckets bind them together),
    and [relay.onion] bounds circuits (max_circuits), streams per
    circuit (max_streams_per_circuit) and optionally the
    introduction-point rate (intro_rate/intro_burst). Clearnet
    listeners serve while the onion listener bootstraps in the
    background with capped retries. The first derived onion URL is the
    canonical service_url when none is set (every onion URL is an
    alias otherwise), onion_location advertises it to non-onion
    clients, nosfry onion address prints the ws://<addr>.onion URLs
    without starting the relay, and nosfry_onion_* metrics report
    state, circuits, streams and rejections. Write-policy plugins see
    onion connections as "sourceType":"Onion".

  • Release artifacts for the onion variant: every archive has a
    nosfry-<version>-onion-<target>.tar.gz twin and the container image
    has <version>-onion, <major>.<minor>-onion, <major>-onion and
    onion tags, all built with --features onion and attested like the
    default artifacts; the release build asserts the default binary and
    SBOM contain no Arti and the onion ones do.

  • nosfry sync over Tor (native, onion feature). A
    ws://<addr>.onion peer URL is dialed through an embedded Arti
    client — ws:// only, because the circuit already encrypts and
    authenticates the service, and never a clearnet DNS lookup. The
    client shares [relay.onion] state_dir with the onion listeners:
    one guard set per installation, a warm cache next to a running
    relay, and read-only state and cache under Arti's own lock files when
    that relay holds them. Bootstrap is bounded at 180 seconds, each
    connection by --timeout; a build without the feature refuses the
    URL and names it.

  • iroh transport (native, opt-in). A [[relay.listen]] address of
    iroh:<nickname> makes the relay reachable over iroh QUIC by anyone
    holding its endpoint id, with NAT hole punching and relay fallback, so
    a relay at home or behind CGNAT needs no public IP. It sits behind the
    new iroh cargo feature (iroh 1.4.1) — off by default and absent from
    the published binaries and container image (cargo install nosfry --locked --features iroh). Each QUIC stream on ALPN nosfry/http/1
    is an ordinary HTTP/1.1 connection, so NIP-11, WebSockets and NIP-86
    are unchanged. Per-peer caps and buckets key on the authenticated
    remote endpoint id; [relay.iroh] bounds QUIC connections per
    listener before the handshake (max_connections) and streams per
    connection, picks n0's public relays, your own (relay_mode = "custom", relay_urls) or none, and turns n0's DNS address lookup
    on or off. Each listener's relay name ws://<endpoint-id>.iroh joins
    the relay names (canonical when nothing else names the relay), NIP-11
    lists the endpoint ids under "iroh", nosfry iroh address prints
    the dial address offline, and nosfry_iroh_* metrics count direct
    and relayed connections. nosfry sync iroh:<endpoint-id> reconciles
    with a relay over iroh, and nosfry connect <endpoint-id> --listen 127.0.0.1:<port> is a localhost gateway through which any existing
    Nostr client reaches an iroh-only relay. Write-policy plugins see
    "sourceType":"Iroh". See guides/iroh.md.

  • nosfry sync <url> [--filter] [--dir down|up|both] [--since] [--until] reconciles the local database with any NIP-77 relay
    (nosfry, strfry) and transfers the difference (native). Memory stays
    bounded whatever the set sizes: the range is reconciled in time
    windows of at most 100,000 local events and 100,000 differences,
    split further when the remote answers blocked:. Frame sizes and
    download batches follow the remote's NIP-11 limits, rate-limited:
    answers are retried after their hint, and an interrupted run is
    resumed by running it again. Downloads pass the same validation as a
    client EVENT, NIP-86 moderation, and the write-policy plugin
    ("sourceType":"Sync"); protected events and events an
    [relay.access] read rule hides from unauthenticated readers are
    never uploaded. Exit codes: 0 complete, 3 partial, 1 failed. NIP-42
    keys come only from --auth-key-file (mode 600); loopback and
    private addresses need --allow-private. See guides/sync.md.

  • [relay] service_url_aliases lists further ws:///wss:// names
    the relay answers to (for example its onion address); NIP-42 AUTH,
    NIP-62 requests to vanish, and NIP-98 management calls accept the
    canonical service_url and every alias, in both editions. NIP-11
    and the landing page keep naming service_url.

  • Unix-domain-socket listeners (address = "unix:/path"), for a
    reverse proxy on the same host or a torrc HiddenServicePort unix: target. Without real_ip_header, all connections of such a
    listener are one peer: its profile's per-peer cap and ip_*
    buckets apply to the whole listener, the write-policy plugin sees
    "sourceType":"Unix" with the socket path, and blockip does not
    apply. A stale socket file is replaced at startup and the file is
    removed at shutdown.

  • connection closed log lines carry duration_ms, and the relay
    warns at most once a minute per listener when its real_ip_header
    is missing or unparsable and the peer falls back to the transport.

  • Gift wraps (kind 1059) are deleted by their p recipient's
    NIP-09 kind 5, with re-publication blocked (NIP-59).

  • An AUTH challenge is sent whenever an unauthenticated REQ, COUNT,
    or NEG-OPEN filter could match a restricted kind; restricted
    events stay hidden until AUTH.

  • EOSE now carries NIP-67 completeness hints, in both editions:
    ["EOSE", <sub>, ["finish"]] when every stored match was sent so
    the client need not paginate, ["more"] when a matching stored
    event provably remains, and ["auth"] when the request could
    match restricted kinds — the AUTH challenge precedes that EOSE.
    NIP-11 lists 67 unconditionally.

  • The NIP-01 rate-limited: retry hint (milliseconds until the
    bucket refills) on OK and CLOSED.

  • NIP-59 in supported_nips when AUTH is on and 1059 is restricted.

  • nosfry export appends versioned {"nosfry_state":1,…} lines
    (NIP-86 bans, allow/disallow lists, kind lists, IP blocks, and
    NIP-11 overrides plus NIP-62 vanish points) and nosfry import
    applies them; a malformed state line aborts the import.
    export --events-only writes events only, for piping into other
    relays (native).

  • nosfry_event_outcomes_total{outcome} counts verified publishes
    by outcome (native).

  • Release artifacts that can be verified: every archive comes with a
    .sha256 file (all of them also in SHA256SUMS), a CycloneDX SBOM,
    and a GitHub build provenance attestation; the container image carries
    its own provenance attestation and SBOM
    (gh attestation verify <archive> --repo qntx/nosfry). Before anything
    is published, the release workflow runs the full CI gate on the tagged
    commit, starts every Linux binary in Debian 11, Debian 12 and Ubuntu
    22.04, and smoke-tests the image on both architectures. The crates are
    published with the organization's crates.io token.

  • Operator guides in guides/: install,
    configuration reference, deployment (a hardened systemd unit and an
    nginx site in contrib/), administration, security model,
    Tor, the Workers edition, and a test relay for client CI.

  • Every WebSocket connection logs inside a conn{id, peer} span on
    target nosfry::conn (the peer after real_ip_header), so each
    line of a connection is attributable, e.g. by fail2ban. With
    RUST_LOG=info,nosfry::conn=debug the relay logs connection open,
    connection closed reason="...", and connection cap reached peer=...; JSON lines carry the span as "span":{"name":"conn", "id":..,"peer":".."}.

  • nosfry_reader_busy_total{msg="scan|conn_scan|neg_msg|control"}
    counts queries and control messages shed because the readers were
    saturated, and the nosfry_reader_jobs gauge shows the queries
    admitted to the readers and not yet finished.

  • contrib/marmot/nosfry.toml, a ready-to-run native profile for a
    Marmot group/inbox relay (2 MiB events and frames, rate limits
    sized to the measured White Noise bursts, anonymous_kinds = [445]), with guides/marmot.md covering deployment on both
    editions, the privacy posture and a members-only variant; the
    conformance suite gained a fourth pass that runs its marmot_*
    cases against the shipped profile on both editions.

  • contrib/test-relay/nosfry-test-relay.sh starts a seeded local or
    CI test relay on a temp dir, waits for NIP-11 readiness, and cleans
    up deterministically on signal (guide: guides/test-relay.md).

Changed

  • heed 0.22.1 → 0.23.1, the LMDB binding for the native store. The
    vendored C library (lmdb-master-sys 0.2.6) is unchanged, and the
    on-disk format stays at version 4: replace the binary and restart,
    no export/import needed. The bump is verified format-compatible in
    both directions (a store written by 0.22 exports identically under
    0.23 and vice versa).

  • rusqlite is held at 0.40.2 (libsqlite3-sys 0.38.2) across the whole
    workspace lockfile so Arti 0.48 resolves (#116). The default native
    binary and the Workers bundle link no SQLite, so neither changes;
    SQLite is linked by nosfry-sql's optional rusqlite feature (tests
    and downstream users) and by --features onion builds (Arti's
    directory cache).

  • Listener configuration moved (native). [[relay.listen]]
    entries (address, profile, real_ip_header) replace [relay] bind, port, and real_ip_header; each names a
    [relay.profiles.<name>] (default default) holding
    max_connections_per_peer (was [relay] max_connections_per_ip)
    and rate_limits (was [relay.rate_limits]). There are no
    aliases for the old keys: move them by hand, as in
    nosfry.example.toml. Listeners are restart-only; profiles reload,
    and a reload removing a profile in use is refused.

  • restricted_read_kinds defaults to 4, 1059, 21059 (was 4, 1059;
    strfry master has 4, 1059).

  • With AUTH disabled (empty service_url), writes of restricted
    kinds are refused with restricted: instead of acknowledged and
    never served; set restricted_read_kinds = [] to accept and
    serve them openly.

  • ids, authors, #e, and #p filter values must be 64
    lowercase hex characters; anything else is refused with
    invalid: (strfry accepts uppercase and a 0x prefix).

  • NIP-11 limitation.max_message_length is now
    min(max_websocket_payload_size, max_event_size + 10).

  • A config whose max_websocket_payload_size is smaller than
    max_event_size + 10 is refused at load and at reload.

  • nostr_events_total{kind} counts events persisted to the store
    (strfry master semantics, #225) instead of every verified
    publish, and at most 256 kinds get their own series — later kinds
    count under kind="other". Dashboards built on strfry 1.1.3's
    ingress semantics will see lower numbers (native).

  • AUTH events are checked against a dedicated symmetric ±600 s
    window (created_at within ~10 minutes of the relay's time, per
    NIP-42) instead of the ephemeral-age rules that limited them to
    60 s in the past.

  • Only the newest kind-62 request to vanish per author is stored
    (NIP-62 bookkeeping); an older or equal-dated incoming request is
    answered duplicate: have a newer version instead of accumulating.

  • Idle WebSocket connections now hold a few words instead of a
    channel buffer block: the per-connection outbound queue is a
    mutex-guarded deque with a waker (~2.4 KiB less per connection),
    and the socket write buffer no longer pre-reserves 2 KiB.

  • Writer transactions take every queued publish (bounded by the
    65,536-request / 64 MiB writer inbox) instead of at most 1,024
    events, amortizing commit cost on large databases.

  • COUNT's tag-cover check binary-searches the sorted earlier values
    instead of scanning them against every packed tag.

  • The container image's Rust and distroless base images are pinned by
    digest.

Fixed

  • Events written by another process while the relay runs (nosfry import, nosfry sync) were invisible to new REQ, COUNT and
    NEG-OPEN queries until the relay stored an event of its own. Each
    query now starts from the store's latest commit; such events are
    still not broadcast to subscriptions that are already open (native).
  • The native relay refused a WebSocket frame of exactly
    max_websocket_payload_size bytes (yawc's limit is exclusive);
    the limit is now inclusive on both editions.
  • import no longer buffers a whole input line before the max_line
    check: it reads at most max_line + 1 bytes, rejects a longer line
    once, and consumes the rest without allocating it.
  • The write-policy plugin's modification-time check no longer blocks a
    runtime worker thread with synchronous file I/O.

Verifying the artifacts

Every archive has a .sha256 file (all of them are also in SHA256SUMS),
a build provenance attestation, and a CycloneDX SBOM (.cdx.json) attested
to the archive it describes. The container image carries its own provenance
attestation and SBOM. The same applies to the nosfry-<version>-onion-<target>
archives and the ghcr.io/qntx/nosfry:<version>-onion image tags, which ship
the Arti-linked variant.

sha256sum -c nosfry-<version>-<target>.tar.gz.sha256
gh attestation verify nosfry-<version>-<target>.tar.gz --repo qntx/nosfry
gh attestation verify oci://ghcr.io/qntx/nosfry:<version> --repo qntx/nosfry

The Linux binaries need glibc 2.31 or newer (Debian 11, Ubuntu 20.04, RHEL 9
and newer); each one was started on Debian 11, Debian 12 and Ubuntu 22.04
before this release was published.