Skip to content

Attestation provider server uses unix sockets and simple binary protocol rather than HTTP - #112

Open
ameba23 wants to merge 4 commits into
mainfrom
peg/attestation-provider-uses-unix-socket
Open

ameba23 wants to merge 4 commits into
mainfrom
peg/attestation-provider-uses-unix-socket

Conversation

@ameba23

@ameba23 ameba23 commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

For context: We are concerned about having the attested TLS proxy require root privileges in order to generate quotes. Before switching to do quote generation in a separate process, we want to make some improvements to the inter-process communication.

This improves security of the attestation provider server by using unix sockets rather than the loopback interface, giving stronger guarantees that it runs on the same host as the caller.

It also switches the protocol used from HTTP to a very simple binary protocol.

The client who wants an attestation sends the 64 byte quote input, and the service responds with a SCALE encoded Result<AttestationExchangeMessage, ProviderError>.

@ameba23
ameba23 force-pushed the peg/attestation-provider-uses-unix-socket branch from 70471ea to 3433691 Compare October 28, 2026 15:26
@ameba23
ameba23 force-pushed the peg/attestation-provider-uses-unix-socket branch from 4ed3c46 to 5dfc570 Compare October 29, 2026 08:19
@ameba23
ameba23 requested a balanced review from Copilot November 9, 2026 12:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An attacker can replace a parent directory under a writable ancestor and redirect the privileged socket chmod through a symlink to an attacker-selected file.

1 open issue
What changed in this PR

Replaces the HTTP attestation provider with a Unix socket service, strengthening same-host guarantees while keeping privileged attestation generation separate from applications.

Changes:

  • Adds a length-prefixed SCALE protocol with request validation, response limits, and client deadlines.
  • Migrates generator configuration and the CLI to socket paths, with socket permissions and lifecycle cleanup.
  • Updates dependencies and documentation, and adds protocol and socket lifecycle tests.
File Description
readme.md Describes the provider as Unix socket-based.
crates/​attestation/​src/​provider.rs Adds the synchronous socket client and wire response types.
crates/​attestation/​src/​lib.rs Replaces provider URLs with socket paths.
crates/​attestation/​README.md Documents socket configuration and Unix platform support.
crates/​attestation/​Cargo.toml Adds the socket client dependency.
crates/​attestation-provider-server/​src/​main.rs Migrates CLI configuration and adds shutdown handling.
crates/​attestation-provider-server/​src/​lib.rs Implements socket serving, permissions, cleanup, and tests.
crates/​attestation-provider-server/​README.md Documents directory and socket permissions.
crates/​attestation-provider-server/​Cargo.toml Replaces HTTP dependencies with socket-related dependencies.
Cargo.lock Records updated dependency resolution.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

A recoverable accept error such as file-descriptor exhaustion shuts down the provider and removes its socket instead of retrying, turning temporary resource exhaustion into a permanent service outage.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Retry recoverable accept errors instead of shutting down the provider

crates/​attestation-provider-server/​src/​lib.rs:129

A recoverable accept error now shuts down the entire provider. For example, reaching the process file-descriptor limit makes accept() return EMFILE; this ? exits the server and causes the CLI to remove the socket, even though the same listener could resume accepting once descriptors are freed. Log and retry accept failures with a backoff so temporary resource exhaustion does not permanently stop attestation service.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Timed socket reads abort on ErrorKind::Interrupted instead of retrying within the existing deadline, potentially rejecting a valid response before the one-second timeout.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Retry interrupted socket reads until the deadline

crates/​attestation/​src/​provider.rs:99

Retry ErrorKind::Interrupted rather than aborting the request when a handled signal interrupts a timed socket read. Otherwise, a valid response can be rejected before the one-second deadline, including during this final EOF check; the frame-reading loop at line 76 has the same issue. Retry both reads while recomputing the remaining timeout from the existing deadline.

1 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the Unix-socket attestation transport change.

No open issues 🎉

Review effort: Balanced

@ameba23
ameba23 requested a review from alexhulbert November 10, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants