Skip to content

fix(security): authenticate local wallet HTTP API across localhost, webview, desktop, and Android - #252

Open
NubsCarson wants to merge 1 commit into
IQCoreTeam:mainfrom
NubsCarson:codex/agentnet-local-wallet-auth
Open

NubsCarson wants to merge 1 commit into
IQCoreTeam:mainfrom
NubsCarson:codex/agentnet-local-wallet-auth

Conversation

@NubsCarson

Copy link
Copy Markdown
Contributor

Summary

Require a per-launch 256-bit bearer capability on local wallet HTTP endpoints (/session, /events, and /rpc), delivered via an owner-only launch URL file ($AGENTNET_HOME/localhost-auth/<port>.url) instead of unauthenticated localhost HTTP endpoints or cookies.

Changes

  • Localhost server (surfaces/localhost): Bind to 127.0.0.1, enforce Host, Origin, Sec-Fetch-Site, Cache-Control: no-store, and constant-time Bearer checks in src/httpAuth.ts, and document the launch flow in surfaces/localhost/README.md.
  • Webview transport and state (surfaces/webview): Capture the launch fragment into origin-scoped sessionStorage, strip it from browser history, authenticate fetch-based SSE and RPC requests, fail closed to a localAuth lock state that clears revealed secrets on missing or rejected sessions, and update vite.config.ts to forward authenticated /session, /events, and /rpc requests while blocking cross-origin requests.
  • Desktop (Tauri) (surfaces/desktop): Read the private launch file in src-tauri/src/local_session.rs and verify GET /session before opening the UI.
  • Android (surfaces/android): Update MainActivity, ServerManager, RpcClient, and NotifActionReceiver to read the private launch file and authenticate GET /session and notification RPC actions.
  • Tests: Add localhost HTTP and transport security regression tests (surfaces/localhost/test/http-security.test.ts) and webview reducer lock-state tests (surfaces/webview/src/state/store.spec.tsx).

Verification

  • Full .github/workflows/ci.yml (test-and-build): PASS (agent-sdk 581 passed / 5 skipped, webview 26/26 passed + build, all tsc --noEmit, CLI and MCP builds)
  • pnpm --filter agentnet-localhost test: 5/5 PASS + live localhost server E2E smoke test PASS
  • Desktop Rust: cargo test PASS
  • Android: compileDebugKotlin PASS

…ebview, desktop, and Android

Require a per-launch 256-bit bearer capability on localhost /session,
/events, and /rpc endpoints, delivered via an owner-only launch URL file
under $AGENTNET_HOME/localhost-auth/<port>.url instead of unauthenticated
HTTP endpoints or cookies.

- Bind surfaces/localhost to 127.0.0.1 and enforce Host, Origin,
  Sec-Fetch-Site, no-store, and constant-time Bearer checks in httpAuth.
- Update surfaces/webview Transport to capture the launch fragment into
  origin-scoped sessionStorage, strip it from history, authenticate
  fetch-based SSE and RPC requests, and fail closed to a localAuth lock
  state that clears revealed secrets on missing or rejected sessions.
- Update Vite dev proxy to forward authenticated /session, /events, and
  /rpc requests while blocking cross-origin requests.
- Update Desktop (Tauri) and Android wrappers (plus Android notification
  RPC actions) to read the private launch file and verify GET /session
  before opening the UI.
- Add localhost HTTP and transport security regression tests, webview
  reducer lock-state tests, and surfaces/localhost/README.md.
Copilot AI balanced review requested due to automatic review settings December 2, 2026 03:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

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.

2 participants