Skip to content

feat(security): warn before sending credentials over plain http to non-loopback hosts - #5179

Open
thymikee wants to merge 5 commits into
mainfrom
feat/credential-transport-rule
Open

thymikee wants to merge 5 commits into
mainfrom
feat/credential-transport-rule

Conversation

@thymikee

@thymikee thymikee commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Summary

First-party credentials belong on https:, or http: to loopback. For other URLs, 0.21.x warns on stderr once per origin; 0.22 will refuse (insecure_credential_transport; one function flips). ADR: #5178.

Covers daemon, cloud (including refresh), Metro bridge, and default-transport proxy URLs. Insecure upload tickets are dropped unsent for the legacy upload. Daemon and Revyl share one loopback classifier.

Breaking: none on main. In 0.22, non-loopback http:// setups need encryption or AGENT_DEVICE_ALLOW_INSECURE_TRANSPORT=1. The proxy package has no override: use https, a loopback upstream, or upstreamFetch.

  • Cloud URLs are judged where each flow reads them (login, refresh, profile); auth-session.ts is at the line cap.
  • New host-kit subpath: reusing an existing one grows 9–43 startup closures.
  • 164 added, 46 removed production lines (target ~150), including the moved classifier.

Before / after

Remote daemon at a plain-HTTP, non-loopback URL. Before: token sent silently. After:

Warning: credentials for http://remote-mac.example.test:7777 are sent in cleartext. agent-device 0.22 will refuse this. Use https, ssh -L, or Tailscale Serve, or set AGENT_DEVICE_ALLOW_INSECURE_TRANSPORT=1.

Validation

At 5537b6e014: nine changed test files (69 tests) and package-boundaries.test.ts passed; a scratch closure measurement found no growth. Ticket tests fail without the guard. Lint, typecheck, and other gates are left to CI. No live run.

Security

  • Each listed path is checked before its request.
  • The override must equal 1, from the sending process's host environment; profiles, tickets and requests cannot set it.
  • The Metro companion receives exactly the judged URL and token.
  • Messages show the origin only.
  • No redirect, wire-format, or provider URL changes.

🤖 Generated with Claude Code

thymikee and others added 2 commits November 28, 2026 13:50
…n-loopback hosts

A configured URL that receives a first-party credential should be https, or
plain http to a loopback host. agent-device 0.21.x warns on stderr, once per
origin, for any other URL; 0.22 will refuse with
reason insecure_credential_transport. Nothing breaks in this release.

Checked destinations: the remote daemon URL, the cloud URL (including the
stored issuer on refresh), the Metro bridge URL, and the @agent-device/proxy
upstream URL with its default transport. A direct-upload ticket that fails the
rule is dropped unsent and the upload takes the legacy route.

AGENT_DEVICE_ALLOW_INSECURE_TRANSPORT=1 in the sending process's environment
allows plain http. @agent-device/proxy reads it from the new `env` option.

The daemon resolution and Revyl loopback classifiers now share one owner.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… digests

Two new contracts exports, and acks for the upload preflight declarations that
now judge a ticket URL locally. No request or response shape changes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.68 MB 6.68 MB +2.4 kB
Package (unpacked) 6.68 MB 6.68 MB +2.4 kB
Package (download) 2.04 MB 2.04 MB +663 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 20.9 ms 22.7 ms +1.8 ms
CLI --help 48.4 ms 47.7 ms -0.7 ms

`createDaemonProxy` takes no environment option. The `agent-device proxy`
upstream is the local daemon on loopback, and an embedder with another plain
http upstream supplies `upstreamFetch` or uses https. The warning names those
fixes instead of an environment variable the proxy does not read.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review completed against the latest diff

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread website/docs/docs/security-trust.md Resolved
Comment thread src/commands/schema/cli-help.ts Resolved
thymikee and others added 2 commits November 28, 2026 13:57
Login judges the URL it reads, and a refresh judges the stored issuer, before
either sends. This keeps auth-session.ts within the file line cap.

The ticket tests now assert that no request opens to the ticket host, and the
Metro test asserts the bearer it is judging. The docs limit the loopback claim
to the daemon and proxy listeners, and the CLI help says which process reads the
override.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Re-exporting it from an existing subpath would load the rule eagerly in every
importer: 43 entry closures grow through diagnostics, 9 through transport.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 5537b6e

No open findings.

2 findings below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (411b2a746e60).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

This branch has not been deployed

No deployments
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