auto-permission-system 3.17.0 → 3.18.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auto-permission-system",
3
- "version": "3.17.0",
3
+ "version": "3.18.0",
4
4
  "description": "Claude auto mode for Pi & security for Pi. A zero-trust permission system for Pi coding agent powered by Advanced Secure mode to scan files, content, and tools to prevent data breaches.",
5
5
  "type": "module",
6
6
  "author": "Navin Kumar",
@@ -93,7 +93,7 @@ async function preflightSensitiveCommands(
93
93
  return undefined;
94
94
  }
95
95
  auditL1({ subject, decision: "no", note: "sensitive-command", cwd });
96
- onData(Buffer.from(`\n[Security Block] pi-sandbox: command blocked — it can print secrets: ${subject}. Nothing was run — ask the user.\n`));
96
+ onData(Buffer.from(`\n[Security Block] sandbox: command execution was denied by user: ${subject}. Command was not executed.\n`));
97
97
  return { exitCode: 1 };
98
98
  }
99
99
 
@@ -109,14 +109,15 @@ async function preflightAskReads(
109
109
  ): Promise<{ exitCode: number } | undefined> {
110
110
  const cfg = loadConfig(cwd).filesystem;
111
111
  if (!cfg?.askRead?.length) return undefined;
112
- const paths = askReadCandidates(command, cwd, homedir(), cfg, undefined, (absPath) => canonicalize(absPath, cwd));
113
- if (!paths.length) return undefined;
112
+ const rawPaths = askReadCandidates(command, cwd, homedir(), cfg, undefined, (absPath) => canonicalize(absPath, cwd));
113
+ if (!rawPaths.length) return undefined;
114
+ const paths = Array.from(new Set(rawPaths.map((p) => canonicalize(p, cwd))));
114
115
  const ui = opts?.ctx as AskCtx | undefined;
115
116
  for (const absPath of paths) {
116
117
  if (sessionAskReadGrants.includes(absPath)) continue;
117
118
  if (!ui?.hasUI || !ui.ui?.select) {
118
119
  auditL1({ subject: absPath, decision: "no", note: "ask-read-headless", cwd });
119
- onData(Buffer.from(`\n[Security Block] pi-sandbox: sensitive file read blocked: ${absPath}. Nothing was run — ask the user.\n`));
120
+ onData(Buffer.from(`\n[Security Block] sandbox: read access to ${absPath} was blocked (automated environment). Command was not executed.\n`));
120
121
  return { exitCode: 1 };
121
122
  }
122
123
  const choice = await askMain(ui, "Let this command read your .env file?", [`File ${absPath}`, `Why .env files usually hold passwords and API keys`, `Risk the AI will see any keys in it`, `Note can't be saved as a permanent rule (it holds secrets)`].join("\n"), { session: true, remember: false, icon: "cred" });
@@ -126,7 +127,7 @@ async function preflightAskReads(
126
127
  continue;
127
128
  }
128
129
  auditL1({ subject: absPath, decision: "no", note: "ask-read", cwd });
129
- onData(Buffer.from(`\n[Security Block] pi-sandbox: sensitive file read blocked: ${absPath}. Nothing was run — ask the user.\n`));
130
+ onData(Buffer.from(`\n[Security Block] sandbox: read access to ${absPath} was denied by user. Command was not executed.\n`));
130
131
  return { exitCode: 1 };
131
132
  }
132
133
  return undefined;
@@ -143,7 +144,9 @@ async function preflightOutsideReads(
143
144
  return undefined;
144
145
  }
145
146
  const once: string[] = [];
146
- for (const absPath of outsideProjectReadCandidates(command, cwd, homedir(), cfg, undefined, (absPath) => canonicalize(absPath, cwd))) {
147
+ const rawCandidates = outsideProjectReadCandidates(command, cwd, homedir(), cfg, undefined, (absPath) => canonicalize(absPath, cwd));
148
+ const candidates = Array.from(new Set(rawCandidates.map((p) => canonicalize(p, cwd))));
149
+ for (const absPath of candidates) {
147
150
  if (sessionReadGrants.includes(absPath)) continue;
148
151
  const ui = opts.ctx as AskCtx;
149
152
  const parent = dirname(absPath);