pi-ext
bugabingas pi extensions
owned by bugabinga
fix(git-safe): validate Windows clone paths
108f0d9155d7a031f7e08763267c1d10c2169187
Oliver Krylow <o.krylow@isp-insoft.de> ·
SSH signature · not checked
Browse filesCompare with HEAD
Changed files (3)
46 46 - Fix Pulse TAB completion
47 47 - Fix Notes so `/tree` restores notes from the selected branch and `/new` asks whether to carry pending notes into the new session
48 48 - Fix the uv extension on Windows by skipping incompatible shell shims while retaining command blocking
49 +- Fix git-safe cloning on Windows so valid deep destination paths are accepted
49 50 - Fix Overkill's Aftermath skill picker so large skill lists scroll within the terminal
50 51 - Fix Overkill Aftermath completion when mining finds insufficient tasks so it offers report-only actions and shows consistent artifact paths
51 52 - Show persistent below-editor progress during long Overkill phases, including mining and aggregation calls
extensions/git-safe/__tests__/path.test.ts
Addednew file mode 100644 1 +import { join, parse }
from "node:path";
2 +import { describe, expect, it }
from "vitest";
3 +import { isDangerousPath }
from "../clone";
5 +describe(
"git-safe clone path validation", ()
=> {
6 + it(
"accepts a deep native path", ()
=> {
17 + expect(
isDangerousPath(target)).
toBeNull();
20 + it(
"rejects native root and shallow paths", ()
=> {
21 + const root
= parse(
process.
cwd()).root;
23 + expect(
isDangerousPath(
root)).
toBe(
"path is root directory");
24 + expect(
isDangerousPath(
join(
root,
"repo"))).
toMatch(
/path is too shallow/);
extensions/git-safe/clone.ts
Modified 16 16 } from
"node:fs/promises";
17 17 import { homedir, tmpdir }
from "node:os";
18 -import { dirname, isAbsolute, join, normalize, resolve }
from "node:path";
59 -function isDangerousPath(p
: string)
: string | null {
68 +export function isDangerousPath(p
: string)
: string | null {
60 69 const resolved
= resolve(p);
61 70 const home
= homedir();
62 - const parts
= resolved.
split(
"/").
filter(
Boolean);
71 + const root
= parse(resolved).root;
72 + const parts
= relative(
root, resolved).
split(sep).
filter(
Boolean);
65 - if (resolved
=== "/")
return "path is root directory";
75 + if (resolved
=== root)
return "path is root directory";
67 77 if (resolved
=== home)
return "path is home directory";