[PR #3826] [MERGED] Harden host folder and Giphy failure paths #6119

Closed
opened 2026-10-23 04:07:15 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3826
Author: @Xelvanis
Created: 7/19/2026
Status: ✅ Merged
Merged: 7/19/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/host-folder-and-giphy-hardening


📝 Commits (2)

  • d7c6437 Harden host folder and Giphy failure paths
  • 646e4b2 Address Giphy and folder action review feedback

📊 Changes

9 files changed (+151 additions, -57 deletions)

View changed files

📝 packages/client/src/components/agents/AgentEditor.tsx (+10 -10)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+15 -4)
📝 packages/client/src/hooks/use-game-assets.ts (+2 -2)
📝 packages/client/src/hooks/use-scene-analysis.ts (+1 -2)
📝 packages/client/src/lib/host-device.ts (+7 -0)
➕ packages/server/src/lib/open-folder-in-file-manager.ts (+22 -0)
📝 packages/server/src/routes/fonts.routes.ts (+10 -8)
📝 packages/server/src/routes/game-assets.routes.ts (+8 -5)
📝 packages/server/src/routes/gifs.routes.ts (+76 -26)

📄 Description

Linked issue

Closes #3824
Closes #3825

Why this change

  • Native folder routes could launch Explorer, Finder, or xdg-open for authenticated or trusted non-loopback clients and return absolute host paths.
  • The Giphy proxy relied on ambient Undici timeouts and loosely trusted upstream response shapes.

What changed

  • Gate Fonts and Game Assets folder routes with loopback-only privileged access and share a detached native file-manager launcher.
  • Route client folder actions through host-device-aware helpers with a typed cancellation error, avoiding duplicate or misleading toasts.
  • Add a 12-second Giphy timeout, stable 504/502 error mapping, and response validation.
  • Remove ignored debugMode and streaming inputs from the scene-analysis hook API.

Validation

  • pnpm check passes locally
  • Container behavior checked, if applicable
  • Ran the app and clicked through the changes manually
  • Checked relevant edge cases and error paths
  • Read and followed CONTRIBUTING.md

Validation notes

  • pnpm check passed on the final branch based directly on the latest origin/staging.
  • In Chrome, a trusted non-loopback localtest.me client received the host-only message for Fonts and Game Assets; Game Assets did not also show the generic failure toast.
  • A seeded conversation exercised the GIF picker missing-key state with no browser console errors; the seeded chats were removed afterward.
  • On Windows, the detached file-manager helper resolved after launch and both local folder endpoints returned 200 instead of treating Explorer exit code 1 as failure.
  • Configured-key timeout and malformed-response behavior were exercised with focused route mocks, not live Giphy traffic.

Docs and release impact

No documentation or release metadata changes are needed. Existing user-facing behavior remains the same except for safer access boundaries and clearer upstream failure responses.

UI evidence (if applicable)

No screenshots attached. The affected UI behavior consists of guard and error states exercised manually.

Summary by CodeRabbit

  • New Features

    • Added support for opening Game Assets and Fonts folders using the system file manager.
    • Added clear feedback when folder-opening actions succeed or fail.
  • Bug Fixes

    • Improved handling when folder access is unavailable or restricted.
    • Strengthened GIF search response validation and added timeout handling for more reliable results.
    • Folder-opening failures now return clear errors instead of failing silently.
  • Security

    • Restricted folder-opening actions to authorized local access.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/3826 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 7/19/2026 **Status:** ✅ Merged **Merged:** 7/19/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/host-folder-and-giphy-hardening` --- ### 📝 Commits (2) - [`d7c6437`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d7c6437b0ac00a605eeb4314e2a534a8cb47d899) Harden host folder and Giphy failure paths - [`646e4b2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/646e4b208c735e0286efb50a9691afc75bf134ce) Address Giphy and folder action review feedback ### 📊 Changes **9 files changed** (+151 additions, -57 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/agents/AgentEditor.tsx` (+10 -10) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+15 -4) 📝 `packages/client/src/hooks/use-game-assets.ts` (+2 -2) 📝 `packages/client/src/hooks/use-scene-analysis.ts` (+1 -2) 📝 `packages/client/src/lib/host-device.ts` (+7 -0) ➕ `packages/server/src/lib/open-folder-in-file-manager.ts` (+22 -0) 📝 `packages/server/src/routes/fonts.routes.ts` (+10 -8) 📝 `packages/server/src/routes/game-assets.routes.ts` (+8 -5) 📝 `packages/server/src/routes/gifs.routes.ts` (+76 -26) </details> ### 📄 Description ## Linked issue Closes #3824 Closes #3825 ## Why this change - Native folder routes could launch Explorer, Finder, or `xdg-open` for authenticated or trusted non-loopback clients and return absolute host paths. - The Giphy proxy relied on ambient Undici timeouts and loosely trusted upstream response shapes. ## What changed - Gate Fonts and Game Assets folder routes with loopback-only privileged access and share a detached native file-manager launcher. - Route client folder actions through host-device-aware helpers with a typed cancellation error, avoiding duplicate or misleading toasts. - Add a 12-second Giphy timeout, stable 504/502 error mapping, and response validation. - Remove ignored `debugMode` and `streaming` inputs from the scene-analysis hook API. ## Validation - [x] `pnpm check` passes locally - [ ] Container behavior checked, if applicable - [x] Ran the app and clicked through the changes manually - [x] Checked relevant edge cases and error paths - [x] Read and followed `CONTRIBUTING.md` ### Validation notes - `pnpm check` passed on the final branch based directly on the latest `origin/staging`. - In Chrome, a trusted non-loopback `localtest.me` client received the host-only message for Fonts and Game Assets; Game Assets did not also show the generic failure toast. - A seeded conversation exercised the GIF picker missing-key state with no browser console errors; the seeded chats were removed afterward. - On Windows, the detached file-manager helper resolved after launch and both local folder endpoints returned 200 instead of treating Explorer exit code 1 as failure. - Configured-key timeout and malformed-response behavior were exercised with focused route mocks, not live Giphy traffic. ## Docs and release impact No documentation or release metadata changes are needed. Existing user-facing behavior remains the same except for safer access boundaries and clearer upstream failure responses. ## UI evidence (if applicable) No screenshots attached. The affected UI behavior consists of guard and error states exercised manually. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for opening Game Assets and Fonts folders using the system file manager. * Added clear feedback when folder-opening actions succeed or fail. * **Bug Fixes** * Improved handling when folder access is unavailable or restricted. * Strengthened GIF search response validation and added timeout handling for more reliable results. * Folder-opening failures now return clear errors instead of failing silently. * **Security** * Restricted folder-opening actions to authorized local access. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:07:15 +07:00
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#6119
No description provided.