Conversation
|
| for await (const entry of await opendir(await resolve(rel))) { | ||
| if (!entry.isFile() && !entry.isDirectory()) continue; | ||
| entries.push({ | ||
| name: entry.name, | ||
| path: rel ? `${rel}/${entry.name}` : entry.name, | ||
| type: entry.isDirectory() ? "directory" : "file", | ||
| }); | ||
| if (entries.length > MAX_ENTRIES) | ||
| throw new Error("Import directory contains too many entries"); | ||
| } | ||
| assertOpen(); | ||
| return entries.sort((a, b) => a.path.localeCompare(b.path)); | ||
| }; | ||
| readFile = async (value) => { | ||
| const handle = await open( | ||
| await resolve(value), | ||
| constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0), |
There was a problem hiding this comment.
If an intermediate directory is replaced with a symlink after resolve() validates it but before opendir() or open() uses the returned path, the operation can follow that symlink outside the selected root. O_NOFOLLOW only protects the final file component and does not protect readDir, so a plugin could list or read files outside the selected source. This conflicts with the file-tree API's confinement guarantee; validation and opening should be bound to the same filesystem objects.
There was a problem hiding this comment.
Acceptable risk for this feature
|
@greptile-apps please review the latest changes. |
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Yaak importers currently receive a text string, which cannot represent Bruno collection directories or ZIP exports. Add
onImportFiles(ctx, { files })with lazyreadDir, binaryreadFile, and UTF-8readTextFileaccess for single files, ZIPs, directories, and pasted text. KeeponImportbackwards compatible but deprecated, with a one-time migration warning; the file hook takes precedence when both exist.Add Bruno imports for bundled OpenCollection YAML, YAML collection directories/ZIPs, and legacy
.brucollections using Bruno’s official file parser. Preserve folders, environments, common auth, and HTTP/GraphQL/gRPC/WebSocket requests. Desktop gains a folder picker; desktop, URL, and CLI import paths preserve binary input and use the existing import planning and linked-reimport flow.Validation:
.bruand YAML), pinned tousebruno/bruno@4eb7e585, now exercise real upstream inputs. All 48 Bruno tests and the importer TypeScript/lint checks pass. Source attribution and the MIT license are included; embedded scripts are not executed..brudirectories, and an OpenAPI fixture passed in an isolated data directory. Linked reimport preserved request IDs without duplicates.The picker still selects one file or folder; arbitrary multi-select is not included. Collection scripts are not executed, unsupported settings are retained for manual migration, and referenced file paths may need adjustment. ZIPs are detected by signature and read without extraction, with path and size limits. Directory path validation is best-effort under concurrent filesystem changes: a symlink swap can redirect a read or listing outside the selected root. This remains a documented limitation, not a security confinement guarantee; plugins already run with normal Node.js filesystem permissions.
Related: OpenCollection, Bruno file parser.