fix: Add path validation for optional params in test runner routes

Add path validation middleware for optional projectPath and worktreePath
parameters in test runner routes to maintain parity with other worktree
routes and ensure proper security validation when ALLOWED_ROOT_DIRECTORY
is configured.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Shirone
2026-01-21 17:21:18 +01:00
parent 4ab927a5fb
commit 6eb7acb6d4

View File

@@ -146,11 +146,11 @@ export function createWorktreeRoutes(
// Test runner routes
router.post(
'/start-tests',
validatePathParams('worktreePath'),
validatePathParams('worktreePath', 'projectPath?'),
createStartTestsHandler(settingsService)
);
router.post('/stop-tests', createStopTestsHandler());
router.get('/test-logs', createGetTestLogsHandler());
router.get('/test-logs', validatePathParams('worktreePath?'), createGetTestLogsHandler());
// Init script routes
router.get('/init-script', createGetInitScriptHandler());