f-0002 · must · score 1 · effort xs - check-freeze.sh omits tilde expansion on FILE_PATH and uses GNU-only sed /+ quantifier that fails on macOS BSD sed
In freeze/bin/check-freeze.sh:85-88, FREEZE_DIR expands a leading ~/ or ~ to $HOME, but lines 143-149 omit tilde expansion on FILE_PATH and instead join FILE_PATH onto $(pwd)/. When pwd is inside FREEZE_DIR, an out-of-boundary tilde path like ~/.zshrc becomes $(pwd)/~/.zshrc and is falsely allowed; when pwd is outside FREEZE_DIR, an in-boundary tilde path ~/project/src/index.ts becomes $(pwd)/~/project/src/index.ts and is falsely denied. In addition, line 157 uses sed “s|/+|/|g;s|/$||”, where + is a GNU BRE extension that macOS BSD sed treats as a literal plus sign rather than one-or-more slashes: double slashes are not collapsed on macOS, and UNC paths (//server/share/…) receive an extra _FP_LEAD=/ prefix to become ///server/share/…, breaking UNC boundary matching on macOS.
Evidence: freeze/bin/check-freeze.sh:85-88, freeze/bin/check-freeze.sh:143-159, test/investigate-freeze-path.test.ts:88-93
Do: Expand leading ~/ and ~ on FILE_PATH before gstack_hook_normalize_path (matching FREEZE_DIR), replace sed “s|/+|/|g;s|/$||” with portable POSIX BRE sed “s|//*|/|g;s|/$||”, and add regression tests in test/hook-scripts.test.ts covering dotdot traversal, symlink directory + new-subdir, and tilde-prefixed file_path.
f-0001 · must · score 1 · effort s - _resolve_path in check-freeze.sh fails on missing parent directories and intermediate directory symlinks, allowing dotdot and symlink boundary escapes while falsely denying new subdirectories on macOS
In freeze/bin/check-freeze.sh:169-188, _resolve_path only follows symlinks on the final path component (while [ -L “$_p” ]) and runs cd “$(dirname “$_p”)” 2>/dev/null && pwd -P || printf “%s” “$_dir” on the immediate parent directory. Whenever a parent directory does not exist yet (for example, Write or NotebookEdit creating a file in a new subdirectory), cd fails and falls back to the raw uncanonicalized _dir string: (1) /../outside/new-dir/secret.ts retains its / prefix and is allowed outside the boundary; (2) /out-link/new-dir/secret.ts (where out-link is an in-boundary directory symlink pointing outside) fails both [ -L "$_p" ] and cd, retaining /out-link/ and allowing the escape; (3) /.. leaves basename as .. and is allowed; and (4) on macOS where /tmp and /var are symlinks to /private/tmp and /private/var, FREEZE_DIR resolves via pwd -P to /private/var/folders/.../boundary while a legitimate new subdirectory write /new-subdir/Component.tsx fails cd and stays /var/folders/.../boundary/new-subdir/Component.tsx, falsely denying an in-boundary write.
Evidence: `freeze/bin/check-freeze.sh:169-188`, `freeze/bin/check-freeze.sh:193-209`
Do: Walk path components left-to-right in _resolve_path (collapsing . and .. and expanding symlinks via readlink at every component depth, bounded to 40 hops), walk up to the deepest existing ancestor directory before running cd && pwd -P, and compare _RESOLVED_FILE against _RESOLVED_FREEZE so user-facing denial messages preserve the normalized input path.
Shape of the work
1 module · 2 findings · effort 1×xs, 1×s
Generated by Ponder - AI that knows when to speak, and when to shut up.