You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pi-permission-system: untyped wire ingestion in readForwardedPermissionRequest and unsafe event object assertions #1069
In src/authority/forwarding-io.ts (lines 507–535), readForwardedPermissionRequest casts raw JSON.parse output directly to Partial<ForwardedPermissionRequest> and performs manual typeof checks on a subset of fields. Unvalidated fields are passed directly into internal domain models.
Expected behavior
Pi lifecycle events should be inspected with proper type guards (isRecord(event) or standard narrowing).
Wire-level JSON files loaded from the filesystem should be validated with runtime schemas (such as Zod, which is already a core project dependency for config validation) rather than unchecked type assertions.
Suggested remediation
Replace double assertion with a type guard helper:
functionhasToolCallId(event: unknown): event is {toolCallId: string}{returntypeofevent==="object"&&event!==null&&"toolCallId"inevent&&typeof(eventas{toolCallId: unknown}).toolCallId==="string";}
Introduce a Zod schema for ForwardedPermissionRequest in forwarding-io.ts to guarantee payload integrity and type safety across IPC boundaries.
Activity