Skip to content

fix(openrouter): isolate custom proxy credentials and transport security - #118773

Merged
steipete merged 2 commits into
mainfrom
codex/qa0803-openrouter-catalog-proxy-boundary
Aug 3, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/qa0803-openrouter-catalog-proxy-boundary

Conversation

@steipete

@steipete steipete commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Actual configured HTTPS origin and HTTP CONNECT proxy proof

Ran the actual OpenRouter buildOpenrouterLiveProvider, fetchOpenRouterUsage, and speech synthesis owner against an ephemeral local HTTPS server through a real ephemeral HTTP CONNECT corporate proxy, using real Undici guarded dispatch and a temporary in-memory self-signed certificate. No external network, user credential, or persisted certificate was accessed.

{"externalNetwork":false,"realHttpsLoopback":true,"realHttpConnectProxy":true,"sameConfiguredOrigin":true,"catalogContainsLiveModel":true,"receivedPaths":["/api/v1/models","/api/v1/credits","/api/v1/key","/api/v1/audio/speech"],"catalogAndUsageHaveConfiguredProxyAuth":true,"speechBearerScopedToConfiguredOrigin":true,"speechAudioBytes":4,"unknownBearerEscaped":false,"proxyConnectTunnels":4,"ambientFetchCalls":0,"usageBalance":3,"syntheticDnsLookups":6,"explicitDenyAdditionalRequests":0,"explicitDenyAdditionalTunnels":0,"explicitDenyOutcome":"Usage unavailable"}

This is an actual TLS transport, actual corporate CONNECT proxy, actual configured dispatcher/selected credentials, and actual provider catalog/usage owner; explicit private-network denial provably establishes zero additional connections. Six existing mocked-fetch test annotations are being aligned with the public fetch signature; production code remains unchanged.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 1:25 PM ET / 17:25 UTC.

ClawSweeper review

What this changes

The PR makes OpenRouter catalog discovery, dynamic models, usage reporting, and speech use a configured OpenRouter-compatible proxy origin and request transport policy instead of sending those credentialed calls to the public OpenRouter endpoint.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this PR open for explicit maintainer review. Current main still hard-codes OpenRouter catalog, dynamic-model, and usage requests to the public origin, while the submitted patch consistently carries the configured destination and transport policy; the PR body now includes strong redacted terminal proof of the fixed real transport path. The security-sensitive behavior change and protected maintainer label mean it should not be auto-closed or auto-merged, and this checkout could not refresh the complete exact-head blob diff because its partial clone could not reach GitHub.

Priority: P0
Reviewed head: 2665fed0f55a4a7e27a7027564579a0fd787d6b4
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong real transport proof and focused coverage support the repair, while the complete current-head source diff still needs a refreshed maintainer inspection because this partial clone could not fetch all PR objects.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The current PR body contains inspectable redacted terminal output from an after-fix loopback HTTPS and real HTTP CONNECT proxy run covering catalog, usage, key, and speech paths with explicit denial checks.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The current PR body contains inspectable redacted terminal output from an after-fix loopback HTTPS and real HTTP CONNECT proxy run covering catalog, usage, key, and speech paths with explicit denial checks.
Evidence reviewed 8 items Current catalog path ignores configured destination: Current main constructs live catalog discovery with the fixed public /models endpoint and a fallback provider base URL, so a configured OpenRouter-compatible origin cannot own catalog traffic.
Current dynamic, catalog, and usage callers bypass custom configuration: The current dynamic-model builder uses OPENROUTER_BASE_URL; catalog invocation passes only credentials; and the usage snapshot passes no provider base URL or request policy.
Current usage owner targets the public API root: Current usage code declares the fixed public OpenRouter API root, confirming the reported credential-destination mismatch is source-reproducible on main.
Findings None None.
Security None None.

How this fits together

The bundled OpenRouter provider turns model-provider configuration into catalog, inference-model, usage, and text-to-speech HTTP calls. Those calls must retain the selected endpoint, credentials, proxy settings, and SSRF policy so a custom OpenRouter-compatible service receives its own traffic without leaking credentials or bypassing configured transport controls.

flowchart LR
  A[OpenRouter provider configuration] --> B[Validated request policy]
  B --> C[Catalog discovery]
  B --> D[Dynamic model resolution]
  B --> E[Usage and speech requests]
  C --> F[Configured OpenRouter-compatible origin]
  D --> F
  E --> F
  F --> G[Guarded HTTPS and proxy transport]
Loading

Decision needed

Question Recommendation
Should the maintainer accept the PR's changed behavior as the supported upgrade path for existing OpenRouter custom-proxy configurations after an exact-head security review is refreshed? Pause for exact-head review: Restore source access, inspect the complete current-head diff and merge result, then confirm the custom-origin behavior before merging.

Why: The patch deliberately changes where existing custom-endpoint credentials and transport settings are applied; that is the intended repair, but it is a provider security and compatibility contract that needs owner acceptance rather than automated policy selection.

Before merge

  • Resolve merge risk (P1) - Existing custom OpenRouter-compatible configurations will intentionally redirect catalog, usage, and speech calls from the public endpoint to their configured origin; the merge should retain the demonstrated default-origin behavior and recheck the exact current head after source access is restored.
  • Resolve merge risk (P1) - The local partial clone could not fetch all PR blobs or its base objects because GitHub was unreachable, so this review cannot independently regenerate the complete exact-head diff or a three-way merge result.
  • Complete next step (P2) - The repair appears sound and has real behavior proof, but a protected maintainer-labeled auth and security boundary change needs an owner to refresh the complete exact-head review before merge.
Agent review details

Security

None.

PR surface

Source +132, Tests +696. Total +828 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 159 27 +132
Tests 4 697 1 +696
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 856 28 +828

Review metrics

Metric Value Why it matters
Production vs test delta production +132, tests +696 The production growth implements one cross-path credential and transport owner boundary, with most of the change devoted to regression and proxy-policy coverage.

Merge-risk options

Maintainer options:

  1. Pause for a refreshed security review (recommended)
    Do not merge until the full exact-head source diff and current merge result can be inspected for credential, dispatcher, and SSRF-policy consistency.
  2. Accept the custom-endpoint contract
    A maintainer may merge after accepting that existing custom OpenRouter endpoints now receive catalog, usage, and speech credentials as well as inference traffic.

Technical review

Best possible solution:

Use one validated configured OpenRouter API origin and the existing shared HTTP/SSRF request-policy seams for every credentialed OpenRouter path, then land only after the security owner refreshes the full exact-head review against current main.

Do we have a high-confidence way to reproduce the issue?

Yes, source inspection gives a high-confidence current-main path: catalog, dynamic-model, and usage owners hard-code the public OpenRouter destination even when a provider configuration can carry a custom base URL and request policy. The PR body also supplies an after-fix loopback TLS and CONNECT-proxy run for the repaired paths.

Is this the best way to solve the issue?

Yes, the submitted direction is the maintainable fix: it moves each credentialed OpenRouter owner onto the existing configured HTTP-request and SSRF-policy seams instead of adding downstream credential guards or a separate proxy implementation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8406cfeac162.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The current PR body contains inspectable redacted terminal output from an after-fix loopback HTTPS and real HTTP CONNECT proxy run covering catalog, usage, key, and speech paths with explicit denial checks.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The current PR body contains inspectable redacted terminal output from an after-fix loopback HTTPS and real HTTP CONNECT proxy run covering catalog, usage, key, and speech paths with explicit denial checks.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P0: The PR repairs a credential-routing and transport-security boundary that can send custom-endpoint credentials or requests to an unintended origin.
  • merge-risk: 🚨 auth-provider: Merging changes the endpoint and request credentials used by existing custom OpenRouter provider configurations.
  • merge-risk: 🚨 security-boundary: The diff changes SSRF guarding, destination validation, proxy dispatch, and credential scoping for provider HTTP traffic.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The current PR body contains inspectable redacted terminal output from an after-fix loopback HTTPS and real HTTP CONNECT proxy run covering catalog, usage, key, and speech paths with explicit denial checks.
  • proof: sufficient: Contributor real behavior proof is sufficient. The current PR body contains inspectable redacted terminal output from an after-fix loopback HTTPS and real HTTP CONNECT proxy run covering catalog, usage, key, and speech paths with explicit denial checks.

Evidence

What I checked:

  • Current catalog path ignores configured destination: Current main constructs live catalog discovery with the fixed public /models endpoint and a fallback provider base URL, so a configured OpenRouter-compatible origin cannot own catalog traffic. (extensions/openrouter/provider-catalog.ts:168, 8406cfeac162)
  • Current dynamic, catalog, and usage callers bypass custom configuration: The current dynamic-model builder uses OPENROUTER_BASE_URL; catalog invocation passes only credentials; and the usage snapshot passes no provider base URL or request policy. (extensions/openrouter/index.ts:230, 8406cfeac162)
  • Current usage owner targets the public API root: Current usage code declares the fixed public OpenRouter API root, confirming the reported credential-destination mismatch is source-reproducible on main. (extensions/openrouter/usage.ts:10, 8406cfeac162)
  • Shared transport contract supports the proposed owner boundary: The existing shared request resolver merges provider request overrides, produces dispatcher policy, and treats configured custom/local origins as an explicit trust boundary; the submitted patch uses these seams rather than introducing a parallel transport implementation. (src/media-understanding/shared.ts:396, 8406cfeac162)
  • SSRF policy helper constrains the configured origin: The shared SSRF helper derives an allowed origin only from a valid HTTP(S) base URL, matching the PR's stated configured-origin policy approach. (src/infra/net/ssrf.ts:186, 8406cfeac162)
  • After-fix real behavior proof: The PR body includes copied terminal output from a real loopback TLS server and HTTP CONNECT proxy covering /models, /credits, /key, and /audio/speech; it reports four proxy tunnels, scoped credentials, no ambient fetch calls, and no additional denied connections. (2665fed0f55a)

Likely related people:

  • steipete: Authored the two commits at the current PR head; shallow current-main blame also maps the baseline OpenRouter owner files to Peter Steinberger, though the truncated history prevents stronger feature-introduction attribution. (role: recent OpenRouter boundary contributor; confidence: medium; commits: 90ea59627290, 2665fed0f55a, 06957a69d867; files: extensions/openrouter/provider-catalog.ts, extensions/openrouter/index.ts, extensions/openrouter/usage.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh the complete exact-head diff and merge result once GitHub source retrieval is available.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-03T16:50:25.246Z sha 90ea596 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 3, 2026
@steipete
steipete merged commit 830ab16 into main Aug 3, 2026
99 of 106 checks passed
@steipete
steipete deleted the codex/qa0803-openrouter-catalog-proxy-boundary branch August 3, 2026 17:32
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 3, 2026
* origin/main: (25 commits)
  test(qa): cover plugin authoring contracts (#118821)
  fix(parallels): keep provider keys out of POSIX job logs (#118840)
  improve: reduce redundant Code Mode test work (#118815)
  fix(models): report primary OpenRouter limits in scans (#110855)
  test: speed up setup inference fixtures (#118811)
  fix(auto-reply): enforce canonical reset authorization (#118580)
  docs(gateway): fix invalid heartbeat visibility examples (#118827)
  fix(plugins): unify HTTP route conflict handling (#118203)
  test(agents): use prepared auth fixtures (#118816)
  fix(lmstudio): resolve JIT embedding variants
  fix(lmstudio): preserve embedding preload and model identity
  fix(ai): reject binary Codex websocket frames (#111138)
  fix(deps): bump brace-expansion override to 5.0.9 for HIGH advisory 1130705 (#118804)
  feat(cli): add session archive and delete commands (#118791)
  fix(openai): commit eligible final realtime transcription audio safely (#118782)
  fix(reef): restrict management commands to owners [AI] (#118578)
  fix(google): honor Cloud SDK credential location and Vertex billing project (#118745)
  fix(bedrock): preserve private embedding endpoints and AWS routing policy (#118744)
  fix(voice): make signed callback replay reservations durable and retryable (#118754)
  fix(openrouter): isolate custom proxy credentials and transport security (#118773)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
…ity (openclaw#118773)

* fix(openrouter): confine custom endpoint credentials and transport policy

* test(openrouter): preserve typed fetch arguments in proxy fixtures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: openrouter maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant