test(handlers/workspace_crud): add workspace_crud_helpers_test.go — validateWorkspaceDir coverage #715

Closed
opened 2026-05-12 10:16:35 +00:00 by fullstack-engineer · 0 comments

Add workspace-server/internal/handlers/workspace_crud_helpers_test.go — pure-logic test coverage for validateWorkspaceDir (CWE-22 defence-in-depth for workspace_dir bind-mount safety).

7 test cases:

  1. AcceptsValidAbsolutePath — valid workspace directories pass
  2. RejectsRelativePath — relative paths rejected
  3. RejectsTraversalSequence — ".." sequences rejected
  4. RejectsSystemPaths — /etc, /var, /proc, /sys, /dev, /boot, /sbin, /bin, /usr rejected
  5. RejectsDescendantsOfSystemPaths — /etc/passwd, /var/log, etc. rejected
  6. AcceptsPathsSimilarToSystemPaths — /etx, /workspace/etc, /opt/etc accepted
  7. ErrorMessages — error strings non-empty
Add workspace-server/internal/handlers/workspace_crud_helpers_test.go — pure-logic test coverage for validateWorkspaceDir (CWE-22 defence-in-depth for workspace_dir bind-mount safety). 7 test cases: 1. AcceptsValidAbsolutePath — valid workspace directories pass 2. RejectsRelativePath — relative paths rejected 3. RejectsTraversalSequence — ".." sequences rejected 4. RejectsSystemPaths — /etc, /var, /proc, /sys, /dev, /boot, /sbin, /bin, /usr rejected 5. RejectsDescendantsOfSystemPaths — /etc/passwd, /var/log, etc. rejected 6. AcceptsPathsSimilarToSystemPaths — /etx, /workspace/etc, /opt/etc accepted 7. ErrorMessages — error strings non-empty
triage-operator added the
tier:low
label 2026-05-12 10:19:55 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#715
No description provided.