[PR #4149] [MERGED] Gate external Agent imports behind permission review #6253

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

📋 Pull Request Information

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

Base: staging ← Head: agent/custom-agent-import-gate


📝 Commits (2)

  • 8b4c901 Gate external Agent imports
  • 16cfa61 fix: address custom agent import review

📊 Changes

23 files changed (+1037 additions, -124 deletions)

View changed files

📝 README.md (+1 -1)
📝 docs/CONFIGURATION.md (+7 -1)
📝 docs/agents/custom-agents.md (+20 -3)
📝 e2e/core-flows.e2e.ts (+144 -0)
📝 packages/client/src/components/agents/AgentEditor.tsx (+90 -4)
📝 packages/client/src/components/agents/CustomAgentRepositoriesModal.tsx (+52 -2)
📝 packages/client/src/components/panels/AgentsPanel.tsx (+261 -38)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+37 -0)
📝 packages/client/src/hooks/use-agents.ts (+31 -1)
📝 packages/client/src/hooks/use-generate.ts (+2 -1)
📝 packages/client/src/lib/agent-transfer.ts (+22 -15)
📝 packages/client/src/localization/locales/en.json (+64 -0)
📝 packages/server/src/routes/agents.routes.ts (+87 -0)
📝 packages/server/src/routes/custom-agent-repositories.routes.ts (+12 -0)
📝 packages/server/src/routes/generate.routes.ts (+11 -4)
📝 packages/server/src/routes/generate/agent-result-capabilities.ts (+8 -23)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+18 -25)
➕ packages/server/src/services/agents/custom-agent-import-policy.service.ts (+16 -0)
📝 packages/server/src/services/agents/custom-agent-repositories.service.ts (+16 -2)
📝 packages/server/src/services/prompt/marker-expander.ts (+13 -1)

...and 3 more files

📄 Description

Linked issue

Closes #4147

Why this change

  • External Agent files, folders, and custom repositories can alter prompts and request side effects, but previously shared the same trust path as locally authored configurations. Users need an explicit opt-in and permission review without losing access to Agents they create themselves or official downloaded Agents.

What changed

  • Added a persisted Allow custom Agent imports toggle above extension imports in Advanced Settings → Danger Zone; it does not require an .env change.
  • Locked file, folder, and custom-repository imports until enabled, with hover/tap guidance in the Agents panel.
  • Added a deny-by-default permission review for imported files and folders, server-side import validation, provenance, credential/tool/write-target stripping, and explicit capability enforcement for Agent result actions.
  • Prevented externally imported Agents and their stored prompt output from running while the toggle is off. Locally authored custom Agents and official downloaded Agents remain available.
  • Sanitized Agent-provided CSS before it reaches the app stylesheet and expanded capability coverage for backgrounds, sprites, media, haptics, About Me updates, interactive choices, and message effects.
  • Updated English localization, README/configuration/custom-Agent documentation, regression coverage, and a mobile browser flow.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Automated evidence gathered while preparing the PR:

  • pnpm check — passed (one pre-existing NoodleHome.tsx hook warning)
  • pnpm localization:check — passed
  • pnpm regression:agent-import-security — passed
  • pnpm regression:docs — passed
  • pnpm exec playwright test -c playwright.config.ts -g "external Agent imports require" — mobile flow passed; desktop project intentionally skipped because the policy is persisted in the shared test server
  • git diff --check — passed

Manual verification notes

  • Manually verify the Danger Zone warning/confirmation and toggle persistence.
  • Manually verify locked import guidance with mouse hover and mobile tap.
  • Manually import Agents with approved and denied capabilities, then disable the gate and confirm imported Agents stop running while locally authored and official Agents continue.
  • Manually review the permission modal and custom-repository preview in light/dark themes and narrow/wide viewports.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

README, docs/CONFIGURATION.md, and docs/agents/custom-agents.md are updated. Translation follow-up: #4148.

UI evidence (if applicable)

  • Add screenshots of the Danger Zone toggle, locked Agents-panel controls, and permission review before marking ready.

Summary by CodeRabbit

  • New Features

    • Added a Danger Zone control to enable or disable external custom-agent imports.
    • Added an import review step requiring explicit approval of requested capabilities.
    • Expanded custom-agent abilities, including backgrounds, sprites, media, haptics, and About Me updates.
    • Added permission previews for custom-agent repository changes.
  • Bug Fixes

    • Prevented disabled or unapproved imported agents from running or applying unauthorized results.
    • Sanitized CSS provided by imported agents.
  • Documentation

    • Updated setup and security guidance for gated external imports.

🔄 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/4149 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/26/2026 **Status:** ✅ Merged **Merged:** 7/26/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/custom-agent-import-gate` --- ### 📝 Commits (2) - [`8b4c901`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8b4c9018d6d26e935d2fdffcac3f9fbcc45e2118) Gate external Agent imports - [`16cfa61`](https://github.com/Pasta-Devs/Marinara-Engine/commit/16cfa611dc675d36bd47b3985c6210b8f4b88601) fix: address custom agent import review ### 📊 Changes **23 files changed** (+1037 additions, -124 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -1) 📝 `docs/CONFIGURATION.md` (+7 -1) 📝 `docs/agents/custom-agents.md` (+20 -3) 📝 `e2e/core-flows.e2e.ts` (+144 -0) 📝 `packages/client/src/components/agents/AgentEditor.tsx` (+90 -4) 📝 `packages/client/src/components/agents/CustomAgentRepositoriesModal.tsx` (+52 -2) 📝 `packages/client/src/components/panels/AgentsPanel.tsx` (+261 -38) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+37 -0) 📝 `packages/client/src/hooks/use-agents.ts` (+31 -1) 📝 `packages/client/src/hooks/use-generate.ts` (+2 -1) 📝 `packages/client/src/lib/agent-transfer.ts` (+22 -15) 📝 `packages/client/src/localization/locales/en.json` (+64 -0) 📝 `packages/server/src/routes/agents.routes.ts` (+87 -0) 📝 `packages/server/src/routes/custom-agent-repositories.routes.ts` (+12 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+11 -4) 📝 `packages/server/src/routes/generate/agent-result-capabilities.ts` (+8 -23) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+18 -25) ➕ `packages/server/src/services/agents/custom-agent-import-policy.service.ts` (+16 -0) 📝 `packages/server/src/services/agents/custom-agent-repositories.service.ts` (+16 -2) 📝 `packages/server/src/services/prompt/marker-expander.ts` (+13 -1) _...and 3 more files_ </details> ### 📄 Description ## Linked issue Closes #4147 ## Why this change - External Agent files, folders, and custom repositories can alter prompts and request side effects, but previously shared the same trust path as locally authored configurations. Users need an explicit opt-in and permission review without losing access to Agents they create themselves or official downloaded Agents. ## What changed - Added a persisted **Allow custom Agent imports** toggle above extension imports in Advanced Settings → Danger Zone; it does not require an `.env` change. - Locked file, folder, and custom-repository imports until enabled, with hover/tap guidance in the Agents panel. - Added a deny-by-default permission review for imported files and folders, server-side import validation, provenance, credential/tool/write-target stripping, and explicit capability enforcement for Agent result actions. - Prevented externally imported Agents and their stored prompt output from running while the toggle is off. Locally authored custom Agents and official downloaded Agents remain available. - Sanitized Agent-provided CSS before it reaches the app stylesheet and expanded capability coverage for backgrounds, sprites, media, haptics, About Me updates, interactive choices, and message effects. - Updated English localization, README/configuration/custom-Agent documentation, regression coverage, and a mobile browser flow. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Automated evidence gathered while preparing the PR: - `pnpm check` — passed (one pre-existing `NoodleHome.tsx` hook warning) - `pnpm localization:check` — passed - `pnpm regression:agent-import-security` — passed - `pnpm regression:docs` — passed - `pnpm exec playwright test -c playwright.config.ts -g "external Agent imports require"` — mobile flow passed; desktop project intentionally skipped because the policy is persisted in the shared test server - `git diff --check` — passed ### Manual verification notes - Manually verify the Danger Zone warning/confirmation and toggle persistence. - Manually verify locked import guidance with mouse hover and mobile tap. - Manually import Agents with approved and denied capabilities, then disable the gate and confirm imported Agents stop running while locally authored and official Agents continue. - Manually review the permission modal and custom-repository preview in light/dark themes and narrow/wide viewports. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) README, `docs/CONFIGURATION.md`, and `docs/agents/custom-agents.md` are updated. Translation follow-up: #4148. ## UI evidence (if applicable) - Add screenshots of the Danger Zone toggle, locked Agents-panel controls, and permission review before marking ready. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a Danger Zone control to enable or disable external custom-agent imports. * Added an import review step requiring explicit approval of requested capabilities. * Expanded custom-agent abilities, including backgrounds, sprites, media, haptics, and About Me updates. * Added permission previews for custom-agent repository changes. * **Bug Fixes** * Prevented disabled or unapproved imported agents from running or applying unauthorized results. * Sanitized CSS provided by imported agents. * **Documentation** * Updated setup and security guidance for gated external imports. <!-- 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:08:38 +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#6253
No description provided.