pi-landstrip 0.20.11 → 0.20.13
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.
- package/dist/index.ts +26 -10
- package/package.json +2 -2
package/dist/index.ts
CHANGED
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
isRecord as isRecord3,
|
|
41
41
|
isQueryTrap,
|
|
42
42
|
matchesPathPattern,
|
|
43
|
+
matchesWriteDenyPattern,
|
|
43
44
|
mergeArray,
|
|
44
45
|
parseLandstripTraps,
|
|
45
46
|
parseSandboxConfig,
|
|
@@ -6947,7 +6948,8 @@ function createLandstripIntegrationWithPrompts(options, permissionPrompts) {
|
|
|
6947
6948
|
if (!config.enabled)
|
|
6948
6949
|
return { allowed: true, prompted: false };
|
|
6949
6950
|
for (const access of normalized) {
|
|
6950
|
-
|
|
6951
|
+
const denied = access.operation === "read" ? matchesPattern(access.path, config.filesystem.denyReadAlways, ctx.cwd) : matchesWriteDenyPattern(access.path, mergeArray(config.filesystem.denyWriteAlways, config.filesystem.denyWrite), ctx.cwd, getEffectiveAllowWrite(config));
|
|
6952
|
+
if (denied) {
|
|
6951
6953
|
return {
|
|
6952
6954
|
allowed: false,
|
|
6953
6955
|
prompted: false,
|
|
@@ -7101,7 +7103,7 @@ ${paths}${note}`, PERMISSION_OPTIONS, promptSignal);
|
|
|
7101
7103
|
...[...allowances.explicitDenyRead.globRoots.values()].flat()
|
|
7102
7104
|
]), cwd, { requireAllowMatch: true }) ? { action: "allow" } : undefined;
|
|
7103
7105
|
}
|
|
7104
|
-
if (trap.operation === "write" && (
|
|
7106
|
+
if (trap.operation === "write" && (matchesWriteDenyPattern(path, config.filesystem.denyWriteAlways, cwd, getEffectiveAllowWrite(config, allowances)) || matchesWriteDenyPattern(path, config.filesystem.denyWrite, cwd, getEffectiveAllowWrite(config, allowances)))) {
|
|
7105
7107
|
return { action: "deny", reason: "hard-deny" };
|
|
7106
7108
|
}
|
|
7107
7109
|
const allowed = trap.operation === "read" ? readAllowed(path, getEffectiveAllowRead(config, cwd, allowances), getEffectiveDenyRead(config, cwd), cwd) : !shouldPromptForWrite(path, getEffectiveAllowWrite(config, allowances), cwd);
|
|
@@ -7764,9 +7766,19 @@ ${paths}${note}`, PERMISSION_OPTIONS, promptSignal);
|
|
|
7764
7766
|
if (!ctx.hasUI)
|
|
7765
7767
|
return null;
|
|
7766
7768
|
const { globalPath, projectPath } = getPiConfigPaths(ctx.cwd, "sandbox.json");
|
|
7769
|
+
const writeDeniedBy = (config) => {
|
|
7770
|
+
const writeRoots = getEffectiveAllowWrite(config, allowances);
|
|
7771
|
+
if (matchesWriteDenyPattern(blockedPath, config.filesystem.denyWriteAlways, ctx.cwd, writeRoots)) {
|
|
7772
|
+
return "denyWriteAlways";
|
|
7773
|
+
}
|
|
7774
|
+
if (matchesWriteDenyPattern(blockedPath, config.filesystem.denyWrite, ctx.cwd, writeRoots)) {
|
|
7775
|
+
return "denyWrite";
|
|
7776
|
+
}
|
|
7777
|
+
return null;
|
|
7778
|
+
};
|
|
7767
7779
|
const current = () => {
|
|
7768
7780
|
const config = loadConfig(ctx.cwd);
|
|
7769
|
-
if (
|
|
7781
|
+
if (operation === "read" ? matchesPattern(blockedPath, config.filesystem.denyReadAlways, ctx.cwd) : writeDeniedBy(config) !== null) {
|
|
7770
7782
|
return false;
|
|
7771
7783
|
}
|
|
7772
7784
|
const needsPrompt = operation === "read" ? !readAllowed(blockedPath, getEffectiveAllowRead(config, ctx.cwd, allowances), getEffectiveDenyRead(config, ctx.cwd), ctx.cwd) : shouldPromptForWrite(blockedPath, getEffectiveAllowWrite(config, allowances), ctx.cwd);
|
|
@@ -7786,21 +7798,25 @@ ${paths}${note}`, PERMISSION_OPTIONS, promptSignal);
|
|
|
7786
7798
|
}, signal);
|
|
7787
7799
|
if (!access) {
|
|
7788
7800
|
const config = loadConfig(ctx.cwd);
|
|
7789
|
-
if (operation === "write"
|
|
7790
|
-
const tier =
|
|
7791
|
-
|
|
7801
|
+
if (operation === "write") {
|
|
7802
|
+
const tier = writeDeniedBy(config);
|
|
7803
|
+
if (tier) {
|
|
7804
|
+
notify(ctx, `"${blockedPath}" is blocked by ${tier}. Check:
|
|
7792
7805
|
${projectPath}
|
|
7793
7806
|
${globalPath}`, "warning");
|
|
7807
|
+
}
|
|
7794
7808
|
}
|
|
7795
7809
|
return null;
|
|
7796
7810
|
}
|
|
7797
7811
|
let config = loadConfig(ctx.cwd);
|
|
7798
|
-
if (operation === "write"
|
|
7799
|
-
const tier =
|
|
7800
|
-
|
|
7812
|
+
if (operation === "write") {
|
|
7813
|
+
const tier = writeDeniedBy(config);
|
|
7814
|
+
if (tier) {
|
|
7815
|
+
notify(ctx, `"${blockedPath}" was added to allowWrite, but ${tier} still blocks it. Check:
|
|
7801
7816
|
${projectPath}
|
|
7802
7817
|
${globalPath}`, "warning");
|
|
7803
|
-
|
|
7818
|
+
return null;
|
|
7819
|
+
}
|
|
7804
7820
|
}
|
|
7805
7821
|
onUpdate?.({
|
|
7806
7822
|
content: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-landstrip",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.13",
|
|
4
4
|
"description": "Sandboxed Bash and process-backed agents for Pi",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"landstrip",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"ci:test": "npm run test"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@landstrip/landstrip-api": "^0.20.
|
|
42
|
+
"@landstrip/landstrip-api": "^0.20.13",
|
|
43
43
|
"jsonc-parser": "^3.3.1",
|
|
44
44
|
"minimatch": "^10.2.5",
|
|
45
45
|
"undici": "^8.9.0",
|