[GH-ISSUE #1538] [Issue]: Several file upload paths read entire files before caller-specific size preflight #783

Closed
opened 2026-10-20 17:33:20 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Xelvanis on GitHub (May 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1538

Originally assigned to: @Romuromylus on GitHub.

Summary

Shared file payload conversion now supports caller-side maxBytes preflight, and image/background/lorebook paths use it. Several non-image/import paths still read or base64 whole files without a caller-specific max.

Expected behavior

Every upload/import caller should enforce a domain-appropriate size limit before reading the full file into memory.

Actual behavior

fileToUploadPayload accepts maxBytes, but formDataToJson, import API file import paths, and gameAssetsApi.upload still call it without a caller-specific limit. GameInput also keeps its own FileReader path.

Steps to reproduce

  1. Attempt a large file through a non-image import, FormData conversion, game asset upload, or GameInput path.
  2. Observe whether the caller rejects by size before arrayBuffer()/FileReader reads the full file.
  3. Compare to image/background/lorebook paths that already pass maxBytes.

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; read-only failpath audit finding
  • Run mode: upload/import paths; focused native repro still needed
  • OS + version: not verified
  • Node + pnpm versions: not relevant yet
  • Rust version, if relevant: not verified
  • Remote Runtime URL configured? not verified
  • Provider, model, or integration, if relevant: not relevant

Logs, screenshots, or video

No screenshot attached.

Regression notes

Unknown.

Additional context

Suggested direction: add explicit maxBytes limits for import/game-asset/FormData upload callers or route them through domain wrappers that enforce preflight before arrayBuffer().

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 @Xelvanis on GitHub (May 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1538 Originally assigned to: @Romuromylus on GitHub. ## Summary Shared file payload conversion now supports caller-side `maxBytes` preflight, and image/background/lorebook paths use it. Several non-image/import paths still read or base64 whole files without a caller-specific max. ## Expected behavior Every upload/import caller should enforce a domain-appropriate size limit before reading the full file into memory. ## Actual behavior `fileToUploadPayload` accepts `maxBytes`, but `formDataToJson`, import API file import paths, and `gameAssetsApi.upload` still call it without a caller-specific limit. `GameInput` also keeps its own `FileReader` path. ## Steps to reproduce 1. Attempt a large file through a non-image import, FormData conversion, game asset upload, or `GameInput` path. 2. Observe whether the caller rejects by size before `arrayBuffer()`/`FileReader` reads the full file. 3. Compare to image/background/lorebook paths that already pass `maxBytes`. ## Impact area - [ ] App shell, navigation, startup, or providers - [ ] Catalog resources - [ ] Chat mode - [ ] Roleplay mode - [x] 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 - [x] 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; read-only failpath audit finding - Run mode: upload/import paths; focused native repro still needed - OS + version: not verified - Node + pnpm versions: not relevant yet - Rust version, if relevant: not verified - Remote Runtime URL configured? not verified - Provider, model, or integration, if relevant: not relevant ## Logs, screenshots, or video No screenshot attached. ## Regression notes Unknown. ## Additional context Suggested direction: add explicit `maxBytes` limits for import/game-asset/FormData upload callers or route them through domain wrappers that enforce preflight before `arrayBuffer()`. ## 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-20 17:33:20 +07:00
Author
Owner

@Romuromylus commented on GitHub (May 30, 2026):

Fixed by #1640, merged into refactor.

<!-- gh-comment-id:4582247055 --> @Romuromylus commented on GitHub (May 30, 2026): Fixed by #1640, merged into `refactor`.
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#783
No description provided.