fix(#1649): add UploadFile for file-to-file sandbox upload semantics#1651
fix(#1649): add UploadFile for file-to-file sandbox upload semantics#1651fullsend-ai-coder[bot] wants to merge 1 commit into
Conversation
openshell sandbox upload treats the remote path as a directory, placing the uploaded file inside it with the source basename. This caused host_files staging to create a directory at the destination path (e.g. prior-review.txt/) with the file nested inside, producing EISDIR errors when the agent tried to read the file. Add sandbox.UploadFile() — analogous to the existing DownloadFile() — which uploads to the parent directory and renames in-sandbox if the basename differs. Update all three sandbox.Upload() calls in bootstrapEnv's host_files staging and .env upload to use UploadFile instead. Note: Go tests could not run in sandbox (go.mod requires go >= 1.26.0, sandbox has 1.24.13 with read-only GOPATH). Pre-commit could not run (same Go toolchain issue). Manual verification of go-test is required. Closes #1649
Site previewPreview: https://dc57d31b-site.fullsend-ai.workers.dev Commit: |
ReviewFindingsLow
Info
|
| // If that differs from the desired remotePath, rename it in-sandbox. | ||
| uploadedPath := filepath.Join(remoteDir, filepath.Base(localPath)) | ||
| if uploadedPath != remotePath { | ||
| mvCmd := fmt.Sprintf("mv %s %s", uploadedPath, remotePath) |
There was a problem hiding this comment.
[low] injection-defense
The mv command in UploadFile uses fmt.Sprintf without shell-quoting paths. Pre-existing pattern but not defensive against paths with spaces or metacharacters.
Suggested fix: Use shell-safe quoting for paths in sandbox Exec commands. Consider a helper function for constructing sandbox shell commands.
openshell sandbox upload treats the remote path as a directory, placing the uploaded file inside it with the source basename. This caused host_files staging to create a directory at the destination path (e.g. prior-review.txt/) with the file nested inside, producing EISDIR errors when the agent tried to read the file.
Add sandbox.UploadFile() — analogous to the existing DownloadFile() — which uploads to the parent directory and renames in-sandbox if the basename differs. Update all three sandbox.Upload() calls in bootstrapEnv's host_files staging and .env upload to use UploadFile instead.
Note: Go tests could not run in sandbox (go.mod requires go >= 1.26.0, sandbox has 1.24.13 with read-only GOPATH). Pre-commit could not run (same Go toolchain issue). Manual verification of go-test is required.
Closes #1649
Post-script verification
agent/1649-fix-upload-file-staging)557c0a1189eed1adca4ec44cbdb53bf81f423703..HEAD)