[security] fix(islo): contain workdir paths under workspace#65
Merged
steipete merged 3 commits intoMay 9, 2026
Merged
Conversation
754b443 to
41e576a
Compare
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.
Summary
This PR hardens the Islo provider's workspace path boundary so repo-local configuration cannot steer delegated sync outside
/workspace.It specifically:
islo.workdirvalues before Islo client setup or sandbox creation;..values that clean outside/workspace;team/repoworking as/workspace/team/repo;Security issues covered
/workspace/etcBefore this PR
crabbox.yaml/.crabbox.yamland appliedislo.workdirdirectly.isloWorkspacePath()accepted absolute paths such as/etc.../etcwere joined with/workspaceand cleaned to/etc.rm -rf <workspace> && mkdir -p <workspace>whensync.deletewas enabled.After this PR
islo.workdiris validated as a relative directory under/workspace./workspaceitself or outside/workspace/are rejected.Run()validates the path before Islo client setup or sandbox creation, so invalid config fails before provider-side side effects...escapes.Why this matters
Islo delegated sync prepares the remote sandbox workdir before the user's command runs. A repository can carry Crabbox config, so the workdir value should not be able to redirect Crabbox's setup/deletion step at broad provider-side filesystem locations.
Without this guardrail, a malicious or compromised repository could include config such as:
On vulnerable code, that resolves to
/etcand reaches the workspace preparation path.How this differs from related E2B workdir fixes
This is a same-family variant of the E2B workspace hardening already merged in:
Those PRs hardened E2B-specific workspace handling. This PR addresses the remaining Islo-specific implementation, which has a separate
isloWorkspacePath()helper and delegated archive-sync flow.The failure mode is similar, but the vulnerable code path is different:
internal/providers/e2b/...internal/providers/islo/...Attack flow
Affected code
internal/providers/islo/sync.go,internal/providers/islo/backend.go,internal/providers/islo/backend_test.godocs/features/islo.md,docs/providers/islo.mdRoot cause
Issue: Islo workdir escape
islo.workdiras a path component but did not enforce containment under/workspace.path.Join("/workspace", workdir)was used without checking whether the cleaned result stayed under the intended root.CVSS assessment
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:HRationale:
Safe reproduction steps
On vulnerable code, consider this repo-local config:
The previous path resolver would compute:
The workspace preparation command would then target the escaped path:
This PR's regression coverage exercises the same condition safely in unit tests, without running destructive commands against a real sandbox.
Expected vulnerable behavior
Before this PR:
islo.workdir: ../etcresolved to/etc.islo.workdir: /etcwas accepted directly.prepareWorkspace()used the escaped path in the generated remote shell command.After this PR:
Changes in this PR
isloWorkspacePath()to return(string, error)./workspaceitself or outside/workspace/.Run()andsyncWorkspace().Run()early, before Islo client setup or sandbox creation./workspace.Files changed
internal/providers/islo/sync.gointernal/providers/islo/backend.gointernal/providers/islo/backend_test.godocs/features/islo.md,docs/providers/islo.md/workspaceboundaryMaintainer impact
team/reporemain supported.Fix rationale
The Islo docs already describe sync into
/workspace/<islo.workdir>, and the CLI flag help describes the value as an Islo sandbox working directory under/workspace. Enforcing that boundary in code makes the documented model true and prevents repo-local config from controlling broad filesystem deletion or extraction targets.The containment check is intentionally small and local to the Islo path helper, so future call sites get the same validation automatically.
Type of change
Test plan
go test ./internal/providers/islo ./internal/cli ./internal/providers/e2b -count=1go test ./... -count=1git diff --checknode scripts/build-docs-site.mjsExecuted with:
Token usage
Disclosure notes