opencode-hashline 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -701,8 +701,13 @@ function createHashlineEditTool(config, cache) {
|
|
|
701
701
|
} catch {
|
|
702
702
|
realAbs = (0, import_path2.resolve)(absPath);
|
|
703
703
|
}
|
|
704
|
+
const realDirectory = (0, import_fs2.realpathSync)((0, import_path2.resolve)(context.directory));
|
|
704
705
|
const realWorktree = (0, import_fs2.realpathSync)((0, import_path2.resolve)(context.worktree));
|
|
705
|
-
|
|
706
|
+
function isWithin(filePath, dir) {
|
|
707
|
+
if (dir === import_path2.sep) return false;
|
|
708
|
+
return filePath === dir || filePath.startsWith(dir + import_path2.sep);
|
|
709
|
+
}
|
|
710
|
+
if (!isWithin(realAbs, realDirectory) && !isWithin(realAbs, realWorktree)) {
|
|
706
711
|
throw new Error(`Access denied: "${path}" resolves outside the project directory`);
|
|
707
712
|
}
|
|
708
713
|
const normalizedAbs = (0, import_path2.resolve)(absPath);
|
|
@@ -39,8 +39,13 @@ function createHashlineEditTool(config, cache) {
|
|
|
39
39
|
} catch {
|
|
40
40
|
realAbs = resolve(absPath);
|
|
41
41
|
}
|
|
42
|
+
const realDirectory = realpathSync(resolve(context.directory));
|
|
42
43
|
const realWorktree = realpathSync(resolve(context.worktree));
|
|
43
|
-
|
|
44
|
+
function isWithin(filePath, dir) {
|
|
45
|
+
if (dir === sep) return false;
|
|
46
|
+
return filePath === dir || filePath.startsWith(dir + sep);
|
|
47
|
+
}
|
|
48
|
+
if (!isWithin(realAbs, realDirectory) && !isWithin(realAbs, realWorktree)) {
|
|
44
49
|
throw new Error(`Access denied: "${path}" resolves outside the project directory`);
|
|
45
50
|
}
|
|
46
51
|
const normalizedAbs = resolve(absPath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-hashline",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Hashline plugin for OpenCode — content-addressable line hashing for precise AI code editing",
|
|
5
5
|
"main": "dist/opencode-hashline.cjs",
|
|
6
6
|
"module": "dist/opencode-hashline.js",
|