passport-bridge 0.41.0 → 0.44.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/README.md +16 -56
- package/dist/callingAgent.d.ts +64 -0
- package/dist/callingAgent.js +163 -0
- package/dist/cliExec.d.ts +13 -29
- package/dist/cliExec.js +71 -173
- package/dist/cliGitCredential.d.ts +2 -1
- package/dist/cliGitCredential.js +28 -4
- package/dist/cliGuardHealth.js +2 -0
- package/dist/cliHook.d.ts +4 -1
- package/dist/cliHook.js +12 -5
- package/dist/cliHookDecide.js +4 -13
- package/dist/cliHookRewrite.d.ts +3 -2
- package/dist/cliHookRewrite.js +10 -6
- package/dist/cliKeys.js +10 -9
- package/dist/cliKeysBack.d.ts +3 -5
- package/dist/cliKeysBack.js +6 -23
- package/dist/cliKeysShim.d.ts +4 -1
- package/dist/cliKeysShim.js +9 -1
- package/dist/cliKubeCredential.d.ts +6 -1
- package/dist/cliKubeCredential.js +10 -0
- package/dist/cliOutput.js +14 -23
- package/dist/cliScan.js +3 -4
- package/dist/cliStatus.js +1 -3
- package/dist/cliSupport.js +7 -10
- package/dist/commandRepair.d.ts +1 -1
- package/dist/commandRepair.js +1 -1
- package/dist/completion.js +4 -4
- package/dist/connectorKit/manifests/github.generated.d.ts +1 -1
- package/dist/connectorKit/manifests/github.generated.js +13 -7
- package/dist/connectorKit/manifests/githubHooks.generated.js +1 -1
- package/dist/connectorKit/manifests/railway.generated.js +8 -8
- package/dist/connectorKit/manifests/supabase.generated.js +1 -1
- package/dist/connectorKit/manifests/supabaseCatalog.generated.js +4 -4
- package/dist/controlPlane.generated.d.ts +40 -13
- package/dist/controlPlane.generated.js +18 -23
- package/dist/controlPlaneBasic.generated.d.ts +2 -5
- package/dist/controlPlaneBasic.generated.js +2 -7
- package/dist/controlPlaneExec.js +1 -3
- package/dist/controlPlaneGithub.generated.d.ts +1 -1
- package/dist/controlPlaneGithub.generated.js +1 -1
- package/dist/controlPlaneGithubCatalog.generated.d.ts +2 -2
- package/dist/controlPlaneGithubCatalog.generated.js +1 -1
- package/dist/controlPlaneGithubCli.generated.d.ts +1 -2
- package/dist/controlPlaneGithubCli.generated.js +2 -3
- package/dist/controlPlaneGuard.d.ts +2 -2
- package/dist/controlPlaneGuard.js +2 -2
- package/dist/controlPlaneModel.generated.d.ts +2 -1
- package/dist/controlPlaneModel.generated.js +10 -2
- package/dist/controlPlaneSupabase.js +1 -1
- package/dist/execGit.d.ts +14 -10
- package/dist/execGit.js +33 -19
- package/dist/execVendors.js +3 -6
- package/dist/initKeysStep.js +15 -0
- package/dist/initPlan.d.ts +1 -1
- package/dist/initPlan.js +14 -3
- package/dist/initState.d.ts +2 -1
- package/dist/keysHere.js +3 -2
- package/dist/keysInV1.d.ts +9 -0
- package/dist/keysInV1.js +48 -0
- package/dist/keysLocal.js +4 -0
- package/dist/keysV1Cleanup.d.ts +3 -0
- package/dist/keysV1Cleanup.js +37 -0
- package/dist/offInV1.d.ts +26 -0
- package/dist/offInV1.js +28 -0
- package/dist/pluginPin.d.ts +1 -1
- package/dist/pluginPin.js +1 -1
- package/dist/statusKeys.d.ts +2 -2
- package/dist/statusKeys.js +3 -8
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* ids, exact matching and Managed coverage (decided 2026-11-13) live beside it
|
|
7
7
|
* in `controlPlaneModel.ts`.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
/** The kinds (2026-11-16). A read is decided only when a Block could cover it (server `readGate.ts`). */
|
|
10
|
+
export declare const KINDS: readonly ["delete", "change", "create", "read"];
|
|
10
11
|
export type Kind = (typeof KINDS)[number];
|
|
11
12
|
export declare const KIND_LABEL: Readonly<Record<Kind, string>>;
|
|
12
13
|
export declare const KIND_MEANING: Readonly<Record<Kind, string>>;
|
|
@@ -72,11 +73,11 @@ export type ActionDef = {
|
|
|
72
73
|
appliesTo: string;
|
|
73
74
|
/** Sentence case, verb first: "Delete the branch". */
|
|
74
75
|
label: string;
|
|
75
|
-
/**
|
|
76
|
+
/** The exact target an event records beyond the node when the request names it ("collaborator"); absent: the node. */
|
|
76
77
|
exactTarget?: string;
|
|
77
78
|
/** A lucide-react icon name matching the platform's own iconography ("Trash2"). */
|
|
78
79
|
icon?: string;
|
|
79
|
-
/** Can't be undone (`cli.local.*`): only action rules decide it (`resolveRule`), Observe refuses it
|
|
80
|
+
/** Can't be undone (`cli.local.*`): only action rules decide it (`resolveRule`), Observe refuses it. */
|
|
80
81
|
irreversible?: true;
|
|
81
82
|
/** The platform sources that report it, and whether they name who did it (visibility levels). */
|
|
82
83
|
seenBy?: ReadonlyArray<{
|
|
@@ -123,9 +124,11 @@ export type Visibility = "full" | "partial" | "agent_only";
|
|
|
123
124
|
* A platform's level from its catalog and the sources that are on: Full when
|
|
124
125
|
* every action is reported by a platform source that names the actor, Agent-only
|
|
125
126
|
* when no platform source is on, else Partial. `unseen` lists the actions no
|
|
126
|
-
* platform source that is on reports. An action that declares no `seenBy` is unseen.
|
|
127
|
+
* platform source that is on reports. An action that declares no `seenBy` is unseen; reads are left out.
|
|
127
128
|
*/
|
|
128
|
-
export declare function visibilityOf(
|
|
129
|
+
export declare function visibilityOf(all: readonly (Pick<ActionDef, "key" | "seenBy"> & {
|
|
130
|
+
kind?: Kind;
|
|
131
|
+
})[], sources: readonly Pick<ObservationSource, "source" | "status">[]): {
|
|
129
132
|
visibility: Visibility;
|
|
130
133
|
unseen: string[];
|
|
131
134
|
};
|
|
@@ -212,7 +215,7 @@ export type ControlRule = {
|
|
|
212
215
|
/** Optional note shown beside the rule. */
|
|
213
216
|
note?: string;
|
|
214
217
|
};
|
|
215
|
-
/**
|
|
218
|
+
/** No rule, no block (2026-11-16): every kind is allowed until an admin adds a Block. */
|
|
216
219
|
export declare const DEFAULT_KIND_DECISION: Readonly<Record<Kind, Decision>>;
|
|
217
220
|
export type Resolution = {
|
|
218
221
|
decision: Decision;
|
|
@@ -221,11 +224,12 @@ export type Resolution = {
|
|
|
221
224
|
/** Where it was found: a node id, "workspace", or "default". */
|
|
222
225
|
at: string;
|
|
223
226
|
by: "action" | "kind";
|
|
227
|
+
converted?: true;
|
|
224
228
|
};
|
|
225
229
|
/**
|
|
226
230
|
* The one resolution order, used by every enforcement point and every view: walk from the node up to its platform; at
|
|
227
231
|
* each level an action rule beats a kind rule; the nearest level wins; then workspace action rule, workspace kind
|
|
228
|
-
* rule, then the
|
|
232
|
+
* rule, then the default (Allow). A kind Allow never decides an irreversible action; a kind Block does. Pure.
|
|
229
233
|
*/
|
|
230
234
|
export declare function resolveRule(path: readonly string[], action: Pick<ActionDef, "key" | "kind" | "irreversible">, rules: readonly ControlRule[]): Resolution;
|
|
231
235
|
/**
|
|
@@ -298,7 +302,7 @@ export type ActionEvent = {
|
|
|
298
302
|
/** An event Passport decided and the platform later confirmed share one id; this records the confirmation. */
|
|
299
303
|
confirmedAt?: number;
|
|
300
304
|
/** When the action's target is an argument (a collaborator, a secret, a tag): its keyed hash, never the
|
|
301
|
-
* target itself.
|
|
305
|
+
* target itself. */
|
|
302
306
|
targetHash?: string;
|
|
303
307
|
/** What it touched beneath the node (section 6): a Variable, a domain, a branch. Names only. */
|
|
304
308
|
target?: ActionTarget;
|
|
@@ -324,7 +328,7 @@ export type ActionEvent = {
|
|
|
324
328
|
export declare const OUTSIDE_CREDENTIAL_KINDS: readonly ["personal_token", "deploy_key", "actions_secret", "railway_token", "service_role_key", "database_password"];
|
|
325
329
|
export type OutsideCredentialKind = (typeof OUTSIDE_CREDENTIAL_KINDS)[number];
|
|
326
330
|
export declare const SETUP_GAP_KINDS: readonly ["guard_off", "key_on_computer", "token_in_secrets", "stale_deploy_key"];
|
|
327
|
-
export type SetupGapKind = (typeof SETUP_GAP_KINDS)[number];
|
|
331
|
+
export type SetupGapKind = (typeof SETUP_GAP_KINDS)[number] | "account_not_connected";
|
|
328
332
|
/** Where and whose, when known: a computer or a repository's secrets ("payments-api secrets"), the person, the install,
|
|
329
333
|
* the resource it sits on; `expected`: an admin marked it expected (core loop 4): off Needs you, still Unmanaged. */
|
|
330
334
|
export type CredentialPlace = {
|
|
@@ -358,15 +362,27 @@ export type CpOutsideCredential = CredentialPlace & {
|
|
|
358
362
|
lastSeenTs: number;
|
|
359
363
|
unmanaged7d: number;
|
|
360
364
|
};
|
|
361
|
-
/** A "Needs you" setup row: `id` `gap_` + 16 hex; `command` closes it; `count`: its Unmanaged events in 7 days
|
|
362
|
-
|
|
365
|
+
/** A "Needs you" setup row: `id` `gap_` + 16 hex; `command` closes it; `count`: its Unmanaged events in 7 days (an
|
|
366
|
+
* account's: every action); `href`: its fix off Passport; `impact`: a credential row's week (spec "Impact"). */
|
|
367
|
+
export type CpSetupGap = CredentialPlace & GapRow & GapMore;
|
|
368
|
+
type GapRow = {
|
|
363
369
|
id: string;
|
|
364
370
|
platform: PlatformKey;
|
|
365
371
|
kind: SetupGapKind;
|
|
366
372
|
label: string;
|
|
373
|
+
href?: string;
|
|
374
|
+
};
|
|
375
|
+
type GapMore = {
|
|
367
376
|
lastUsedTs?: number;
|
|
368
377
|
command?: string;
|
|
369
378
|
count?: number;
|
|
379
|
+
impact?: GapImpact;
|
|
380
|
+
};
|
|
381
|
+
export type GapImpact = {
|
|
382
|
+
actions: number;
|
|
383
|
+
total: number;
|
|
384
|
+
before: number;
|
|
385
|
+
after: number;
|
|
370
386
|
};
|
|
371
387
|
export type Coverage = {
|
|
372
388
|
/** Consequential actions in the window (every event is consequential by construction). */
|
|
@@ -389,14 +405,17 @@ export type Coverage = {
|
|
|
389
405
|
};
|
|
390
406
|
/** Deprecated: counts `through` as recorded, credential-defined on servers before 2026-11-13. Use `managedCoverageOf`. */
|
|
391
407
|
export declare function coverageOf(events: readonly (Pick<ActionEvent, "through"> & Partial<Pick<ActionEvent, "outcome">>)[], observed: boolean): Coverage;
|
|
408
|
+
/** A block's decision as stored; "once" (Allow once, removed 2026-11-16) is history, read back so old rows render. */
|
|
392
409
|
export type BlockDecision = "keep" | "once" | "always";
|
|
410
|
+
/** What an admin can decide on a block now: Keep blocked or Always allow. */
|
|
411
|
+
export type BlockChoice = Exclude<BlockDecision, "once">;
|
|
393
412
|
export type PendingBlock = {
|
|
394
413
|
/** The blocked event's id. */
|
|
395
414
|
eventId: string;
|
|
396
415
|
decidedAt?: number;
|
|
397
416
|
decidedBy?: string;
|
|
398
417
|
decision?: BlockDecision;
|
|
399
|
-
/**
|
|
418
|
+
/** History: an old "once" decision's pass expiry. Never honored since 2026-11-16. */
|
|
400
419
|
passExpiresAt?: number;
|
|
401
420
|
/** For "always": the rule it created. */
|
|
402
421
|
ruleId?: string;
|
|
@@ -432,6 +451,13 @@ export type CpPlatformRow = {
|
|
|
432
451
|
identity?: "member" | "shared";
|
|
433
452
|
/** The connection's held grant stopped working: the row says "Reconnect <Platform>". */
|
|
434
453
|
reconnect?: true;
|
|
454
|
+
readOnly?: true;
|
|
455
|
+
/** How agents reach the app ("Model"): MCP, CLI, API, Outside (`platform`), each set up or not. */
|
|
456
|
+
interfaces?: Array<{
|
|
457
|
+
interface: Interface;
|
|
458
|
+
setUp: boolean;
|
|
459
|
+
}>;
|
|
460
|
+
gatewayCalls7d?: number;
|
|
435
461
|
};
|
|
436
462
|
export type CpNodeView = {
|
|
437
463
|
node: ResourceNode;
|
|
@@ -469,7 +495,7 @@ export type CpRuleRow = {
|
|
|
469
495
|
* would have blocked in the last 7 days. Absent once enforcing. */
|
|
470
496
|
wouldBlock?: number;
|
|
471
497
|
};
|
|
472
|
-
/** An event as the API returns it: whether
|
|
498
|
+
/** An event as the API returns it: whether it names an exact target, never the hash itself. */
|
|
473
499
|
export type CpEvent = Omit<ActionEvent, "targetHash"> & {
|
|
474
500
|
hasTarget: boolean;
|
|
475
501
|
};
|
|
@@ -570,3 +596,4 @@ export type CpCoverageView = {
|
|
|
570
596
|
/** A fact Passport does not record is left out, never made up. */
|
|
571
597
|
facts: CpCoverageFact[];
|
|
572
598
|
};
|
|
599
|
+
export {};
|
|
@@ -10,25 +10,22 @@
|
|
|
10
10
|
/* ------------------------------------------------------------------ */
|
|
11
11
|
/* Kinds: what an action does, the same on every platform */
|
|
12
12
|
/* ------------------------------------------------------------------ */
|
|
13
|
-
|
|
13
|
+
/** The kinds (2026-11-16). A read is decided only when a Block could cover it (server `readGate.ts`). */
|
|
14
|
+
export const KINDS = ["delete", "change", "create", "read"];
|
|
14
15
|
export const KIND_LABEL = {
|
|
15
16
|
delete: "Delete",
|
|
16
17
|
change: "Change",
|
|
17
18
|
create: "Create",
|
|
18
|
-
|
|
19
|
-
expose: "Expose",
|
|
20
|
-
disarm: "Disarm"
|
|
19
|
+
read: "Read"
|
|
21
20
|
};
|
|
22
21
|
export const KIND_MEANING = {
|
|
23
|
-
delete: "
|
|
24
|
-
change: "Changes code, config or
|
|
25
|
-
create: "Adds something new",
|
|
26
|
-
|
|
27
|
-
expose: "Moves data out or makes it public",
|
|
28
|
-
disarm: "Turns off a protection"
|
|
22
|
+
delete: "Removes or overwrites something, or turns off a protection",
|
|
23
|
+
change: "Changes code, config, data or access",
|
|
24
|
+
create: "Adds something new, such as a member, key or release",
|
|
25
|
+
read: "Looks at something without changing it"
|
|
29
26
|
};
|
|
30
27
|
/** Most severe first: how a bundle of actions picks the one its event records (spec Part 2, section 4). */
|
|
31
|
-
export const KIND_SEVERITY = ["delete", "
|
|
28
|
+
export const KIND_SEVERITY = ["delete", "change", "create", "read"];
|
|
32
29
|
/** A node id from its parts (see ResourceNode). */
|
|
33
30
|
export function nodeId(platform, service, type, externalKey) {
|
|
34
31
|
if (!service)
|
|
@@ -41,9 +38,10 @@ export function nodeId(platform, service, type, externalKey) {
|
|
|
41
38
|
* A platform's level from its catalog and the sources that are on: Full when
|
|
42
39
|
* every action is reported by a platform source that names the actor, Agent-only
|
|
43
40
|
* when no platform source is on, else Partial. `unseen` lists the actions no
|
|
44
|
-
* platform source that is on reports. An action that declares no `seenBy` is unseen.
|
|
41
|
+
* platform source that is on reports. An action that declares no `seenBy` is unseen; reads are left out.
|
|
45
42
|
*/
|
|
46
|
-
export function visibilityOf(
|
|
43
|
+
export function visibilityOf(all, sources) {
|
|
44
|
+
const actions = all.filter((action) => action.kind !== "read");
|
|
47
45
|
const on = new Set(sources.filter((s) => s.status === "on" && s.source !== "passport").map((s) => s.source));
|
|
48
46
|
if (on.size === 0)
|
|
49
47
|
return { visibility: "agent_only", unseen: actions.map((a) => a.key) };
|
|
@@ -66,19 +64,17 @@ export function mostSevere(found, kindOf) {
|
|
|
66
64
|
};
|
|
67
65
|
return [...found].sort((a, b) => rank(a) - rank(b))[0];
|
|
68
66
|
}
|
|
69
|
-
/**
|
|
67
|
+
/** No rule, no block (2026-11-16): every kind is allowed until an admin adds a Block. */
|
|
70
68
|
export const DEFAULT_KIND_DECISION = {
|
|
71
|
-
delete: "
|
|
69
|
+
delete: "allow",
|
|
72
70
|
change: "allow",
|
|
73
71
|
create: "allow",
|
|
74
|
-
|
|
75
|
-
expose: "block",
|
|
76
|
-
disarm: "block"
|
|
72
|
+
read: "allow"
|
|
77
73
|
};
|
|
78
74
|
/**
|
|
79
75
|
* The one resolution order, used by every enforcement point and every view: walk from the node up to its platform; at
|
|
80
76
|
* each level an action rule beats a kind rule; the nearest level wins; then workspace action rule, workspace kind
|
|
81
|
-
* rule, then the
|
|
77
|
+
* rule, then the default (Allow). A kind Allow never decides an irreversible action; a kind Block does. Pure.
|
|
82
78
|
*/
|
|
83
79
|
export function resolveRule(path /* node id first, platform last */, action, rules) {
|
|
84
80
|
const at = (target, key) => rules.find((rule) => ("workspace" in rule.target
|
|
@@ -87,20 +83,19 @@ export function resolveRule(path /* node id first, platform last */, action, rul
|
|
|
87
83
|
("action" in rule.key
|
|
88
84
|
? "action" in key && rule.key.action === key.action
|
|
89
85
|
: "kind" in key && rule.key.kind === key.kind));
|
|
86
|
+
const kindCounts = (rule) => (action.irreversible && rule?.decision !== "block" ? undefined : rule);
|
|
90
87
|
for (const id of path) {
|
|
91
88
|
const byAction = at({ nodeId: id }, { action: action.key });
|
|
92
89
|
if (byAction)
|
|
93
90
|
return { decision: byAction.decision, ruleId: byAction.id, at: id, by: "action" };
|
|
94
|
-
const byKind =
|
|
91
|
+
const byKind = kindCounts(at({ nodeId: id }, { kind: action.kind }));
|
|
95
92
|
if (byKind)
|
|
96
93
|
return { decision: byKind.decision, ruleId: byKind.id, at: id, by: "kind" };
|
|
97
94
|
}
|
|
98
95
|
const wsAction = at({ workspace: true }, { action: action.key });
|
|
99
96
|
if (wsAction)
|
|
100
97
|
return { decision: wsAction.decision, ruleId: wsAction.id, at: "workspace", by: "action" };
|
|
101
|
-
|
|
102
|
-
return { decision: "block", ruleId: null, at: "default", by: "action" };
|
|
103
|
-
const wsKind = at({ workspace: true }, { kind: action.kind });
|
|
98
|
+
const wsKind = kindCounts(at({ workspace: true }, { kind: action.kind }));
|
|
104
99
|
if (wsKind)
|
|
105
100
|
return { decision: wsKind.decision, ruleId: wsKind.id, at: "workspace", by: "kind" };
|
|
106
101
|
return { decision: DEFAULT_KIND_DECISION[action.kind], ruleId: null, at: "default", by: "kind" };
|
|
@@ -18,9 +18,9 @@ import type { ActionDef, BasicPlatform } from "./controlPlane.generated.js";
|
|
|
18
18
|
* This computer (`cli:local`) is the one exception: commands that can't be undone on the computer an agent runs on
|
|
19
19
|
* (deleting the home folder, the disk, system files or the project folder; recursive permission changes there), one
|
|
20
20
|
* action per class (`LOCAL_IRREVERSIBLE_VERBS`), kind Delete, `irreversible`: only an Allow on that action unlocks
|
|
21
|
-
* one, kind rules never do, Observe mode refuses it too, and a block offers Always allow
|
|
21
|
+
* one, kind rules never do, Observe mode refuses it too, and a block offers Always allow.
|
|
22
22
|
*/
|
|
23
|
-
export declare const BASIC_KINDS: readonly ["delete", "change", "create"];
|
|
23
|
+
export declare const BASIC_KINDS: readonly ["delete", "change", "create", "read"];
|
|
24
24
|
export type BasicKind = (typeof BASIC_KINDS)[number];
|
|
25
25
|
export type BasicSource = "app" | "cli";
|
|
26
26
|
/** This computer's vendor key: `cli:local`, `cli.local.<verb>`. */
|
|
@@ -47,9 +47,6 @@ export type LocalIrreversibleVerb = keyof typeof LOCAL_IRREVERSIBLE_VERBS;
|
|
|
47
47
|
* No check: naming files is no governed action. */
|
|
48
48
|
export declare function localSteer(verb: LocalIrreversibleVerb): NonNullable<ActionDef["steer"]>;
|
|
49
49
|
export declare function isLocalIrreversibleVerb(verb: string): verb is LocalIrreversibleVerb;
|
|
50
|
-
/** Why one of these doesn't run, in the words the agent reads after "Blocked by Passport:" and an admin reads when
|
|
51
|
-
* Allow once is refused for one. */
|
|
52
|
-
export declare function irreversibleRefusal(label: string): string;
|
|
53
50
|
export declare function isBasicSlug(value: string): boolean;
|
|
54
51
|
/** Which kind of basic platform a key names: "app" or "cli"; null for a connector platform (or anything else). Lets
|
|
55
52
|
* code branch on basic platforms first, so switches over `ConnectorPlatform` stay exhaustive. */
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
* This computer (`cli:local`) is the one exception: commands that can't be undone on the computer an agent runs on
|
|
18
18
|
* (deleting the home folder, the disk, system files or the project folder; recursive permission changes there), one
|
|
19
19
|
* action per class (`LOCAL_IRREVERSIBLE_VERBS`), kind Delete, `irreversible`: only an Allow on that action unlocks
|
|
20
|
-
* one, kind rules never do, Observe mode refuses it too, and a block offers Always allow
|
|
20
|
+
* one, kind rules never do, Observe mode refuses it too, and a block offers Always allow.
|
|
21
21
|
*/
|
|
22
|
-
export const BASIC_KINDS = ["delete", "change", "create"];
|
|
22
|
+
export const BASIC_KINDS = ["delete", "change", "create", "read"];
|
|
23
23
|
/** App keys and CLI vendors are slugs: letters, digits, "-" and "_" (never "." or ":"). */
|
|
24
24
|
const SLUG = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
|
|
25
25
|
/** A tool name or a verb: no control characters, bounded. */
|
|
@@ -53,11 +53,6 @@ export function localSteer(verb) {
|
|
|
53
53
|
export function isLocalIrreversibleVerb(verb) {
|
|
54
54
|
return Object.prototype.hasOwnProperty.call(LOCAL_IRREVERSIBLE_VERBS, verb);
|
|
55
55
|
}
|
|
56
|
-
/** Why one of these doesn't run, in the words the agent reads after "Blocked by Passport:" and an admin reads when
|
|
57
|
-
* Allow once is refused for one. */
|
|
58
|
-
export function irreversibleRefusal(label) {
|
|
59
|
-
return `"${label}" can't be undone, so it runs only once an admin allows this kind of command. An admin can Always allow it on every computer in Passport › Blocked.`;
|
|
60
|
-
}
|
|
61
56
|
export function isBasicSlug(value) {
|
|
62
57
|
return SLUG.test(value);
|
|
63
58
|
}
|
package/dist/controlPlaneExec.js
CHANGED
|
@@ -115,9 +115,7 @@ export async function execRailwayScope(prepared, auth, env, home = homedir(), gi
|
|
|
115
115
|
payload.decisionId = decisionId;
|
|
116
116
|
}
|
|
117
117
|
prepared.body.railwayDecide = payload;
|
|
118
|
-
|
|
119
|
-
if (scope)
|
|
120
|
-
prepared.body.railway = scope;
|
|
118
|
+
// No `railway` scope: Passport mints no project token in v1 (2026-11-16).
|
|
121
119
|
}
|
|
122
120
|
/** Before authorize: the Supabase project the command acts on (`supabaseProjectRef`), so Passport decides it on that
|
|
123
121
|
* project rather than on Supabase as a whole. The ref only. */
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Summaries are fixed templates filled with names and numbers only: never a
|
|
9
9
|
* secret's value, a commit message, a body or an email address.
|
|
10
10
|
*
|
|
11
|
-
* `target` is
|
|
11
|
+
* `target` is the exact target an event records (hashed) when the action's
|
|
12
12
|
* target is an argument rather than the node (a collaborator's login and
|
|
13
13
|
* permission, a secret's name, a release tag): a canonical string the server
|
|
14
14
|
* turns into a keyed hash. It is never stored, logged or shown; only the
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Summaries are fixed templates filled with names and numbers only: never a
|
|
10
10
|
* secret's value, a commit message, a body or an email address.
|
|
11
11
|
*
|
|
12
|
-
* `target` is
|
|
12
|
+
* `target` is the exact target an event records (hashed) when the action's
|
|
13
13
|
* target is an argument rather than the node (a collaborator's login and
|
|
14
14
|
* permission, a secret's name, a release tag): a canonical string the server
|
|
15
15
|
* turns into a keyed hash. It is never stored, logged or shown; only the
|
|
@@ -56,7 +56,7 @@ export type GithubClassification = {
|
|
|
56
56
|
nodeId: string;
|
|
57
57
|
actionKey: string;
|
|
58
58
|
summary: string;
|
|
59
|
-
/**
|
|
59
|
+
/** The exact target beyond the node and action (stored only as a keyed hash); absent when the node is all of it. */
|
|
60
60
|
target?: string;
|
|
61
61
|
};
|
|
62
62
|
export type GithubRepo = {
|
|
@@ -77,7 +77,7 @@ export declare const withTarget: (found: GithubClassification, target: string |
|
|
|
77
77
|
export declare function withoutTarget(found: GithubClassification): GithubClassification;
|
|
78
78
|
export declare const onRepo: (r: Repo, actionKey: string, summary: string, target?: string) => GithubClassification;
|
|
79
79
|
/** Fails closed: a `gh` command Passport can't name, a Delete on its repository (on Repositories when none is
|
|
80
|
-
* known). No target
|
|
80
|
+
* known). No target narrower than the node. */
|
|
81
81
|
export declare const unclassifiedGh: (r: Repo | null) => GithubClassification;
|
|
82
82
|
/** The branch's own node, its most specific pattern node, or the repository when no node matches. */
|
|
83
83
|
export declare function branchTarget(r: Repo, branch: string, context: BranchContext): string;
|
|
@@ -130,7 +130,7 @@ export function withoutTarget(found) {
|
|
|
130
130
|
}
|
|
131
131
|
export const onRepo = (r, actionKey, summary, target) => withTarget({ nodeId: repoNode(r.owner, r.repo), actionKey, summary }, target);
|
|
132
132
|
/** Fails closed: a `gh` command Passport can't name, a Delete on its repository (on Repositories when none is
|
|
133
|
-
* known). No target
|
|
133
|
+
* known). No target narrower than the node. */
|
|
134
134
|
export const unclassifiedGh = (r) => r
|
|
135
135
|
? {
|
|
136
136
|
nodeId: repoNode(r.owner, r.repo),
|
|
@@ -55,8 +55,7 @@ export type Unnamed = {
|
|
|
55
55
|
* The worst a push to branches it doesn't name can do, on the repository
|
|
56
56
|
* node: force-push and delete, decided together (blocked when either is).
|
|
57
57
|
* For `git push --all`, `--mirror`, `:` (matching branches), a pattern, or a
|
|
58
|
-
* destination that can't be resolved. No target: there is no exact branch
|
|
59
|
-
* tie an "Allow once" to.
|
|
58
|
+
* destination that can't be resolved. No target: there is no exact branch.
|
|
60
59
|
*/
|
|
61
60
|
export declare function worstCasePush(r: GithubRepo, why: string): GithubClassification[];
|
|
62
61
|
/**
|
|
@@ -112,7 +112,7 @@ export function ghApi(parsed, args, context) {
|
|
|
112
112
|
// With --input the body comes from a file (any -f fields go to the query string): unknown here.
|
|
113
113
|
const opaque = hasFlag(parsed, "--input");
|
|
114
114
|
const found = classifyApi(method, path, opaque ? OPAQUE_BODY : body, context);
|
|
115
|
-
// Fail closed:
|
|
115
|
+
// Fail closed: a body that can't be read names no exact target.
|
|
116
116
|
if (found)
|
|
117
117
|
return opaque ? withoutTarget(found) : found;
|
|
118
118
|
// Named nothing: a read isn't decided; any write is Passport's Unclassified action on its repository. A GraphQL
|
|
@@ -187,8 +187,7 @@ export const resolveHead = (word, currentBranch) => word === "HEAD" || word ===
|
|
|
187
187
|
* The worst a push to branches it doesn't name can do, on the repository
|
|
188
188
|
* node: force-push and delete, decided together (blocked when either is).
|
|
189
189
|
* For `git push --all`, `--mirror`, `:` (matching branches), a pattern, or a
|
|
190
|
-
* destination that can't be resolved. No target: there is no exact branch
|
|
191
|
-
* tie an "Allow once" to.
|
|
190
|
+
* destination that can't be resolved. No target: there is no exact branch.
|
|
192
191
|
*/
|
|
193
192
|
export function worstCasePush(r, why) {
|
|
194
193
|
return [
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Only the classification leaves this computer: the node, the catalog action
|
|
18
18
|
* and the classifier's fixed summary, plus the SHA-256 digest of the target
|
|
19
|
-
* when the command names one (a collaborator, a secret, a tag),
|
|
20
|
-
*
|
|
19
|
+
* when the command names one (a collaborator, a secret, a tag), kept on the
|
|
20
|
+
* event only as a keyed hash. Never the command line,
|
|
21
21
|
* never the target itself.
|
|
22
22
|
*/
|
|
23
23
|
import { type GithubClassification } from "./controlPlaneGithub.generated.js";
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Only the classification leaves this computer: the node, the catalog action
|
|
18
18
|
* and the classifier's fixed summary, plus the SHA-256 digest of the target
|
|
19
|
-
* when the command names one (a collaborator, a secret, a tag),
|
|
20
|
-
*
|
|
19
|
+
* when the command names one (a collaborator, a secret, a tag), kept on the
|
|
20
|
+
* event only as a keyed hash. Never the command line,
|
|
21
21
|
* never the target itself.
|
|
22
22
|
*/
|
|
23
23
|
import { createHash } from "node:crypto";
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* changed only through the orchestrating session.
|
|
6
6
|
*/
|
|
7
7
|
import { type ActionDef, type ActionEvent, type ControlRule, type Coverage, type Kind, type PlatformId, type PlatformKey, type PlatformMode, type ResourceNode, type Surface } from "./controlPlane.generated.js";
|
|
8
|
-
/**
|
|
8
|
+
/** Retired kinds: Spend (2026-11-14), and Grant, Expose and Disarm (2026-11-16). Stored events that name one read as
|
|
9
|
+
* `change` (`currentKind`). */
|
|
9
10
|
export declare const RETIRED_KINDS: Readonly<Record<string, Kind>>;
|
|
10
11
|
/** A stored kind as today's list names it: a retired kind maps to its replacement; undefined when unknown. */
|
|
11
12
|
export declare function currentKind(kind: string): Kind | undefined;
|
|
@@ -9,8 +9,16 @@ import { KINDS, resolveRule } from "./controlPlane.generated.js";
|
|
|
9
9
|
/* ------------------------------------------------------------------ */
|
|
10
10
|
/* Kinds and modes (v19) */
|
|
11
11
|
/* ------------------------------------------------------------------ */
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/** Retired kinds: Spend (2026-11-14), and Grant, Expose and Disarm (2026-11-16). Stored events that name one read as
|
|
13
|
+
* `change` (`currentKind`). */
|
|
14
|
+
export const RETIRED_KINDS = {
|
|
15
|
+
spend: "change",
|
|
16
|
+
// CRUD kinds (2026-11-16): an event of an action the catalog no longer lists reads as Change; every listed action's
|
|
17
|
+
// old events read as its kind now (`REKINDED_ACTIONS` in the server).
|
|
18
|
+
grant: "change",
|
|
19
|
+
expose: "change",
|
|
20
|
+
disarm: "change"
|
|
21
|
+
};
|
|
14
22
|
/** A stored kind as today's list names it: a retired kind maps to its replacement; undefined when unknown. */
|
|
15
23
|
export function currentKind(kind) {
|
|
16
24
|
if (KINDS.includes(kind))
|
|
@@ -184,7 +184,7 @@ export function supabaseProjectRef(argv, where) {
|
|
|
184
184
|
const ref = flagged.at(-1) ?? refOf(found);
|
|
185
185
|
return ref && /^[a-z0-9]{20}$/.test(ref) ? ref : undefined;
|
|
186
186
|
}
|
|
187
|
-
/** The exact target's digest, when the first action has one (a table):
|
|
187
|
+
/** The exact target's digest, when the first action has one (a table): the event records only its keyed hash. */
|
|
188
188
|
function exactDigest(first) {
|
|
189
189
|
const exact = SUPABASE.actions.find((action) => action.key === first.actionKey)?.exactTarget;
|
|
190
190
|
return exact && first.target?.type === exact ? targetDigest(first.target.key) : undefined;
|
package/dist/execGit.d.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `passport exec -- git
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* `passport exec -- git …`: decided like the guard decides git, then run with this computer's own sign-in.
|
|
3
|
+
*
|
|
4
|
+
* Passport issues no git token in v1 (decided 2026-11-16). Each ref a push moves is decided as the guard decides it
|
|
5
|
+
* (`classifyCommands` resolves the push as git will in this folder, `decideCommands` asks `POST /api/cp/decide`); a
|
|
6
|
+
* Block refuses with Passport's message (exit 5) and nothing runs. Everything else (fetch, pull, clone, status, a push
|
|
7
|
+
* Passport doesn't decide, or no answer in time, as the guard fails open, then Passport is told it ran) runs as it is. git gets this shell's own
|
|
8
|
+
* environment, minus Passport's own sign-in, and its exit code passes through.
|
|
8
9
|
*/
|
|
9
10
|
import type { SpawnOptions } from "node:child_process";
|
|
10
|
-
import type
|
|
11
|
+
import { type ParsedArgs } from "./cliArgs.js";
|
|
12
|
+
import { type MemberApi } from "./cliClient.js";
|
|
11
13
|
import { type CommandResult, type Runtime } from "./cliSupport.js";
|
|
12
|
-
|
|
14
|
+
type GitDependencies = {
|
|
15
|
+
api?: MemberApi;
|
|
13
16
|
spawn?: (command: string, args: string[], options: SpawnOptions) => Promise<number>;
|
|
14
17
|
cwd?: string;
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
};
|
|
19
|
+
export declare function execGit(args: ParsedArgs, runtime: Runtime, deps?: GitDependencies): Promise<CommandResult>;
|
|
20
|
+
export {};
|
package/dist/execGit.js
CHANGED
|
@@ -1,28 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { value } from "./cliArgs.js";
|
|
2
|
+
import { memberApi } from "./cliClient.js";
|
|
3
|
+
import { callerFrom, failure, resolveCliAuth, timeoutMs } from "./cliSupport.js";
|
|
4
|
+
import { classifyCommands, decideCommands, gitPlace } from "./controlPlaneGuard.js";
|
|
4
5
|
import { spawnVendor } from "./execSpawn.js";
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
import { EXEC_PASSPORT_ENV } from "./execVendors.js";
|
|
7
|
+
function quote(part) {
|
|
8
|
+
return /^[A-Za-z0-9_@%+=:,./-]+$/.test(part) ? part : `'${part.replaceAll("'", `'\\''`)}'`;
|
|
9
|
+
}
|
|
7
10
|
export async function execGit(args, runtime, deps = {}) {
|
|
8
11
|
const rest = args.positionals.slice(1);
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const cwd = deps.cwd ?? process.cwd();
|
|
13
|
+
const commands = classifyCommands(["git", ...rest].map(quote).join(" "), gitPlace(cwd), { cwd });
|
|
14
|
+
if (commands.some((command) => command.classifications.length)) {
|
|
15
|
+
const client = deps.api ??
|
|
16
|
+
memberApi({
|
|
17
|
+
auth: resolveCliAuth(args, runtime.env),
|
|
18
|
+
caller: callerFrom(args, runtime.env),
|
|
19
|
+
timeoutMs: timeoutMs(args),
|
|
20
|
+
signal: runtime.signal
|
|
21
|
+
});
|
|
22
|
+
const session = value(args, "session");
|
|
23
|
+
const signal = AbortSignal.any([runtime.signal, AbortSignal.timeout(timeoutMs(args))]);
|
|
24
|
+
const decided = await decideCommands((path, init) => client.fetchApi(path, init), commands, session ? { sessionId: session } : {}, signal);
|
|
25
|
+
if (decided.answer.kind === "block")
|
|
26
|
+
return failure(decided.answer.message, 5, "blocked");
|
|
27
|
+
// No answer in time: the push runs (as the guard fails open), and Passport is told it ran, so a block it records
|
|
28
|
+
// late reads "ran, before Passport's block arrived" and the push is reconciled.
|
|
29
|
+
if (decided.answer.kind === "unreachable" && decided.answer.late) {
|
|
30
|
+
const { tellLate } = await import("./controlPlaneLate.js");
|
|
31
|
+
await tellLate((path, init) => client.fetchApi(path, init), decided.answer.late);
|
|
32
|
+
}
|
|
16
33
|
}
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
shell: false,
|
|
21
|
-
cwd: deps.cwd ?? process.cwd()
|
|
22
|
-
};
|
|
34
|
+
const env = { ...runtime.env };
|
|
35
|
+
for (const name of EXEC_PASSPORT_ENV)
|
|
36
|
+
delete env[name];
|
|
23
37
|
let code;
|
|
24
38
|
try {
|
|
25
|
-
code = await (deps.spawn ?? spawnVendor)("git",
|
|
39
|
+
code = await (deps.spawn ?? spawnVendor)("git", rest, { stdio: "inherit", env, shell: false, cwd });
|
|
26
40
|
}
|
|
27
41
|
catch {
|
|
28
42
|
return failure("git couldn't start.", 1, "not_installed");
|
package/dist/execVendors.js
CHANGED
|
@@ -382,12 +382,9 @@ export function devLoopRefusal(vendor, args, issuance) {
|
|
|
382
382
|
export function refusedReason(vendor, args) {
|
|
383
383
|
const words = args.filter((arg) => !arg.startsWith("-"));
|
|
384
384
|
const rule = ruleFor(vendor, args);
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
// A short-lived key keeps a dev loop safe enough: exec checks it was one.
|
|
389
|
-
return EXEC_SHORT_LIVED_DEV.has(vendor) ? undefined : devLoopAnswer(vendor, rule.words, rule.why);
|
|
390
|
-
}
|
|
385
|
+
// v1 (2026-11-16): the CLI runs with the person's own sign-in, so signing in and dev loops run as they are.
|
|
386
|
+
if (rule?.kind === "login" || rule?.kind === "dev")
|
|
387
|
+
return undefined;
|
|
391
388
|
if (rule)
|
|
392
389
|
return `passport exec won't run ${[vendorCommand(vendor), ...rule.words].join(" ")}: it ${rule.why}.`;
|
|
393
390
|
if (vendor === "gh" && words[0] && !GH_BUILTINS.has(words[0])) {
|
package/dist/initKeysStep.js
CHANGED
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Keys Store your Railway account token in Passport and sign the Railway CLI out on this computer? [y/N]
|
|
9
9
|
* ✓ Railway: stored in Passport, removed from this computer
|
|
10
|
+
*
|
|
11
|
+
* Off in v1 (offInV1.ts): `detectKeys` finds the keys and asks the server
|
|
12
|
+
* nothing; `applyKeys` moves nothing, --move-keys included, and records the
|
|
13
|
+
* keys found as kept. The moving code is switched off, not deleted.
|
|
10
14
|
*/
|
|
11
15
|
import { choices } from "./cliAsk.js";
|
|
12
16
|
import { EXEC_VENDOR_NAMES } from "./execVendors.js";
|
|
@@ -16,6 +20,7 @@ import { gitHelperEffective } from "./gitCredentialSetup.js";
|
|
|
16
20
|
import { findLocalKeys } from "./keysLocal.js";
|
|
17
21
|
import { readBoundedJson } from "./cliSupport.js";
|
|
18
22
|
import { runScan } from "./scan.js";
|
|
23
|
+
import { issuesCredentials } from "./offInV1.js";
|
|
19
24
|
function oneEach(keys) {
|
|
20
25
|
const seen = new Set();
|
|
21
26
|
return keys.filter((key) => {
|
|
@@ -40,6 +45,9 @@ export async function detectKeys(s) {
|
|
|
40
45
|
support: "ok",
|
|
41
46
|
envFiles
|
|
42
47
|
};
|
|
48
|
+
// Off in v1: Passport holds no keys and issues no git tokens, so the plan asks the server nothing.
|
|
49
|
+
if (!issuesCredentials(s.deps))
|
|
50
|
+
return plan;
|
|
43
51
|
const support = await s.api(KEYS_PATH, { method: "GET", headers: { accept: "application/json" }, signal: s.signal });
|
|
44
52
|
if (!support.ok) {
|
|
45
53
|
await support.body?.cancel().catch(() => undefined);
|
|
@@ -93,6 +101,13 @@ async function applyGit(s, plan, mode) {
|
|
|
93
101
|
* (Customize; `[y/N]`), "keep" leaves them where they are.
|
|
94
102
|
*/
|
|
95
103
|
export async function applyKeys(s, plan, mode) {
|
|
104
|
+
// Off in v1: nothing moves, --move-keys included. The keys found stay, as the plan said.
|
|
105
|
+
if (!issuesCredentials(s.deps)) {
|
|
106
|
+
if (plan.local.length) {
|
|
107
|
+
s.record("keys", "skipped", { moved: [], left: 0, kept: plan.local.map((key) => key.vendor), off: true });
|
|
108
|
+
}
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
96
111
|
await applyGit(s, plan, mode);
|
|
97
112
|
// Nothing to move: no summary entry.
|
|
98
113
|
if (!plan.local.length)
|