Skip to content

fix(relay): audit binding denials and document isolation boundaries (#96) - #98

Merged
OBenner merged 3 commits into
mainfrom
codex/96-binding-audit
Nov 16, 2026
Merged

OBenner merged 3 commits into
mainfrom
codex/96-binding-audit

Conversation

@OBenner

@OBenner OBenner commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Several HTTP session and delivery routes rejected foreign or stale bindings without recording a security denial. Writer and registration denial details could also copy an unverified session identifier into the audit log.

This change adds HTTP audit ownership for heartbeat, close, claim, authorize, receipt, failure and operator doctor refusals. RelayService, registration/replacement and long-poll admission retain their existing ownership, with tests preventing duplicate events. Denial details use fixed action text; registration surface hints are allowlisted to preserve OpenCode doctor diagnostics without copying arbitrary input. Controlled validation failures on audited session/delivery routes are recorded as INVALID_INPUT.

Existing credential, recipient, writer, session and generation checks are reused unchanged. There is no session/wire/schema change: mirror reads, NOT_WRITER, session-less token-only access and operator behavior remain intact. This does not authenticate the chat that invokes an MCP channel with that channel's valid credentials.

The security documentation now separates relay consistency from host configuration scoping, explains bootstrap/replacement and residual risks, and includes a route/audit-ownership matrix. The original isolation research is marked historical where it overstated the guarantee.

Validation:

  • Eight regression assertions failed before the fix: seven missing HTTP audit events and an unverified writer-session marker copied into a denial.
  • 18 new cases cover foreign bindings, no mutations on denial, missing/stale generation, replacement during long-poll, mirrors/session-less compatibility, foreign ack/reply/receipt, operator access, log hygiene and the SDK caller-identity limitation.
  • Targeted suite: 6 files / 111 tests PASS.
  • Full pnpm verify: 107 files / 941 tests PASS, plus format/import/typecheck/build; git diff --check clean.

The first CI run passed verify and dependency audit but Gitleaks misclassified a synthetic test idempotency label as generic-api-key. The test now generates a UUID. .gitleaksignore records only that exact historical commit/file/rule/line fingerprint, preserving all other scanning and avoiding a public history rewrite. The SDK suite passed again (21 tests).

On the follow-up commit, Secret scan and dependency audit passed; verify hit two timeouts in unchanged relay lifecycle/supervisor tests (939/941 passed). Both files passed locally afterward (4 tests). One rerun of the failed job on the same commit passed: final CI 3/3 SUCCESS, run 43907126160, attempt 2. No test timeout or production behavior was changed to address that run.

Limits: this is not a universal HTTP access log or host chat attestation. Same-user credential access, audit disk failures/tampering, authenticated denial floods and host-specific tool visibility remain outside the guarantee. No live foreign-role channels or host probes were used. Security approved the complete implementation/documentation diff (05bb5cd); a documentation-only follow-up records its nonblocking audit-growth observation. Dev review precedes CTO final.

Fixes #96.

@OBenner

OBenner commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

Review (dev) — ACCEPT

Reviewed the full diff locally before the push (preliminary ACCEPT) and re-verified the published PR — identical at HEAD 8c270a8. security has separately APPROVED the docs/hygiene (0e0a1207), including the docs-only flood-limitation follow-up commit.

Enforcement. CredentialStore remains the single identity source; route-class deny coverage now spans the seven session/delivery/doctor classes that previously returned correct errors with no audit event; RelayService keeps ownership of message-operation denials; long-poll admission is not double-logged (claim + RATE_LIMITED guard). No session/wire/schema changes — arch's contract gate was lifted for exactly this revision.

Bounded diagnostics. denialDetail removes all request-controlled strings from denial events (previously error.message and even the attempted session id were copied); auditedSurface keeps a fixed whitelist vocabulary so the opencode-mcp doctor diagnostic survives while arbitrary surface values collapse to other. Tests assert no session ids, tokens, or message bodies appear in audit JSON.

Conformance. Eight meaningful RED before the fix (seven unaudited denial paths + one unverified-marker leak) → GREEN; 18 new tests cover foreign binding on all six delivery/lifecycle paths with zero-mutation and exactly-one-event assertions, parked-poll recheck after operator replacement, stale/missing generation, mirror reads, NOT_WRITER/NOT_FOUND preservation, session-less compatibility, cross-project inbox, operator doctor, and the explicit SDK limitation case (valid channel credentials act as the role without caller-chat proof — recorded as a limitation, not a passing isolation test).

Docs. The threat model is now the honest source of truth: host-specific limitations (Codex config scoping vs per-chat attestation), bootstrap/replacement semantics, and the corrected P1.1 status replace the previously contradictory "Done" claim; the 2026-11-12 research carries a historical-notice header.

Verified independently: 105 targeted tests in a detached review worktree; author's full verify 107 files / 941 tests; CI pending final confirmation (audit + secret scan already green).

Passing to CTO for final.

@OBenner

OBenner commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

(The stray title field in my previous comment was a tooling slip — the verdict stands: ACCEPT.)

@OBenner
OBenner merged commit 908c6ed into main Nov 16, 2026
5 of 6 checks passed
@OBenner
OBenner deleted the codex/96-binding-audit branch November 16, 2026 16:58
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.

P1.1: relay-side per-chat isolation (token→role→binding consistency + unified deny-audit + conformance matrix)

1 participant