docs(rfc): propose auditing what the broker refuses before the gate

Merged
KI
1mo ago
+180-0

Problem

A Broker audits each request it passes to its gate. It refuses some things before the gate sees them, and those leave no event:

  • a peer whose uid isn't admitted, or can't be read
  • a connection past max_connections
  • a protocol error on an admitted connection: a frame over 1 MiB, bytes past the declared length, an attached descriptor, or a request that doesn't parse

These are the intrusion-detection signals RFC 0002 audits for: another user probing the socket, or a compromised worker sending a descriptor.

Change

RFC 0011 proposes:

  • Two operations. connect, with reasons ok, peer_refused, connection_limit, and no_thread. request, with reasons frame_too_large, malformed_frame, and malformed_request. Each refusal is exactly one event.
  • One new key. peer_uid is added within format version 1, and in Rust it's AuditEvent::peer_uid.

Events go through the sink already on the broker's gate, so there's no new API to receive them. AuditOp, AuditReason, and AuditEvent are #[non_exhaustive], so this isn't a breaking change.

This reverses RFC 0007's decision 3, that a refused peer produces no event, and the RFC says so. That follows the maintainer's choice from the internal review to audit protocol refusals. The RFC asks three questions:

  1. Should an admitted connection also produce an allow event?
  2. A refused peer can flood a synchronous sink. Is relying on the sink's backpressure enough?
  3. Should open and the other operations carry the peer's uid, as a later RFC?

It also adds the roadmap item under M9.

Verification

Docs only. Checked against the code:

  • broker.rs::serve_with refuses peers and the limit with continue, and emits no event.
  • serve_conn and read_frame return the four protocol errors listed.
  • The peer uid comes from SO_PEERCRED on Linux and getpeereid on macOS (broker_sys.rs).
  • fsgate-broker has no audit option outside --experimental-intercept, so this applies to library embedders.

Nothing was implemented or run.

Documentation and release

No behavior change and no changelog entry. If accepted, the implementation updates RFC 0002's field list, RFC 0007's decision 3, the threat model's audit section, and the changelog under Added.

Decisions

The maintainer accepted the RFC as written, and the second commit records it:

  • Admitted connections produce an allow event.
  • There's no rate limit.
  • A peer's uid on open and other operations waits for a later RFC.

The roadmap marks the RFC item done and adds "Implement RFC 0011".