Skip to content

fix(security): refuse plaintext bearer-token transmission (Phase C, C1)#215

Merged
yairfalse merged 1 commit into
mainfrom
feature/monster-c-network-sandbox
May 25, 2026
Merged

fix(security): refuse plaintext bearer-token transmission (Phase C, C1)#215
yairfalse merged 1 commit into
mainfrom
feature/monster-c-network-sandbox

Conversation

@yairfalse
Copy link
Copy Markdown
Collaborator

Monster Phase C — item C1 (audit S1, High) from docs/audit-2026-05-22.md.

The Team Mode bearer token was sent with no scheme check: Sykli.HTTP.ssl_opts/1 returns [] for non-HTTPS, and Coordinator.Client sent Authorization: Bearer <token> regardless — so a http:// coordinator leaked the token in cleartext to any on-path observer (an in-scope adversary per docs/team-mode-security.md).

Fix

  • New Sykli.HTTP.check_token_transport/1: :ok for HTTPS, loopback hosts, or an explicit SYKLI_COORDINATOR_INSECURE=1 opt-in; otherwise {:error, :insecure_transport}.
  • Coordinator.Client.request_json/5 refuses (returns {:error, {:insecure_transport, url}} + logs an error) before sending; warns loudly when the opt-in carries a plaintext send. All token-bearing paths — work/run/gate clients and daemon join — route through this client, so one guard covers them.

Scope note

Phase C is split for focused review. This PR is C1 only. Remaining (with decisions locked):

  • C2 per-team coordinator authz → enforce per-team tokens (own PR — auth-model change)
  • C3 mask file/OIDC-resolved secrets (own PR)
  • C4 SSRF allowlist on gate webhook_url (connect_timeout already present)
  • C5 Shell-runtime trust ADR + Add fluent Go SDK API #4 rewrite (document Shell = trusted only)

Verification

mix format / mix credo (clean) / mix test (1752, 0 failures, +6 HTTP tests) / mix escript.build; black-box team-sync + COORD cases pass (loopback allowed).

🤖 Generated with Claude Code

…oordinators

Monster Phase C, item C1 (audit S1, High). Sykli.Coordinator.Client now refuses
to send the Team Mode bearer token over plaintext HTTP to a non-loopback host
(returns {:error, {:insecure_transport, url}} + logs an error) instead of
leaking it on the wire. HTTPS and loopback are unaffected; SYKLI_COORDINATOR_INSECURE=1
is an explicit opt-in with a loud warning. All token-bearing paths (work/run/gate
clients, daemon join) route through this client. New Sykli.HTTP.check_token_transport/1
holds the shared decision.

Verification: mix format/credo/test (1752, 0 failures), escript.build,
black-box team-sync + COORD cases pass (loopback allowed).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@yairfalse yairfalse self-assigned this May 25, 2026
@yairfalse yairfalse merged commit f63bd50 into main May 25, 2026
12 checks passed
@yairfalse yairfalse deleted the feature/monster-c-network-sandbox branch May 25, 2026 21: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.

1 participant