@gotgenes/pi-permission-system 1.1.0 → 1.2.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.
- package/CHANGELOG.md +28 -0
- package/README.md +4 -3
- package/package.json +1 -1
- package/src/permission-manager.ts +1 -8
- package/tests/permission-system.test.ts +61 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,34 @@ 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
|
+
## [1.2.1](https://github.com/gotgenes/pi-permission-system/compare/v1.2.0...v1.2.1) (2026-05-03)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **retro:** correct MD060 rule — column alignment, not separator spacing ([7f116b8](https://github.com/gotgenes/pi-permission-system/commit/7f116b884c03d9c346a640f306bca934b91214cd))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Documentation
|
|
17
|
+
|
|
18
|
+
* plan relax on-disk identity rule ([#22](https://github.com/gotgenes/pi-permission-system/issues/22)) ([d886862](https://github.com/gotgenes/pi-permission-system/commit/d886862a3686746f48e618ab2f950c7b1109d804))
|
|
19
|
+
* relax on-disk identity rule for config/log paths ([#22](https://github.com/gotgenes/pi-permission-system/issues/22)) ([352b103](https://github.com/gotgenes/pi-permission-system/commit/352b1038b1492b1f8222950edf4b6d093157128d))
|
|
20
|
+
* **retro:** add retro notes for issue [#19](https://github.com/gotgenes/pi-permission-system/issues/19) ([1d4a4a6](https://github.com/gotgenes/pi-permission-system/commit/1d4a4a6959905f102dea08273e7b827d8111a583))
|
|
21
|
+
* update README badges to match pi-autoformat style ([5c6ef1f](https://github.com/gotgenes/pi-permission-system/commit/5c6ef1fcfb2b6f5ee353765ebeeac7cdf09d2bbb))
|
|
22
|
+
|
|
23
|
+
## [1.2.0](https://github.com/gotgenes/pi-permission-system/compare/v1.1.0...v1.2.0) (2026-05-03)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* drop legacy settings.json fallback for MCP server names ([#19](https://github.com/gotgenes/pi-permission-system/issues/19)) ([3978f94](https://github.com/gotgenes/pi-permission-system/commit/3978f94acfe01b32e6e37c4fa0f5ca3b22881208))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Documentation
|
|
32
|
+
|
|
33
|
+
* plan drop legacy settings.json MCP fallback ([#19](https://github.com/gotgenes/pi-permission-system/issues/19)) ([fd88aac](https://github.com/gotgenes/pi-permission-system/commit/fd88aac8e52c0b617b5ce2582c700bbb86b9bf84))
|
|
34
|
+
* **retro:** add retro notes for issue [#18](https://github.com/gotgenes/pi-permission-system/issues/18) ([1bb9cc5](https://github.com/gotgenes/pi-permission-system/commit/1bb9cc52abe159d77b8ab29960bafdb2740c9c98))
|
|
35
|
+
|
|
8
36
|
## [1.1.0](https://github.com/gotgenes/pi-permission-system/compare/v1.0.0...v1.1.0) (2026-05-03)
|
|
9
37
|
|
|
10
38
|
|
package/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# 🔐 @gotgenes/pi-permission-system
|
|
2
2
|
|
|
3
|
-
[](LICENSE)
|
|
3
|
+
[](https://www.npmjs.com/package/@gotgenes/pi-permission-system) [](https://github.com/gotgenes/pi-permission-system/actions/workflows/ci.yml) [](https://opensource.org/licenses/MIT) [](https://www.typescriptlang.org/) [](https://pi.mariozechner.at/)
|
|
5
4
|
|
|
6
5
|
Permission enforcement extension for the Pi coding agent that provides centralized, deterministic permission gates for tool, bash, MCP, skill, and special operations.
|
|
7
6
|
|
|
8
|
-
> **Fork notice:** This package is a friendly fork of [MasuRii/pi-permission-system](https://github.com/MasuRii/pi-permission-system), published to npm as `@gotgenes/pi-permission-system`.
|
|
7
|
+
> **Fork notice:** This package is a friendly fork of [MasuRii/pi-permission-system](https://github.com/MasuRii/pi-permission-system), published to npm as `@gotgenes/pi-permission-system`.
|
|
8
|
+
> This fork diverges from upstream in config layout (#10).
|
|
9
|
+
> The `/permission-system` slash command and `pi-permission-system:permission-request` event channel names are preserved; the config and log paths are not.
|
|
9
10
|
|
|
10
11
|
## Features
|
|
11
12
|
|
package/package.json
CHANGED
|
@@ -31,9 +31,6 @@ function defaultGlobalConfigPath(): string {
|
|
|
31
31
|
function defaultAgentsDir(): string {
|
|
32
32
|
return join(getAgentDir(), "agents");
|
|
33
33
|
}
|
|
34
|
-
function defaultLegacyGlobalSettingsPath(): string {
|
|
35
|
-
return join(getAgentDir(), "settings.json");
|
|
36
|
-
}
|
|
37
34
|
function defaultGlobalMcpConfigPath(): string {
|
|
38
35
|
return join(getAgentDir(), "mcp.json");
|
|
39
36
|
}
|
|
@@ -524,7 +521,6 @@ export class PermissionManager {
|
|
|
524
521
|
private readonly agentsDir: string;
|
|
525
522
|
private readonly projectGlobalConfigPath: string | null;
|
|
526
523
|
private readonly projectAgentsDir: string | null;
|
|
527
|
-
private readonly legacyGlobalSettingsPath: string;
|
|
528
524
|
private readonly globalMcpConfigPath: string;
|
|
529
525
|
private readonly configuredMcpServerNamesOverride: readonly string[] | null;
|
|
530
526
|
private globalConfigCache: FileCacheEntry<GlobalPermissionConfig> | null =
|
|
@@ -554,7 +550,6 @@ export class PermissionManager {
|
|
|
554
550
|
agentsDir?: string;
|
|
555
551
|
projectGlobalConfigPath?: string;
|
|
556
552
|
projectAgentsDir?: string;
|
|
557
|
-
legacyGlobalSettingsPath?: string;
|
|
558
553
|
globalMcpConfigPath?: string;
|
|
559
554
|
mcpServerNames?: readonly string[];
|
|
560
555
|
} = {},
|
|
@@ -564,8 +559,6 @@ export class PermissionManager {
|
|
|
564
559
|
this.agentsDir = options.agentsDir || defaultAgentsDir();
|
|
565
560
|
this.projectGlobalConfigPath = options.projectGlobalConfigPath || null;
|
|
566
561
|
this.projectAgentsDir = options.projectAgentsDir || null;
|
|
567
|
-
this.legacyGlobalSettingsPath =
|
|
568
|
-
options.legacyGlobalSettingsPath || defaultLegacyGlobalSettingsPath();
|
|
569
562
|
this.globalMcpConfigPath =
|
|
570
563
|
options.globalMcpConfigPath || defaultGlobalMcpConfigPath();
|
|
571
564
|
this.configuredMcpServerNamesOverride = options.mcpServerNames
|
|
@@ -840,7 +833,7 @@ export class PermissionManager {
|
|
|
840
833
|
return this.configuredMcpServerNamesOverride;
|
|
841
834
|
}
|
|
842
835
|
|
|
843
|
-
const paths = [this.globalMcpConfigPath
|
|
836
|
+
const paths = [this.globalMcpConfigPath];
|
|
844
837
|
const stamp = paths
|
|
845
838
|
.map((path) => `${path}:${getFileStamp(path)}`)
|
|
846
839
|
.join("|");
|
|
@@ -911,6 +911,67 @@ test("MCP proxy tool infers server-prefixed aliases from configured server names
|
|
|
911
911
|
}
|
|
912
912
|
});
|
|
913
913
|
|
|
914
|
+
test("MCP server names in settings.json are not used — only mcp.json is consulted", () => {
|
|
915
|
+
const baseDir = mkdtempSync(join(tmpdir(), "pi-permission-system-test-"));
|
|
916
|
+
const globalConfigPath = join(baseDir, "pi-permissions.jsonc");
|
|
917
|
+
const mcpConfigPath = join(baseDir, "mcp.json");
|
|
918
|
+
const settingsJsonPath = join(baseDir, "settings.json");
|
|
919
|
+
const agentsDir = join(baseDir, "agents");
|
|
920
|
+
mkdirSync(agentsDir, { recursive: true });
|
|
921
|
+
|
|
922
|
+
// Policy: allow any target prefixed with legacy-server, default mcp is ask.
|
|
923
|
+
// If legacy-server were known as a configured server name, a tool named
|
|
924
|
+
// "some_tool_legacy-server" would derive "legacy-server_some_tool_legacy-server"
|
|
925
|
+
// which matches this rule and returns "allow".
|
|
926
|
+
// After the fix, settings.json is ignored, so no server name is derived and the
|
|
927
|
+
// result falls through to the default mcp policy ("ask").
|
|
928
|
+
const config: GlobalPermissionConfig = {
|
|
929
|
+
defaultPolicy: {
|
|
930
|
+
tools: "ask",
|
|
931
|
+
bash: "ask",
|
|
932
|
+
mcp: "ask",
|
|
933
|
+
skills: "ask",
|
|
934
|
+
special: "ask",
|
|
935
|
+
},
|
|
936
|
+
tools: {},
|
|
937
|
+
bash: {},
|
|
938
|
+
mcp: { "legacy-server_*": "allow" },
|
|
939
|
+
skills: {},
|
|
940
|
+
special: {},
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
writeFileSync(
|
|
944
|
+
globalConfigPath,
|
|
945
|
+
`${JSON.stringify(config, null, 2)}\n`,
|
|
946
|
+
"utf8",
|
|
947
|
+
);
|
|
948
|
+
// mcp.json does not know about legacy-server.
|
|
949
|
+
writeFileSync(mcpConfigPath, JSON.stringify({ mcpServers: {} }), "utf8");
|
|
950
|
+
// settings.json has legacy-server — the legacy source that must now be ignored.
|
|
951
|
+
writeFileSync(
|
|
952
|
+
settingsJsonPath,
|
|
953
|
+
JSON.stringify({ mcpServers: { "legacy-server": {} } }),
|
|
954
|
+
"utf8",
|
|
955
|
+
);
|
|
956
|
+
|
|
957
|
+
const manager = new PermissionManager({
|
|
958
|
+
globalConfigPath,
|
|
959
|
+
agentsDir,
|
|
960
|
+
globalMcpConfigPath: mcpConfigPath,
|
|
961
|
+
});
|
|
962
|
+
|
|
963
|
+
try {
|
|
964
|
+
// "legacy-server" must not be derived from settings.json.
|
|
965
|
+
// The bare tool name falls through to the default mcp policy → "ask".
|
|
966
|
+
const result = manager.checkPermission("mcp", {
|
|
967
|
+
tool: "some_tool_legacy-server",
|
|
968
|
+
});
|
|
969
|
+
assert.equal(result.state, "ask");
|
|
970
|
+
} finally {
|
|
971
|
+
rmSync(baseDir, { recursive: true, force: true });
|
|
972
|
+
}
|
|
973
|
+
});
|
|
974
|
+
|
|
914
975
|
test("MCP describe mode normalizes qualified tool names without duplicating server prefixes", () => {
|
|
915
976
|
const { manager, cleanup } = createManager(
|
|
916
977
|
{
|