improvement(file-block): add get operation#4588
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR adds a "Get" operation to the File block, letting users retrieve workspace file metadata by selecting a file from the UI (basic mode) or supplying a file ID directly (advanced mode). The new
Confidence Score: 3/5The file ID path is safe; the fileInput fast-path returns whatever the caller sends without any server-side validation. The block config, tool definition, and registry changes are straightforward and follow existing patterns. The route handler's apps/sim/app/api/tools/file/manage/route.ts and apps/sim/lib/api/contracts/tools/file.ts need attention around the fileInput handling in the new get case.
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/tools/file/manage/route.ts | Adds get case to the file manage route; the fileInput fast-path echoes unvalidated client data back as a trusted file object, creating a potential SSRF/data-injection vector. |
| apps/sim/lib/api/contracts/tools/file.ts | New fileManageGetBodySchema added; uses z.any() for fileInput and makes both nullable inputs optional without a schema-level mutual-exclusion check. |
| apps/sim/tools/file/get.ts | New file_get tool definition; clean structure, correctly delegates to the manage API and transforms the response. |
| apps/sim/blocks/blocks/file.ts | Adds "Get" operation to the file block dropdown with basic/advanced sub-block modes; correctly routes to file_get tool and builds params. |
| apps/sim/tools/file/index.ts | Exports fileGetTool alongside existing file tools — no issues. |
| apps/sim/tools/registry.ts | Registers file_get in the tool registry; change is minimal and correct. |
Reviews (1): Last reviewed commit: "Lint" | Re-trigger Greptile
Summary
File block get
Type of Change
Testing
Manual
Checklist