@xynogen/pix-gate 0.4.2 → 0.4.4
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 +2 -2
- package/src/lib.ts +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xynogen/pix-gate",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Pi extension \u2014 permission gate for dangerous bash commands (confirm/block with TUI dialog)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@xynogen/pix-pretty": "^1.32.0",
|
|
47
|
-
"@xynogen/pix-runtime": "^0.
|
|
47
|
+
"@xynogen/pix-runtime": "^0.15.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@earendil-works/pi-coding-agent": "*",
|
package/src/lib.ts
CHANGED
|
@@ -323,8 +323,11 @@ export function buildRules(cfg: UserConfig): {
|
|
|
323
323
|
pathRules: PathRule[];
|
|
324
324
|
} {
|
|
325
325
|
const base = cfg.guardrails === "off" ? [] : DEFAULT_RULES.slice();
|
|
326
|
+
// `g`/`y` make RegExp.test() stateful (lastIndex), so the same command would
|
|
327
|
+
// match on one call and slip through on the next. Strip them.
|
|
328
|
+
const stateless = (flags: string) => flags.replace(/[gy]/g, "");
|
|
326
329
|
const extra = (cfg.extraRules ?? []).map((r) => ({
|
|
327
|
-
pattern: new RegExp(r.pattern, r.flags ?? "i"),
|
|
330
|
+
pattern: new RegExp(r.pattern, stateless(r.flags ?? "i")),
|
|
328
331
|
severity: (r.severity ?? "dangerous") as Severity,
|
|
329
332
|
reason: r.reason ?? "user-defined rule",
|
|
330
333
|
}));
|