[PR #4973] [MERGED] security: harden profile import trust boundaries #6563

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4973
Author: @SpicyMarinara
Created: 8/13/2026
Status: ✅ Merged
Merged: 8/13/2026
Merged by: @SpicyMarinara

Base: staging ← Head: agent/profile-import-security-followup


📝 Commits (9)

  • 108c155 security: expose quarantined profile content
  • ac04ca0 security: quarantine untrusted profile state
  • 21325d2 chore: keep profile security diff focused
  • 1a731e6 security: require review for imported endpoints
  • 44aaa43 security: harden active media validation
  • 45dd779 security: keep imported endpoints quarantined
  • 5353fc7 security: apply profile import review fixes
  • 8caa6fc security: close profile import review findings
  • ee380d0 security: stream validated media descriptors

📊 Changes

26 files changed (+1986 additions, -237 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 package.json (+3 -1)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+54 -51)
📝 packages/client/src/lib/card-css.ts (+89 -14)
➕ packages/client/src/lib/profile-import-warnings.ts (+54 -0)
📝 packages/client/src/localization/locales/en.json (+11 -0)
📝 packages/server/src/db/schema/connections.ts (+2 -0)
📝 packages/server/src/routes/avatars.routes.ts (+16 -24)
📝 packages/server/src/routes/backgrounds.routes.ts (+16 -15)
📝 packages/server/src/routes/backup.routes.ts (+309 -37)
📝 packages/server/src/routes/characters.routes.ts (+21 -4)
📝 packages/server/src/routes/custom-emojis.routes.ts (+21 -7)
📝 packages/server/src/routes/custom-stickers.routes.ts (+21 -7)
📝 packages/server/src/routes/gallery.routes.ts (+24 -6)
📝 packages/server/src/routes/game-assets.routes.ts (+47 -11)
📝 packages/server/src/routes/game.routes.ts (+8 -3)
📝 packages/server/src/routes/global-gallery.routes.ts (+7 -3)
📝 packages/server/src/routes/knowledge-sources.routes.ts (+26 -4)
📝 packages/server/src/routes/sprites.routes.ts (+20 -19)
📝 packages/server/src/services/import/profile-import-assets.ts (+62 -3)

...and 6 more files

📄 Description

Why

A crafted Marinara profile could carry active or misleading state across the import trust boundary. The demonstrated v2.4.1 chain executed an enabled custom script on the first chat generation after import; staging already replaced that host node:vm path and quarantines imported executable tools. This follow-up closes the remaining profile-import paths without removing profile, extension, theme, asset, or Professor Mari capabilities.

No public issue is linked because this is a maintainer-requested security hardening follow-up.

What changes

  • disclose executable tools, personal extensions, and Professor Mari memories in the import preview
  • quarantine imported executable/persistent state and active themes for deliberate re-enabling
  • keep saved credentials bound to the provider endpoint they were created for
  • validate imported media and metadata before serving, exporting, or deleting files
  • preserve CSS token boundaries so removed syntax cannot reassemble into active rules
  • apply bounded archive metadata and entry limits while retaining large profile support

Test plan

  • Import a normal JSON profile and verify expected data is restored.
  • Import a normal ZIP profile with images, audio, themes, and knowledge sources.
  • Verify quarantined tools, extensions, memories, and themes remain available for deliberate review/re-enabling.
  • Verify an existing connection keeps its credential only when its provider identity is unchanged.
  • Verify rejected active/non-media profile assets cannot execute in the Engine origin.
  • Run the focused profile-import, asset, and theme security regressions.
  • Run pnpm check.

Summary by CodeRabbit

  • Security Improvements

    • Strengthened profile imports with archive limits and quarantine protections for credentials, tools, extensions, instructions, themes, and unsafe assets.
    • Added validation for uploaded and served images, videos, SVGs, stickers, emojis, avatars, galleries, and game assets.
    • Improved protection against unsafe file paths, executable content, malicious theme CSS, and unreviewed imported connections.
    • Invalid or unsafe media now returns a not-found response instead of being served.
  • User Experience

    • Profile-import summaries now include additional content types and clearly localized warnings when items are quarantined.

🔄 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/4973 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 8/13/2026 **Status:** ✅ Merged **Merged:** 8/13/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/profile-import-security-followup` --- ### 📝 Commits (9) - [`108c155`](https://github.com/Pasta-Devs/Marinara-Engine/commit/108c155ec778f12d2bc089fb78cb904e855e8e46) security: expose quarantined profile content - [`ac04ca0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ac04ca0b3930c6dfe6c14da547081ae76d9d414f) security: quarantine untrusted profile state - [`21325d2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/21325d2794e043152396f7dd014a7b598ddff29e) chore: keep profile security diff focused - [`1a731e6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1a731e650e7f1ed0c917b7cd360896b8584bdbf7) security: require review for imported endpoints - [`44aaa43`](https://github.com/Pasta-Devs/Marinara-Engine/commit/44aaa435a797c3dcd96ca9a1445661c5037fba35) security: harden active media validation - [`45dd779`](https://github.com/Pasta-Devs/Marinara-Engine/commit/45dd77991793eeb312c35a9a5ee7339eb205af5e) security: keep imported endpoints quarantined - [`5353fc7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5353fc72453ff933535d43aa7a0c0431a8166e9a) security: apply profile import review fixes - [`8caa6fc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8caa6fc1d018535fd1358c40a4343fea30e25026) security: close profile import review findings - [`ee380d0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ee380d08f9907b3eec28bdb31b382d62da2999f5) security: stream validated media descriptors ### 📊 Changes **26 files changed** (+1986 additions, -237 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `package.json` (+3 -1) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+54 -51) 📝 `packages/client/src/lib/card-css.ts` (+89 -14) ➕ `packages/client/src/lib/profile-import-warnings.ts` (+54 -0) 📝 `packages/client/src/localization/locales/en.json` (+11 -0) 📝 `packages/server/src/db/schema/connections.ts` (+2 -0) 📝 `packages/server/src/routes/avatars.routes.ts` (+16 -24) 📝 `packages/server/src/routes/backgrounds.routes.ts` (+16 -15) 📝 `packages/server/src/routes/backup.routes.ts` (+309 -37) 📝 `packages/server/src/routes/characters.routes.ts` (+21 -4) 📝 `packages/server/src/routes/custom-emojis.routes.ts` (+21 -7) 📝 `packages/server/src/routes/custom-stickers.routes.ts` (+21 -7) 📝 `packages/server/src/routes/gallery.routes.ts` (+24 -6) 📝 `packages/server/src/routes/game-assets.routes.ts` (+47 -11) 📝 `packages/server/src/routes/game.routes.ts` (+8 -3) 📝 `packages/server/src/routes/global-gallery.routes.ts` (+7 -3) 📝 `packages/server/src/routes/knowledge-sources.routes.ts` (+26 -4) 📝 `packages/server/src/routes/sprites.routes.ts` (+20 -19) 📝 `packages/server/src/services/import/profile-import-assets.ts` (+62 -3) _...and 6 more files_ </details> ### 📄 Description ## Why A crafted Marinara profile could carry active or misleading state across the import trust boundary. The demonstrated v2.4.1 chain executed an enabled custom script on the first chat generation after import; staging already replaced that host node:vm path and quarantines imported executable tools. This follow-up closes the remaining profile-import paths without removing profile, extension, theme, asset, or Professor Mari capabilities. No public issue is linked because this is a maintainer-requested security hardening follow-up. ## What changes - disclose executable tools, personal extensions, and Professor Mari memories in the import preview - quarantine imported executable/persistent state and active themes for deliberate re-enabling - keep saved credentials bound to the provider endpoint they were created for - validate imported media and metadata before serving, exporting, or deleting files - preserve CSS token boundaries so removed syntax cannot reassemble into active rules - apply bounded archive metadata and entry limits while retaining large profile support ## Test plan - [ ] Import a normal JSON profile and verify expected data is restored. - [ ] Import a normal ZIP profile with images, audio, themes, and knowledge sources. - [ ] Verify quarantined tools, extensions, memories, and themes remain available for deliberate review/re-enabling. - [ ] Verify an existing connection keeps its credential only when its provider identity is unchanged. - [ ] Verify rejected active/non-media profile assets cannot execute in the Engine origin. - [ ] Run the focused profile-import, asset, and theme security regressions. - [ ] Run pnpm check. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Security Improvements** * Strengthened profile imports with archive limits and quarantine protections for credentials, tools, extensions, instructions, themes, and unsafe assets. * Added validation for uploaded and served images, videos, SVGs, stickers, emojis, avatars, galleries, and game assets. * Improved protection against unsafe file paths, executable content, malicious theme CSS, and unreviewed imported connections. * Invalid or unsafe media now returns a not-found response instead of being served. * **User Experience** * Profile-import summaries now include additional content types and clearly localized warnings when items are quarantined. <!-- 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:11:37 +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#6563
No description provided.