passport-bridge 0.32.1 → 0.35.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 +73 -27
- package/dist/awsCommands.d.ts +47 -0
- package/dist/awsCommands.js +371 -0
- package/dist/awsConfig.d.ts +34 -0
- package/dist/awsConfig.js +115 -0
- package/dist/azureCommands.d.ts +54 -0
- package/dist/azureCommands.js +333 -0
- package/dist/cli.js +9 -8
- package/dist/cliActions.d.ts +4 -1
- package/dist/cliActions.js +132 -8
- package/dist/cliActionsLocal.d.ts +38 -0
- package/dist/cliActionsLocal.js +186 -0
- package/dist/cliAllowances.d.ts +3 -3
- package/dist/cliAllowances.js +2 -2
- package/dist/cliAnswered.d.ts +29 -9
- package/dist/cliAnswered.js +59 -19
- package/dist/cliArgs.d.ts +1 -1
- package/dist/cliArgs.js +20 -9
- package/dist/cliAutopilot.d.ts +3 -1
- package/dist/cliAutopilot.js +77 -14
- package/dist/cliAutopilotPolicy.d.ts +41 -6
- package/dist/cliAutopilotPolicy.js +65 -29
- package/dist/cliDescribe.d.ts +2 -2
- package/dist/cliDescribe.js +2 -2
- package/dist/cliExec.d.ts +6 -14
- package/dist/cliExec.js +110 -80
- package/dist/cliGitCredential.d.ts +36 -0
- package/dist/cliGitCredential.js +432 -0
- package/dist/cliGuardHealth.js +3 -1
- package/dist/cliGuardState.d.ts +13 -2
- package/dist/cliGuardState.js +36 -1
- package/dist/cliHook.js +46 -46
- package/dist/cliHookAfter.d.ts +5 -0
- package/dist/cliHookAfter.js +14 -1
- package/dist/cliHookClassify.d.ts +12 -0
- package/dist/cliHookClassify.js +145 -44
- package/dist/cliHookCoverage.d.ts +20 -0
- package/dist/cliHookCoverage.js +139 -0
- package/dist/cliHookCreates.js +128 -3
- package/dist/cliHookDecide.d.ts +14 -53
- package/dist/cliHookDecide.js +187 -168
- package/dist/cliHookDecideRequest.d.ts +48 -0
- package/dist/cliHookDecideRequest.js +69 -0
- package/dist/cliHookDeliver.d.ts +21 -1
- package/dist/cliHookDeliver.js +38 -7
- package/dist/cliHookEarly.d.ts +10 -0
- package/dist/cliHookEarly.js +8 -0
- package/dist/cliHookEnvironment.js +23 -6
- package/dist/cliHookGuard.d.ts +3 -3
- package/dist/cliHookGuard.js +16 -9
- package/dist/cliHookIac.d.ts +32 -0
- package/dist/cliHookIac.js +53 -0
- package/dist/cliHookInput.d.ts +10 -0
- package/dist/cliHookInput.js +12 -0
- package/dist/cliHookInstall.d.ts +12 -4
- package/dist/cliHookInstall.js +54 -75
- package/dist/cliHookLease.js +10 -2
- package/dist/cliHookLinks.d.ts +6 -1
- package/dist/cliHookLinks.js +194 -7
- package/dist/cliHookLocal.d.ts +5 -12
- package/dist/cliHookLocal.js +73 -48
- package/dist/cliHookLocalCode.d.ts +8 -1
- package/dist/cliHookLocalCode.js +14 -0
- package/dist/cliHookLocalFs.d.ts +4 -0
- package/dist/cliHookLocalFs.js +32 -1
- package/dist/cliHookMode.d.ts +3 -0
- package/dist/cliHookMode.js +7 -0
- package/dist/cliHookParse.js +122 -31
- package/dist/cliHookPlace.d.ts +25 -0
- package/dist/cliHookPlace.js +39 -0
- package/dist/cliHookPlan.d.ts +35 -0
- package/dist/cliHookPlan.js +34 -0
- package/dist/cliHookProject.d.ts +13 -2
- package/dist/cliHookProject.js +48 -20
- package/dist/cliHookReach.d.ts +31 -0
- package/dist/cliHookReach.js +84 -0
- package/dist/cliHookRepo.js +29 -8
- package/dist/cliHookRewrite.d.ts +31 -5
- package/dist/cliHookRewrite.js +57 -15
- package/dist/cliHookScripts.d.ts +13 -3
- package/dist/cliHookScripts.js +146 -25
- package/dist/cliHookServerDecision.d.ts +30 -0
- package/dist/cliHookServerDecision.js +85 -0
- package/dist/cliHookSessionEnd.d.ts +29 -1
- package/dist/cliHookSessionEnd.js +79 -10
- package/dist/cliHookSessionState.d.ts +2 -0
- package/dist/cliHookSessionState.js +2 -2
- package/dist/cliHookSettings.d.ts +17 -0
- package/dist/cliHookSettings.js +80 -0
- package/dist/cliHookSpawn.d.ts +6 -6
- package/dist/cliHookSpawn.js +3 -21
- package/dist/cliHookStatus.d.ts +7 -2
- package/dist/cliHookStatus.js +17 -5
- package/dist/cliHookStop.d.ts +37 -0
- package/dist/cliHookStop.js +59 -0
- package/dist/cliHookUncheckedName.d.ts +2 -1
- package/dist/cliHookUncheckedName.js +4 -1
- package/dist/cliHookVendors.js +86 -63
- package/dist/cliHookVendorsGitlab.d.ts +15 -0
- package/dist/cliHookVendorsGitlab.js +95 -0
- package/dist/cliHookVendorsMore.js +117 -1
- package/dist/cliInit.d.ts +5 -1
- package/dist/cliInit.js +18 -11
- package/dist/cliKeys.js +43 -19
- package/dist/cliKeysBack.js +2 -1
- package/dist/cliKeysKeep.js +6 -5
- package/dist/cliKeysRotate.js +16 -4
- package/dist/cliKeysShim.d.ts +1 -1
- package/dist/cliKeysShim.js +3 -2
- package/dist/cliKubeCredential.d.ts +53 -0
- package/dist/cliKubeCredential.js +291 -0
- package/dist/cliLoosening.d.ts +9 -1
- package/dist/cliLoosening.js +36 -10
- package/dist/cliMain.js +41 -65
- package/dist/cliOutput.d.ts +2 -0
- package/dist/cliOutput.js +122 -57
- package/dist/cliPolicy.d.ts +9 -0
- package/dist/cliPolicy.js +24 -3
- package/dist/cliPolicyV2.js +85 -9
- package/dist/cliReady.js +2 -2
- package/dist/cliReceipt.d.ts +18 -0
- package/dist/cliReceipt.js +75 -0
- package/dist/cliRequestTask.d.ts +2 -2
- package/dist/cliRequestTask.js +4 -4
- package/dist/cliScan.d.ts +12 -14
- package/dist/cliScan.js +52 -11
- package/dist/cliScriptRead.js +1 -1
- package/dist/cliScriptText.d.ts +8 -0
- package/dist/cliScriptText.js +32 -4
- package/dist/cliSessions.d.ts +8 -22
- package/dist/cliSessions.js +26 -167
- package/dist/cliSessionsJson.d.ts +8 -199
- package/dist/cliSessionsJson.js +5 -186
- package/dist/cliSessionsRender.d.ts +2 -28
- package/dist/cliSessionsRender.js +9 -196
- package/dist/cliSetupOrg.d.ts +7 -0
- package/dist/cliSetupOrg.js +29 -2
- package/dist/cliSpeed.d.ts +4 -3
- package/dist/cliSpeed.js +7 -6
- package/dist/cliStatus.d.ts +5 -2
- package/dist/cliStatus.js +81 -17
- package/dist/cliStatusGuard.d.ts +14 -2
- package/dist/cliStatusGuard.js +29 -6
- package/dist/cliSupport.d.ts +4 -0
- package/dist/cliSupport.js +5 -1
- package/dist/cliWhere.d.ts +50 -0
- package/dist/cliWhere.js +120 -0
- package/dist/cliWork.d.ts +123 -0
- package/dist/cliWork.js +584 -0
- package/dist/cliWorkWords.d.ts +122 -0
- package/dist/cliWorkWords.js +361 -0
- package/dist/completion.js +12 -5
- package/dist/controlPlane.generated.d.ts +434 -0
- package/dist/controlPlane.generated.js +134 -0
- package/dist/controlPlaneExec.d.ts +68 -0
- package/dist/controlPlaneExec.js +135 -0
- package/dist/controlPlaneGithub.generated.d.ts +45 -0
- package/dist/controlPlaneGithub.generated.js +94 -0
- package/dist/controlPlaneGithubApi.generated.d.ts +15 -0
- package/dist/controlPlaneGithubApi.generated.js +117 -0
- package/dist/controlPlaneGithubCatalog.generated.d.ts +127 -0
- package/dist/controlPlaneGithubCatalog.generated.js +253 -0
- package/dist/controlPlaneGithubCli.generated.d.ts +94 -0
- package/dist/controlPlaneGithubCli.generated.js +287 -0
- package/dist/controlPlaneGithubWebhook.generated.d.ts +30 -0
- package/dist/controlPlaneGithubWebhook.generated.js +105 -0
- package/dist/controlPlaneGuard.d.ts +147 -0
- package/dist/controlPlaneGuard.js +277 -0
- package/dist/controlPlaneLate.d.ts +30 -0
- package/dist/controlPlaneLate.js +72 -0
- package/dist/controlPlaneLateHold.d.ts +20 -0
- package/dist/controlPlaneLateHold.js +101 -0
- package/dist/controlPlaneRailway.generated.d.ts +30 -0
- package/dist/controlPlaneRailway.generated.js +217 -0
- package/dist/controlPlaneRailwayCli.generated.d.ts +11 -0
- package/dist/controlPlaneRailwayCli.generated.js +436 -0
- package/dist/controlPlaneRailwayGuard.d.ts +172 -0
- package/dist/controlPlaneRailwayGuard.js +527 -0
- package/dist/controlPlaneRailwayModel.generated.d.ts +189 -0
- package/dist/controlPlaneRailwayModel.generated.js +355 -0
- package/dist/controlPlaneRailwayReach.d.ts +43 -0
- package/dist/controlPlaneRailwayReach.js +163 -0
- package/dist/credentialStorage.d.ts +3 -0
- package/dist/credentialStorage.js +13 -2
- package/dist/credentials.js +60 -6
- package/dist/designTokens.generated.d.ts +16 -0
- package/dist/designTokens.generated.js +11 -0
- package/dist/doctor.d.ts +4 -0
- package/dist/doctor.js +25 -9
- package/dist/envLinkFs.d.ts +1 -0
- package/dist/envLinkFs.js +7 -1
- package/dist/envLinksAzure.d.ts +34 -0
- package/dist/envLinksAzure.js +179 -0
- package/dist/envLinksCloud.d.ts +19 -6
- package/dist/envLinksCloud.js +84 -74
- package/dist/envLinksGitlab.d.ts +66 -0
- package/dist/envLinksGitlab.js +352 -0
- package/dist/envLinksHosting.d.ts +26 -4
- package/dist/envLinksHosting.js +92 -27
- package/dist/envLinksIac.d.ts +62 -0
- package/dist/envLinksIac.js +267 -0
- package/dist/envResolve.d.ts +12 -1
- package/dist/envResolve.js +57 -9
- package/dist/envTarget.js +10 -1
- package/dist/execAzure.d.ts +79 -0
- package/dist/execAzure.js +280 -0
- package/dist/execBackupAzure.d.ts +14 -0
- package/dist/execBackupAzure.js +49 -0
- package/dist/execBackupGoogle.d.ts +24 -0
- package/dist/execBackupGoogle.js +141 -0
- package/dist/execBackupTarget.d.ts +18 -4
- package/dist/execBackupTarget.js +61 -0
- package/dist/execGit.d.ts +16 -0
- package/dist/execGit.js +31 -0
- package/dist/execGoogle.d.ts +17 -0
- package/dist/execGoogle.js +52 -0
- package/dist/execPlan.d.ts +20 -0
- package/dist/execPlan.js +38 -0
- package/dist/execShims.d.ts +12 -1
- package/dist/execShims.js +87 -6
- package/dist/execSpawn.d.ts +16 -0
- package/dist/execSpawn.js +47 -0
- package/dist/execTarget.d.ts +3 -1
- package/dist/execTarget.js +9 -3
- package/dist/execVendors.d.ts +13 -1
- package/dist/execVendors.js +131 -6
- package/dist/externalLinks.d.ts +1 -1
- package/dist/externalLinks.js +213 -1
- package/dist/firstRun.d.ts +18 -0
- package/dist/firstRun.js +49 -0
- package/dist/gitCredentialSetup.d.ts +91 -0
- package/dist/gitCredentialSetup.js +338 -0
- package/dist/gitInvocation.d.ts +41 -0
- package/dist/gitInvocation.js +207 -0
- package/dist/gitPush.d.ts +27 -0
- package/dist/gitPush.js +172 -0
- package/dist/gitPushDecisions.d.ts +6 -0
- package/dist/gitPushDecisions.js +69 -0
- package/dist/gitReadOnly.d.ts +10 -0
- package/dist/gitReadOnly.js +57 -0
- package/dist/gitRemote.d.ts +15 -0
- package/dist/gitRemote.js +51 -0
- package/dist/hookFastPath.d.ts +4 -1
- package/dist/hookFastPath.js +9 -6
- package/dist/hookMain.js +1 -1
- package/dist/hookOutbox.d.ts +2 -0
- package/dist/hookOutbox.js +6 -2
- package/dist/hookPromptFast.d.ts +3 -2
- package/dist/hookPromptFast.js +16 -4
- package/dist/hookRepair.d.ts +34 -0
- package/dist/hookRepair.js +69 -0
- package/dist/iacPlan.d.ts +75 -0
- package/dist/iacPlan.js +384 -0
- package/dist/iacPlanRead.d.ts +88 -0
- package/dist/iacPlanRead.js +341 -0
- package/dist/iacPlanStore.d.ts +43 -0
- package/dist/iacPlanStore.js +139 -0
- package/dist/initAutopilotStep.d.ts +2 -1
- package/dist/initAutopilotStep.js +23 -11
- package/dist/initInstall.js +5 -5
- package/dist/initKeysStep.d.ts +6 -0
- package/dist/initKeysStep.js +43 -3
- package/dist/initLocalSteps.d.ts +6 -0
- package/dist/initLocalSteps.js +23 -1
- package/dist/initPlan.js +7 -0
- package/dist/initUi.d.ts +1 -1
- package/dist/initUi.js +1 -1
- package/dist/keysAzure.d.ts +14 -0
- package/dist/keysAzure.js +23 -0
- package/dist/keysHere.d.ts +35 -0
- package/dist/keysHere.js +89 -0
- package/dist/keysLocal.d.ts +12 -1
- package/dist/keysLocal.js +10 -1
- package/dist/keysLocalGoogle.d.ts +83 -0
- package/dist/keysLocalGoogle.js +354 -0
- package/dist/keysReport.d.ts +16 -3
- package/dist/keysReport.js +19 -10
- package/dist/kubeBackup.d.ts +78 -0
- package/dist/kubeBackup.js +261 -0
- package/dist/kubeCommand.d.ts +54 -0
- package/dist/kubeCommand.js +529 -0
- package/dist/kubeRollout.d.ts +18 -0
- package/dist/kubeRollout.js +2 -0
- package/dist/kubeWatch.d.ts +138 -0
- package/dist/kubeWatch.js +513 -0
- package/dist/kubeconfig.d.ts +59 -0
- package/dist/kubeconfig.js +304 -0
- package/dist/launcherFastPath.d.ts +3 -2
- package/dist/launcherFastPath.js +10 -3
- package/dist/leaseCommands.d.ts +1 -1
- package/dist/leaseCommands.js +141 -8
- package/dist/localBackups.d.ts +10 -0
- package/dist/localBackups.js +46 -6
- package/dist/localBackupsGate.d.ts +22 -4
- package/dist/localBackupsGate.js +32 -4
- package/dist/localCommands.d.ts +6 -4
- package/dist/localCommands.js +46 -7
- package/dist/localGit.d.ts +4 -3
- package/dist/localGit.js +7 -4
- package/dist/localReach.d.ts +17 -4
- package/dist/localReach.js +123 -4
- package/dist/localRestore.d.ts +1 -1
- package/dist/localRestore.js +13 -0
- package/dist/localTools.js +29 -2
- package/dist/nativeSync.js +1 -1
- package/dist/nodeVersion.d.ts +13 -6
- package/dist/nodeVersion.js +15 -8
- package/dist/pluginPin.d.ts +1 -1
- package/dist/pluginPin.js +1 -1
- package/dist/railwayDecisions.d.ts +12 -0
- package/dist/railwayDecisions.js +112 -0
- package/dist/recommendedPolicy.d.ts +13 -0
- package/dist/recommendedPolicy.generated.d.ts +1 -0
- package/dist/recommendedPolicy.generated.js +1589 -0
- package/dist/recommendedPolicy.js +6 -0
- package/dist/regenerable.d.ts +37 -13
- package/dist/regenerable.js +133 -40
- package/dist/repoCheckouts.d.ts +40 -0
- package/dist/repoCheckouts.js +113 -0
- package/dist/scanSignedIn.d.ts +39 -0
- package/dist/scanSignedIn.js +85 -0
- package/dist/sessionBrief.d.ts +2 -1
- package/dist/sessionBrief.js +6 -3
- package/dist/sessionCreated.d.ts +24 -0
- package/dist/sessionCreated.js +80 -0
- package/dist/signInFailure.js +6 -1
- package/dist/statusKeys.d.ts +31 -0
- package/dist/statusKeys.js +48 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/waitingLine.d.ts +2 -2
- package/dist/waitingLine.js +2 -2
- package/dist/watchNotice.d.ts +5 -1
- package/dist/watchNotice.js +19 -6
- package/npm-shrinkwrap.json +3 -3
- package/package.json +2 -2
- package/dist/cliChanges.d.ts +0 -97
- package/dist/cliChanges.js +0 -382
- package/dist/cliProjectSummary.d.ts +0 -9
- package/dist/cliProjectSummary.js +0 -145
package/dist/execGit.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { failure } from "./cliSupport.js";
|
|
2
|
+
import { gitHelperInstalled } from "./gitCredentialSetup.js";
|
|
3
|
+
import { EXEC_GIT_COMMAND, gitSubcommand } from "./gitInvocation.js";
|
|
4
|
+
import { spawnVendor } from "./execSpawn.js";
|
|
5
|
+
/** The git commands that reach github.com and ask the helper for a token. */
|
|
6
|
+
const REMOTE = new Set(["push", "fetch", "pull", "clone", "ls-remote"]);
|
|
7
|
+
export async function execGit(args, runtime, deps = {}) {
|
|
8
|
+
const rest = args.positionals.slice(1);
|
|
9
|
+
const argv = ["git", ...rest];
|
|
10
|
+
const sub = gitSubcommand(argv);
|
|
11
|
+
if (!sub || !REMOTE.has(sub)) {
|
|
12
|
+
return failure("passport exec runs git only for push, fetch, pull, clone and ls-remote. Run other git commands as they are.", 6, "exec_refused");
|
|
13
|
+
}
|
|
14
|
+
if (!(deps.installed ?? gitHelperInstalled)()) {
|
|
15
|
+
return failure("Passport isn't set up for git on this computer. Run passport git-credential setup, then try again.", 6, "exec_refused");
|
|
16
|
+
}
|
|
17
|
+
const options = {
|
|
18
|
+
stdio: "inherit",
|
|
19
|
+
env: { ...runtime.env, [EXEC_GIT_COMMAND]: JSON.stringify(argv) },
|
|
20
|
+
shell: false,
|
|
21
|
+
cwd: deps.cwd ?? process.cwd()
|
|
22
|
+
};
|
|
23
|
+
let code;
|
|
24
|
+
try {
|
|
25
|
+
code = await (deps.spawn ?? spawnVendor)("git", [...rest], options);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return failure("git couldn't start.", 1, "not_installed");
|
|
29
|
+
}
|
|
30
|
+
return { json: { exitCode: code }, silent: true, exitCode: code };
|
|
31
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firebase through `passport exec`: firebase-tools reads no access-token
|
|
3
|
+
* variable, only a key file, its own sign-in, or Google's metadata server
|
|
4
|
+
* (google-auth-library, via `GCE_METADATA_HOST`). So exec serves the one
|
|
5
|
+
* short-lived token Passport issued from a metadata endpoint on 127.0.0.1,
|
|
6
|
+
* for the command's lifetime only, and points the child at it. Nothing is
|
|
7
|
+
* written to disk and the key file never reaches this computer.
|
|
8
|
+
*
|
|
9
|
+
* It answers only Google's metadata requests (the `Metadata-Flavor: Google`
|
|
10
|
+
* header a browser can't send without a preflight it never gets, and the
|
|
11
|
+
* exact Host it listens on), and only the token, never anything else.
|
|
12
|
+
*/
|
|
13
|
+
export type GoogleMetadata = {
|
|
14
|
+
env: Record<string, string>;
|
|
15
|
+
stop: () => Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
export declare function serveGoogleToken(token: string, expiresAt: number | undefined, now?: () => number): Promise<GoogleMetadata>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firebase through `passport exec`: firebase-tools reads no access-token
|
|
3
|
+
* variable, only a key file, its own sign-in, or Google's metadata server
|
|
4
|
+
* (google-auth-library, via `GCE_METADATA_HOST`). So exec serves the one
|
|
5
|
+
* short-lived token Passport issued from a metadata endpoint on 127.0.0.1,
|
|
6
|
+
* for the command's lifetime only, and points the child at it. Nothing is
|
|
7
|
+
* written to disk and the key file never reaches this computer.
|
|
8
|
+
*
|
|
9
|
+
* It answers only Google's metadata requests (the `Metadata-Flavor: Google`
|
|
10
|
+
* header a browser can't send without a preflight it never gets, and the
|
|
11
|
+
* exact Host it listens on), and only the token, never anything else.
|
|
12
|
+
*/
|
|
13
|
+
import { createServer } from "node:http";
|
|
14
|
+
const TOKEN_PATH = "/computeMetadata/v1/instance/service-accounts/default/token";
|
|
15
|
+
export async function serveGoogleToken(token, expiresAt, now = Date.now) {
|
|
16
|
+
let host = "";
|
|
17
|
+
const server = createServer((request, response) => {
|
|
18
|
+
const path = (request.url ?? "").split("?")[0];
|
|
19
|
+
const flavored = request.headers["metadata-flavor"] === "Google";
|
|
20
|
+
response.setHeader("Metadata-Flavor", "Google");
|
|
21
|
+
if (request.method !== "GET" || !flavored || request.headers.host !== host) {
|
|
22
|
+
response.writeHead(403).end();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (path !== TOKEN_PATH) {
|
|
26
|
+
// Project, email, universe: the client falls back to its own defaults on 404.
|
|
27
|
+
response.writeHead(404).end();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const seconds = expiresAt === undefined ? 3600 : Math.max(0, Math.floor((expiresAt - now()) / 1000));
|
|
31
|
+
response.writeHead(200, { "content-type": "application/json" });
|
|
32
|
+
response.end(JSON.stringify({ access_token: token, expires_in: seconds, token_type: "Bearer" }));
|
|
33
|
+
});
|
|
34
|
+
await new Promise((resolve, reject) => {
|
|
35
|
+
server.once("error", reject);
|
|
36
|
+
server.listen(0, "127.0.0.1", () => resolve());
|
|
37
|
+
});
|
|
38
|
+
const address = server.address();
|
|
39
|
+
if (!address || typeof address === "string") {
|
|
40
|
+
server.close();
|
|
41
|
+
throw new Error("Passport couldn't start the local token endpoint.");
|
|
42
|
+
}
|
|
43
|
+
host = `127.0.0.1:${address.port}`;
|
|
44
|
+
server.unref();
|
|
45
|
+
return {
|
|
46
|
+
env: { GCE_METADATA_HOST: host, METADATA_SERVER_DETECTION: "assume-present" },
|
|
47
|
+
stop: () => new Promise((resolve) => {
|
|
48
|
+
server.closeAllConnections();
|
|
49
|
+
server.close(() => resolve());
|
|
50
|
+
})
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An apply a carrier runs through `passport exec` (`terraform apply`, `pulumi
|
|
3
|
+
* up`): its plan on the request, for a server that reads plans, so an ask
|
|
4
|
+
* through exec says what the apply changes too. Exec isn't inside the guard's
|
|
5
|
+
* budget, so it may run `terraform show`. Counts and addresses only.
|
|
6
|
+
*/
|
|
7
|
+
import type { WhereContext } from "./envTarget.js";
|
|
8
|
+
/** A carrier (`terraform`) is decided as itself; it only borrows the cloud's key. */
|
|
9
|
+
export declare function carrierOf(binary: string): string | undefined;
|
|
10
|
+
/** The command's own finding: the carrier's, else the key's CLI's. */
|
|
11
|
+
export declare function ownFinding(found: string | null, vendor: string, carrier: string | undefined): boolean;
|
|
12
|
+
/** Adds `plan` to the request body when the command is a carrier's apply and its plan is readable. */
|
|
13
|
+
export declare function withExecPlan(prepared: {
|
|
14
|
+
binary: string;
|
|
15
|
+
rest: readonly string[];
|
|
16
|
+
body: Record<string, unknown>;
|
|
17
|
+
}, auth: {
|
|
18
|
+
kind: string;
|
|
19
|
+
profile?: string;
|
|
20
|
+
}, where: () => WhereContext): Promise<void>;
|
package/dist/execPlan.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An apply a carrier runs through `passport exec` (`terraform apply`, `pulumi
|
|
3
|
+
* up`): its plan on the request, for a server that reads plans, so an ask
|
|
4
|
+
* through exec says what the apply changes too. Exec isn't inside the guard's
|
|
5
|
+
* budget, so it may run `terraform show`. Counts and addresses only.
|
|
6
|
+
*/
|
|
7
|
+
import { classifyCommand } from "./cliHookClassify.js";
|
|
8
|
+
import { readCliPolicy } from "./cliPolicy.js";
|
|
9
|
+
import { EXEC_CARRIERS, execVendorOf } from "./execVendors.js";
|
|
10
|
+
/** The longest exec waits on a plan before it asks without one. */
|
|
11
|
+
const EXEC_PLAN_MS = 5_000;
|
|
12
|
+
/** A carrier (`terraform`) is decided as itself; it only borrows the cloud's key. */
|
|
13
|
+
export function carrierOf(binary) {
|
|
14
|
+
return !execVendorOf(binary) && Object.hasOwn(EXEC_CARRIERS, binary) ? binary : undefined;
|
|
15
|
+
}
|
|
16
|
+
/** The command's own finding: the carrier's, else the key's CLI's. */
|
|
17
|
+
export function ownFinding(found, vendor, carrier) {
|
|
18
|
+
return Boolean(found && (carrier ? found === carrier : execVendorOf(found) === vendor));
|
|
19
|
+
}
|
|
20
|
+
/** Adds `plan` to the request body when the command is a carrier's apply and its plan is readable. */
|
|
21
|
+
export async function withExecPlan(prepared, auth, where) {
|
|
22
|
+
if (!carrierOf(prepared.binary) || auth.kind !== "profile" || !auth.profile)
|
|
23
|
+
return;
|
|
24
|
+
const policy = readCliPolicy(auth.profile);
|
|
25
|
+
if (policy?.version !== 2 || !policy.autopilot.plans)
|
|
26
|
+
return;
|
|
27
|
+
const finding = classifyCommand([prepared.binary, ...prepared.rest].map(quote).join(" ")).find((candidate) => candidate.vendor === prepared.binary);
|
|
28
|
+
const { attachPlans, needsPlan } = await import("./iacPlanRead.js");
|
|
29
|
+
if (!finding || !needsPlan(finding))
|
|
30
|
+
return;
|
|
31
|
+
await attachPlans([finding], where(), { deadline: Date.now() + EXEC_PLAN_MS, now: Date.now });
|
|
32
|
+
const facts = finding.plan;
|
|
33
|
+
if (facts && "summary" in facts)
|
|
34
|
+
prepared.body.plan = facts.summary;
|
|
35
|
+
}
|
|
36
|
+
function quote(part) {
|
|
37
|
+
return /^[A-Za-z0-9_@%+=:,./-]+$/.test(part) ? part : `'${part.replaceAll("'", `'\\''`)}'`;
|
|
38
|
+
}
|
package/dist/execShims.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export declare const SHIM_MARKER = "# passport-shim v1";
|
|
|
3
3
|
/** How many shims deep a command may go before the shim refuses (a vendor
|
|
4
4
|
* CLI that runs itself once is fine; a loop is not). */
|
|
5
5
|
export declare const SHIM_MAX_DEPTH = 3;
|
|
6
|
-
|
|
6
|
+
/** changed: its content isn't what Passport wrote, so Passport no longer treats it as its own. */
|
|
7
|
+
export type ShimState = "active" | "not_on_path" | "shadowed" | "changed";
|
|
7
8
|
/** One shim, for `passport status` and `passport keys shim`. */
|
|
8
9
|
export type ShimInfo = {
|
|
9
10
|
vendor: ExecVendor;
|
|
@@ -28,6 +29,13 @@ export declare function shimDir(): string;
|
|
|
28
29
|
export declare function shimBinaries(vendor: ExecVendor): string[];
|
|
29
30
|
/** Does this file start like a Passport shim? Reads 256 bytes at most. */
|
|
30
31
|
export declare function isPassportShim(path: string): boolean;
|
|
32
|
+
/** The changed-shim warning `passport status` shows. */
|
|
33
|
+
export declare const shimChangedMessage: (binary: string) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the shim for `binary` in Passport's folder is still what Passport wrote: "absent" when there is none
|
|
36
|
+
* (or a file Passport never wrote), "changed" when its content differs from what Passport recorded at install.
|
|
37
|
+
*/
|
|
38
|
+
export declare function shimIntegrity(binary: string): "intact" | "changed" | "absent";
|
|
31
39
|
/** True for Passport's shim folder and any file that is a shim. */
|
|
32
40
|
export declare function shimSkipper(): (candidate: string) => boolean;
|
|
33
41
|
/** The vendor CLI itself, never a shim: what exec runs. */
|
|
@@ -37,6 +45,9 @@ export declare function shimText(binary: string, passportCommand: readonly strin
|
|
|
37
45
|
/** What a shim runs: the stable launcher `passport init` installs, else this
|
|
38
46
|
* CLI when it isn't a one-off npx copy. */
|
|
39
47
|
export declare function defaultPassportCommand(): string[] | undefined;
|
|
48
|
+
/** Whether typing `binary` runs Passport's own shim: the first on PATH, and still what Passport recorded (advisory:
|
|
49
|
+
* the record sits beside the shim, so it catches an edited shim, not someone who can write Passport's folder). */
|
|
50
|
+
export declare function shimRuns(binary: string, env: NodeJS.ProcessEnv, platform?: NodeJS.Platform): boolean;
|
|
40
51
|
/** Every shim in Passport's folder. Never throws: a data function for status. */
|
|
41
52
|
export declare function listShims(env: NodeJS.ProcessEnv, platform?: NodeJS.Platform): ShimInfo[];
|
|
42
53
|
export type InstallOutcome = {
|
package/dist/execShims.js
CHANGED
|
@@ -13,13 +13,19 @@
|
|
|
13
13
|
* - Removal: `passport keys shim --remove <cli>`, automatically when Passport
|
|
14
14
|
* no longer holds that vendor's key, and when the last profile signs out.
|
|
15
15
|
*
|
|
16
|
+
* - Integrity (advisory): installing records each shim's SHA-256 (`$PASSPORT_HOME/shims.json`). A shim
|
|
17
|
+
* whose content no longer matches is "changed": status says so, and Passport stops treating it as its
|
|
18
|
+
* own (the guard leaves no decision for it, the session brief doesn't count it). A shim from before the
|
|
19
|
+
* record counts as Passport's only when it is exactly the text Passport writes. The record lives in the
|
|
20
|
+
* same writable folder, so it catches an edited shim, never someone who can write Passport's folder.
|
|
21
|
+
*
|
|
16
22
|
* POSIX only. Files without the marker are never overwritten or removed.
|
|
17
23
|
*/
|
|
18
|
-
import { randomBytes } from "node:crypto";
|
|
19
|
-
import { chmodSync, closeSync, lstatSync, mkdirSync, openSync, readSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
24
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
25
|
+
import { chmodSync, closeSync, lstatSync, mkdirSync, openSync, readSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
20
26
|
import { homedir } from "node:os";
|
|
21
27
|
import { dirname, join, resolve } from "node:path";
|
|
22
|
-
import { credentialDir, ensurePrivateDirectory } from "./credentialStorage.js";
|
|
28
|
+
import { credentialDir, ensurePrivateDirectory, writePrivateAtomic } from "./credentialStorage.js";
|
|
23
29
|
import { EXEC_ALIASES, EXEC_VENDORS, EXEC_VENDOR_NAMES } from "./execVendors.js";
|
|
24
30
|
import { findOnPath, isEphemeralPath, launcherPath, pathDirectories, pathLine } from "./initInstall.js";
|
|
25
31
|
export const SHIM_MARKER = "# passport-shim v1";
|
|
@@ -64,6 +70,63 @@ export function isPassportShim(path) {
|
|
|
64
70
|
closeSync(descriptor);
|
|
65
71
|
}
|
|
66
72
|
}
|
|
73
|
+
const RECORD = "shims.json";
|
|
74
|
+
const MAX_SHIM_BYTES = 8 * 1024;
|
|
75
|
+
const sha256 = (text) => createHash("sha256").update(text).digest("hex");
|
|
76
|
+
function readRecord() {
|
|
77
|
+
try {
|
|
78
|
+
const parsed = JSON.parse(readFileSync(join(credentialDir(), RECORD), "utf8"));
|
|
79
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
80
|
+
return {};
|
|
81
|
+
return Object.fromEntries(Object.entries(parsed).filter((entry) => typeof entry[1] === "string"));
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return {};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function writeRecord(record) {
|
|
88
|
+
try {
|
|
89
|
+
writePrivateAtomic(join(credentialDir(), RECORD), ".shims", JSON.stringify(record), "shim record");
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
// Without it, a shim counts as Passport's only when it is exactly Passport's text.
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/** Exactly the text `shimText` writes, for some passport command (a shim from before the record). */
|
|
96
|
+
function passportText(binary, text) {
|
|
97
|
+
const lines = text.split("\n");
|
|
98
|
+
const expected = shimText(binary, ["passport"]).split("\n");
|
|
99
|
+
const at = expected.findIndex((line) => line.startsWith("exec "));
|
|
100
|
+
const word = "'(?:[^']|'\\\\'')*'";
|
|
101
|
+
const exec = new RegExp(`^exec (?:${word} )+exec -- ${binary} "\\$@"$`);
|
|
102
|
+
return (lines.length === expected.length &&
|
|
103
|
+
lines.every((line, index) => (index === at ? exec.test(line) : line === expected[index])));
|
|
104
|
+
}
|
|
105
|
+
/** The changed-shim warning `passport status` shows. */
|
|
106
|
+
export const shimChangedMessage = (binary) => `The ${binary} shim was changed; Passport no longer treats it as its own.`;
|
|
107
|
+
/**
|
|
108
|
+
* Whether the shim for `binary` in Passport's folder is still what Passport wrote: "absent" when there is none
|
|
109
|
+
* (or a file Passport never wrote), "changed" when its content differs from what Passport recorded at install.
|
|
110
|
+
*/
|
|
111
|
+
export function shimIntegrity(binary) {
|
|
112
|
+
const path = join(shimDir(), binary);
|
|
113
|
+
const recorded = readRecord()[binary];
|
|
114
|
+
let text;
|
|
115
|
+
try {
|
|
116
|
+
const stat = lstatSync(path);
|
|
117
|
+
if (!stat.isFile() || stat.size > MAX_SHIM_BYTES)
|
|
118
|
+
return recorded ? "changed" : "absent";
|
|
119
|
+
text = readFileSync(path);
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return "absent";
|
|
123
|
+
}
|
|
124
|
+
if (recorded)
|
|
125
|
+
return sha256(text) === recorded ? "intact" : "changed";
|
|
126
|
+
if (!text.toString("utf8").includes(SHIM_MARKER))
|
|
127
|
+
return "absent";
|
|
128
|
+
return passportText(binary, text.toString("utf8")) ? "intact" : "changed";
|
|
129
|
+
}
|
|
67
130
|
/** True for Passport's shim folder and any file that is a shim. */
|
|
68
131
|
export function shimSkipper() {
|
|
69
132
|
const folder = canonical(shimDir());
|
|
@@ -133,6 +196,13 @@ function stateOf(binary, path, env, platform) {
|
|
|
133
196
|
const first = findOnPath(binary, env, platform);
|
|
134
197
|
return first && canonical(first) === canonical(path) ? "active" : "shadowed";
|
|
135
198
|
}
|
|
199
|
+
/** Whether typing `binary` runs Passport's own shim: the first on PATH, and still what Passport recorded (advisory:
|
|
200
|
+
* the record sits beside the shim, so it catches an edited shim, not someone who can write Passport's folder). */
|
|
201
|
+
export function shimRuns(binary, env, platform = process.platform) {
|
|
202
|
+
if (platform === "win32" || shimIntegrity(binary) !== "intact")
|
|
203
|
+
return false;
|
|
204
|
+
return stateOf(binary, join(shimDir(), binary), env, platform) === "active";
|
|
205
|
+
}
|
|
136
206
|
/** Every shim in Passport's folder. Never throws: a data function for status. */
|
|
137
207
|
export function listShims(env, platform = process.platform) {
|
|
138
208
|
if (platform === "win32")
|
|
@@ -148,14 +218,15 @@ export function listShims(env, platform = process.platform) {
|
|
|
148
218
|
for (const binary of entries.sort()) {
|
|
149
219
|
const vendor = vendorOfBinary(binary);
|
|
150
220
|
const path = join(shimDir(), binary);
|
|
151
|
-
|
|
221
|
+
const integrity = vendor ? shimIntegrity(binary) : "absent";
|
|
222
|
+
if (!vendor || integrity === "absent")
|
|
152
223
|
continue;
|
|
153
224
|
const vendorPath = findVendorBinary(binary, env, platform);
|
|
154
225
|
shims.push({
|
|
155
226
|
vendor,
|
|
156
227
|
binary,
|
|
157
228
|
path,
|
|
158
|
-
state: stateOf(binary, path, env, platform),
|
|
229
|
+
state: integrity === "changed" ? "changed" : stateOf(binary, path, env, platform),
|
|
159
230
|
...(vendorPath ? { vendorPath } : {})
|
|
160
231
|
});
|
|
161
232
|
}
|
|
@@ -176,6 +247,7 @@ export function installShims(vendor, context) {
|
|
|
176
247
|
return { skipped: "run passport init first, so the shim has a passport command to call" };
|
|
177
248
|
const folder = prepareFolder();
|
|
178
249
|
const installed = [];
|
|
250
|
+
const record = readRecord();
|
|
179
251
|
for (const binary of binaries) {
|
|
180
252
|
const path = join(folder, binary);
|
|
181
253
|
try {
|
|
@@ -188,8 +260,9 @@ export function installShims(vendor, context) {
|
|
|
188
260
|
/* not there yet */
|
|
189
261
|
}
|
|
190
262
|
const temporary = join(folder, `.${binary}-${randomBytes(6).toString("hex")}.tmp`);
|
|
263
|
+
const text = shimText(binary, command);
|
|
191
264
|
try {
|
|
192
|
-
writeFileSync(temporary,
|
|
265
|
+
writeFileSync(temporary, text, { mode: 0o755 });
|
|
193
266
|
chmodSync(temporary, 0o755);
|
|
194
267
|
renameSync(temporary, path);
|
|
195
268
|
}
|
|
@@ -197,6 +270,8 @@ export function installShims(vendor, context) {
|
|
|
197
270
|
rmSync(temporary, { force: true });
|
|
198
271
|
throw error;
|
|
199
272
|
}
|
|
273
|
+
record[binary] = sha256(text);
|
|
274
|
+
writeRecord(record);
|
|
200
275
|
installed.push({
|
|
201
276
|
vendor,
|
|
202
277
|
binary,
|
|
@@ -234,6 +309,12 @@ export function removeShims(vendors) {
|
|
|
234
309
|
/* left for passport keys shim --remove */
|
|
235
310
|
}
|
|
236
311
|
}
|
|
312
|
+
const record = readRecord();
|
|
313
|
+
if (removed.some((binary) => binary in record)) {
|
|
314
|
+
for (const binary of removed)
|
|
315
|
+
delete record[binary];
|
|
316
|
+
writeRecord(record);
|
|
317
|
+
}
|
|
237
318
|
return removed;
|
|
238
319
|
}
|
|
239
320
|
/** Keep only the shims for vendors whose key Passport still holds. */
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Running the vendor CLI for `passport exec`: its exit code, and with a mask,
|
|
3
|
+
* its stdout and stderr read through the masker (execMask.ts).
|
|
4
|
+
*/
|
|
5
|
+
import { type SpawnOptions } from "node:child_process";
|
|
6
|
+
import type { Runtime } from "./cliSupport.js";
|
|
7
|
+
/** Where masked output goes; the real streams unless a test captures them. */
|
|
8
|
+
export type MaskTarget = {
|
|
9
|
+
needles: readonly Buffer[];
|
|
10
|
+
stdout: Runtime["stdout"];
|
|
11
|
+
stderr: Runtime["stderr"];
|
|
12
|
+
};
|
|
13
|
+
/** Run the vendor CLI. With `mask`, its stdout and stderr are pipes read
|
|
14
|
+
* through the masker; stdin stays the terminal. The exit code is the
|
|
15
|
+
* child's, or 128 + the signal that ended it. */
|
|
16
|
+
export declare function spawnVendor(command: string, args: string[], options: SpawnOptions, mask?: MaskTarget): Promise<number>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Running the vendor CLI for `passport exec`: its exit code, and with a mask,
|
|
3
|
+
* its stdout and stderr read through the masker (execMask.ts).
|
|
4
|
+
*/
|
|
5
|
+
import { spawn as nodeSpawn } from "node:child_process";
|
|
6
|
+
import { maskChildOutput } from "./execMask.js";
|
|
7
|
+
/** How long output may keep arriving after the vendor CLI exits (a program
|
|
8
|
+
* it started may still hold the pipe) before exec stops reading it. */
|
|
9
|
+
const DRAIN_AFTER_EXIT_MS = 5_000;
|
|
10
|
+
/** Run the vendor CLI. With `mask`, its stdout and stderr are pipes read
|
|
11
|
+
* through the masker; stdin stays the terminal. The exit code is the
|
|
12
|
+
* child's, or 128 + the signal that ended it. */
|
|
13
|
+
export function spawnVendor(command, args, options, mask) {
|
|
14
|
+
return new Promise((resolveExit, reject) => {
|
|
15
|
+
const child = nodeSpawn(command, args, {
|
|
16
|
+
...options,
|
|
17
|
+
stdio: mask ? ["inherit", "pipe", "pipe"] : options.stdio
|
|
18
|
+
});
|
|
19
|
+
const forward = (signal) => () => child.kill(signal);
|
|
20
|
+
const onTerm = forward("SIGTERM");
|
|
21
|
+
process.on("SIGTERM", onTerm);
|
|
22
|
+
const output = mask ? maskChildOutput(child, mask, mask.needles) : Promise.resolve();
|
|
23
|
+
child.once("error", (error) => {
|
|
24
|
+
process.removeListener("SIGTERM", onTerm);
|
|
25
|
+
reject(error);
|
|
26
|
+
});
|
|
27
|
+
child.once("exit", (code, signal) => {
|
|
28
|
+
process.removeListener("SIGTERM", onTerm);
|
|
29
|
+
const signals = { SIGINT: 2, SIGTERM: 15, SIGKILL: 9, SIGHUP: 1 };
|
|
30
|
+
const exitCode = code ?? (signal ? 128 + (signals[signal] ?? 1) : 1);
|
|
31
|
+
let timer;
|
|
32
|
+
const late = new Promise((resolveLate) => {
|
|
33
|
+
timer = setTimeout(() => {
|
|
34
|
+
child.stdout?.destroy();
|
|
35
|
+
child.stderr?.destroy();
|
|
36
|
+
resolveLate();
|
|
37
|
+
}, DRAIN_AFTER_EXIT_MS);
|
|
38
|
+
timer.unref?.();
|
|
39
|
+
});
|
|
40
|
+
void Promise.race([output, late]).then(() => {
|
|
41
|
+
if (timer)
|
|
42
|
+
clearTimeout(timer);
|
|
43
|
+
resolveExit(exitCode);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
package/dist/execTarget.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type ExecVendor } from "./execVendors.js";
|
|
2
|
-
/** Which vendor, or one line saying why exec won't run it.
|
|
2
|
+
/** Which vendor, or one line saying why exec won't run it. A carrier
|
|
3
|
+
* (`terraform`) runs with its cloud's key: `vendor` is the key's CLI. */
|
|
3
4
|
export declare function execTarget(argv: readonly string[]): {
|
|
4
5
|
vendor: ExecVendor;
|
|
5
6
|
binary: string;
|
|
7
|
+
carrier?: true;
|
|
6
8
|
} | {
|
|
7
9
|
refused: string;
|
|
8
10
|
};
|
package/dist/execTarget.js
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* loading the network client: the guard runs before every agent command.
|
|
5
5
|
*/
|
|
6
6
|
import { basename } from "node:path";
|
|
7
|
-
import { EXEC_VENDORS, EXEC_WRAPPERS, execVendorOf, refusedReason } from "./execVendors.js";
|
|
8
|
-
const
|
|
9
|
-
|
|
7
|
+
import { EXEC_CARRIERS, EXEC_VENDORS, EXEC_WRAPPERS, carrierRefusal, execVendorOf, refusedReason } from "./execVendors.js";
|
|
8
|
+
const PROGRAMS = [...EXEC_VENDORS, ...Object.keys(EXEC_CARRIERS)];
|
|
9
|
+
const LIST = `${PROGRAMS.slice(0, -1).join(", ")}, and ${PROGRAMS.at(-1)}`;
|
|
10
|
+
/** Which vendor, or one line saying why exec won't run it. A carrier
|
|
11
|
+
* (`terraform`) runs with its cloud's key: `vendor` is the key's CLI. */
|
|
10
12
|
export function execTarget(argv) {
|
|
11
13
|
const program = argv[0];
|
|
12
14
|
if (!program)
|
|
@@ -21,6 +23,10 @@ export function execTarget(argv) {
|
|
|
21
23
|
};
|
|
22
24
|
}
|
|
23
25
|
const vendor = execVendorOf(program);
|
|
26
|
+
if (!vendor && Object.hasOwn(EXEC_CARRIERS, program)) {
|
|
27
|
+
const refused = carrierRefusal(program, argv.slice(1));
|
|
28
|
+
return refused ? { refused } : { vendor: EXEC_CARRIERS[program], binary: program, carrier: true };
|
|
29
|
+
}
|
|
24
30
|
if (!vendor)
|
|
25
31
|
return { refused: `passport exec runs ${LIST}. It won't run ${program}.` };
|
|
26
32
|
const refused = refusedReason(vendor, argv.slice(1));
|
package/dist/execVendors.d.ts
CHANGED
|
@@ -3,11 +3,23 @@
|
|
|
3
3
|
* subcommands it won't run. A checked copy of shared/keysContract.ts (the
|
|
4
4
|
* published CLI can't import it); a server test pins the two together.
|
|
5
5
|
*/
|
|
6
|
-
export declare const EXEC_VENDORS: readonly ["railway", "gh", "vercel", "wrangler", "supabase", "stripe", "aws", "neonctl", "flyctl"];
|
|
6
|
+
export declare const EXEC_VENDORS: readonly ["railway", "gh", "vercel", "wrangler", "supabase", "stripe", "aws", "neonctl", "flyctl", "az", "azd", "glab", "gcloud", "firebase"];
|
|
7
7
|
export type ExecVendor = (typeof EXEC_VENDORS)[number];
|
|
8
8
|
/** The binary a person types, when it isn't the vendor id. */
|
|
9
9
|
export declare const EXEC_ALIASES: Readonly<Record<string, ExecVendor>>;
|
|
10
10
|
export declare function execVendorOf(binary: string): ExecVendor | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Programs exec runs with another CLI's key: infrastructure-as-code tools
|
|
13
|
+
* that call the cloud themselves. `passport exec -- terraform apply` runs
|
|
14
|
+
* terraform with the short-lived AWS key Passport mints for that command,
|
|
15
|
+
* chosen for where the workspace lands (a Production workspace gets the
|
|
16
|
+
* Production key). Their own state and sign-in stay as they are.
|
|
17
|
+
*/
|
|
18
|
+
export declare const EXEC_CARRIERS: Readonly<Record<string, ExecVendor>>;
|
|
19
|
+
/** The key a program runs with: its own CLI's, or the cloud's for a carrier. */
|
|
20
|
+
export declare function execCredentialOf(binary: string): ExecVendor | undefined;
|
|
21
|
+
/** Why exec won't run this carrier command, or undefined. */
|
|
22
|
+
export declare function carrierRefusal(binary: string, args: readonly string[]): string | undefined;
|
|
11
23
|
export declare const EXEC_VENDOR_NAMES: Readonly<Record<ExecVendor, string>>;
|
|
12
24
|
export declare const EXEC_ENV_NAMES: Readonly<Record<ExecVendor, readonly string[]>>;
|
|
13
25
|
export declare const EXEC_TOKEN_PAGES: Readonly<Record<ExecVendor, string>>;
|