From 9ec1f01b5a65a8e5b6af412ad3df1aa2f7cd1b9a Mon Sep 17 00:00:00 2001 From: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> Date: Thu, 19 Mar 2026 00:16:28 -0500 Subject: [PATCH] Canonicalize hook metadata file paths --- src/hooks/workspace.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/hooks/workspace.ts b/src/hooks/workspace.ts index 7b86d9d23c8..32bb903f909 100644 --- a/src/hooks/workspace.ts +++ b/src/hooks/workspace.ts @@ -81,11 +81,19 @@ function loadHookFromDir(params: { nameHint?: string; }): Hook | null { const hookMdPath = path.join(params.hookDir, "HOOK.md"); - const content = readBoundaryFileUtf8({ + const safeHookMdPath = resolveBoundaryFilePath({ absolutePath: hookMdPath, rootPath: params.hookDir, boundaryLabel: "hook directory", }); + if (!safeHookMdPath) { + return null; + } + const content = readBoundaryFileUtf8({ + absolutePath: safeHookMdPath, + rootPath: params.hookDir, + boundaryLabel: "hook directory", + }); if (content === null) { return null; } @@ -127,7 +135,7 @@ function loadHookFromDir(params: { description, source: params.source, pluginId: params.pluginId, - filePath: hookMdPath, + filePath: safeHookMdPath, baseDir, handlerPath, };