@gotgenes/pi-permission-system 4.1.0 → 4.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.
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
+ ## [4.1.1](https://github.com/gotgenes/pi-permission-system/compare/v4.1.0...v4.1.1) (2026-05-04)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * add dotAll flag so wildcard `*` matches newlines ([#73](https://github.com/gotgenes/pi-permission-system/issues/73)) ([57085e3](https://github.com/gotgenes/pi-permission-system/commit/57085e3c9dbe80204e5629a3c18f8c1f307226f8))
14
+
15
+
16
+ ### Documentation
17
+
18
+ * plan dotAll fix for wildcard multiline matching ([#73](https://github.com/gotgenes/pi-permission-system/issues/73)) ([b9c0a5b](https://github.com/gotgenes/pi-permission-system/commit/b9c0a5bcabc0f77e85d4932f7e2cf584a1bc0223))
19
+
8
20
  ## [4.1.0](https://github.com/gotgenes/pi-permission-system/compare/v4.0.1...v4.1.0) (2026-05-04)
9
21
 
10
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gotgenes/pi-permission-system",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "description": "Permission enforcement extension for the Pi coding agent.",
5
5
  "type": "module",
6
6
  "files": [
@@ -26,7 +26,7 @@ export function compileWildcardPattern<TState>(
26
26
  return {
27
27
  pattern,
28
28
  state,
29
- regex: new RegExp(`^${escaped}$`),
29
+ regex: new RegExp(`^${escaped}$`, "s"),
30
30
  };
31
31
  }
32
32
 
@@ -635,6 +635,27 @@ test("PermissionManager canonical built-in permission checking", () => {
635
635
  }
636
636
  });
637
637
 
638
+ test("multiline bash command resolves to allow via universal fallback", () => {
639
+ // Regression test for #73: node -e "..." with embedded newlines was
640
+ // falling through to the hard-coded 'ask' default because wildcardMatch
641
+ // used /^.*$/ (no dotAll), which does not match '\n'.
642
+ const { manager, cleanup } = createManager({
643
+ permission: {
644
+ "*": "allow",
645
+ bash: { "rm -rf *": "deny", "sudo *": "ask" },
646
+ },
647
+ });
648
+
649
+ try {
650
+ const command =
651
+ "node -e \"\nimport('x').then(() => {\n console.log('done');\n});\n\"";
652
+ const result = manager.checkPermission("bash", { command });
653
+ assert.equal(result.state, "allow");
654
+ } finally {
655
+ cleanup();
656
+ }
657
+ });
658
+
638
659
  test("Bash specific deny patterns override catch-all within the same config", () => {
639
660
  // In the flat format, patterns within a surface map are ordered by insertion.
640
661
  // Last-match-wins means specific patterns placed AFTER the catch-all override it.
@@ -187,6 +187,22 @@ describe("wildcardMatch", () => {
187
187
  expect(wildcardMatch("*", "bash")).toBe(true);
188
188
  });
189
189
 
190
+ test("'*' pattern matches values containing newlines", () => {
191
+ expect(wildcardMatch("*", "line1\nline2")).toBe(true);
192
+ expect(wildcardMatch("*", "a\nb\nc")).toBe(true);
193
+ });
194
+
195
+ test("prefix-wildcard pattern matches value with embedded newlines", () => {
196
+ const command =
197
+ "node -e \"\nimport('x').then(() => {\n console.log('done');\n});\n\"";
198
+ expect(wildcardMatch("node *", command)).toBe(true);
199
+ });
200
+
201
+ test("compileWildcardPattern regex matches multiline string", () => {
202
+ const compiled = compileWildcardPattern("*", "allow");
203
+ expect(compiled.regex.test("a\nb")).toBe(true);
204
+ });
205
+
190
206
  test("exact pattern matches identical value", () => {
191
207
  expect(wildcardMatch("read", "read")).toBe(true);
192
208
  expect(wildcardMatch("external_directory", "external_directory")).toBe(