Skip to content

test(sandbox): add unit tests for policy-paths helpers (#524) - #526

Open
pethapixels-create wants to merge 1 commit into
dmae97:mainfrom
pethapixels-create:pr-524-subagent
Open

pethapixels-create wants to merge 1 commit into
dmae97:mainfrom
pethapixels-create:pr-524-subagent

Conversation

@pethapixels-create

Copy link
Copy Markdown

Fixes #524.

Adds packages/coding-agent/test/sandbox-policy-paths.test.ts covering the sandbox path helpers in src/core/sandbox/policy-paths.ts:

  • normalizeSandboxPath: trailing-slash strip, root "/", .. resolution
  • isInsideSandboxPath: identical path, nested descendant, sibling shared-prefix rejection (/tmp/ab vs /tmp/a), root containment
  • matchesSandboxPath: /** and /* prefix matching, sibling shared-prefix rejection

Suite is wrapped in describe.skipIf(process.platform === "win32") since the helpers use POSIX paths. No source files changed.

Verified: cd packages/coding-agent && npx vitest --run test/sandbox-policy-paths.test.ts → 10 passed. Confirmed the tests catch the classic prefix bug (temporarily dropping the trailing-slash guard fails the sibling-prefix cases).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add unit tests for sandbox path helpers in coding-agent/src/core/sandbox/policy-paths.ts

1 participant