Repository navigation
feat(models): allow private network via models.providers.*.request - #63671
Conversation
Greptile SummaryThis PR adds
Confidence Score: 5/5Safe to merge; the HTTP SSRF guard integration is correct and the WebSocket gap is a no-op, not a regression. All findings are P2. The core sanitize/merge/type/schema changes are correct and well-tested. The WebSocket path gap is inert (no existing guard to break) and does not affect security or correctness of the primary HTTP use case. src/agents/openai-ws-connection.ts —
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e14ee9d5fb
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49fedcf5b0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Patched the PR head with a scoped fix for the review feedback. What changed:
Verification run:
Note: the default commit hook on this branch also hits an unrelated existing branch-wide failure in New head: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f04bb2cdb1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 285d9f97f9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Add optional request.allowPrivateNetwork for operator-controlled self-hosted OpenAI-compatible bases (LAN/overlay/split DNS). Plumbs the flag into resolveProviderRequestPolicyConfig for streaming provider HTTP and OpenAI responses WebSocket so SSRF policy can allow private-resolved model URLs when explicitly enabled. Updates zod schema, config help/labels, and unit tests for sanitize/merge.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc2ce816ac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| apiKey: string; | ||
| baseUrl?: string; | ||
| request?: ProviderRequestTransportOverrides; | ||
| request?: ModelProviderRequestTransportOverrides; |
There was a problem hiding this comment.
Keep runtime-auth request contract to honored transport fields
This change widens ProviderPreparedRuntimeAuth.request to ModelProviderRequestTransportOverrides, which now includes allowPrivateNetwork, but the runtime-auth application path still strips that field (sanitizeRuntimeProviderRequestOverrides keeps only headers/auth in src/agents/provider-request-config.ts) and never reattaches it to the runtime model in applyPreparedRuntimeRequestOverrides (src/agents/pi-embedded-runner/run/auth-controller.ts). In practice, a provider plugin can now return request.allowPrivateNetwork: true (and type-check), yet private baseUrl traffic remains blocked because the flag is silently ignored; the contract should either stay narrow here or this field should be plumbed through the runtime-auth path.
Useful? React with 👍 / 👎.
* feat(models): allow private network via models.providers.*.request Add optional request.allowPrivateNetwork for operator-controlled self-hosted OpenAI-compatible bases (LAN/overlay/split DNS). Plumbs the flag into resolveProviderRequestPolicyConfig for streaming provider HTTP and OpenAI responses WebSocket so SSRF policy can allow private-resolved model URLs when explicitly enabled. Updates zod schema, config help/labels, and unit tests for sanitize/merge. * agents thread provider request into websocket stream * fix(config): scope allowPrivateNetwork to model requests * fix(agents): refresh websocket manager on request changes * fix(agents): scope runtime private-network overrides to models * fix: allow private network provider request opt-in (#63671) (thanks @qas) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
* feat(models): allow private network via models.providers.*.request Add optional request.allowPrivateNetwork for operator-controlled self-hosted OpenAI-compatible bases (LAN/overlay/split DNS). Plumbs the flag into resolveProviderRequestPolicyConfig for streaming provider HTTP and OpenAI responses WebSocket so SSRF policy can allow private-resolved model URLs when explicitly enabled. Updates zod schema, config help/labels, and unit tests for sanitize/merge. * agents thread provider request into websocket stream * fix(config): scope allowPrivateNetwork to model requests * fix(agents): refresh websocket manager on request changes * fix(agents): scope runtime private-network overrides to models * fix: allow private network provider request opt-in (#63671) (thanks @qas) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
* feat(models): allow private network via models.providers.*.request Add optional request.allowPrivateNetwork for operator-controlled self-hosted OpenAI-compatible bases (LAN/overlay/split DNS). Plumbs the flag into resolveProviderRequestPolicyConfig for streaming provider HTTP and OpenAI responses WebSocket so SSRF policy can allow private-resolved model URLs when explicitly enabled. Updates zod schema, config help/labels, and unit tests for sanitize/merge. * agents thread provider request into websocket stream * fix(config): scope allowPrivateNetwork to model requests * fix(agents): refresh websocket manager on request changes * fix(agents): scope runtime private-network overrides to models * fix: allow private network provider request opt-in (openclaw#63671) (thanks @qas) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
* feat(models): allow private network via models.providers.*.request Add optional request.allowPrivateNetwork for operator-controlled self-hosted OpenAI-compatible bases (LAN/overlay/split DNS). Plumbs the flag into resolveProviderRequestPolicyConfig for streaming provider HTTP and OpenAI responses WebSocket so SSRF policy can allow private-resolved model URLs when explicitly enabled. Updates zod schema, config help/labels, and unit tests for sanitize/merge. * agents thread provider request into websocket stream * fix(config): scope allowPrivateNetwork to model requests * fix(agents): refresh websocket manager on request changes * fix(agents): scope runtime private-network overrides to models * fix: allow private network provider request opt-in (openclaw#63671) (thanks @qas) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
* feat(models): allow private network via models.providers.*.request Add optional request.allowPrivateNetwork for operator-controlled self-hosted OpenAI-compatible bases (LAN/overlay/split DNS). Plumbs the flag into resolveProviderRequestPolicyConfig for streaming provider HTTP and OpenAI responses WebSocket so SSRF policy can allow private-resolved model URLs when explicitly enabled. Updates zod schema, config help/labels, and unit tests for sanitize/merge. * agents thread provider request into websocket stream * fix(config): scope allowPrivateNetwork to model requests * fix(agents): refresh websocket manager on request changes * fix(agents): scope runtime private-network overrides to models * fix: allow private network provider request opt-in (openclaw#63671) (thanks @qas) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
* feat(models): allow private network via models.providers.*.request Add optional request.allowPrivateNetwork for operator-controlled self-hosted OpenAI-compatible bases (LAN/overlay/split DNS). Plumbs the flag into resolveProviderRequestPolicyConfig for streaming provider HTTP and OpenAI responses WebSocket so SSRF policy can allow private-resolved model URLs when explicitly enabled. Updates zod schema, config help/labels, and unit tests for sanitize/merge. * agents thread provider request into websocket stream * fix(config): scope allowPrivateNetwork to model requests * fix(agents): refresh websocket manager on request changes * fix(agents): scope runtime private-network overrides to models * fix: allow private network provider request opt-in (openclaw#63671) (thanks @qas) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
* feat(models): allow private network via models.providers.*.request Add optional request.allowPrivateNetwork for operator-controlled self-hosted OpenAI-compatible bases (LAN/overlay/split DNS). Plumbs the flag into resolveProviderRequestPolicyConfig for streaming provider HTTP and OpenAI responses WebSocket so SSRF policy can allow private-resolved model URLs when explicitly enabled. Updates zod schema, config help/labels, and unit tests for sanitize/merge. * agents thread provider request into websocket stream * fix(config): scope allowPrivateNetwork to model requests * fix(agents): refresh websocket manager on request changes * fix(agents): scope runtime private-network overrides to models * fix: allow private network provider request opt-in (openclaw#63671) (thanks @qas) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
* feat(models): allow private network via models.providers.*.request Add optional request.allowPrivateNetwork for operator-controlled self-hosted OpenAI-compatible bases (LAN/overlay/split DNS). Plumbs the flag into resolveProviderRequestPolicyConfig for streaming provider HTTP and OpenAI responses WebSocket so SSRF policy can allow private-resolved model URLs when explicitly enabled. Updates zod schema, config help/labels, and unit tests for sanitize/merge. * agents thread provider request into websocket stream * fix(config): scope allowPrivateNetwork to model requests * fix(agents): refresh websocket manager on request changes * fix(agents): scope runtime private-network overrides to models * fix: allow private network provider request opt-in (openclaw#63671) (thanks @qas) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
Add optional
request.allowPrivateNetworkfor operator-controlled self-hosted OpenAI-compatible bases (LAN/overlay/split DNS). Plumbs the flag intoresolveProviderRequestPolicyConfigfor streaming provider HTTP sofetchWithSsrFGuardcan allow private-resolved model URLs when explicitly enabled. Embedded OpenAI Responses WebSocket uses the samerequestobject (headers/TLS); it does not use the HTTP fetch SSRF stack.Updates zod schema, config help/labels, unit tests for sanitize/merge, and threads provider
requestinto the embedded WebSocket stream path (stream-resolution.ts).Summary
Describe the problem and fix in 2–5 bullets:
If this PR fixes a plugin beta-release blocker, title it
fix(<plugin-id>): beta blocker - <summary>and link the matchingBeta blocker: <plugin-name> - <summary>issue labeledbeta-blocker. Contributors cannot label PRs, so the title is the PR-side signal for maintainers and automation.baseUrlresolves to private/CGNAT addresses were blocked by default SSRF-style protections, with no config-level way to opt in per provider.models.providers.<id>.request.allowPrivateNetwork(sanitized/merged like other request fields), wired throughresolveProviderRequestPolicyConfiginto provider HTTP fetch sofetchWithSsrFGuardrespects the flag whentrue. Embedded OpenAI Responses WebSocket receives the model’srequestviamanagerOptionsfor headers/TLS continuity (not the same SSRF gate as HTTP). SharedConfiguredProviderRequeststill exposes this field on some non-model surfaces that do not forwardrequest.allowPrivateNetworkyet — acknowledged in review; follow-up to narrow schema or wire those paths separately.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write
N/A. If the cause is unclear, writeUnknown.Regression Test Plan (if applicable)
For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write
N/A.src/agents/provider-request-config.test.ts(sanitize + merge behavior forallowPrivateNetwork).requestfields; invalid values do not silently enable private network access.provider-request-config.test.tsas listed above.User-visible / Behavior Changes
List user-visible changes (including defaults/config).
If none, write
None.models.providers.<providerId>.request.allowPrivateNetwork(boolean). When omitted orfalse, behavior matches prior defaults (private-resolved model URLs remain blocked by the HTTP fetch SSRF policy). Whentrue, provider HTTP streaming can reach private-resolved modelbaseUrls viafetchWithSsrFGuard(operator opt-in). OpenAI Responses WebSocket uses the samerequestfor handshake headers/TLS; it does not use that HTTP fetch SSRF path.Diagram (if applicable)
For UI changes or non-trivial logic flows, include a small ASCII diagram reviewers can scan quickly. Otherwise write
N/A.Security Impact (required)
baseUrlresolution to private addresses when explicitly set (HTTP fetch path).Yes, explain risk + mitigation: Risk: misconfiguration could expose traffic to unintended private hosts. Mitigation: default remains off; flag is per-provider and must be set deliberately; operators should only enable for trusted self-hosted bases.Repro + Verification
Environment
engines)baseUrlresolving to RFC1918/CGNAT (or your test harness).models.providers.<id>.baseUrl+models.providers.<id>.request.allowPrivateNetwork: trueSteps
baseUrlandrequest.allowPrivateNetwork: true.buildGuardedModelFetch/fetchWithSsrFGuard). Optionally exercise OpenAI Responses WebSocket; headers/TLS come fromrequest, not the HTTP SSRF gate.Expected
true: model HTTP calls to a trusted privatebaseUrlsucceed when DNS resolves privately (subject to the fetch guard).false/omitted: behavior unchanged from before this PR (private resolution still blocked by policy on HTTP fetch).Actual
Evidence
Attach at least one:
(Adjust checkboxes to what you attach.)
Human Verification (required)
What you personally verified (not just CI), and how:
false,true; invalid inputs rejected or normalized per tests.baseUrlin production-like network (if applicable).Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
models.providers.*.request.Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.allowPrivateNetworkon a provider whosebaseUrlis not fully trusted, widening SSRF exposure to internal networks.baseUrlwhere possible.