[GH-ISSUE #2390] [Issue]: 10-CONN-ERROR-config-url-and-provider-error-safety config fetches allow private URLs and unbounded error bodies #1178

Closed
opened 2026-10-21 05:28:23 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Jun 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2390

Originally assigned to: @Promansis on GitHub.

Summary

Surface 10-CONN-ERROR-config-url-and-provider-error-safety from #2384 has a confirmed parity gap. Refactor connection model/test config fetches allow private/local URLs by default and read provider responses before truncating.

Expected behavior

Legacy config model/test fetches use outbound URL policy: allow loopback, block private/LAN/reserved targets unless the provider/image local URL opt-in allows them, validate redirects, cap response bytes, and sanitize provider HTML/error bodies.

Actual behavior

Refactor model/test URL checks call is_allowed_outbound_url(url, true), which allows any http or https local/private target. Refactor redacts and truncates displayed errors, but model/test/image response paths read full .text() or .bytes() before truncation, so legacy response caps are missing.

Steps to reproduce

  1. Inspect Target 10 surface 10-CONN-ERROR-config-url-and-provider-error-safety in #2384.
  2. Compare legacy safeFetch policy and caps against refactor Rust connection model/test helpers.
  3. Observe refactor config fetches use allow-local URL checks and uncapped response reads before sanitization.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: refactor parityscan, 2026-06-06
  • Run mode: Tauri desktop / remote runtime config command surface
  • OS + version: not relevant; static parityscan
  • Node + pnpm versions: not relevant; static parityscan
  • Rust version, if relevant: not captured
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: connection model/test URL fetches and image provider config fetches

Logs, screenshots, or video

Static proof only; no live provider request was made.

Legacy proof:

  • upstream/main:packages/server/src/routes/connections.routes.ts:106 builds provider/image local URL policy with loopback allowed and private/local gated by env flags.
  • upstream/main:packages/server/src/routes/connections.routes.ts:119 normalizes image loopback test base URLs.
  • upstream/main:packages/server/src/routes/connections.routes.ts:500, :632, :641 use safeFetch with policy and 5 MiB caps for config model fetches.
  • upstream/main:packages/server/src/utils/security.ts:309, :340, :372, :533 validate outbound URLs/redirects and cap buffered/streaming responses.

Refactor proof:

  • src-tauri/src/commands/storage/llm.rs:634, :866, :1060, :1389, :1404 send connection/model fetch requests, allow local URLs, read full text, then sanitize displayed body.
  • src-tauri/crates/security/src/lib.rs:83 returns true for any http/https URL when allow_local is true.
  • src-tauri/crates/llm/src/lib.rs:369, :1260, :1280, :4060 allow local provider URLs and sanitize/redact provider errors after reading full text.
  • src-tauri/src/commands/storage/images/providers.rs:441, :490, :602 sanitize image provider errors after reading full text/bytes.

Regression notes

Legacy upstream/main has safer config URL policy and response caps. Refactor currently lacks those guards on this surface.

Additional context

Linked tracker: #2384

Acceptance criteria:

  • Preserve exact surface ID 10-CONN-ERROR-config-url-and-provider-error-safety in fix notes or PR proof.
  • Refactor connection model/test config fetches reject private/LAN/reserved outbound URLs by default while still allowing intended loopback/local provider cases.
  • Local/private provider opt-ins are explicit and provider-scoped, matching legacy intent.
  • Redirect targets are validated under the same policy.
  • Model/test/image config responses have bounded reads before body parsing/sanitization.
  • Provider error messages continue to redact secrets and avoid dumping HTML bodies.
  • Verification uses static/unit or focused harness proof only; live provider transport remains Target 11 unless separately requested.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Jun 6, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2390 Originally assigned to: @Promansis on GitHub. ## Summary Surface `10-CONN-ERROR-config-url-and-provider-error-safety` from #2384 has a confirmed parity gap. Refactor connection model/test config fetches allow private/local URLs by default and read provider responses before truncating. ## Expected behavior Legacy config model/test fetches use outbound URL policy: allow loopback, block private/LAN/reserved targets unless the provider/image local URL opt-in allows them, validate redirects, cap response bytes, and sanitize provider HTML/error bodies. ## Actual behavior Refactor model/test URL checks call `is_allowed_outbound_url(url, true)`, which allows any `http` or `https` local/private target. Refactor redacts and truncates displayed errors, but model/test/image response paths read full `.text()` or `.bytes()` before truncation, so legacy response caps are missing. ## Steps to reproduce 1. Inspect Target 10 surface `10-CONN-ERROR-config-url-and-provider-error-safety` in #2384. 2. Compare legacy `safeFetch` policy and caps against refactor Rust connection model/test helpers. 3. Observe refactor config fetches use allow-local URL checks and uncapped response reads before sanitization. ## Impact area <!-- Check the areas you think are relevant. Leave uncertain items unchecked. --> - [ ] App shell, navigation, startup, or providers - [ ] Catalog resources - [ ] Chat mode - [ ] Roleplay mode - [ ] Game mode - [ ] Shared mode UI - [ ] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: `refactor` parityscan, 2026-06-06 - Run mode: Tauri desktop / remote runtime config command surface - OS + version: not relevant; static parityscan - Node + pnpm versions: not relevant; static parityscan - Rust version, if relevant: not captured - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: connection model/test URL fetches and image provider config fetches ## Logs, screenshots, or video Static proof only; no live provider request was made. Legacy proof: - `upstream/main:packages/server/src/routes/connections.routes.ts:106` builds provider/image local URL policy with loopback allowed and private/local gated by env flags. - `upstream/main:packages/server/src/routes/connections.routes.ts:119` normalizes image loopback test base URLs. - `upstream/main:packages/server/src/routes/connections.routes.ts:500`, `:632`, `:641` use `safeFetch` with policy and 5 MiB caps for config model fetches. - `upstream/main:packages/server/src/utils/security.ts:309`, `:340`, `:372`, `:533` validate outbound URLs/redirects and cap buffered/streaming responses. Refactor proof: - `src-tauri/src/commands/storage/llm.rs:634`, `:866`, `:1060`, `:1389`, `:1404` send connection/model fetch requests, allow local URLs, read full text, then sanitize displayed body. - `src-tauri/crates/security/src/lib.rs:83` returns true for any `http`/`https` URL when `allow_local` is true. - `src-tauri/crates/llm/src/lib.rs:369`, `:1260`, `:1280`, `:4060` allow local provider URLs and sanitize/redact provider errors after reading full text. - `src-tauri/src/commands/storage/images/providers.rs:441`, `:490`, `:602` sanitize image provider errors after reading full text/bytes. ## Regression notes Legacy `upstream/main` has safer config URL policy and response caps. Refactor currently lacks those guards on this surface. ## Additional context Linked tracker: #2384 Acceptance criteria: - Preserve exact surface ID `10-CONN-ERROR-config-url-and-provider-error-safety` in fix notes or PR proof. - Refactor connection model/test config fetches reject private/LAN/reserved outbound URLs by default while still allowing intended loopback/local provider cases. - Local/private provider opt-ins are explicit and provider-scoped, matching legacy intent. - Redirect targets are validated under the same policy. - Model/test/image config responses have bounded reads before body parsing/sanitization. - Provider error messages continue to redact secrets and avoid dumping HTML bodies. - Verification uses static/unit or focused harness proof only; live provider transport remains Target 11 unless separately requested. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:28:23 +07:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1178
No description provided.