passport-bridge 0.41.0 → 0.43.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 +70 -172
- 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.js +12 -6
- 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 +31 -7
- package/dist/controlPlane.generated.js +13 -17
- package/dist/controlPlaneBasic.generated.d.ts +1 -1
- package/dist/controlPlaneBasic.generated.js +1 -1
- package/dist/controlPlaneExec.js +1 -3
- package/dist/controlPlaneModel.generated.d.ts +2 -1
- package/dist/controlPlaneModel.generated.js +10 -2
- 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
|
@@ -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,14 +64,12 @@ export function mostSevere(found, kindOf) {
|
|
|
66
64
|
};
|
|
67
65
|
return [...found].sort((a, b) => rank(a) - rank(b))[0];
|
|
68
66
|
}
|
|
69
|
-
/** The shipped workspace defaults:
|
|
67
|
+
/** The shipped workspace defaults: Delete is blocked; Read, Create and Change are allowed. */
|
|
70
68
|
export const DEFAULT_KIND_DECISION = {
|
|
71
69
|
delete: "block",
|
|
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
|
|
@@ -20,7 +20,7 @@ import type { ActionDef, BasicPlatform } from "./controlPlane.generated.js";
|
|
|
20
20
|
* action per class (`LOCAL_IRREVERSIBLE_VERBS`), kind Delete, `irreversible`: only an Allow on that action unlocks
|
|
21
21
|
* one, kind rules never do, Observe mode refuses it too, and a block offers Always allow, never Allow once.
|
|
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>`. */
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* action per class (`LOCAL_IRREVERSIBLE_VERBS`), kind Delete, `irreversible`: only an Allow on that action unlocks
|
|
20
20
|
* one, kind rules never do, Observe mode refuses it too, and a block offers Always allow, never Allow once.
|
|
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. */
|
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. */
|
|
@@ -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))
|
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)
|
package/dist/initPlan.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Already set up
|
|
9
9
|
* ✓ GitHub connected
|
|
10
10
|
* Not changed
|
|
11
|
-
* –
|
|
11
|
+
* – Your AWS and Railway keys stay on this computer.
|
|
12
12
|
*
|
|
13
13
|
* Then one question: "Use the recommended setup? [Y/n]". No walks each step.
|
|
14
14
|
* `--dry-run` (and `--json` without `--yes`) stops after the plan.
|
package/dist/initPlan.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Already set up
|
|
9
9
|
* ✓ GitHub connected
|
|
10
10
|
* Not changed
|
|
11
|
-
* –
|
|
11
|
+
* – Your AWS and Railway keys stay on this computer.
|
|
12
12
|
*
|
|
13
13
|
* Then one question: "Use the recommended setup? [Y/n]". No walks each step.
|
|
14
14
|
* `--dry-run` (and `--json` without `--yes`) stops after the plan.
|
|
@@ -18,6 +18,7 @@ import { agentFiles } from "./initLocalSteps.js";
|
|
|
18
18
|
import { appLabel } from "./initState.js";
|
|
19
19
|
import { listOf } from "./initUi.js";
|
|
20
20
|
import { AGENT_NAMES, displayHome } from "./initAgents.js";
|
|
21
|
+
import { issuesCredentials } from "./offInV1.js";
|
|
21
22
|
function names(list) {
|
|
22
23
|
return listOf(list.map((entry) => entry.name));
|
|
23
24
|
}
|
|
@@ -59,7 +60,17 @@ function planApps(b, apps, options) {
|
|
|
59
60
|
b.kept("apps", options.interactive ? "No apps found on this computer. Answer n to pick some." : "No apps found on this computer.");
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
|
-
function planKeys(b, keys, options) {
|
|
63
|
+
function planKeys(b, keys, options, on) {
|
|
64
|
+
// Off in v1: Passport holds no keys, so the keys found stay, --move-keys or not.
|
|
65
|
+
if (!on) {
|
|
66
|
+
if (keys?.local.length) {
|
|
67
|
+
const one = keys.local.length === 1;
|
|
68
|
+
b.kept("keys", `Your ${listOf(keys.names)} ${one ? "key stays" : "keys stay"} on this computer.`);
|
|
69
|
+
}
|
|
70
|
+
for (const file of keys?.envFiles ?? [])
|
|
71
|
+
b.kept("keys", `Used by your app, so Passport leaves it: ${file}`);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
63
74
|
if (keys?.local.length) {
|
|
64
75
|
const one = keys.local.length === 1;
|
|
65
76
|
if (keys.support === "old")
|
|
@@ -136,7 +147,7 @@ function planGuard(b, s, guard) {
|
|
|
136
147
|
export function buildPlan(s, d, options) {
|
|
137
148
|
const b = new PlanBuilder();
|
|
138
149
|
planApps(b, d.apps, options);
|
|
139
|
-
planKeys(b, d.keys, options);
|
|
150
|
+
planKeys(b, d.keys, options, issuesCredentials(s.deps));
|
|
140
151
|
planAgents(b, s, d.agents);
|
|
141
152
|
planGuard(b, s, d.guard);
|
|
142
153
|
// Last, since it's the one step the person finishes in another app.
|
package/dist/initState.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { Env } from "./cliSupport.js";
|
|
|
6
6
|
import type { AgentContext, AgentId } from "./initAgents.js";
|
|
7
7
|
import type { InstallContext, StableCommand } from "./initInstall.js";
|
|
8
8
|
import type { InitScreen, InitTerminal } from "./initUi.js";
|
|
9
|
+
import type { CredentialsSwitch } from "./offInV1.js";
|
|
9
10
|
import type { ScanOptions, ScanResult } from "./scan.js";
|
|
10
11
|
export declare const PASSPORT_CLOUD = "https://passportmcp.com";
|
|
11
12
|
/** The production apps init looks for, in the order it lists them. */
|
|
@@ -26,7 +27,7 @@ export declare const WAIT_NEXT_SECONDS = 300;
|
|
|
26
27
|
export declare const WAIT_CHUNK_SECONDS = 10;
|
|
27
28
|
export type StepStatus = "done" | "already_set_up" | "skipped" | "needs_attention" | "failed" | "unavailable";
|
|
28
29
|
export type Gateway = Pick<CliGateway, "callTool" | "fetchApi" | "close" | "origin">;
|
|
29
|
-
export type InitDependencies = {
|
|
30
|
+
export type InitDependencies = CredentialsSwitch & {
|
|
30
31
|
terminal?: InitTerminal;
|
|
31
32
|
scan?: (options: ScanOptions) => ScanResult;
|
|
32
33
|
login?: typeof login;
|
package/dist/keysHere.js
CHANGED
|
@@ -78,11 +78,12 @@ export function keysHere(found, kept, salt) {
|
|
|
78
78
|
...(fingerprint ? { fingerprint } : {}),
|
|
79
79
|
holdable,
|
|
80
80
|
kept: isKept,
|
|
81
|
+
// Off in v1 (offInV1.ts): Passport holds no keys, so none is moved.
|
|
81
82
|
step: isKept
|
|
82
|
-
?
|
|
83
|
+
? "Kept here on purpose."
|
|
83
84
|
: key.vendor === "npm"
|
|
84
85
|
? LOCAL_ONLY_STEPS[name]
|
|
85
|
-
:
|
|
86
|
+
: "Stays on this computer: Passport doesn't hold keys in v1."
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
89
|
return out;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `passport keys` in v1 (decided 2026-11-16): Passport holds no keys. The list shows the keys found on this computer,
|
|
3
|
+
* which stay; move, add, rotate, keep and signed-out print one line (offInV1.ts).
|
|
4
|
+
*/
|
|
5
|
+
import type { CommandResult, Runtime } from "./cliSupport.js";
|
|
6
|
+
/** The v1 answer for a `passport keys` action, or undefined for one that still runs as before (`shim`). */
|
|
7
|
+
export declare function keysInV1(action: string, runtime: Runtime, deps: {
|
|
8
|
+
home?: string;
|
|
9
|
+
}): CommandResult | undefined;
|
package/dist/keysInV1.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { shimJson } from "./cliKeysShim.js";
|
|
2
|
+
import { listShims } from "./execShims.js";
|
|
3
|
+
import { listOf } from "./initUi.js";
|
|
4
|
+
import { findKeysHere } from "./keysHere.js";
|
|
5
|
+
import { KEYS_OFF, offResult } from "./offInV1.js";
|
|
6
|
+
import { table, termOf } from "./term.js";
|
|
7
|
+
/** Off in v1: these held keys in Passport. `keys shim` (list, --remove) stays, in cliKeysShim.ts. */
|
|
8
|
+
const OFF_ACTIONS = new Set(["move", "add", "rotate", "keep", "signed-out"]);
|
|
9
|
+
/** The v1 answer for a `passport keys` action, or undefined for one that still runs as before (`shim`). */
|
|
10
|
+
export function keysInV1(action, runtime, deps) {
|
|
11
|
+
if (action === "list")
|
|
12
|
+
return detected(runtime, deps);
|
|
13
|
+
if (OFF_ACTIONS.has(action))
|
|
14
|
+
return offResult(`keys ${action}`, KEYS_OFF);
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
/** What `passport keys` lists in v1: the keys found on this computer, which stay. Reads no server. */
|
|
18
|
+
function detected(runtime, deps) {
|
|
19
|
+
const found = findKeysHere({ env: runtime.env, ...(deps.home ? { home: deps.home } : {}) });
|
|
20
|
+
const seen = new Set();
|
|
21
|
+
const local = found.filter((key) => {
|
|
22
|
+
const where = `${key.vendor}\u0000${key.location}`;
|
|
23
|
+
if (seen.has(where))
|
|
24
|
+
return false;
|
|
25
|
+
seen.add(where);
|
|
26
|
+
return true;
|
|
27
|
+
});
|
|
28
|
+
const term = termOf((runtime.stdout ?? {}), runtime.env);
|
|
29
|
+
const lines = local.length
|
|
30
|
+
? [
|
|
31
|
+
"Keys on this computer:",
|
|
32
|
+
...table(local.map((key) => [` ${key.label}`, key.location]), term.width, { indent: " " }),
|
|
33
|
+
`${local.length === 1 ? "It stays" : "They stay"} here: Passport doesn't hold keys in v1.`
|
|
34
|
+
]
|
|
35
|
+
: ["No CLI keys on this computer."];
|
|
36
|
+
const shims = listShims(runtime.env);
|
|
37
|
+
if (shims.length) {
|
|
38
|
+
const typed = listOf(shims.map((shim) => shim.binary));
|
|
39
|
+
lines.push(`Typing ${typed} ${shims.length === 1 ? "runs" : "run"} ${shims.length === 1 ? "it" : "them"} through Passport.`);
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
json: {
|
|
43
|
+
onThisComputer: local.map((key) => ({ vendor: key.vendor, label: key.label, location: key.location })),
|
|
44
|
+
shims: shims.map(shimJson)
|
|
45
|
+
},
|
|
46
|
+
human: lines.join("\n")
|
|
47
|
+
};
|
|
48
|
+
}
|
package/dist/keysLocal.js
CHANGED
|
@@ -22,6 +22,7 @@ import { join, relative, isAbsolute } from "node:path";
|
|
|
22
22
|
import { readBoundedUtf8File } from "./boundedFile.js";
|
|
23
23
|
import { EXEC_TOKEN_PAGES, EXEC_VENDOR_NAMES } from "./execVendors.js";
|
|
24
24
|
import { findOnPath } from "./initInstall.js";
|
|
25
|
+
import { removesLocalKeys } from "./offInV1.js";
|
|
25
26
|
import { removeKeychainItems, stripeKeychain, supabaseKeychain } from "./keysKeychain.js";
|
|
26
27
|
import { withoutAwsProfileKeys, withoutJsonFields, withoutTomlKeys, writeAtomic } from "./keysLocalEdit.js";
|
|
27
28
|
import { firebaseKeys, gcloudKeys, removeGcloudAccount } from "./keysLocalGoogle.js";
|
|
@@ -476,6 +477,9 @@ function stillThere(key, context) {
|
|
|
476
477
|
* stays in Passport either way.
|
|
477
478
|
*/
|
|
478
479
|
export async function removeLocalCopy(key, context, runner = defaultRunner) {
|
|
480
|
+
// Off in v1 (decided 2026-11-16): Passport never removes or edits a CLI's own sign-in.
|
|
481
|
+
if (!removesLocalKeys())
|
|
482
|
+
return { localCopy: "logout_failed", left: `${key.location} stays: Passport keeps no keys in v1.` };
|
|
479
483
|
const name = EXEC_VENDOR_NAMES[key.vendor];
|
|
480
484
|
const removal = key.removal;
|
|
481
485
|
if (!removal)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Once, on the first run of a CLI with credentials off in v1 (decided 2026-11-16): clear what the switched-off key
|
|
3
|
+
* custody left behind in $PASSPORT_HOME, so nothing acts on it. The "Keep my CLIs signed out" answer (each profile's
|
|
4
|
+
* keys choices), the exec-vendors marker (`exec-keys/`), and the moved-keys manifest (`keys-moved.json`). Keys kept
|
|
5
|
+
* here on purpose stay recorded. Never throws; a folder that doesn't exist yet is left alone.
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { credentialDir } from "./credentialStorage.js";
|
|
10
|
+
import { readKeysChoices, setSignedOut } from "./keysKept.js";
|
|
11
|
+
export const V1_CLEARED = "keys-v1-cleared";
|
|
12
|
+
/** True when it cleared something this run. */
|
|
13
|
+
export function clearKeyCustodyOnce(now = Date.now()) {
|
|
14
|
+
try {
|
|
15
|
+
const dir = credentialDir();
|
|
16
|
+
const done = join(dir, V1_CLEARED);
|
|
17
|
+
if (!existsSync(dir) || existsSync(done))
|
|
18
|
+
return false;
|
|
19
|
+
rmSync(join(dir, "keys-moved.json"), { force: true });
|
|
20
|
+
rmSync(join(dir, "exec-keys"), { recursive: true, force: true });
|
|
21
|
+
const choices = join(dir, "keys-choices");
|
|
22
|
+
if (existsSync(choices)) {
|
|
23
|
+
for (const file of readdirSync(choices)) {
|
|
24
|
+
if (!file.endsWith(".json"))
|
|
25
|
+
continue;
|
|
26
|
+
const profile = file.slice(0, -".json".length);
|
|
27
|
+
if (readKeysChoices(profile).signedOut?.on)
|
|
28
|
+
setSignedOut(profile, false, now);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
writeFileSync(done, `${now}\n`, { mode: 0o600 });
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passport issues no credentials in v1 (decided 2026-11-16, docs/DECISIONS.md):
|
|
3
|
+
* it decides Allow or Block and records, and never gives an agent or a CLI a
|
|
4
|
+
* working app credential. The commands that held keys or issued tokens are
|
|
5
|
+
* switched off, not deleted: `ISSUES_CREDENTIALS` gates their code, and each
|
|
6
|
+
* prints one line from here instead, reading and sending nothing.
|
|
7
|
+
*
|
|
8
|
+
* passport keys move is off in v1: Passport no longer holds keys. Your CLIs keep their own sign-ins.
|
|
9
|
+
*/
|
|
10
|
+
import type { CommandResult } from "./cliSupport.js";
|
|
11
|
+
/** False in v1: key custody, git tokens and cluster tokens are off. */
|
|
12
|
+
export declare const ISSUES_CREDENTIALS: boolean;
|
|
13
|
+
/** What a command's dependencies take: tests turn the switched-off code on to keep it covered until it's deleted. */
|
|
14
|
+
export type CredentialsSwitch = {
|
|
15
|
+
issuesCredentials?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare function issuesCredentials(deps?: CredentialsSwitch): boolean;
|
|
18
|
+
export declare function allowKeyRemovalForTests(on: boolean): void;
|
|
19
|
+
export declare function removesLocalKeys(): boolean;
|
|
20
|
+
export declare const KEYS_OFF = "Passport no longer holds keys. Your CLIs keep their own sign-ins.";
|
|
21
|
+
export declare const GIT_OFF = "Passport no longer issues git tokens. git keeps using your own sign-in.";
|
|
22
|
+
export declare const KUBE_OFF = "Passport no longer issues cluster tokens. Point kubectl at your own credentials.";
|
|
23
|
+
/** "passport keys move is off in v1: …" */
|
|
24
|
+
export declare function offLine(command: string, reason: string): string;
|
|
25
|
+
/** An off command's answer: the line on stdout, exit 0. */
|
|
26
|
+
export declare function offResult(command: string, reason: string): CommandResult;
|
package/dist/offInV1.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** False in v1: key custody, git tokens and cluster tokens are off. */
|
|
2
|
+
export const ISSUES_CREDENTIALS = false;
|
|
3
|
+
export function issuesCredentials(deps) {
|
|
4
|
+
return deps?.issuesCredentials ?? ISSUES_CREDENTIALS;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Off in v1: Passport never removes or edits a CLI's own sign-in on this computer (`removeLocalCopy`). Only a test
|
|
8
|
+
* of the switched-off move code turns it back on, and turns it off again after.
|
|
9
|
+
*/
|
|
10
|
+
let removalForTests = false;
|
|
11
|
+
export function allowKeyRemovalForTests(on) {
|
|
12
|
+
removalForTests = on;
|
|
13
|
+
}
|
|
14
|
+
export function removesLocalKeys() {
|
|
15
|
+
return removalForTests;
|
|
16
|
+
}
|
|
17
|
+
export const KEYS_OFF = "Passport no longer holds keys. Your CLIs keep their own sign-ins.";
|
|
18
|
+
export const GIT_OFF = "Passport no longer issues git tokens. git keeps using your own sign-in.";
|
|
19
|
+
export const KUBE_OFF = "Passport no longer issues cluster tokens. Point kubectl at your own credentials.";
|
|
20
|
+
/** "passport keys move is off in v1: …" */
|
|
21
|
+
export function offLine(command, reason) {
|
|
22
|
+
return `passport ${command} is off in v1: ${reason}`;
|
|
23
|
+
}
|
|
24
|
+
/** An off command's answer: the line on stdout, exit 0. */
|
|
25
|
+
export function offResult(command, reason) {
|
|
26
|
+
const message = offLine(command, reason);
|
|
27
|
+
return { json: { off: true, command, message }, human: message };
|
|
28
|
+
}
|
package/dist/pluginPin.d.ts
CHANGED
package/dist/pluginPin.js
CHANGED
package/dist/statusKeys.d.ts
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* computer, read from the same list `passport scan` prints and Work › To fix
|
|
4
4
|
* counts (keysHere.ts). "Passport holds it" is only true when no key for that
|
|
5
5
|
* app is also on this computer: an agent that finds the local one can skip
|
|
6
|
-
* Passport, so that case reads plainly
|
|
6
|
+
* Passport, so that case reads plainly. Moving keys is off in v1
|
|
7
|
+
* (offInV1.ts), so no row says to move one.
|
|
7
8
|
*
|
|
8
9
|
* ✓ Cloudflare in Passport · used 2 h ago
|
|
9
10
|
* ! Railway used 5 h ago, but also on this computer
|
|
10
11
|
* ~/.railway/config.json
|
|
11
|
-
* Run: passport keys move railway
|
|
12
12
|
* ! npm on this computer, not in Passport
|
|
13
13
|
* ~/.npmrc
|
|
14
14
|
* Passport can't hold npm tokens yet. Run npm logout when you aren't publishing.
|
package/dist/statusKeys.js
CHANGED
|
@@ -6,12 +6,7 @@ export function keyRows(held, local, use) {
|
|
|
6
6
|
const copies = here(key.vendor);
|
|
7
7
|
const loose = copies.filter((copy) => !copy.kept);
|
|
8
8
|
if (key.status !== "ok") {
|
|
9
|
-
return {
|
|
10
|
-
mark: "warn",
|
|
11
|
-
name: key.name,
|
|
12
|
-
detail: key.status.replace(/_/g, " "),
|
|
13
|
-
note: `Run: passport keys move ${key.vendor}`
|
|
14
|
-
};
|
|
9
|
+
return { mark: "warn", name: key.name, detail: key.status.replace(/_/g, " ") };
|
|
15
10
|
}
|
|
16
11
|
const used = use(key.lastUsedAt);
|
|
17
12
|
if (loose.length) {
|
|
@@ -19,7 +14,7 @@ export function keyRows(held, local, use) {
|
|
|
19
14
|
mark: "warn",
|
|
20
15
|
name: key.name,
|
|
21
16
|
detail: key.lastUsedAt ? `${used}, but also on this computer` : "in Passport, but also on this computer",
|
|
22
|
-
note:
|
|
17
|
+
note: where(loose)
|
|
23
18
|
};
|
|
24
19
|
}
|
|
25
20
|
return {
|
|
@@ -41,7 +36,7 @@ export function keyRows(held, local, use) {
|
|
|
41
36
|
mark: "warn",
|
|
42
37
|
name: first.name,
|
|
43
38
|
detail: "on this computer, not in Passport",
|
|
44
|
-
note:
|
|
39
|
+
note: first.vendor === "npm" ? `${where(copies)}\n${first.step}` : where(copies)
|
|
45
40
|
});
|
|
46
41
|
}
|
|
47
42
|
return rows;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.43.0";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Keep in lockstep with bridge/package.json.
|
|
2
|
-
export const VERSION = "0.
|
|
2
|
+
export const VERSION = "0.43.0";
|