Repository navigation
Conversation
…d folder The registry RPCs that change a project (restore, install, update and remove packages; install and uninstall project plugins) ran in restricted mode too: a cloned project could have Restore packages follow a link out of it. They now call assertTrusted, as the other trust-gated RPCs do. Before a package change they also refuse a symbolic link as nf_modules, one of its entries or a scope's entry, and before a project plugin change one on the way to its folder (.nanoforge, plugins, scope, entry). Listing the packages and user-scope plugins stay open. The editor still ships @nanoforge-dev/registry 3.0.1, which follows those links: these checks fix it here. The same nf_modules check in the registry lib (CLI branch fix/registry-safety) is defence in depth until the catalog moves to the released version. Closes #248
The Packages dialog turned every FORBIDDEN into "Packages can only be installed in a local editor.", which is wrong in a restricted folder now that package changes need a trusted folder. It shows the server's message, which names the right reason in a hosted editor and in an untrusted folder. The docs say that package and project plugin changes need a trusted folder. Refs #248
Registry 3.0.1 reads nanoforge.packages.json and its lock through a symbolic link, and writes tsconfig.json through one, which copies JSON from outside the project in and writes outside it. The changing package RPCs now refuse a link as any of these three files, next to the nf_modules check. Refs #248
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Closes #248
Package and project plugin changes now need a trusted folder, and they no longer follow links out of the project. The editor still ships
@nanoforge-dev/registry3.0.1, so these checks live in the editor server and are enough for #248 on their own.registry.implementation.ts):restorePackages,installPackage,updatePackage,uninstallPackageand the project-scopeinstallPlugin/uninstallPlugincallprojects.assertTrusted, as the other trust-gated RPCs do. The order islocalOnly→projects.get→assertTrusted. Listing packages and user-scope plugins stay open.BAD_REQUEST"… is a symbolic link"):nf_modules, its scopes and their entries;nanoforge.packages.json, its lock andtsconfig.json; and every folder on the way to a project plugin (.nanoforge,plugins, scope, entry).plugins/packages): it showed "Packages can only be installed in a local editor." for everyFORBIDDEN, which is wrong in an untrusted folder. It now shows the server's message, which names the right reason in a hosted editor and in an untrusted folder.docs/docs/editor/plugins-and-packages.mdxanddocs/docs/getting-started/create-your-first-project.mdxsay that package and project plugin changes need a trusted folder.The same
nf_modulesand project-file checks in the registry lib are in NanoForge-dev/CLI fix/registry-safety (NanoForge-dev/CLI#380), as defence in depth once the editor moves to that release.How do you test this PR?
test/rpc/registry.spec.ts"changes the packages and plugins of a trusted project only".nanoforge,pluginsand scope, as junctions)BAD_REQUEST, the folder outside is untouchedtsconfig.json, danglingtsconfig.json, linked list)marketplace.spec.ts"says a restricted folder must be trusted before its packages change"Commands run from the worktree:
pnpm build,pnpm typecheck,pnpm lint(after the build, so knip ran), server-core unit tests (133 passed on 0bd693d), packages plugin unit tests (2 passed). On cfcfdca:CHROME=… pnpm test(41/41 tasks, 1 skipped:editor-native.spec.ts, no.examples/) and Playwrightmarketplace,trustandproject-plugins(7 passed, 0 skipped). No UI file changed after that e2e run.Integration: a scratch branch with every editor branch of this sweep merged passed
pnpm build, lint, typecheck,pnpm test --force(1014 passed, 1 skipped) and the full e2e suite with the engine (141/141, Chromium only).Merge danger
maindeploys the editor app.nf_modules, on the way to.nanoforge/plugins, or as the package list, lock ortsconfig.jsonis refused in any folder.Follow-up issues
Quality gate
plugins-and-packages.mdx,create-your-first-project.mdxLast round 0bd693d: producer red→green, not re-reviewed.