passport-bridge 0.46.1 → 0.48.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/dist/cliExec.js +2 -2
- package/dist/cliGitCredential.js +3 -9
- package/dist/cliGuardHealth.d.ts +5 -0
- package/dist/cliGuardHealth.js +6 -1
- package/dist/cliHook.d.ts +3 -13
- package/dist/cliHook.js +68 -43
- package/dist/cliHookClients.d.ts +3 -0
- package/dist/cliHookClients.js +4 -0
- package/dist/cliHookDecide.d.ts +12 -3
- package/dist/cliHookDecide.js +120 -11
- package/dist/cliHookDeliver.js +5 -2
- package/dist/cliHookInput.d.ts +2 -0
- package/dist/cliHookInput.js +10 -0
- package/dist/cliHookInstall.d.ts +6 -1
- package/dist/cliHookInstall.js +36 -9
- package/dist/cliHookStatus.d.ts +13 -0
- package/dist/cliHookStatus.js +54 -5
- package/dist/cliSetupLock.d.ts +1 -1
- package/dist/cliSetupLock.js +4 -3
- package/dist/cliSigningKeys.d.ts +10 -0
- package/dist/cliSigningKeys.js +10 -0
- package/dist/cliStatus.d.ts +5 -0
- package/dist/cliStatus.js +15 -5
- package/dist/connectorKit/engine.generated.js +16 -6
- package/dist/connectorKit/githubDecide.generated.d.ts +57 -0
- package/dist/connectorKit/githubDecide.generated.js +247 -0
- package/dist/{controlPlaneGithubCatalog.generated.d.ts → connectorKit/githubIds.generated.d.ts} +8 -12
- package/dist/{controlPlaneGithubCatalog.generated.js → connectorKit/githubIds.generated.js} +2 -33
- package/dist/connectorKit/http.generated.d.ts +33 -0
- package/dist/connectorKit/http.generated.js +399 -0
- package/dist/connectorKit/manifest.generated.d.ts +10 -1
- package/dist/connectorKit/manifests/github.generated.d.ts +1 -0
- package/dist/connectorKit/manifests/github.generated.js +39 -3
- package/dist/connectorKit/manifests/githubActionList.generated.d.ts +30 -0
- package/dist/connectorKit/manifests/githubActionList.generated.js +22 -0
- package/dist/connectorKit/manifests/githubCapture.generated.js +150 -84
- package/dist/connectorKit/manifests/githubGenerated.generated.d.ts +40 -0
- package/dist/connectorKit/manifests/githubGenerated.generated.js +143 -0
- package/dist/connectorKit/manifests/githubHooks.generated.d.ts +8 -0
- package/dist/connectorKit/manifests/githubHooks.generated.js +229 -29
- package/dist/connectorKit/manifests/githubReads.generated.js +23 -24
- package/dist/connectorKit/shadow.generated.d.ts +4 -10
- package/dist/connectorKit/shadow.generated.js +4 -40
- package/dist/connectorKit/sources/github/actions.generated.d.ts +35 -0
- package/dist/connectorKit/sources/github/actions.generated.js +2 -0
- package/dist/connectorKit/sources/github/catalog.generated.d.ts +2220 -0
- package/dist/connectorKit/sources/github/catalog.generated.js +2 -0
- package/dist/controlPlane.generated.d.ts +14 -32
- package/dist/controlPlane.generated.js +16 -5
- package/dist/controlPlaneCli.js +5 -2
- package/dist/controlPlaneGuard.d.ts +7 -7
- package/dist/controlPlaneGuard.js +37 -45
- package/dist/controlPlaneModel.generated.js +3 -0
- package/dist/controlPlaneOffline.d.ts +67 -0
- package/dist/controlPlaneOffline.js +213 -0
- package/dist/controlPlanePeople.generated.d.ts +9 -0
- package/dist/controlPlaneRailwayGuard.d.ts +7 -0
- package/dist/controlPlaneRailwayGuard.js +15 -2
- package/dist/controlPlaneRoutes.generated.d.ts +1 -1
- package/dist/controlPlaneRoutes.generated.js +1 -1
- package/dist/controlPlaneSupabase.d.ts +7 -0
- package/dist/controlPlaneSupabase.js +16 -3
- package/dist/cpCli.d.ts +22 -0
- package/dist/cpCli.js +108 -1
- package/dist/cpRefusal.d.ts +8 -0
- package/dist/cpRefusal.js +13 -0
- package/dist/execGithubRepo.js +6 -5
- package/dist/gitPush.d.ts +1 -11
- package/dist/gitPush.js +2 -5
- package/dist/hookAdapters.d.ts +44 -0
- package/dist/hookAdapters.js +106 -0
- package/dist/kitShadow.d.ts +2 -11
- package/dist/kitShadow.js +2 -7
- package/dist/lockedHooks.d.ts +13 -11
- package/dist/lockedHooks.js +19 -16
- package/dist/managedHooks.d.ts +2 -0
- package/dist/managedHooks.js +24 -3
- package/dist/pluginPin.d.ts +1 -1
- package/dist/pluginPin.js +1 -1
- package/dist/testHookEnv.d.ts +2 -0
- package/dist/testHookEnv.js +26 -0
- package/dist/testSigning.d.ts +5 -0
- package/dist/testSigning.js +19 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/controlPlaneGithub.generated.d.ts +0 -45
- package/dist/controlPlaneGithub.generated.js +0 -101
- package/dist/controlPlaneGithubApi.generated.d.ts +0 -17
- package/dist/controlPlaneGithubApi.generated.js +0 -172
- package/dist/controlPlaneGithubCli.generated.d.ts +0 -104
- package/dist/controlPlaneGithubCli.generated.js +0 -367
- package/dist/controlPlaneGithubWebhook.generated.d.ts +0 -30
- package/dist/controlPlaneGithubWebhook.generated.js +0 -105
package/dist/cliHookInput.d.ts
CHANGED
|
@@ -48,6 +48,8 @@ export declare function subagentOf(input: Pick<HookInput, "agent_id">): {
|
|
|
48
48
|
/** A shell string as-is, or an argv array (`["bash", "-lc", "…"]`) re-quoted
|
|
49
49
|
* so the classifier reads the same words the shell will. */
|
|
50
50
|
export declare function commandText(candidate: unknown): string | null;
|
|
51
|
+
/** What the agent sent, as text; null when nothing arrived in the budget or it was more than the hook reads. */
|
|
52
|
+
export declare function readRaw(runtime: Runtime, signal: AbortSignal): Promise<string | null>;
|
|
51
53
|
export declare function readInput(runtime: Runtime, signal: AbortSignal): Promise<HookInput | null>;
|
|
52
54
|
/** An object's fields, or none for anything else. */
|
|
53
55
|
export declare function record(candidate: unknown): Record<string, unknown>;
|
package/dist/cliHookInput.js
CHANGED
|
@@ -55,6 +55,16 @@ export function commandText(candidate) {
|
|
|
55
55
|
.map((part) => (/^[A-Za-z0-9_@%+=:,./-]+$/.test(part) ? part : `'${part.replaceAll("'", `'\\''`)}'`))
|
|
56
56
|
.join(" ");
|
|
57
57
|
}
|
|
58
|
+
/** What the agent sent, as text; null when nothing arrived in the budget or it was more than the hook reads. */
|
|
59
|
+
export async function readRaw(runtime, signal) {
|
|
60
|
+
try {
|
|
61
|
+
const text = await readStdin(runtime, signal);
|
|
62
|
+
return text ? text : null;
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
58
68
|
export async function readInput(runtime, signal) {
|
|
59
69
|
try {
|
|
60
70
|
const parsed = JSON.parse(await readStdin(runtime, signal));
|
package/dist/cliHookInstall.d.ts
CHANGED
|
@@ -43,7 +43,8 @@ export declare function stableInvocation(stable: {
|
|
|
43
43
|
* Add Passport's entry to every slot a registered kind is missing, with the
|
|
44
44
|
* command it already runs, touching nothing else. Idempotent; never adds a
|
|
45
45
|
* kind that isn't there (the guard someone turned off stays off), and leaves
|
|
46
|
-
* an agent the plugin covers alone.
|
|
46
|
+
* an agent the plugin covers alone. A guard entry from before fail-closed is
|
|
47
|
+
* upgraded in place (not counted). Returns the events added. Throws a
|
|
47
48
|
* CliFailure when the file can't be read.
|
|
48
49
|
*/
|
|
49
50
|
export declare function repairHookSlots(client: HookClient, env: Env): string[];
|
|
@@ -60,6 +61,8 @@ export declare function registeredEntries(client: HookClient, env: Env): {
|
|
|
60
61
|
};
|
|
61
62
|
/** What the guard does in Codex, in plain words (status, install, init). */
|
|
62
63
|
export declare const CODEX_BLOCK_ONLY = "In Codex, Passport refuses what your rules block and says why.";
|
|
64
|
+
/** Where the guard fails closed (Claude Code, Cursor): removing Passport first would block every shell command. */
|
|
65
|
+
export declare const FAIL_CLOSED_WARNING = "The guard fails closed: before removing Passport, run passport hook uninstall, or this agent's shell commands are refused.";
|
|
63
66
|
export type Change = {
|
|
64
67
|
action: "add" | "update" | "remove";
|
|
65
68
|
event: string;
|
|
@@ -93,6 +96,8 @@ export declare function agentHookStatus(client: HookClient, env: Env): {
|
|
|
93
96
|
plugin: boolean;
|
|
94
97
|
/** Hook events Passport's entry should be on but isn't. */
|
|
95
98
|
missing: string[];
|
|
99
|
+
/** The guard entry fails closed; null where the agent can't (Codex). The plugin's hooks fail open. */
|
|
100
|
+
failClosed: boolean | null;
|
|
96
101
|
command: string | null;
|
|
97
102
|
guardCommand: string | null;
|
|
98
103
|
path: string;
|
package/dist/cliHookInstall.js
CHANGED
|
@@ -177,7 +177,8 @@ function missingEvents(spec, settings) {
|
|
|
177
177
|
* Add Passport's entry to every slot a registered kind is missing, with the
|
|
178
178
|
* command it already runs, touching nothing else. Idempotent; never adds a
|
|
179
179
|
* kind that isn't there (the guard someone turned off stays off), and leaves
|
|
180
|
-
* an agent the plugin covers alone.
|
|
180
|
+
* an agent the plugin covers alone. A guard entry from before fail-closed is
|
|
181
|
+
* upgraded in place (not counted). Returns the events added. Throws a
|
|
181
182
|
* CliFailure when the file can't be read.
|
|
182
183
|
*/
|
|
183
184
|
export function repairHookSlots(client, env) {
|
|
@@ -188,18 +189,24 @@ export function repairHookSlots(client, env) {
|
|
|
188
189
|
const { settings } = readSettings(path);
|
|
189
190
|
let next = settings;
|
|
190
191
|
const added = [];
|
|
192
|
+
let upgraded = false;
|
|
191
193
|
for (const kind of ["guard", "audit"]) {
|
|
192
194
|
const command = registered(spec, settings, kind);
|
|
193
195
|
if (!command)
|
|
194
196
|
continue;
|
|
195
197
|
for (const slot of slotsOf(spec, kind)) {
|
|
196
|
-
|
|
198
|
+
const there = registeredAt(spec, settings, slot);
|
|
199
|
+
// A guard installed before fail-closed existed is upgraded in place, with the command it already runs.
|
|
200
|
+
if (there && (kind !== "guard" || entryFailsClosed(spec, entryAt(spec, settings, slot.event, kind)) !== false))
|
|
197
201
|
continue;
|
|
198
|
-
next = withEntry(spec, next, slot, command);
|
|
199
|
-
|
|
202
|
+
next = withEntry(spec, next, slot, there ?? command);
|
|
203
|
+
if (there)
|
|
204
|
+
upgraded = true;
|
|
205
|
+
else
|
|
206
|
+
added.push(slot.event);
|
|
200
207
|
}
|
|
201
208
|
}
|
|
202
|
-
if (added.length)
|
|
209
|
+
if (added.length || upgraded)
|
|
203
210
|
writeSettings(path, next);
|
|
204
211
|
return added;
|
|
205
212
|
}
|
|
@@ -207,6 +214,18 @@ export function repairHookSlots(client, env) {
|
|
|
207
214
|
export function registeredHookCommand(settings) {
|
|
208
215
|
return registered(CLIENTS["claude-code"], settings, "audit");
|
|
209
216
|
}
|
|
217
|
+
/** The guard entry's fail-closed setting, where the agent has one. */
|
|
218
|
+
function guardExtra(spec, kind) {
|
|
219
|
+
return kind === "guard" && spec.failClosed ? { ...spec.failClosed } : {};
|
|
220
|
+
}
|
|
221
|
+
/** Whether a guard entry fails closed: null where the agent can't, false when it could and doesn't. */
|
|
222
|
+
function entryFailsClosed(spec, entry) {
|
|
223
|
+
if (!spec.failClosed)
|
|
224
|
+
return null;
|
|
225
|
+
if (!entry)
|
|
226
|
+
return false;
|
|
227
|
+
return Object.entries(spec.failClosed).every(([key, value]) => entry[key] === value);
|
|
228
|
+
}
|
|
210
229
|
function withEntry(spec, settings, slot, command) {
|
|
211
230
|
const { event } = slot;
|
|
212
231
|
const ours = isOurs(slot.kind);
|
|
@@ -215,12 +234,12 @@ function withEntry(spec, settings, slot, command) {
|
|
|
215
234
|
if (spec.format === "cursor") {
|
|
216
235
|
const at = list.findIndex((entry) => ours(entry?.command));
|
|
217
236
|
const kept = list.filter((entry) => !ours(entry?.command));
|
|
218
|
-
const fresh = { command, timeout: HOOK_TIMEOUT_SECONDS };
|
|
237
|
+
const fresh = { command, timeout: HOOK_TIMEOUT_SECONDS, ...guardExtra(spec, slot.kind) };
|
|
219
238
|
hooks[event] = at === -1 ? [...kept, fresh] : [...kept.slice(0, at), fresh, ...kept.slice(at)];
|
|
220
239
|
const version = typeof settings.version === "number" ? settings.version : 1;
|
|
221
240
|
return { ...settings, version, hooks };
|
|
222
241
|
}
|
|
223
|
-
const entry = { type: "command", command, timeout: HOOK_TIMEOUT_SECONDS };
|
|
242
|
+
const entry = { type: "command", command, timeout: HOOK_TIMEOUT_SECONDS, ...guardExtra(spec, slot.kind) };
|
|
224
243
|
const groups = list;
|
|
225
244
|
// An older Passport entry (another version's path) is replaced where it stands.
|
|
226
245
|
const owner = groups.findIndex((group) => group && Array.isArray(group.hooks) && group.hooks.some((candidate) => ours(candidate?.command)));
|
|
@@ -287,6 +306,8 @@ const LIMITS_LINE = "It can't see inside scripts, aliases, or make targets.";
|
|
|
287
306
|
const CODEX_TRUST_LINE = "Next: Open Codex → /hooks and trust Passport's hooks.";
|
|
288
307
|
/** What the guard does in Codex, in plain words (status, install, init). */
|
|
289
308
|
export const CODEX_BLOCK_ONLY = "In Codex, Passport refuses what your rules block and says why.";
|
|
309
|
+
/** Where the guard fails closed (Claude Code, Cursor): removing Passport first would block every shell command. */
|
|
310
|
+
export const FAIL_CLOSED_WARNING = "The guard fails closed: before removing Passport, run passport hook uninstall, or this agent's shell commands are refused.";
|
|
290
311
|
/** A hook's command as a person reads it: "passport hook guard", not the
|
|
291
312
|
* absolute paths of node and the CLI (those show with --verbose). */
|
|
292
313
|
export function shownHookCommand(command, verbose) {
|
|
@@ -328,7 +349,8 @@ function pendingChanges(spec, settings, wanted) {
|
|
|
328
349
|
// A timeout shorter than the entry needs (hand-edited) is fixed too.
|
|
329
350
|
const timeout = entryAt(spec, settings, entry.event, entry.kind)?.timeout;
|
|
330
351
|
const short = typeof timeout === "number" && timeout < HOOK_TIMEOUT_SECONDS;
|
|
331
|
-
|
|
352
|
+
const opensOnFailure = entry.kind === "guard" && entryFailsClosed(spec, entryAt(spec, settings, entry.event, entry.kind)) === false;
|
|
353
|
+
if (current === entry.command && !short && !opensOnFailure)
|
|
332
354
|
continue;
|
|
333
355
|
changes.push({ action: current ? "update" : "add", event: entry.event, command: entry.command });
|
|
334
356
|
}
|
|
@@ -389,7 +411,8 @@ function installClient(spec, args, runtime) {
|
|
|
389
411
|
? [
|
|
390
412
|
`Guard on for ${spec.name}.`,
|
|
391
413
|
spec.id === "codex" ? CODEX_BLOCK_ONLY : "Passport refuses what your rules block, like railway volume delete.",
|
|
392
|
-
LIMITS_LINE
|
|
414
|
+
LIMITS_LINE,
|
|
415
|
+
...(spec.failClosed ? [FAIL_CLOSED_WARNING] : [])
|
|
393
416
|
]
|
|
394
417
|
: [`${spec.name} now records the CLIs it runs in Passport Activity.`, RECORDS_LINE];
|
|
395
418
|
return {
|
|
@@ -449,12 +472,14 @@ function clientStatus(spec, env) {
|
|
|
449
472
|
let audit = null;
|
|
450
473
|
let guard = null;
|
|
451
474
|
let missing = [];
|
|
475
|
+
let failClosed = spec.failClosed ? false : null;
|
|
452
476
|
let mode;
|
|
453
477
|
try {
|
|
454
478
|
const { settings } = readSettings(path);
|
|
455
479
|
audit = registered(spec, settings, "audit");
|
|
456
480
|
guard = registered(spec, settings, "guard");
|
|
457
481
|
missing = missingEvents(spec, settings);
|
|
482
|
+
failClosed = entryFailsClosed(spec, guard ? entryAt(spec, settings, spec.pre, "guard") : null);
|
|
458
483
|
mode = audit && guard ? "audit + guard" : audit ? "audit" : guard ? "guard" : "not installed";
|
|
459
484
|
}
|
|
460
485
|
catch {
|
|
@@ -473,6 +498,8 @@ function clientStatus(spec, env) {
|
|
|
473
498
|
plugin,
|
|
474
499
|
/** Hook events Passport's entry should be on but isn't. */
|
|
475
500
|
missing: plugin ? [] : missing,
|
|
501
|
+
/** The guard entry fails closed; null where the agent can't (Codex). The plugin's hooks fail open. */
|
|
502
|
+
failClosed: plugin && !guard ? (spec.failClosed ? false : null) : failClosed,
|
|
476
503
|
command: audit,
|
|
477
504
|
guardCommand: guard,
|
|
478
505
|
path,
|
package/dist/cliHookStatus.d.ts
CHANGED
|
@@ -15,7 +15,20 @@ export declare function localGuardStates(env: Env): Promise<{
|
|
|
15
15
|
fix: ProblemFix | null;
|
|
16
16
|
/** Partly set up: the hook events Passport's entry is missing from. */
|
|
17
17
|
missing: string[];
|
|
18
|
+
/** The guard fails closed; null where the agent can't (Codex). */
|
|
19
|
+
failClosed: boolean | null;
|
|
20
|
+
locked: boolean;
|
|
18
21
|
}[]>;
|
|
22
|
+
/** The agents Passport's guard doesn't install into yet (docs/design/v22/visibility.md). */
|
|
23
|
+
export declare const NOT_SUPPORTED_YET: readonly ["Copilot CLI", "VS Code", "Gemini CLI", "Antigravity", "Windsurf", "Devin", "Factory", "Kiro", "Junie", "Cline", "OpenCode", "Amp"];
|
|
24
|
+
export declare const NOT_SUPPORTED_LINE: string;
|
|
25
|
+
/** "fails closed · locked": how hard the guard is to get around on this computer. */
|
|
26
|
+
export declare function safetyText(entry: {
|
|
27
|
+
failClosed?: boolean | null;
|
|
28
|
+
locked?: boolean;
|
|
29
|
+
}): string;
|
|
30
|
+
/** For each agent whose guard is on: "Cursor: the guard fails open." and its fix, or "Codex: can't fail closed." */
|
|
31
|
+
export declare function safetyLines(states: Awaited<ReturnType<typeof localGuardStates>>): string[];
|
|
19
32
|
/** Partly set up, in words: "Passport can't see session starts and prompts." */
|
|
20
33
|
export declare function missingLine(missing: readonly string[]): string | null;
|
|
21
34
|
/** "Codex: Open Codex → /hooks and trust Passport's hooks." for each problem,
|
package/dist/cliHookStatus.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* how old this computer's copy of what Passport decides is. Never writes anything.
|
|
6
6
|
*/
|
|
7
7
|
import { bool, value } from "./cliArgs.js";
|
|
8
|
-
import { GUARD_CLIENT_LABEL, GUARD_STATE_LABEL, fixLines, guardClientReports, guardStateFix, localGuardState, missingHooksText } from "./cliGuardHealth.js";
|
|
8
|
+
import { CAN_FAIL_CLOSED, GUARD_CLIENT_LABEL, GUARD_STATE_LABEL, fixLines, guardClientReports, guardStateFix, localGuardState, missingHooksText } from "./cliGuardHealth.js";
|
|
9
9
|
import { CODEX_BLOCK_ONLY, HOOK_CLIENTS, agentHookStatus, displayPath } from "./cliHookInstall.js";
|
|
10
10
|
import { readCpCli } from "./cpCli.js";
|
|
11
11
|
import { readCreds } from "./credentials.js";
|
|
@@ -56,10 +56,48 @@ export async function localGuardStates(env) {
|
|
|
56
56
|
state,
|
|
57
57
|
label: state ? GUARD_STATE_LABEL[state] : null,
|
|
58
58
|
fix: guardStateFix(state, report.client),
|
|
59
|
-
missing: state === "partial" ? (report.missing ?? []) : []
|
|
59
|
+
missing: state === "partial" ? (report.missing ?? []) : [],
|
|
60
|
+
failClosed: CAN_FAIL_CLOSED.has(report.client) ? report.failClosed === true : null,
|
|
61
|
+
locked: report.locked === true
|
|
60
62
|
};
|
|
61
63
|
});
|
|
62
64
|
}
|
|
65
|
+
/** The agents Passport's guard doesn't install into yet (docs/design/v22/visibility.md). */
|
|
66
|
+
export const NOT_SUPPORTED_YET = [
|
|
67
|
+
"Copilot CLI",
|
|
68
|
+
"VS Code",
|
|
69
|
+
"Gemini CLI",
|
|
70
|
+
"Antigravity",
|
|
71
|
+
"Windsurf",
|
|
72
|
+
"Devin",
|
|
73
|
+
"Factory",
|
|
74
|
+
"Kiro",
|
|
75
|
+
"Junie",
|
|
76
|
+
"Cline",
|
|
77
|
+
"OpenCode",
|
|
78
|
+
"Amp"
|
|
79
|
+
];
|
|
80
|
+
export const NOT_SUPPORTED_LINE = `Not supported yet: ${NOT_SUPPORTED_YET.join(", ")}.`;
|
|
81
|
+
/** "fails closed · locked": how hard the guard is to get around on this computer. */
|
|
82
|
+
export function safetyText(entry) {
|
|
83
|
+
const fail = entry.failClosed === null ? "can't fail closed" : entry.failClosed ? "fails closed" : "fails open";
|
|
84
|
+
return `${fail} · ${entry.locked ? "locked" : "not locked"}`;
|
|
85
|
+
}
|
|
86
|
+
/** For each agent whose guard is on: "Cursor: the guard fails open." and its fix, or "Codex: can't fail closed." */
|
|
87
|
+
export function safetyLines(states) {
|
|
88
|
+
return states.flatMap((entry) => {
|
|
89
|
+
if (entry.state !== "on" && entry.state !== "locked")
|
|
90
|
+
return [];
|
|
91
|
+
const name = GUARD_CLIENT_LABEL[entry.client];
|
|
92
|
+
if (entry.failClosed === null)
|
|
93
|
+
return [`${name}: can't fail closed.`];
|
|
94
|
+
if (entry.failClosed)
|
|
95
|
+
return [];
|
|
96
|
+
if (entry.locked)
|
|
97
|
+
return [`${name}: the locked guard fails open. Run: passport init --org --lock`];
|
|
98
|
+
return [`${name}: the guard fails open.`, `Run: passport hook install --agent ${entry.client} --guard --apply`];
|
|
99
|
+
});
|
|
100
|
+
}
|
|
63
101
|
/** Partly set up, in words: "Passport can't see session starts and prompts." */
|
|
64
102
|
export function missingLine(missing) {
|
|
65
103
|
const words = missingHooksText(missing);
|
|
@@ -97,6 +135,8 @@ export async function hookStatus(args, runtime) {
|
|
|
97
135
|
...status,
|
|
98
136
|
guardState: guard.state,
|
|
99
137
|
guardLabel: guard.label,
|
|
138
|
+
failClosed: guard.failClosed,
|
|
139
|
+
locked: guard.locked,
|
|
100
140
|
...(guard.fix ? { fix: guard.fix } : {})
|
|
101
141
|
};
|
|
102
142
|
});
|
|
@@ -106,7 +146,10 @@ export async function hookStatus(args, runtime) {
|
|
|
106
146
|
// "Audit and guard · On": what's installed, then the guard's state.
|
|
107
147
|
const stateText = (agent) => {
|
|
108
148
|
const mode = MODE_WORDS[agent.mode] ?? agent.mode;
|
|
109
|
-
|
|
149
|
+
if (!agent.guardLabel)
|
|
150
|
+
return mode;
|
|
151
|
+
const on = agent.guardState === "on" || agent.guardState === "locked";
|
|
152
|
+
return on ? `${mode} · ${agent.guardLabel} · ${safetyText(agent)}` : `${mode} · ${agent.guardLabel}`;
|
|
110
153
|
};
|
|
111
154
|
const stateWidth = Math.max(...agents.map((agent) => stateText(agent).length));
|
|
112
155
|
const codexGuarded = agents.some((agent) => agent.client === "codex" && agent.guard);
|
|
@@ -116,7 +159,13 @@ export async function hookStatus(args, runtime) {
|
|
|
116
159
|
policy.line,
|
|
117
160
|
...(codexGuarded ? [CODEX_BLOCK_ONLY] : []),
|
|
118
161
|
...(disabled ? ["PASSPORT_HOOK_DISABLED=1 is set, so hooks do nothing in this shell."] : []),
|
|
119
|
-
...guardFixLines(guards)
|
|
162
|
+
...guardFixLines(guards),
|
|
163
|
+
...safetyLines(guards),
|
|
164
|
+
NOT_SUPPORTED_LINE
|
|
120
165
|
];
|
|
121
|
-
return {
|
|
166
|
+
return {
|
|
167
|
+
json: { agents, policy: policy.json, disabled, notSupported: NOT_SUPPORTED_YET },
|
|
168
|
+
human: lines.join("\n"),
|
|
169
|
+
essential: true
|
|
170
|
+
};
|
|
122
171
|
}
|
package/dist/cliSetupLock.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ type Merge = {
|
|
|
29
29
|
* replaces them. Someone else's `[hooks]`, `managed_dir`, or `hooks = false`
|
|
30
30
|
* needs a person to decide, so it is a conflict.
|
|
31
31
|
*/
|
|
32
|
-
export declare function mergeCodexRequirements(existing: string,
|
|
32
|
+
export declare function mergeCodexRequirements(existing: string, _strict: boolean, platform: "darwin" | "linux"): Merge;
|
|
33
33
|
/** Passport's two entries in Cursor's system hooks.json; everyone else's stay. */
|
|
34
34
|
export declare function mergeCursorHooks(existing: string | undefined, platform: LockPlatform, strict: boolean): Merge;
|
|
35
35
|
export declare function runLock(options: LockOptions): LockReport;
|
package/dist/cliSetupLock.js
CHANGED
|
@@ -125,7 +125,7 @@ function trimBlank(lines) {
|
|
|
125
125
|
* replaces them. Someone else's `[hooks]`, `managed_dir`, or `hooks = false`
|
|
126
126
|
* needs a person to decide, so it is a conflict.
|
|
127
127
|
*/
|
|
128
|
-
export function mergeCodexRequirements(existing,
|
|
128
|
+
export function mergeCodexRequirements(existing, _strict, platform) {
|
|
129
129
|
const fix = "Merge Passport's lines by hand from Agents › Rollout in Passport, then run this again.";
|
|
130
130
|
const kept = [];
|
|
131
131
|
let inside = false;
|
|
@@ -179,7 +179,8 @@ export function mergeCodexRequirements(existing, strict, platform) {
|
|
|
179
179
|
conflict: "requirements.toml turns hooks off ([features] hooks = false). Set it to true, then run this again."
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
|
-
|
|
182
|
+
// Every lock is managed-only (2026-11-18): someone else's `false` needs a person to decide.
|
|
183
|
+
if (strictValue !== undefined && strictValue !== "true") {
|
|
183
184
|
return {
|
|
184
185
|
conflict: `requirements.toml sets allow_managed_hooks_only = ${strictValue}. Remove it or set it to true, then run this again.`
|
|
185
186
|
};
|
|
@@ -188,7 +189,7 @@ export function mergeCodexRequirements(existing, strict, platform) {
|
|
|
188
189
|
// copy-style-allow double-space: TOML comment spacing in a managed file
|
|
189
190
|
if (features >= 0 && featureHooks === undefined)
|
|
190
191
|
lines.splice(features + 1, 0, "hooks = true # passport");
|
|
191
|
-
const top =
|
|
192
|
+
const top = strictValue === undefined ? [BEGIN, CODEX_STRICT_LINE, END, ""] : [];
|
|
192
193
|
const block = [
|
|
193
194
|
BEGIN,
|
|
194
195
|
...(features < 0 ? ["[features]", "hooks = true", ""] : []),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public halves of Passport's CLI signing keys (`docs/design/v22/visibility.md`, B4), by key id: the first 16 hex
|
|
3
|
+
* characters of the SPKI's SHA-256 (`server/src/controlPlane/cliSigning.ts` `keyIdOf`). A cached copy of the rules for
|
|
4
|
+
* when Passport can't be reached counts only when one of these signed it. Shipped in the CLI, so an agent on the
|
|
5
|
+
* computer can't swap it the way it could a file.
|
|
6
|
+
*
|
|
7
|
+
* Empty until the production key is provisioned: generate it, set `PASSPORT_CLI_SIGNING_KEY` on the server, and add
|
|
8
|
+
* its public key here (base64 SPKI DER) in the release that should trust it. Keep the previous key while rotating.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CLI_SIGNING_KEYS: Readonly<Record<string, string>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public halves of Passport's CLI signing keys (`docs/design/v22/visibility.md`, B4), by key id: the first 16 hex
|
|
3
|
+
* characters of the SPKI's SHA-256 (`server/src/controlPlane/cliSigning.ts` `keyIdOf`). A cached copy of the rules for
|
|
4
|
+
* when Passport can't be reached counts only when one of these signed it. Shipped in the CLI, so an agent on the
|
|
5
|
+
* computer can't swap it the way it could a file.
|
|
6
|
+
*
|
|
7
|
+
* Empty until the production key is provisioned: generate it, set `PASSPORT_CLI_SIGNING_KEY` on the server, and add
|
|
8
|
+
* its public key here (base64 SPKI DER) in the release that should trust it. Keep the previous key while rotating.
|
|
9
|
+
*/
|
|
10
|
+
export const CLI_SIGNING_KEYS = {};
|
package/dist/cliStatus.d.ts
CHANGED
|
@@ -36,9 +36,14 @@ export type GuardStatusAgent = {
|
|
|
36
36
|
fix?: ProblemFix;
|
|
37
37
|
/** Partly set up: "Passport can't see session starts and prompts." */
|
|
38
38
|
missing?: string;
|
|
39
|
+
/** The guard fails closed; null where the agent can't (Codex). */
|
|
40
|
+
failClosed?: boolean | null;
|
|
41
|
+
locked?: boolean;
|
|
39
42
|
};
|
|
40
43
|
export type GuardStatus = {
|
|
41
44
|
agents: GuardStatusAgent[];
|
|
45
|
+
/** "Cursor: the guard fails open." and its fix, "Codex: can't fail closed." */
|
|
46
|
+
safety?: string[];
|
|
42
47
|
/** Hook slots this run added (`hookRepair.ts`), one line per agent. */
|
|
43
48
|
repaired?: string[];
|
|
44
49
|
};
|
package/dist/cliStatus.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { managePayload } from "./cliConnect.js";
|
|
2
2
|
import { fixLines, GUARD_CLIENT_LABEL } from "./cliGuardHealth.js";
|
|
3
|
-
import { localGuardStates, missingLine } from "./cliHookStatus.js";
|
|
3
|
+
import { localGuardStates, missingLine, NOT_SUPPORTED_LINE, safetyLines, safetyText } from "./cliHookStatus.js";
|
|
4
4
|
import { computerName, keyUse, KEYS_PATH } from "./cliKeys.js";
|
|
5
5
|
import { readBoundedJson, sanitize, timeoutMs } from "./cliSupport.js";
|
|
6
6
|
import { ago, mark, paint, table, termOf, visibleLength, wrap } from "./term.js";
|
|
@@ -75,7 +75,8 @@ async function guardStatus(env) {
|
|
|
75
75
|
...repairLines(await repairHooks(env)),
|
|
76
76
|
...(await import("./commandRepair.js")).repairPassportCommand(env)
|
|
77
77
|
];
|
|
78
|
-
const
|
|
78
|
+
const states = await localGuardStates(env);
|
|
79
|
+
const agents = states
|
|
79
80
|
.filter((entry) => entry.state)
|
|
80
81
|
.map((entry) => {
|
|
81
82
|
const missing = missingLine(entry.missing);
|
|
@@ -85,12 +86,15 @@ async function guardStatus(env) {
|
|
|
85
86
|
state: entry.state,
|
|
86
87
|
label: entry.label,
|
|
87
88
|
...(entry.fix ? { fix: entry.fix } : {}),
|
|
88
|
-
...(missing ? { missing } : {})
|
|
89
|
+
...(missing ? { missing } : {}),
|
|
90
|
+
failClosed: entry.failClosed,
|
|
91
|
+
locked: entry.locked
|
|
89
92
|
};
|
|
90
93
|
});
|
|
91
94
|
if (!agents.length && !repaired.length)
|
|
92
95
|
return undefined;
|
|
93
|
-
|
|
96
|
+
const safety = safetyLines(states);
|
|
97
|
+
return { agents, ...(repaired.length ? { repaired } : {}), ...(safety.length ? { safety } : {}) };
|
|
94
98
|
}
|
|
95
99
|
catch {
|
|
96
100
|
return undefined;
|
|
@@ -176,13 +180,19 @@ function guardRow(guard, term) {
|
|
|
176
180
|
lines.push(...markedTable(term, guard.agents.map((agent) => ({
|
|
177
181
|
mark: agent.state === "on" || agent.state === "locked" ? "done" : "warn",
|
|
178
182
|
name: agent.name,
|
|
179
|
-
detail: agent.
|
|
183
|
+
detail: (agent.state === "on" || agent.state === "locked") && agent.failClosed !== undefined
|
|
184
|
+
? `${agent.label} · ${safetyText(agent)}`
|
|
185
|
+
: agent.label,
|
|
180
186
|
...(agent.fix ? { note: [agent.missing, fixLines(agent.fix)].filter(Boolean).join("\n") } : {})
|
|
181
187
|
}))));
|
|
182
188
|
}
|
|
183
189
|
if (guard.repaired)
|
|
184
190
|
for (const line of guard.repaired)
|
|
185
191
|
lines.push(...wrap(line, width));
|
|
192
|
+
for (const line of guard.safety ?? [])
|
|
193
|
+
lines.push(...wrap(line, width));
|
|
194
|
+
if (lines.length)
|
|
195
|
+
lines.push(...wrap(NOT_SUPPORTED_LINE, width));
|
|
186
196
|
return lines.length ? { label: "Guard", lines } : undefined;
|
|
187
197
|
}
|
|
188
198
|
function appRow(view, term) {
|
|
@@ -277,7 +277,8 @@ function listWhereOne(m, part, params, each) {
|
|
|
277
277
|
...typeChain(m, part.on).flatMap((t) => [m.nodes[t].key].flat()),
|
|
278
278
|
part.target?.key,
|
|
279
279
|
part.target?.name,
|
|
280
|
-
part.summary
|
|
280
|
+
part.summary,
|
|
281
|
+
...(part.summaryElse ?? [])
|
|
281
282
|
].filter((t) => typeof t === "string");
|
|
282
283
|
return templates
|
|
283
284
|
.flatMap(placeholders)
|
|
@@ -299,7 +300,7 @@ function buildSql(m, part, p, at, out) {
|
|
|
299
300
|
? SQL_LABEL[finding.category]
|
|
300
301
|
: m.actions.find((a) => a.key === actionKey).label;
|
|
301
302
|
const t = finding.table ? { type: "table", key: finding.table, name: finding.table } : undefined;
|
|
302
|
-
const where = part.summary ?
|
|
303
|
+
const where = part.summary ? summaryOf(part, part.summary, p) : "";
|
|
303
304
|
out.push({
|
|
304
305
|
nodeId: at.nodeId,
|
|
305
306
|
actionKey,
|
|
@@ -318,7 +319,8 @@ function build(m, part, params, context, hooks, each) {
|
|
|
318
319
|
p[name] = p[source];
|
|
319
320
|
if (listWhereOne(m, part, p, each))
|
|
320
321
|
return UNCLASSIFIED;
|
|
321
|
-
|
|
322
|
+
// "platform": the platform's own node (an account-level operation: keys, gists, notifications).
|
|
323
|
+
const at = part.on === "platform" ? { nodeId: nodeId(m.platform), chain: [] } : nodeChain(m, part.on, p, context, hooks);
|
|
322
324
|
if (at.unresolved)
|
|
323
325
|
return UNCLASSIFIED;
|
|
324
326
|
const out = [];
|
|
@@ -328,12 +330,17 @@ function build(m, part, params, context, hooks, each) {
|
|
|
328
330
|
out.push({
|
|
329
331
|
nodeId: at.nodeId,
|
|
330
332
|
actionKey: part.action,
|
|
331
|
-
summary:
|
|
333
|
+
summary: summaryOf(part, part.summary ?? m.actions.find((a) => a.key === part.action)?.label ?? part.action, p),
|
|
332
334
|
nodes: at.chain,
|
|
333
335
|
...(t ? { target: t } : {})
|
|
334
336
|
});
|
|
335
337
|
return out;
|
|
336
338
|
}
|
|
339
|
+
/** A rule's summary: the first template that fills, else the last rendered with "(unknown)" for what doesn't. */
|
|
340
|
+
function summaryOf(part, summary, p) {
|
|
341
|
+
const all = [summary, ...(part.summaryElse ?? [])];
|
|
342
|
+
return fill(all, p) ?? render(all[all.length - 1], p);
|
|
343
|
+
}
|
|
337
344
|
/** What an unnamed request hit, coarse (`controlPlaneUnnamed.ts`): an API call's method and path template, a command
|
|
338
345
|
* line's program and the words the CLI itself uses, up to the first it doesn't. Nothing for an MCP tool. */
|
|
339
346
|
function unnamedOf(m, n, ops) {
|
|
@@ -408,10 +415,13 @@ function decideRequest(m, n, context, hooks, override) {
|
|
|
408
415
|
found: [unclassified(m, n, canonical(m, n, rule, context, override).params, context, hooks, problem ?? n.problem)],
|
|
409
416
|
via: "failed"
|
|
410
417
|
});
|
|
411
|
-
if (n.problem)
|
|
412
|
-
return failed();
|
|
413
418
|
const spec = m.capture[n.iface];
|
|
414
419
|
const candidates = spec.rules.filter((rule) => rule.match === n.op);
|
|
420
|
+
// "none": an op it doesn't know names nothing, and nor does a listed read whatever its flags.
|
|
421
|
+
if (spec.unknown === "none" && n.op && candidates.length === 0)
|
|
422
|
+
return Object.hasOwn(spec.reads, n.op) ? { found: [], via: "read" } : { found: [], via: "none" };
|
|
423
|
+
if (n.problem)
|
|
424
|
+
return failed();
|
|
415
425
|
if (candidates.length === 0)
|
|
416
426
|
return Object.hasOwn(spec.reads, n.op) ? { found: [], via: "read" } : failed();
|
|
417
427
|
if (n.iface === "cli" && n.local)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub's decision through the kit (docs/design/v23/github-kit.md, Phase 1): what one request does, by the kit's
|
|
3
|
+
* GitHub manifest (`manifests/github.ts`) and its hooks (`manifests/githubHooks.ts`), in the shape the guard, the
|
|
4
|
+
* credential helper, `passport exec` and the gateway read. Pure and synchronous; the bridge ships a copy.
|
|
5
|
+
*
|
|
6
|
+
* `context` is what the inventory knows of a repository's branches (the server). Without one (the guard on a
|
|
7
|
+
* computer) every named branch is its own node, which the server maps to its pattern node.
|
|
8
|
+
*
|
|
9
|
+
* A target is the canonical string (`githubTarget`): JSON of the named fields, the kit's `ActionTarget.key`, so a
|
|
10
|
+
* decision records the same digest whichever side classified it.
|
|
11
|
+
*/
|
|
12
|
+
import type { GithubClassification, GithubContext, GithubRepo, GithubRequest } from "./githubIds.generated.js";
|
|
13
|
+
export type { GithubClassification, GithubContext, GithubRepo, GithubRequest } from "./githubIds.generated.js";
|
|
14
|
+
/**
|
|
15
|
+
* Every consequential thing one request does, in order: one entry, except a `git push` naming several refs (one per
|
|
16
|
+
* ref, worst first). Empty when nothing is consequential. Enforcement decides each and blocks when any one is.
|
|
17
|
+
*/
|
|
18
|
+
export declare function classifyGithubAll(request: GithubRequest, context?: GithubContext): GithubClassification[];
|
|
19
|
+
/** A push's order: a delete, then a force-push, a tag, a push (anything else ranks before them). */
|
|
20
|
+
export declare const pushRank: (found: Pick<GithubClassification, "actionKey">) => number;
|
|
21
|
+
/** The single most consequential thing a request does, or null. For a command line, use `classifyGithubAll`. */
|
|
22
|
+
export declare function classifyGithub(request: GithubRequest, context?: GithubContext): GithubClassification | null;
|
|
23
|
+
export type GithubCliArgs = {
|
|
24
|
+
argv: string[];
|
|
25
|
+
cwdRepo?: GithubRepo;
|
|
26
|
+
currentBranch?: string;
|
|
27
|
+
};
|
|
28
|
+
/** Whether a command line is `git push` (git's own options before it don't count). */
|
|
29
|
+
export declare function isGitPush(argv: readonly string[]): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Every ref a `git push` moves, one classification each, worst first, with the worst case for what it can't name;
|
|
32
|
+
* null when it isn't a push to GitHub (or is a dry run).
|
|
33
|
+
*/
|
|
34
|
+
export declare function classifyGitPushRefs(args: GithubCliArgs, context?: GithubContext): GithubClassification[] | null;
|
|
35
|
+
/** The worst a push to branches it doesn't name can do: force-push and delete, on the repository. */
|
|
36
|
+
export declare function worstCasePush(r: GithubRepo, why: string): GithubClassification[];
|
|
37
|
+
export type Parsed = {
|
|
38
|
+
pos: string[];
|
|
39
|
+
opts: Array<[string, string | true]>;
|
|
40
|
+
};
|
|
41
|
+
/** The options of a gh command that take a value, as `-x` and `--long`, from the kit's flag table. */
|
|
42
|
+
export declare function ghValueFlags(command: string): ReadonlySet<string>;
|
|
43
|
+
/** Words and options of one command. `valueFlags` are the options that take the next word as their value. */
|
|
44
|
+
export declare function parseArgs(args: readonly string[], valueFlags: ReadonlySet<string>): Parsed;
|
|
45
|
+
export declare const values: (parsed: Parsed, ...names: string[]) => string[];
|
|
46
|
+
export declare const lastValue: (parsed: Parsed, ...names: string[]) => string | undefined;
|
|
47
|
+
export declare const hasFlag: (parsed: Parsed, ...names: string[]) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* How `gh api` is read when only its method matters: GET or HEAD (no method, or one of those, and with no method no
|
|
50
|
+
* fields, as gh then sends a POST) is a read; any other method, or a body from `--input`, is a write.
|
|
51
|
+
*/
|
|
52
|
+
export declare function ghApiMethod(parsed: Parsed): {
|
|
53
|
+
method: string;
|
|
54
|
+
read: boolean;
|
|
55
|
+
};
|
|
56
|
+
/** A REST path's segments, decoded, without the host, query or fragment. */
|
|
57
|
+
export declare function apiSegments(path: string): string[];
|