Skip to content

NexaPipe v0.2.0

Choose a tag to compare

@open-nexa open-nexa released this 28 Sep 16:15
· 360 commits to main since this release
2e21fcd

NexaPipe exposes HTTP, HTTPS, WebSocket, TCP and UDP services that live behind NAT through a
single iroh/QUIC endpoint — without terminating TLS, without a control plane, and without a
server to rent.

v0.2.0 is a hardening release. A full review of the tree — server, client library, Android and
desktop apps — produced a batch of security and correctness fixes, alongside configurable
health checks, a draining shutdown, and access logs on the iroh tunnel path. It carries
breaking changes: default_backend is removed, and the server now refuses some configs it
used to "fix" silently. See Upgrading before restarting.

Highlights

Security hardening across the whole tree

Ordered by what an attacker could reach first:

  • An empty enrollment token completed enrollment. pending_enrollment = "" — the natural
    way to clear a token — accepted any peer: the secret was rotated and handed to the caller,
    and the real devices were dropped. Both sides of the comparison must now be non-empty, and a
    blank token refuses to load.
  • Config hot reload logged the credentials. The endpoint's ed25519 secret key, the relay
    auth token and TOTP secrets were printed on every reload. Hand-written Debug impls now
    redact them.
  • The client auth handshake had an unbounded allocation and no deadline. A 4-byte
    0xFFFFFFFF length made the client allocate 4 GiB, and one silent server could block every
    request for that backend. Reads are capped at 64 KiB and the handshake has a 10 s timeout.
  • The desktop in-process path validated nothing. The frontend could publish an
    unauthenticated LAN proxy that the privileged service path deliberately blocks. The loopback
    and TUN-subnet checks now run before the service/process split, and a minimal CSP replaces
    csp: null.
  • Request handling got deadlines and limits. The request head read has a 30 s total
    deadline (an idle deadline is reset by one byte every 30 s); concurrent streams per
    connection are capped at 256, refused rather than queued; request bodies are capped at
    64 MiB checked before allocating; response compression switches to streaming past 1 MiB
    instead of buffering unboundedly.
  • Android and desktop credentials are sealed. TOTP seeds, enrollment tokens and the relay
    token used to sit in plaintext SharedPreferences / localStorage, inside the Android backup
    scope. They are now encrypted through the platform Keystore (AES-256-GCM), with old
    plaintext values migrated on startup.

No protocol, wire-format or public API change.

Correctness fixes that were silently breaking traffic

  • Chunked request bodies were silently dropped on the iroh tunnel path — only
    content-length bodies were read, so the backend received a body with no framing and no way
    to know it was truncated. They are now decoded as they arrive and forwarded with a computed
    content-length.
  • Health checks were orphaned by a config reload: an unchanged route kept pointing at a
    backend pool nobody probed, so it was never marked unhealthy again. Pools are now reused
    across reloads, and probes are tracked and aborted with their route.
  • A reload could resurrect a spent enrollment token by overwriting live auth state with a
    file snapshot read outside the lock; the read now happens inside it.
  • Host wildcards matched without a label boundary (*example.com matched notexample.com);
    IPv6 Host headers never matched a route; hop-by-hop headers were forwarded verbatim; a 502
    echoed internal error details (backend URL, parse errors) to the client.
  • Plus fixes across TOTP validation, connection-pool lifecycle, TUN DNS parsing (RFC 1035
    compression pointers), UDP flow limits, and a DNS cache for the TUN proxy.

Health checks are configurable, and the threshold is finally honoured

[health_check] is new, and every key is optional — absent means the defaults, so existing
configs keep working:

[health_check]
enabled   = true      # false disables probing entirely
interval  = 10        # seconds between two rounds
timeout   = 5         # seconds before one check is abandoned
threshold = 3         # consecutive failures before a backend leaves the pool
path      = "/health"