Repository navigation
docs(360): project-oriented editing and extensions feasibility study - #396
Conversation
Exploration deliverable for petertzy#360, in the style of the existing AIWorkPanelFeasibilityStudy.md. Zero code/config/dependency changes. Covers all seven suggested acceptance outputs: core-vs-extension boundary with decision rule, layered capability architecture plus the Work-panel capability model and invocation contract, deny-by-default permissions/security model, enablement lifecycle (folder-drop only, no marketplace), explicit built-in/out-of-scope lists, a Local Model Bridge PoC sketch gated on petertzy#357, and a feasibility verdict of "technically feasible, organizationally gated". Every factual claim was verified against current sources before writing: the /api/ai/work contract and stale-result guard, the pre-existing project primitives (find_note_files, SQLite FTS5 indexing), the unsandboxed files-router surface, provider/key-storage infrastructure, and the AIPanel tab shell.
|
|
||
| Until step 3 is triggered, **no extension code should be merged**, keeping the core small and the default experience untouched, per the issue's own guidance. | ||
|
|
||
| Arbitrary code execution, shell access, UI plugins that inject into the editor DOM, and anything that bypasses the review pipeline. The issue's design principle — *"minimal impact on users who do not need extensions"* — implies the default install carries **zero** of §4.2. |
There was a problem hiding this comment.
Let's move this paragraph under line 79, "### 4.3 Explicitly out of scope"!
Address review feedback on petertzy#396: the closing paragraph listing what extensions must never do (arbitrary code execution, shell access, DOM-injecting UI plugins) was left at the end of the document instead of under "4.3 Explicitly out of scope", where it belongs.
karaaslanz
left a comment
There was a problem hiding this comment.
Thanks for the thorough, intentionally docs-only exploration. I reviewed the exact updated head c63d084 and #360's explicit "security and isolation" acceptance principle, including the existing backend/main.py and backend/routers/files.py trust boundary. The prior reviewer's section-4.3 placement request appears addressed in this updated head.
One important architecture-contract inconsistency remains before this study should be accepted as guidance:
- Section 5.1 proposes a future extension host using "subprocess/HTTP tools"; Section 7 installs extension folders; Sections 6.1-6.2 promise that even a malicious extension cannot read beyond the project, exfiltrate API keys, or reach arbitrary network destinations, with "no ambient authority".
- But Section 6.3 defers subprocess sandboxing to Phase 2. If a third-party extension can execute its own process/code with the application's user privileges, backend-only project path clamping, JSON manifests, and an HTTP egress proxy do NOT constrain that process's direct OS filesystem or socket access. The existing /api/files/read and /api/files/write also accept absolute paths, and the shared X-Markdown-Reader-Token is only a local API boundary, not a sandbox for executable extensions. This discrepancy would be critical precisely when real third-party code is first enabled.
Suggested small documentation-only fix (no feature implementation required): explicitly choose one enforceable Phase-1 trust/execution model:
(a) first phase allows only declarative manifests / backend-owned, audited adapters with NO arbitrary third-party executable code, keeping the subprocess host out of scope until OS-level isolation; or
(b) running untrusted extension processes is conditional on a real OS-level filesystem/network/secret isolation boundary being implemented and tested before first enable.
Then qualify "cannot read/exfiltrate" guarantees and net:allowlist/project:read permission semantics against that chosen execution model. No need to design the sandbox in this exploratory PR, only avoid promising a security property the proposed v1 cannot enforce.
Everything else is useful as a feasibility study; I am not asking for extension code or a marketplace. The current exact-head CI reports SUCCESS. This review is source/design-level only; no full app test or extension runtime was executed. No push or merge on my side.
|
Done in c63d084 — moved the out-of-scope paragraph (arbitrary code execution, shell access, DOM-injecting UI plugins) into §4.3, where it now fills the previously empty heading, and trimmed the stray tail from after §10. Thanks for the review! |
|
Designing an entirely new way of interacting with projects from scratch, while also ensuring that it is welcomed and accepted by users, involves significant risks and challenges. To make the plan more practical and achievable in its initial stage, I would prefer to first implement a project interaction version similar to that of Visual Studio Code (VS Code). In the future, we can build upon this foundation and gradually develop our own unique approach to project interaction. Regarding the plugin system, my original idea was to have the core application invoke these external plugins while strictly preventing them from accessing any part of the main project. The goal is to achieve the highest possible level of security. However, whether it is technically feasible to completely prevent plugins from making reverse calls or otherwise accessing the main application is an important question that this document should investigate and attempt to answer. If the research ultimately concludes that no sufficiently secure solution exists, then abandoning the plugin system would be the necessary choice. |
|
Thanks for clarifying the direction. A VS Code-like project interaction layer first, with plugins conditional on a demonstrable isolation boundary, seems like the safer order. On the specific feasibility question: the core process cannot reliably prevent arbitrary filesystem access, local API calls, or outbound connections by an untrusted plugin that executes as a normal subprocess under the same OS user. Project-root checks, a manifest, a backend egress proxy and hiding the app's HTTP token only constrain brokered requests; such a subprocess can bypass them through its own filesystem/socket APIs. Blocking "reverse calls" alone therefore does not meet ?6.1's security goal. There are two technically distinct options:
A concrete acceptance test would run a deliberately hostile sample plugin and verify it cannot read an unrelated project or the app's key storage, reach the local backend directly, open an unapproved network destination, escape via symlinks, or spawn an unsandboxed child. Test both denial and a legitimately brokered project:read operation. For this docs-only PR, I'd suggest changing ?5.1/?6.3/?10 to make option 1 the only feasible Phase 1, and the subprocess host conditional, not a Phase 2 hardening detail. That answers the feasibility question without adding plugin code or prematurely promising absolute isolation. |
|
@karaaslanz, I'd like to add one more point: if we're going to introduce this plugin mechanism, I think the safest approach would be to initially limit the number of plugins to no more than three, and ensure that all of them are developed and maintained by us. |
|
Thanks for clarifying the direction and authorizing a merge after the final documentation touches. I agree that the VS Code-like project workflow should come before any plugin execution. I checked PR head @Eswar0108, could you please apply these bounded edits to
No new architecture or PR is necessary. Once the existing branch is updated, I can verify the exact changed head and checks, and follow the maintainer's merge direction if permissions allow. |
Address review feedback from karaaslanz on petertzy#396: 1. Rollout: at most three project-developed/maintained plugins, all disabled by default, toggled via a Plugins option on the right side of the app menu; no third-party executable downloads or folder-drop install in this iteration. 2. Isolation: distinguish brokered permissions/path-clamping/egress from OS-level sandboxing. Annotate the 5.1 diagram, add a "Mediation != sandbox" note and the chosen Phase-1 execution model (a) (no arbitrary third-party executable code) to 6.1, qualify 6.2 permission semantics, and replace the "sandbox can wait until Phase 2" claim in 6.3. 3. Conclusion: keep petertzy#357 and project-root safeguards first; frame the Local Model Bridge as a trusted, mediated proof of workflow integration, not proof of plugin isolation.
karaaslanz
left a comment
There was a problem hiding this comment.
Follow-up on my earlier CHANGES_REQUESTED review. I checked docs-only head 47e26c7 and the green Backend/Frontend CI. The study now limits initial plugins to at most three first-party, project-maintained modules, disabled by default, with explicit per-plugin toggles under Plugins. It distinguishes brokered permission checks from OS-level process isolation and excludes arbitrary third-party executables without enforceable sandboxing. The Local Model Bridge is accurately scoped as trusted workflow integration, not sandbox proof. My earlier security/design concerns are addressed. Documentation-level approval only; no runtime plugin implementation was tested.
Fixes nothing code-wise; contributes to #360 (exploration deliverable).
What
Adds
docs/ProjectExtensionsFeasibilityStudy.md— the exploration/architecture study requested by #360, in the same style as the existingdocs/AIWorkPanelFeasibilityStudy.md. Docs-only, zero code/config/dependency changes.Coverage — all seven suggested acceptance outputs
Grounded in the actual codebase
Every factual claim was verified against current sources before writing:
POST /api/ai/worksingle-document contract + stale-result guard + undoable apply (backend/routers/ai.py,frontend/src/hooks/useAIActions.ts)find_note_files()+ SQLite FTS5 indexing inbackend/knowledge_logic.pybackend/routers/files.pyserves absolute-path read/write with no sandbox — acceptable for user-initiated calls today, but must gain project clamping + review mediation the moment a model or extension can drive it (§6.3)chat / work / translate / settings) as the capability rendererSequencing (per the issue's Important Considerations)
The study is explicitly gated behind #357 (project-wide AI workflows, currently assigned to @petertzy): §10 recommends no extension code be merged until #357 ships, a project-root concept exists, and one concrete third-party need is identified. Until then this document is the deliverable.
Verification
AIWorkPanelFeasibilityStudy.mdprecedent (header block, numbered sections, tables, verdict)