@xynogen/pix-gate 0.2.8 → 0.2.9

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": "@xynogen/pix-gate",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Pi extension — 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
  "dependencies": {
45
45
  "@xynogen/pix-pretty": "^1.11.2",
46
46
  "@xynogen/pix-data": "^0.4.3",
47
- "@xynogen/pix-runtime": "^0.6.0"
47
+ "@xynogen/pix-runtime": "^0.7.0"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@earendil-works/pi-coding-agent": "*",
package/src/gate.test.ts CHANGED
@@ -2,6 +2,8 @@ import { describe, expect, test } from "bun:test";
2
2
  import {
3
3
  buildRules,
4
4
  classify,
5
+ classifyPath,
6
+ DEFAULT_PATH_RULES,
5
7
  DEFAULT_RULES,
6
8
  extractPathsFromBash,
7
9
  isCircuitBreaker,
@@ -9,6 +11,23 @@ import {
9
11
  unattendedGateDecision,
10
12
  } from "./lib.ts";
11
13
 
14
+ // ── .env path gating ─────────────────────────────────────────────
15
+ describe("classifyPath .env", () => {
16
+ const blocked = [".env", ".env.local", ".env.production", "path/to/.env", "src/.env.staging"];
17
+ const allowed = [".env.example", ".env.sample", ".env.template", ".env.dist"];
18
+
19
+ for (const p of blocked) {
20
+ test(`reading ${p} is blocked`, () => {
21
+ expect(classifyPath(p, "read", DEFAULT_PATH_RULES)?.severity).toBe("block");
22
+ });
23
+ }
24
+ for (const p of allowed) {
25
+ test(`reading ${p} is not blocked`, () => {
26
+ expect(classifyPath(p, "read", DEFAULT_PATH_RULES)).toBeUndefined();
27
+ });
28
+ }
29
+ });
30
+
12
31
  // ── isSudoCommand ─────────────────────────────────────────────────────────────
13
32
 
14
33
  describe("isSudoCommand", () => {
package/src/lib.ts CHANGED
@@ -222,9 +222,15 @@ export const DEFAULT_PATH_RULES: PathRule[] = [
222
222
  severity: "block",
223
223
  reason: "credentials file",
224
224
  },
225
+ // Real .env files hold live secrets — block. Placeholder variants
226
+ // (.env.example/.sample/.template/.dist) carry no secrets, so exclude them.
227
+ {
228
+ pattern: /(^|\/)\.env(?:$|\.(?!example|sample|template|dist)[A-Za-z0-9_-]+)/i,
229
+ severity: "block",
230
+ reason: ".env file (live secrets)",
231
+ },
225
232
 
226
233
  // warn — yellow allow-first
227
- { pattern: /(^|\/)\.env(\.|$)/i, severity: "warn", reason: ".env file" },
228
234
  { pattern: /(^|\/)\.envrc$/i, severity: "warn", reason: "direnv file" },
229
235
  {
230
236
  pattern: /(^|\/)\.npmrc$/i,