@xprnvd/pi-permission-system 41.0.0 → 42.0.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/CHANGELOG.md +12 -0
- package/docs/configuration.md +5 -0
- package/package.json +14 -15
- package/schemas/permissions.schema.json +6 -0
- package/src/config/config-schema.ts +42 -19
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [42.0.0](https://github.com/gotgenes/pi-packages/compare/pi-permission-system-v41.0.0...pi-permission-system-v42.0.0) (2026-10-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **pi-permission-system:** require zod 4.6.7, which patches CVE-2023-54404 ([ff17542](https://github.com/gotgenes/pi-packages/commit/ff17542daac79a54557e5fe6671581a98cd6e55c)), closes [#1090](https://github.com/gotgenes/pi-packages/issues/1090)
|
|
14
|
+
* **pi-permission-system:** **breaking:** reject a config array longer than 1,000 entries before walking it ([be1443a](https://github.com/gotgenes/pi-packages/commit/be1443af5e94635f8f80068f2ff0b775b381b8ae)), closes [#1090](https://github.com/gotgenes/pi-packages/issues/1090)
|
|
15
|
+
|
|
16
|
+
### Documentation
|
|
17
|
+
|
|
18
|
+
* **pi-permission-system:** archive Phase 15 to history ([8f7d73e](https://github.com/gotgenes/pi-packages/commit/8f7d73ef7b8042b585524649a822183984d6801d)), closes [#945](https://github.com/gotgenes/pi-packages/issues/945)
|
|
19
|
+
|
|
8
20
|
## [41.0.0](https://github.com/gotgenes/pi-packages/compare/pi-permission-system-v40.3.0...pi-permission-system-v41.0.0) (2026-10-17)
|
|
9
21
|
|
|
10
22
|
|
package/docs/configuration.md
CHANGED
|
@@ -123,6 +123,9 @@ This clamp is deny-preserving and, like `yoloMode`, applied at composition; when
|
|
|
123
123
|
| `piInfrastructureReadPaths` | `[]` | Extra directories to auto-allow for reads, bypassing the `external_directory` gate. Supports `~`/`$HOME`/`${HOME}` expansion and wildcard patterns (`*`, `?`). |
|
|
124
124
|
| `authorizerChain` | `[]` | Ordered names of registered live-authority chain links to consult before the terminal authorizer (see [Authorizer chain](#authorizer-chain--case-by-case-decision-links)). |
|
|
125
125
|
|
|
126
|
+
Every array field (`promptNotifications`, `piInfrastructureReadPaths`, `authorizerChain`, and a `commandEffects` entry's `effects` and `unlessOption` lists) accepts at most 1,000 entries.
|
|
127
|
+
A longer list makes the file invalid, so it is rejected like any other invalid value (see [Merge Precedence](#merge-precedence) for how an invalid scope fails closed).
|
|
128
|
+
|
|
126
129
|
Both logs write to `~/.pi/agent/extensions/pi-permission-system/logs/`.
|
|
127
130
|
No debug output is printed to the terminal.
|
|
128
131
|
|
|
@@ -1145,6 +1148,8 @@ Each key is a command's **bare basename**, and each entry has up to three fields
|
|
|
1145
1148
|
| `unlessOption` | Options that withdraw the declaration when they appear anywhere in the command, so its paths consult both surfaces again. |
|
|
1146
1149
|
| `subcommands` | Entries for the word that follows, keyed by that exact word. A value is a nested entry or, as a shorthand, just its `effects` (`"log": "read"`). |
|
|
1147
1150
|
|
|
1151
|
+
The `effects` and `unlessOption` arrays each accept at most 1,000 entries; a longer list rejects the whole config file.
|
|
1152
|
+
|
|
1148
1153
|
The rules are fail-closed wherever a rule had to choose:
|
|
1149
1154
|
|
|
1150
1155
|
- **Undeclared is unknown.**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xprnvd/pi-permission-system",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "42.0.0",
|
|
4
4
|
"description": "Permission enforcement extension for the Pi coding agent.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"scripts": {
|
|
30
30
|
"check": "tsc --noEmit",
|
|
31
31
|
"build:types": "rollup -c rollup.dts.config.mjs",
|
|
32
|
-
"prepack": "
|
|
32
|
+
"prepack": "npm run build:types",
|
|
33
33
|
"gen:schema": "node --experimental-strip-types scripts/generate-permissions-schema.ts && biome format --write schemas/permissions.schema.json",
|
|
34
34
|
"test": "vitest run",
|
|
35
35
|
"test:watch": "vitest",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"measure:unresolved-redirects": "node scripts/measure-unresolved-redirects.mjs",
|
|
42
42
|
"measure:wrapper-transparency": "node scripts/measure-wrapper-transparency.mjs",
|
|
43
43
|
"lint:md": "rumdl check *.md docs/**/*.md",
|
|
44
|
-
"lint": "biome check . &&
|
|
44
|
+
"lint": "biome check . && npm run lint:md"
|
|
45
45
|
},
|
|
46
46
|
"keywords": [
|
|
47
47
|
"pi-package",
|
|
@@ -61,12 +61,11 @@
|
|
|
61
61
|
"license": "MIT",
|
|
62
62
|
"repository": {
|
|
63
63
|
"type": "git",
|
|
64
|
-
"url": "git+https://github.com/xprnvd/pi-
|
|
65
|
-
"directory": "packages/pi-permission-system"
|
|
64
|
+
"url": "git+https://github.com/xprnvd/pi-permission-system.git"
|
|
66
65
|
},
|
|
67
|
-
"homepage": "https://github.com/
|
|
66
|
+
"homepage": "https://github.com/xprnvd/pi-permission-system",
|
|
68
67
|
"bugs": {
|
|
69
|
-
"url": "https://github.com/
|
|
68
|
+
"url": "https://github.com/xprnvd/pi-permission-system/issues"
|
|
70
69
|
},
|
|
71
70
|
"engines": {
|
|
72
71
|
"node": ">=22"
|
|
@@ -84,19 +83,19 @@
|
|
|
84
83
|
"@earendil-works/pi-tui": ">=1.0.0"
|
|
85
84
|
},
|
|
86
85
|
"devDependencies": {
|
|
87
|
-
"@biomejs/biome": "
|
|
86
|
+
"@biomejs/biome": "^2.5.11",
|
|
88
87
|
"@earendil-works/pi-coding-agent": "1.0.0",
|
|
89
88
|
"@earendil-works/pi-tui": "1.0.0",
|
|
90
|
-
"@types/node": "
|
|
91
|
-
"rollup": "
|
|
92
|
-
"rollup-plugin-dts": "
|
|
93
|
-
"rumdl": "
|
|
94
|
-
"typescript": "
|
|
95
|
-
"vitest": "
|
|
89
|
+
"@types/node": "^22.15.3",
|
|
90
|
+
"rollup": "^4.63.1",
|
|
91
|
+
"rollup-plugin-dts": "^6.5.1",
|
|
92
|
+
"rumdl": "0.2.24",
|
|
93
|
+
"typescript": "^6.0.3",
|
|
94
|
+
"vitest": "^4.1.11"
|
|
96
95
|
},
|
|
97
96
|
"dependencies": {
|
|
98
97
|
"tree-sitter-bash": "^0.25.1",
|
|
99
98
|
"web-tree-sitter": "^0.26.9",
|
|
100
|
-
"zod": "^4.
|
|
99
|
+
"zod": "^4.6.7"
|
|
101
100
|
}
|
|
102
101
|
}
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"description": "Terminal notifications to emit when the inline permission dialog opens: bell (BEL), osc9 (OSC 9 notification), osc777 (OSC 777 notification). Omit or leave empty for none. TUI sessions only.",
|
|
73
73
|
"markdownDescription": "Terminal notifications to emit when the inline permission dialog opens, so a terminal or multiplexer can flag a session waiting on a decision.\n\n- `\"bell\"` writes a BEL — what tmux `monitor-bell` and most terminals react to.\n- `\"osc9\"` writes an OSC 9 desktop notification.\n- `\"osc777\"` writes an OSC 777 desktop notification.\n\nOmit or leave empty for none (the default). Applies to interactive **TUI** sessions only. The notification names the session and the requested tool and agent, never the command, path, or other value being decided.",
|
|
74
74
|
"default": [],
|
|
75
|
+
"maxItems": 1000,
|
|
75
76
|
"type": "array",
|
|
76
77
|
"items": {
|
|
77
78
|
"type": "string",
|
|
@@ -137,6 +138,7 @@
|
|
|
137
138
|
"description": "Additional directories to auto-allow for reads as Pi infrastructure, bypassing the external_directory gate. Supports ~ expansion and wildcard patterns (* and ?).",
|
|
138
139
|
"markdownDescription": "Additional directories to auto-allow for reads as Pi infrastructure, bypassing the `external_directory` gate.\n\nThe extension auto-discovers the global node_modules root (walks up from the extension's install path; falls back to `npm root -g` from a dev checkout), Pi's own install directory (via the coding-agent `getPackageDir()` API), Pi's harness entries under `agentDir` (`agents/`, `extensions/`, `git/`, `npm/`, `prompts/`, `skills/`, `themes/`, `settings.json`, `SYSTEM.md`, `APPEND_SYSTEM.md`, `AGENTS.md`), and project-local `.pi/npm/` and `.pi/git/`. The package's own logs directory is never auto-allowed, even when an entry here covers it. Add entries here for edge cases where auto-discovery is insufficient (e.g. custom `npmCommand` pointing to pnpm).\n\nSupports `~`/`$HOME` expansion. Entries may be plain directory prefixes or wildcard patterns using `*` (matches any characters, including `/`) and `?` (matches exactly one character). `**` and `*` are equivalent — both cross directory boundaries.\n\nOn Windows, matching is case-insensitive and tolerant of either path separator.",
|
|
139
140
|
"default": [],
|
|
141
|
+
"maxItems": 1000,
|
|
140
142
|
"type": "array",
|
|
141
143
|
"items": {
|
|
142
144
|
"type": "string",
|
|
@@ -147,6 +149,7 @@
|
|
|
147
149
|
"description": "Ordered names of registered live-authority chain links to consult before the terminal authorizer. Config order (not registration order) fixes the chain order; an unregistered name is skipped fail-safe (more prompting, never less); a link decides nothing until it is named here.",
|
|
148
150
|
"markdownDescription": "Ordered names of registered **live-authority chain links** (e.g. a model judge) to consult before the terminal authorizer (the human, or the subagent-forwarding / headless-deny fallback).\n\nA link reviews an `ask` and returns `allow` / `deny` (with an optional teaching reason) / `defer` to the next link. Three invariants govern the chain:\n\n- **Config order wins.** The order here — not the order extensions register in — fixes the security-relevant chain order.\n- **Fail-safe skip.** A name with no registered link is skipped with a warning; the `ask` still reaches the terminal (more prompting, never less).\n- **Opt-in activation.** Installing a judge extension grants it no authority; a link decides nothing until you name it here.\n\nThe chain owner caps every verdict with a bounded-delegation checkpoint: a link's `allow` on an excluded surface (`external_directory` or `path`) is downgraded to `defer`, so a link cannot exceed your policy. The one exception is per ask: a link's `allow` on a bash `external_directory` ask whose every flagged path names nothing on disk below the filesystem root (and is not a proven write) is honored, and the review log records `authorizer_allow_licensed`.\n\nDefaults to an empty list (no links).",
|
|
149
151
|
"default": [],
|
|
152
|
+
"maxItems": 1000,
|
|
150
153
|
"type": "array",
|
|
151
154
|
"items": {
|
|
152
155
|
"type": "string",
|
|
@@ -464,6 +467,7 @@
|
|
|
464
467
|
"description": "A filesystem effect: read (the command only reads its path operands) or write (it may modify them)."
|
|
465
468
|
},
|
|
466
469
|
{
|
|
470
|
+
"maxItems": 1000,
|
|
467
471
|
"type": "array",
|
|
468
472
|
"items": {
|
|
469
473
|
"type": "string",
|
|
@@ -476,6 +480,7 @@
|
|
|
476
480
|
},
|
|
477
481
|
"unlessOption": {
|
|
478
482
|
"description": "Option stems whose appearance anywhere in the command withdraws the declaration, so its path operands fall back to consulting both directional surfaces.",
|
|
483
|
+
"maxItems": 1000,
|
|
479
484
|
"type": "array",
|
|
480
485
|
"items": {
|
|
481
486
|
"type": "string",
|
|
@@ -504,6 +509,7 @@
|
|
|
504
509
|
"description": "A filesystem effect: read (the command only reads its path operands) or write (it may modify them)."
|
|
505
510
|
},
|
|
506
511
|
{
|
|
512
|
+
"maxItems": 1000,
|
|
507
513
|
"type": "array",
|
|
508
514
|
"items": {
|
|
509
515
|
"type": "string",
|
|
@@ -16,6 +16,13 @@ import { z } from "zod";
|
|
|
16
16
|
export const PERMISSIONS_SCHEMA_URL =
|
|
17
17
|
"https://raw.githubusercontent.com/gotgenes/pi-packages/main/packages/pi-permission-system/schemas/permissions.schema.json";
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* The most entries any config array accepts. zod checks `.max()` before it
|
|
21
|
+
* walks the elements, so an oversized array costs one issue rather than one per
|
|
22
|
+
* entry (CVE-2023-54404); an unbounded array has no such guard.
|
|
23
|
+
*/
|
|
24
|
+
const MAX_CONFIG_ARRAY_ITEMS = 1000;
|
|
25
|
+
|
|
19
26
|
const permissionStateSchema = z
|
|
20
27
|
.union([
|
|
21
28
|
z.literal("allow").meta({
|
|
@@ -334,7 +341,10 @@ const declaredEffectSchema = z.enum(["read", "write"]).meta({
|
|
|
334
341
|
});
|
|
335
342
|
|
|
336
343
|
const declaredEffectsSchema = z
|
|
337
|
-
.union([
|
|
344
|
+
.union([
|
|
345
|
+
declaredEffectSchema,
|
|
346
|
+
z.array(declaredEffectSchema).max(MAX_CONFIG_ARRAY_ITEMS),
|
|
347
|
+
])
|
|
338
348
|
.meta({
|
|
339
349
|
description:
|
|
340
350
|
'The filesystem effects of a command\'s path operands: "read", "write", or an array of them. An empty array declares that the operands touch no file, so they are withdrawn from the path surfaces.',
|
|
@@ -373,10 +383,14 @@ const commandKeySchema = z
|
|
|
373
383
|
const commandEffectsEntrySchema = z
|
|
374
384
|
.strictObject({
|
|
375
385
|
effects: declaredEffectsSchema.optional(),
|
|
376
|
-
unlessOption: z
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
386
|
+
unlessOption: z
|
|
387
|
+
.array(optionStemSchema)
|
|
388
|
+
.max(MAX_CONFIG_ARRAY_ITEMS)
|
|
389
|
+
.optional()
|
|
390
|
+
.meta({
|
|
391
|
+
description:
|
|
392
|
+
"Option stems whose appearance anywhere in the command withdraws the declaration, so its path operands fall back to consulting both directional surfaces.",
|
|
393
|
+
}),
|
|
380
394
|
get subcommands() {
|
|
381
395
|
return z
|
|
382
396
|
.record(
|
|
@@ -460,6 +474,7 @@ export const unifiedConfigSchema = z
|
|
|
460
474
|
permissionDialogKeys: dialogKeysSchema.optional(),
|
|
461
475
|
promptNotifications: z
|
|
462
476
|
.array(promptNotificationChannelSchema)
|
|
477
|
+
.max(MAX_CONFIG_ARRAY_ITEMS)
|
|
463
478
|
.optional()
|
|
464
479
|
.meta({
|
|
465
480
|
description:
|
|
@@ -516,20 +531,28 @@ export const unifiedConfigSchema = z
|
|
|
516
531
|
markdownDescription:
|
|
517
532
|
"**Deprecated and ignored.** Superseded by `promptMaxRows` and `promptFieldMaxWidth`, which bound the whole permission prompt rather than one summary inside it.\n\nStill accepted so an existing config is not rejected fail-closed, but the value no longer takes effect. Remove it.",
|
|
518
533
|
}),
|
|
519
|
-
piInfrastructureReadPaths: z
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
534
|
+
piInfrastructureReadPaths: z
|
|
535
|
+
.array(z.string().min(1))
|
|
536
|
+
.max(MAX_CONFIG_ARRAY_ITEMS)
|
|
537
|
+
.optional()
|
|
538
|
+
.meta({
|
|
539
|
+
description:
|
|
540
|
+
"Additional directories to auto-allow for reads as Pi infrastructure, bypassing the external_directory gate. Supports ~ expansion and wildcard patterns (* and ?).",
|
|
541
|
+
markdownDescription:
|
|
542
|
+
"Additional directories to auto-allow for reads as Pi infrastructure, bypassing the `external_directory` gate.\n\nThe extension auto-discovers the global node_modules root (walks up from the extension's install path; falls back to `npm root -g` from a dev checkout), Pi's own install directory (via the coding-agent `getPackageDir()` API), Pi's harness entries under `agentDir` (`agents/`, `extensions/`, `git/`, `npm/`, `prompts/`, `skills/`, `themes/`, `settings.json`, `SYSTEM.md`, `APPEND_SYSTEM.md`, `AGENTS.md`), and project-local `.pi/npm/` and `.pi/git/`. The package's own logs directory is never auto-allowed, even when an entry here covers it. Add entries here for edge cases where auto-discovery is insufficient (e.g. custom `npmCommand` pointing to pnpm).\n\nSupports `~`/`$HOME` expansion. Entries may be plain directory prefixes or wildcard patterns using `*` (matches any characters, including `/`) and `?` (matches exactly one character). `**` and `*` are equivalent — both cross directory boundaries.\n\nOn Windows, matching is case-insensitive and tolerant of either path separator.",
|
|
543
|
+
default: [],
|
|
544
|
+
}),
|
|
545
|
+
authorizerChain: z
|
|
546
|
+
.array(z.string().min(1))
|
|
547
|
+
.max(MAX_CONFIG_ARRAY_ITEMS)
|
|
548
|
+
.optional()
|
|
549
|
+
.meta({
|
|
550
|
+
description:
|
|
551
|
+
"Ordered names of registered live-authority chain links to consult before the terminal authorizer. Config order (not registration order) fixes the chain order; an unregistered name is skipped fail-safe (more prompting, never less); a link decides nothing until it is named here.",
|
|
552
|
+
markdownDescription:
|
|
553
|
+
"Ordered names of registered **live-authority chain links** (e.g. a model judge) to consult before the terminal authorizer (the human, or the subagent-forwarding / headless-deny fallback).\n\nA link reviews an `ask` and returns `allow` / `deny` (with an optional teaching reason) / `defer` to the next link. Three invariants govern the chain:\n\n- **Config order wins.** The order here \u2014 not the order extensions register in \u2014 fixes the security-relevant chain order.\n- **Fail-safe skip.** A name with no registered link is skipped with a warning; the `ask` still reaches the terminal (more prompting, never less).\n- **Opt-in activation.** Installing a judge extension grants it no authority; a link decides nothing until you name it here.\n\nThe chain owner caps every verdict with a bounded-delegation checkpoint: a link's `allow` on an excluded surface (`external_directory` or `path`) is downgraded to `defer`, so a link cannot exceed your policy. The one exception is per ask: a link's `allow` on a bash `external_directory` ask whose every flagged path names nothing on disk below the filesystem root (and is not a proven write) is honored, and the review log records `authorizer_allow_licensed`.\n\nDefaults to an empty list (no links).",
|
|
554
|
+
default: [],
|
|
555
|
+
}),
|
|
533
556
|
permission: permissionSchema.optional(),
|
|
534
557
|
shellTools: shellToolsSchema.optional(),
|
|
535
558
|
commandEffects: commandEffectsSchema.optional(),
|