Repository navigation
Conversation
…output of trusted projects only
…d copy to a new place
…t checks them out
…t, once all are made
…a copy of 200 files
…refused link's folder
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 #250
Closes #251
Closes #252
Closes #253
Closes #256
Closes #257
Closes #264
Closes #269
Refs #348
Hardens the editor server's file layer. Path checks now run on where a path really leads, and every project file operation stays inside the project and out of
nf_modulesand.git.Could not watch part of <location>instead of ending the server.nf_modulesduring the walk.nf_modulesread-only check runs on the real path, for every write (write, mkdir, rename, copy, delete, restore, trash)..gitfolder (gatewayProjectRoot).nanoforge.configpaths (dir.*, entry files,out.dir) must stay in the project, and/runtime/serves only trusted projects' files that lie inside it;runtime.manifestgoes through the trust check.open -R, so a.appfolder is shown, not launched.Found during the work and fixed here (no issue):
fs.copycopies entry by entry and never writes through a link in its destination. Links are copied as links only when they still lead inside the project. A failed copy to a new place removes what it made (this is the part of A folder copy that fails halfway leaves a partial copy #348 done here; a failed copy into an existing folder still keeps what it copied).core.symlinks=false)..nanoforge/editor/.gitignoreis never written through a link, and trash entries are restored only when they are plain entries outsidenf_modules.Docs:
AGENTS.md(hosted sessions, restricted mode,/runtime/, config paths,nf_modules),docs/specs/file-manager.md(links, copy, listing, one change at a time) and dated update notes in ADR 0002 and ADR 0005.How do you test this PR?
test/fs,test/projectortest/runtimethat fails before its commit and passes after, on real links and real unreadable folders in a temporary folder. Examples of the red runs: An unreadable folder in a project crashes the editor server #250 an unhandledEACCESand a timeout; A recursive listing fails as a whole on one unreadable subfolder #252RpcError: Permission denied; Saving a file drops its executable bit and replaces a symlink with a plain file #253expected 420 to be 493(mode lost); A static config out.dir can leave the project and /runtime/ then serves host files #251200instead of404; A hosted gateway project dir can point the project root at .git #256 the promise resolved to the.gitfolder; Reveal on a .app folder launches it on macOS #257['open', ['/p/x.app']]instead ofopen -R..gitignore, the setuid bit, the per-project lock, the hosted checkout).nf_modules, cold hashes, 5 runs): 136-189 ms before, 41-94 ms after.fs.cpcall.pnpm build(17/17),pnpm lint,pnpm typecheck(41/41). The fullCHROME=… pnpm testpassed in round 1 (1 skipped:editor-native.spec.ts, no.examples/). e2e not run on this branch alone (no UI flow changed).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
@nanoforge-dev/editor-server-corehas no runtime dependents outside the editor; it ships in the editor server and its Docker image, and merging tomaindeploys the editor app.out.dir; such an app could not run in the editor anyway);/runtime/answers 404 for an untrusted project;nf_modulesor.gitcan't be written, renamed or deleted through the file API (A link to a .git folder inside a project cannot be renamed or deleted #347);fs.copyrefuses a link that leads outside the project or nowhere, and a copy withoverwriteonto a tree that already holds links givesCONFLICT: re-copying a folder with links onto an earlier copy needs a delete first. Copies run in name order and stop at the first failure;git-service.ts: both edit the hosted hardening. The integration branch kept both: in the hosted hardening'selsebranch, setSERVER_CONFIG. This is security code, so the owners of both PRs must confirm that resolution.git-service.spec.tsconflicts too (the integration branch keeps both suites), and so does the restricted-mode line ofAGENTS.md(the integration branch keeps fix/git-untrusted-config's sentence and puts this branch's "(withoutcore.symlinks=false: …)" right after "the hosted hardening on").packages/server-core/test/project/project-registry.spec.tsis also created by fix/server-plugins-deactivate (fix(server-core): log a server entry deactivate error instead of stopping the next project #391) and fix/load-missing-folder (fix(editor): say a missing folder of a link is missing before the trust prompt #371). Whoever merges second or third folds the tests together: one top-level setup, the later suites inside their owndescribe.AGENTS.md: fix/tooling-scripts (fix(editor): build the example plugin before the e2e run and stop pnpm examples following symlinks #376), fix/project-fs-sync (fix(project): reopen a swept project and bound the file system lookups #375), fix/git-untrusted-config (fix(server-core): only read with git in an untrusted folder #385) and fix/session-pending-tokens (fix(server-core): resolve a request only against the check of its own tokens #387) also add text to it. Keep both texts (the integration branch did, including the hosted-sessions line shared with fix/session-pending-tokens).Follow-up issues
Quality gate
AGENTS.md,docs/specs/file-manager.md, ADR 0002 and 0005 dated notesrealpathper/runtime/request, about 25 µs, accepted; copy cost measured above)pnpm lint)Last round f412e8a: producer red→green, not re-reviewed.