@gotgenes/pi-permission-system 23.0.3 → 24.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 CHANGED
@@ -5,6 +5,17 @@ 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
+ ## [24.0.0](https://github.com/gotgenes/pi-packages/compare/pi-permission-system-v23.0.3...pi-permission-system-v24.0.0) (2026-07-26)
9
+
10
+
11
+ ### ⚠ BREAKING CHANGES
12
+
13
+ * **pi-permission-system:** an authorizer chain link's `allow` on a forwarded subagent ask raised by the `path` or `external_directory` gate is now downgraded to `defer`, so the request falls through to an interactive prompt. This affects only an operator running an allow-capable third-party link named in `authorizerChain`; the first-party model judge is deny-first and is unaffected, as are forwarded `bash` asks and per-tool-gated asks. See packages/pi-permission-system/docs/migration/0635-forwarded-ask-delegation-envelope.md
14
+
15
+ ### Bug Fixes
16
+
17
+ * **pi-permission-system:** carry forwarded access facts to the Authorizer Chain ([#635](https://github.com/gotgenes/pi-packages/issues/635)) ([c0790ad](https://github.com/gotgenes/pi-packages/commit/c0790ad6d1d15defaba60097d803618b4d8c461c))
18
+
8
19
  ## [23.0.3](https://github.com/gotgenes/pi-packages/compare/pi-permission-system-v23.0.2...pi-permission-system-v23.0.3) (2026-07-26)
9
20
 
10
21
 
package/dist/public.d.ts CHANGED
@@ -195,8 +195,10 @@ interface PromptPermissionDetails {
195
195
  * The child-fixed access facts the raising gate computed (surface + match
196
196
  * set). Rides through the runner to the escalation edge, which completes
197
197
  * them into a `ForwardedAccessIntent` by stamping `requesterCwd` and
198
- * `principal`. Absent for a serving-node local prompt reconstructed from a
199
- * forwarded request.
198
+ * `principal`. On a serving node these facts are projected back off the
199
+ * forwarded request, so a forwarded ask reaches the `Authorizer` chain with
200
+ * the same evidence as a local one; only a version-skew request that carried
201
+ * no intent leaves this absent.
200
202
  */
201
203
  accessIntent?: ForwardedAccessFacts;
202
204
  }
@@ -209,6 +209,9 @@ Three invariants govern the chain:
209
209
 
210
210
  The chain owner caps every link with a **bounded-delegation checkpoint**: a link's `allow` on an excluded surface (`external_directory` or the `path` surface) is downgraded to `defer`, so a buggy or over-eager judge can never approve access outside your policy.
211
211
  Deny and defer are never capped.
212
+ The excluded surface is the **gate** surface the rule fired on, not the tool name displayed in the prompt — so a `write` blocked by a `path` rule is capped.
213
+ This holds for an ask forwarded up from a subagent exactly as it does for a local one.
214
+ See [migration/0635-forwarded-ask-delegation-envelope.md](migration/0635-forwarded-ask-delegation-envelope.md).
212
215
 
213
216
  Extension authors: register a link from a `permissions:ready` handler via `getPermissionsService().registerAuthorizer(name, authorize)`; the callback receives the ask details and a narrow, session-scoped `PermissionQuery` (`checkPermission` / `getToolPermission`) so it can consult the deterministic engine at gate parity.
214
217
  Registration returns a disposer, and only one link may hold a given name.
@@ -0,0 +1,42 @@
1
+ # Migration guide: forwarded asks and the bounded-delegation checkpoint
2
+
3
+ Starting with the release that closes #635, a permission request forwarded up from a subagent carries the **child-fixed access facts** through to the authorizer chain.
4
+ As a side effect, the bounded-delegation checkpoint now applies to forwarded asks the same way it already applied to local ones.
5
+ This is a **breaking change** for one narrow configuration.
6
+
7
+ ## Who is affected
8
+
9
+ You are affected only if **all** of the following hold:
10
+
11
+ - You name an authorizer chain link in `authorizerChain`, and
12
+ - that link is **allow-capable** (it can return `allow`, not only `deny` / `defer`), and
13
+ - a subagent forwards an `ask` to your session that was raised by the `path` or `external_directory` gate.
14
+
15
+ If you run no chain link, or run only a deny-first link — including the first-party [`@gotgenes/pi-permission-model-judge`](https://github.com/gotgenes/pi-packages/tree/main/packages/pi-permission-model-judge), which only ever denies or defers — **nothing changes for you**.
16
+
17
+ ## What changed
18
+
19
+ The checkpoint downgrades a link's `allow` to `defer` on the excluded surfaces (`path`, `external_directory`), so the request falls through to an interactive prompt instead.
20
+ It selects the surface from the **gate** surface — the surface the matching rule lives on — falling back to the displayed surface when no gate surface is available.
21
+
22
+ A forwarded request previously arrived with no gate surface, so the checkpoint fell back to the child's *display* surface, which is the tool name (`write`, `edit`, `read`).
23
+ A tool name is not an excluded surface, so a link's `allow` on a forwarded `path`-gated request was honored.
24
+ The identical request made directly in the same session was capped, because a local request always carries its gate surface.
25
+
26
+ Forwarding was therefore a way around your own delegation boundary: a link could approve `~/.ssh/config` for a subagent that it could not approve for the main session.
27
+ Now the gate surface crosses the forwarding hop, and both paths behave identically.
28
+
29
+ Unchanged: a forwarded `bash` ask, and a forwarded tool ask gated by a per-tool rule (`write: ask`), are both already on non-excluded surfaces and are not capped.
30
+ `deny` and `defer` verdicts were never capped and still are not.
31
+
32
+ ## What you need to do
33
+
34
+ Nothing, unless you run an allow-capable link.
35
+
36
+ If you do, expect an interactive prompt where that link previously auto-approved a forwarded subagent request for a path.
37
+ To keep such a request from prompting, grant it in policy rather than through the link — the `path` and `external_directory` rules in your config are consulted before the chain runs, so an `allow` there resolves the request without reaching an authorizer at all.
38
+
39
+ ## Related
40
+
41
+ Issue #620 will replace the whole-`path` exclusion with a narrower secret-shaped one, letting a link allow a non-secret path again while keeping secret-shaped paths capped.
42
+ That refinement applies to local and forwarded asks alike, so the two paths stay aligned.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gotgenes/pi-permission-system",
3
- "version": "23.0.3",
3
+ "version": "24.0.0",
4
4
  "description": "Permission enforcement extension for the Pi coding agent.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -5,6 +5,7 @@ import {
5
5
  } from "#src/authority/forwarder-context";
6
6
  import type { PermissionPromptDecision } from "#src/authority/permission-dialog";
7
7
  import {
8
+ type ForwardedAccessFacts,
8
9
  type ForwardedAccessIntent,
9
10
  type ForwardedPermissionRequest,
10
11
  type ForwardedPermissionResponse,
@@ -93,7 +94,14 @@ function formatForwardedPermissionPrompt(
93
94
  /**
94
95
  * Map a forwarded request onto the escalated ask's details, carrying the
95
96
  * forwarded provenance (requester agent/session + the child's original display
96
- * projection) so `LocalUserAuthorizer` emits a non-degraded broadcast (#292).
97
+ * projection) so `LocalUserAuthorizer` emits a non-degraded broadcast (#292),
98
+ * plus the child-fixed access facts so the serving node's `Authorizer` chain
99
+ * judges a forwarded ask on the same evidence as a local one (ADR 0008; #635).
100
+ *
101
+ * The display `surface` and the fact `surface` are distinct and both belong
102
+ * here: the former is the child's tool name (what the UI shows), the latter the
103
+ * gate surface the rule fired on (what the bounded-delegation checkpoint
104
+ * excludes on).
97
105
  */
98
106
  function buildForwardedAskDetails(
99
107
  request: ForwardedPermissionRequest,
@@ -114,6 +122,33 @@ function buildForwardedAskDetails(
114
122
  ...(request.sessionApproval
115
123
  ? { sessionApproval: request.sessionApproval }
116
124
  : {}),
125
+ // Absent for a version-skew request that carried no intent — which the
126
+ // delegation envelope reads as "surface undetermined" and fail-safes to
127
+ // excluded, so absence must stay absence rather than become `undefined`.
128
+ ...(request.accessIntent
129
+ ? { accessIntent: toAccessFacts(request.accessIntent) }
130
+ : {}),
131
+ };
132
+ }
133
+
134
+ /**
135
+ * Project the wire intent down to the child-fixed access facts an `Authorizer`
136
+ * may see.
137
+ *
138
+ * Field-by-field rather than a spread, because this is a disclosure boundary:
139
+ * `requesterCwd` and `principal` are requester identity for the serving node's
140
+ * own resolution (ADR 0008 §3) and stay off the ask details. A link that needs
141
+ * requester identity reads `details.forwarding`. `ForwardedAccessIntent`
142
+ * extends `ForwardedAccessFacts`, so a spread would type-check while widening
143
+ * disclosure at runtime; the explicit return type makes any future field on
144
+ * `ForwardedAccessFacts` a compile error here until it is deliberately
145
+ * projected or deliberately withheld.
146
+ */
147
+ function toAccessFacts(intent: ForwardedAccessIntent): ForwardedAccessFacts {
148
+ return {
149
+ surface: intent.surface,
150
+ matchValues: intent.matchValues,
151
+ boundaryValue: intent.boundaryValue,
117
152
  };
118
153
  }
119
154
 
@@ -53,8 +53,10 @@ export interface PromptPermissionDetails {
53
53
  * The child-fixed access facts the raising gate computed (surface + match
54
54
  * set). Rides through the runner to the escalation edge, which completes
55
55
  * them into a `ForwardedAccessIntent` by stamping `requesterCwd` and
56
- * `principal`. Absent for a serving-node local prompt reconstructed from a
57
- * forwarded request.
56
+ * `principal`. On a serving node these facts are projected back off the
57
+ * forwarded request, so a forwarded ask reaches the `Authorizer` chain with
58
+ * the same evidence as a local one; only a version-skew request that carried
59
+ * no intent leaves this absent.
58
60
  */
59
61
  accessIntent?: ForwardedAccessFacts;
60
62
  }