[PR #5985] [MERGED] fix: enforce package chat persistence permissions #7019

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

📋 Pull Request Information

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

Base: staging ← Head: fix/capability-persistence-permissions-5899


📝 Commits (3)

  • bfcd3ee chore: reserve package permission issue sweep
  • 2f22933 fix: enforce package chat persistence permissions
  • 8713607 Merge remote-tracking branch 'origin/staging' into fix/capability-persistence-permissions-5899

📊 Changes

9 files changed (+416 additions, -26 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 docs/development/optional-agent-packages.md (+15 -8)
➕ e2e/capability-permissions.e2e.ts (+97 -0)
📝 packages/client/src/components/agents/AgentCatalogView.tsx (+51 -8)
📝 packages/client/src/localization/locales/en.json (+4 -0)
📝 packages/server/src/services/capability-packages/capability-module-runtime.service.ts (+7 -3)
📝 packages/server/src/services/capability-packages/capability-persistence.service.ts (+42 -7)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+2 -0)
➕ scripts/regressions/capability-persistence-permissions.regression.ts (+197 -0)

📄 Description

Linked issue

Closes #5899.

Why this change

A package with no declared chat permissions still received unrestricted chat persistence methods. The catalog could also show a newer version's permissions as though they described the installed version.

What changed

Package activation builds the persistence host from its declared permissions. Chat/message/game-state and spatial-snapshot reads require chat-read; chat/message/event and snapshot writes require chat-write. Transactions retain the same checks, and package chat locks require at least one chat permission. Trusted Engine callers retain their existing host.

The existing catalog detail view shows installed permissions and, when different, the catalog version's permissions separately. It explains the API checks and model-command write scope while explicitly identifying network, storage and UI as trusted-code access declarations. These checks do not sandbox package JavaScript or change the existing exact-version/checksum install approval flow.

Validation

Passed pnpm check, capability-persistence-permissions.regression.ts, the package lifecycle/readiness regression, and the Game Master verb runtime regression. The new proof activates four real local package modules through registry loading, file digest verification, runtime snapshots and service registration. It tests no permissions, read-only, write-only and both permissions against actual file storage; denied methods, nested transaction sessions, chat locks, persisted positive writes and manifest-array mutation are covered. The same proof fails against the original activation/persistence code because a denied read succeeds. Updated the existing readiness fixtures to declare the chat reads they perform.

Passed 6 browser cases across desktop Chromium, mobile Chromium and mobile WebKit, covering empty/read-only installed permissions, differing update permissions and reloads. Captured both themes and inspected mobile screenshots. The UI cases use catalog/installed API fixtures; the separate server proof uses actual package activation and persistence. Screenshots are attached to the browser test artifacts.

  • Manually verify an installed third-party package declares every chat permission its persistence calls require.
  • Manually verify the permission display on physical mobile hardware.

Docs and release impact

Updated the optional-package contributor guide, English UI copy and Unreleased changelog. Translation follow-up: #5986. Packages that use undeclared chat APIs must add the relevant permission to their manifest; this is an API enforcement change, not a JavaScript sandbox.

Summary by CodeRabbit

  • New Features

    • Package persistence now enforces declared chat-read and chat-write permissions for chat and spatial snapshot access, including transactions.
    • Agent details distinguish permissions for installed and catalog versions.
    • Permission explanations clarify API access gates versus trusted package-code access.
  • Documentation

    • Updated Capability API and package installation guidance to reflect permission requirements and approval behavior.
  • Tests

    • Added coverage for permission enforcement, catalog display, theme rendering, and state persistence.

🔄 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/5985 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/9/2026 **Status:** ✅ Merged **Merged:** 9/9/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/capability-persistence-permissions-5899` --- ### 📝 Commits (3) - [`bfcd3ee`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bfcd3eebe83fa10299264d51ea099a97bf1c972b) chore: reserve package permission issue sweep - [`2f22933`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2f22933b6fdc3c85aa383edc7996b4651849b3ad) fix: enforce package chat persistence permissions - [`8713607`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8713607e02c2c4d5887da2eacec809929c0b2c0c) Merge remote-tracking branch 'origin/staging' into fix/capability-persistence-permissions-5899 ### 📊 Changes **9 files changed** (+416 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `docs/development/optional-agent-packages.md` (+15 -8) ➕ `e2e/capability-permissions.e2e.ts` (+97 -0) 📝 `packages/client/src/components/agents/AgentCatalogView.tsx` (+51 -8) 📝 `packages/client/src/localization/locales/en.json` (+4 -0) 📝 `packages/server/src/services/capability-packages/capability-module-runtime.service.ts` (+7 -3) 📝 `packages/server/src/services/capability-packages/capability-persistence.service.ts` (+42 -7) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+2 -0) ➕ `scripts/regressions/capability-persistence-permissions.regression.ts` (+197 -0) </details> ### 📄 Description ## Linked issue Closes #5899. ## Why this change A package with no declared chat permissions still received unrestricted chat persistence methods. The catalog could also show a newer version's permissions as though they described the installed version. ## What changed Package activation builds the persistence host from its declared permissions. Chat/message/game-state and spatial-snapshot reads require chat-read; chat/message/event and snapshot writes require chat-write. Transactions retain the same checks, and package chat locks require at least one chat permission. Trusted Engine callers retain their existing host. The existing catalog detail view shows installed permissions and, when different, the catalog version's permissions separately. It explains the API checks and model-command write scope while explicitly identifying network, storage and UI as trusted-code access declarations. These checks do not sandbox package JavaScript or change the existing exact-version/checksum install approval flow. ## Validation Passed `pnpm check`, `capability-persistence-permissions.regression.ts`, the package lifecycle/readiness regression, and the Game Master verb runtime regression. The new proof activates four real local package modules through registry loading, file digest verification, runtime snapshots and service registration. It tests no permissions, read-only, write-only and both permissions against actual file storage; denied methods, nested transaction sessions, chat locks, persisted positive writes and manifest-array mutation are covered. The same proof fails against the original activation/persistence code because a denied read succeeds. Updated the existing readiness fixtures to declare the chat reads they perform. Passed 6 browser cases across desktop Chromium, mobile Chromium and mobile WebKit, covering empty/read-only installed permissions, differing update permissions and reloads. Captured both themes and inspected mobile screenshots. The UI cases use catalog/installed API fixtures; the separate server proof uses actual package activation and persistence. Screenshots are attached to the browser test artifacts. - [ ] Manually verify an installed third-party package declares every chat permission its persistence calls require. - [ ] Manually verify the permission display on physical mobile hardware. ## Docs and release impact Updated the optional-package contributor guide, English UI copy and Unreleased changelog. Translation follow-up: #5986. Packages that use undeclared chat APIs must add the relevant permission to their manifest; this is an API enforcement change, not a JavaScript sandbox. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Package persistence now enforces declared `chat-read` and `chat-write` permissions for chat and spatial snapshot access, including transactions. - Agent details distinguish permissions for installed and catalog versions. - Permission explanations clarify API access gates versus trusted package-code access. - **Documentation** - Updated Capability API and package installation guidance to reflect permission requirements and approval behavior. - **Tests** - Added coverage for permission enforcement, catalog display, theme rendering, and state persistence. <!-- 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:15:47 +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#7019
No description provided.