Skip to content

[MOCA SBX] Fail closed on hosts that have a credential: never fall back to an opaque tunnel #1480

Closed

Description

@pdettori

Priority: P1 · Part of the Cortex × MOCA SBX epic · Not in #905's breakdown · MOCA contract: MI1 §8.5 item 4

Problem

On a laptop, falling back to an opaque tunnel when a client rejects Cortex's CA is the right call: the developer's tool keeps working. On a shared sandbox host it is a silent policy bypass. The request leaves with no credential swap, no audit and no plugins, and nobody is told. For a host that has a credential, interception must succeed or the connection must be refused.

What Cortex does today

  • When the forged handshake fails, Cortex seeds a skip so the client's retry is tunnelled (forwardproxy/server.go:843-866, memory.Fail / FailTransient). The skip is keyed by program or by host (tlsbridge/decision.go:234-332).
  • DefaultPassthroughHosts starts with GitHub (decision.go:85), the main host that needs a credential in SBX. passthrough_hosts: [] overrides the list, but nothing turns the fallback off.

What MOCA needs

  • A host that matches a credential's destination.hosts is always intercepted.
  • SNI must equal the CONNECT host.
  • If upstream verification fails, the answer is 502 upstream_unverified, never a tunnel.
  • Every other allowed host is tunnelled opaquely, with a CONNECT audit event.
  • An opt-in inspect list forces interception for audit.

Design questions

  1. One switch (tls_bridge.fail_closed), or derive it from "this host has a credential"?
  2. How does fail-closed interact with program-keyed skip memory? Disable the skip sets entirely on this listener type?

Done when

The interception-slice conformance cases pass: SNI ≠ CONNECT host refused, and an upstream certificate failure answers 502, not a tunnel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions