AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 29 Bitcoin

Support Unix sockets

Public commit record

What the developer wrote

Authored by Martin Habovstiak

68/100 · Adequate
Support Unix sockets

Unix sockets provide better security and performance, so it is natural
for electrs to want to support them. Because of how similar they are to
TCP sockets the required changes are theoretically small. However, there
is no crate I know of that provided the abstract API, so I made one.

I originally only wanted to support electrum RPC but it turns out not
having to deal with two sets of `SocketAddr` is easier and it wasn't too
difficult. Unix socket was already supported by `tiny_http` via their
own abstraction and we have no other dependencies requiring TCP.

Because this also required modifying the logic around publishing the
electrum address I added an option to set it explicitly regardless of
whether the user is dealing with Unix or TCP socket because having this
is useful for TCP too - the user might want to publish a different port
number if the port was mapped via NAT or a different address when
tunnelled. In theory, this is still not perfect because the same server
could be tunnelled multiple times but we don't bother with such edge
case until someone requires it.

Another side improvement is reporting if the accept thread ends because
of incoming stream ending rather than error. This should never happen
but is useful for debugging if it ever does.
✓ Subject identifies a change✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit adds support for Unix domain sockets to the electrs Bitcoin Electrum server. The main security benefit is that administrators can use filesystem permissions to control which local users or processes can connect, instead of relying solely on TCP network rules. It also lets operators advertise a different public address than the one the server actually binds to, which is useful when tunneling through SSH or NAT. The changes are mostly a feature addition and refactoring; there is no direct evidence in the commit of a fixed vulnerability or exploit.

Recommended action

Treat this as a routine feature addition rather than a security patch. Operators who want the security benefits should run electrs with Unix domain sockets and restrict directory/socket permissions to trusted users. Review the new abstract_socket dependency for supply-chain risk and ensure socket cleanup behavior does not remove files outside the intended path. No urgent upgrade is required for security reasons based on this commit alone.

Security signals we found

01

Adds Unix domain socket support, enabling filesystem-permission-based access control for RPC and metrics endpoints

02

Introduces public_addr option to decouple bound listening address from advertised Electrum server address (relevant for NAT/SSH tunnels)

03

Adds cleanup of Unix socket path on accept-loop termination

04

Adds warning logging when the socket file is removed by another process

05

No direct bug fix, memory-safety issue, or cryptographic change visible in the diff

Risk score

Why this scored 29/100

Our methodology →
Potential impact 5/30
Exploitability 5/25
Stealth signal 5/15
Affected reach 5/15
Confidence 6/10
Evidence quality 3/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.