@prism-d1/cli 1.3.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/aws/advice.d.ts +33 -0
- package/dist/src/aws/advice.d.ts.map +1 -0
- package/dist/src/aws/advice.js +174 -0
- package/dist/src/aws/advice.js.map +1 -0
- package/dist/src/aws/check.d.ts +64 -0
- package/dist/src/aws/check.d.ts.map +1 -0
- package/dist/src/aws/check.js +269 -0
- package/dist/src/aws/check.js.map +1 -0
- package/dist/src/aws/connect.d.ts +65 -0
- package/dist/src/aws/connect.d.ts.map +1 -0
- package/dist/src/aws/connect.js +255 -0
- package/dist/src/aws/connect.js.map +1 -0
- package/dist/src/aws/connection.d.ts +67 -0
- package/dist/src/aws/connection.d.ts.map +1 -0
- package/dist/src/aws/connection.js +137 -0
- package/dist/src/aws/connection.js.map +1 -0
- package/dist/src/aws/recommend.d.ts +76 -0
- package/dist/src/aws/recommend.d.ts.map +1 -0
- package/dist/src/aws/recommend.js +267 -0
- package/dist/src/aws/recommend.js.map +1 -0
- package/dist/src/aws/run-check.d.ts +31 -0
- package/dist/src/aws/run-check.d.ts.map +1 -0
- package/dist/src/aws/run-check.js +92 -0
- package/dist/src/aws/run-check.js.map +1 -0
- package/dist/src/codewatch/globalHooks.d.ts +1 -3
- package/dist/src/codewatch/globalHooks.d.ts.map +1 -1
- package/dist/src/codewatch/globalHooks.js +2 -7
- package/dist/src/codewatch/globalHooks.js.map +1 -1
- package/dist/src/codewatch/hooks.d.ts +9 -2
- package/dist/src/codewatch/hooks.d.ts.map +1 -1
- package/dist/src/codewatch/hooks.js +13 -0
- package/dist/src/codewatch/hooks.js.map +1 -1
- package/dist/src/codewatch/results.d.ts +32 -1
- package/dist/src/codewatch/results.d.ts.map +1 -1
- package/dist/src/codewatch/results.js +4 -0
- package/dist/src/codewatch/results.js.map +1 -1
- package/dist/src/commands/_top/dashboard.js +1 -1
- package/dist/src/commands/_top/dashboard.js.map +1 -1
- package/dist/src/commands/aws/check.d.ts +25 -0
- package/dist/src/commands/aws/check.d.ts.map +1 -0
- package/dist/src/commands/aws/check.js +42 -0
- package/dist/src/commands/aws/check.js.map +1 -0
- package/dist/src/commands/aws/connect.d.ts +16 -0
- package/dist/src/commands/aws/connect.d.ts.map +1 -0
- package/dist/src/commands/aws/connect.js +39 -0
- package/dist/src/commands/aws/connect.js.map +1 -0
- package/dist/src/commands/aws/recommend.d.ts +12 -0
- package/dist/src/commands/aws/recommend.d.ts.map +1 -0
- package/dist/src/commands/aws/recommend.js +21 -0
- package/dist/src/commands/aws/recommend.js.map +1 -0
- package/dist/src/commands/bedrock-protection/scan-account.d.ts.map +1 -1
- package/dist/src/commands/bedrock-protection/scan-account.js +14 -35
- package/dist/src/commands/bedrock-protection/scan-account.js.map +1 -1
- package/dist/src/commands/bedrock-protection/scan-org.d.ts.map +1 -1
- package/dist/src/commands/bedrock-protection/scan-org.js +12 -5
- package/dist/src/commands/bedrock-protection/scan-org.js.map +1 -1
- package/dist/src/commands/bootstrapper/setup-otel-sync.d.ts.map +1 -1
- package/dist/src/commands/bootstrapper/setup-otel-sync.js +3 -2
- package/dist/src/commands/bootstrapper/setup-otel-sync.js.map +1 -1
- package/dist/src/commands/codewatch/pre-commit.d.ts.map +1 -1
- package/dist/src/commands/codewatch/pre-commit.js +3 -1
- package/dist/src/commands/codewatch/pre-commit.js.map +1 -1
- package/dist/src/commands/codewatch/pre-push.d.ts.map +1 -1
- package/dist/src/commands/codewatch/pre-push.js +3 -1
- package/dist/src/commands/codewatch/pre-push.js.map +1 -1
- package/dist/src/commands/codewatch/report.d.ts.map +1 -1
- package/dist/src/commands/codewatch/report.js +9 -3
- package/dist/src/commands/codewatch/report.js.map +1 -1
- package/dist/src/commands/enable/codeburn.d.ts.map +1 -1
- package/dist/src/commands/enable/codeburn.js +2 -3
- package/dist/src/commands/enable/codeburn.js.map +1 -1
- package/dist/src/commands/enable/codewatch.d.ts.map +1 -1
- package/dist/src/commands/enable/codewatch.js +2 -1
- package/dist/src/commands/enable/codewatch.js.map +1 -1
- package/dist/src/commands/enable/security.d.ts.map +1 -1
- package/dist/src/commands/enable/security.js +5 -7
- package/dist/src/commands/enable/security.js.map +1 -1
- package/dist/src/commands/security/code-review.d.ts.map +1 -1
- package/dist/src/commands/security/code-review.js +4 -3
- package/dist/src/commands/security/code-review.js.map +1 -1
- package/dist/src/commands/security/findings.d.ts.map +1 -1
- package/dist/src/commands/security/findings.js +6 -4
- package/dist/src/commands/security/findings.js.map +1 -1
- package/dist/src/commands/security/pentest.d.ts.map +1 -1
- package/dist/src/commands/security/pentest.js +4 -3
- package/dist/src/commands/security/pentest.js.map +1 -1
- package/dist/src/commands/security/threat-model.d.ts.map +1 -1
- package/dist/src/commands/security/threat-model.js +2 -1
- package/dist/src/commands/security/threat-model.js.map +1 -1
- package/dist/src/commands/security/threats.d.ts.map +1 -1
- package/dist/src/commands/security/threats.js +2 -1
- package/dist/src/commands/security/threats.js.map +1 -1
- package/dist/src/commands/securityagent/setup.d.ts.map +1 -1
- package/dist/src/dashboard/aws.d.ts +39 -0
- package/dist/src/dashboard/aws.d.ts.map +1 -0
- package/dist/src/dashboard/aws.js +35 -0
- package/dist/src/dashboard/aws.js.map +1 -0
- package/dist/src/dashboard/codewatch.js +1 -1
- package/dist/src/dashboard/codewatch.js.map +1 -1
- package/dist/src/dashboard/page.d.ts.map +1 -1
- package/dist/src/dashboard/page.js +34 -1
- package/dist/src/dashboard/page.js.map +1 -1
- package/dist/src/dashboard/payload.d.ts +3 -0
- package/dist/src/dashboard/payload.d.ts.map +1 -1
- package/dist/src/dashboard/payload.js +2 -0
- package/dist/src/dashboard/payload.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +16 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/security/errors.d.ts +1 -0
- package/dist/src/security/errors.d.ts.map +1 -1
- package/dist/src/security/errors.js +2 -1
- package/dist/src/security/errors.js.map +1 -1
- package/dist/src/security/marker.d.ts +1 -1
- package/dist/src/security/marker.d.ts.map +1 -1
- package/dist/src/security/marker.js +4 -4
- package/dist/src/security/marker.js.map +1 -1
- package/dist/src/security/pentest.d.ts.map +1 -1
- package/dist/src/security/pentest.js +5 -1
- package/dist/src/security/pentest.js.map +1 -1
- package/dist/src/security/review.d.ts +4 -4
- package/dist/src/security/review.d.ts.map +1 -1
- package/dist/src/security/review.js +12 -8
- package/dist/src/security/review.js.map +1 -1
- package/dist/src/security/setup.d.ts +18 -2
- package/dist/src/security/setup.d.ts.map +1 -1
- package/dist/src/security/setup.js +32 -16
- package/dist/src/security/setup.js.map +1 -1
- package/dist/src/security/threat-model.d.ts +7 -0
- package/dist/src/security/threat-model.d.ts.map +1 -1
- package/dist/src/security/threat-model.js +37 -3
- package/dist/src/security/threat-model.js.map +1 -1
- package/dist/src/utils/audit-account.d.ts +50 -0
- package/dist/src/utils/audit-account.d.ts.map +1 -0
- package/dist/src/utils/audit-account.js +69 -0
- package/dist/src/utils/audit-account.js.map +1 -0
- package/dist/src/utils/audit-iam.d.ts +1 -1
- package/dist/src/utils/audit-iam.d.ts.map +1 -1
- package/dist/src/utils/audit-iam.js +11 -7
- package/dist/src/utils/audit-iam.js.map +1 -1
- package/dist/src/utils/otel-sync-schedule.d.ts +8 -0
- package/dist/src/utils/otel-sync-schedule.d.ts.map +1 -1
- package/dist/src/utils/otel-sync-schedule.js +16 -0
- package/dist/src/utils/otel-sync-schedule.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { AwsResult } from '../utils/aws.js';
|
|
2
|
+
import type { RunResult } from '../utils/exec.js';
|
|
3
|
+
export interface ConnectOptions {
|
|
4
|
+
profile?: string;
|
|
5
|
+
region?: string;
|
|
6
|
+
/** Write (or clear) the per-repo file instead of the per-user one. */
|
|
7
|
+
repo?: boolean;
|
|
8
|
+
status?: boolean;
|
|
9
|
+
clear?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ConnectDeps {
|
|
12
|
+
/** A read-only `aws <args>` call as `profile` in `region` (JSON output). */
|
|
13
|
+
aws(args: string[], profile: string, region: string): AwsResult;
|
|
14
|
+
listProfiles(): string[];
|
|
15
|
+
configRegion(profile?: string): string | null;
|
|
16
|
+
git(args: string[]): RunResult;
|
|
17
|
+
env: NodeJS.ProcessEnv;
|
|
18
|
+
home: string;
|
|
19
|
+
cwd(): string;
|
|
20
|
+
isTTY: boolean;
|
|
21
|
+
ask(question: string): Promise<string>;
|
|
22
|
+
log(line?: string): void;
|
|
23
|
+
now(): Date;
|
|
24
|
+
}
|
|
25
|
+
export declare const CONNECT_NOTICE = "Read-only (aws connect): it checks the profile with STS and reads the account alias, Organizations and IAM; nothing in AWS is changed. No credentials are stored, only the profile name and region.";
|
|
26
|
+
export interface Identity {
|
|
27
|
+
account: string;
|
|
28
|
+
arn: string;
|
|
29
|
+
}
|
|
30
|
+
export type OrgRole = {
|
|
31
|
+
kind: 'management';
|
|
32
|
+
orgId: string;
|
|
33
|
+
} | {
|
|
34
|
+
kind: 'member';
|
|
35
|
+
orgId: string;
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'none';
|
|
38
|
+
} | {
|
|
39
|
+
kind: 'unknown';
|
|
40
|
+
reason: string;
|
|
41
|
+
};
|
|
42
|
+
export interface AccessLevel {
|
|
43
|
+
level: 'admin' | 'read-only' | 'unknown';
|
|
44
|
+
basis: string;
|
|
45
|
+
}
|
|
46
|
+
export declare function callerIdentity(d: ConnectDeps, profile: string, region: string): Identity | {
|
|
47
|
+
error: string;
|
|
48
|
+
};
|
|
49
|
+
export declare function accountAlias(d: ConnectDeps, profile: string, region: string): string | null;
|
|
50
|
+
/** Whether the account is its organization's management account. AccessDenied is "unknown", never "no". */
|
|
51
|
+
export declare function orgRole(d: ConnectDeps, profile: string, region: string, account: string): OrgRole;
|
|
52
|
+
/** The principal behind a caller ARN: an assumed role, an IAM user, or root. */
|
|
53
|
+
export declare function principalOf(arn: string): {
|
|
54
|
+
kind: 'role' | 'user' | 'root' | 'other';
|
|
55
|
+
name: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Admin or read-only, as far as can be told without simulating policies:
|
|
59
|
+
* the attached managed policies when they can be read, else the role or user
|
|
60
|
+
* name. "unknown" whenever neither is conclusive.
|
|
61
|
+
*/
|
|
62
|
+
export declare function accessLevel(d: ConnectDeps, profile: string, region: string, arn: string): AccessLevel;
|
|
63
|
+
/** Runs `aws connect`. Returns the exit code. */
|
|
64
|
+
export declare function awsConnect(o: ConnectOptions, d: ConnectDeps): Promise<number>;
|
|
65
|
+
//# sourceMappingURL=connect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../../src/aws/connect.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAQlD,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,4EAA4E;IAC5E,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAChE,YAAY,IAAI,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC9C,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC,UAAU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D,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAOnG;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAarG;AAqFD,iDAAiD;AACjD,wBAAsB,UAAU,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAyDnF"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `prism-cli aws connect`: choose the AWS profile and region the other AWS
|
|
3
|
+
* commands default to, verify them, and save the choice. Read-only in AWS;
|
|
4
|
+
* stores no credentials (see connection.ts for the files and precedence).
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync } from 'node:fs';
|
|
7
|
+
import { ensureMarkerIgnored } from '../security/marker.js';
|
|
8
|
+
import { accountChangeWarning, applyConnection, clearConnectionFile, connectionLabel, ENV_CREDENTIAL_VARS, loadConnection, PROFILE_RE, readConnectionFile, REGION_RE, REPO_CONNECTION_PATH, repoConnectionPath, repoRootOf, userConnectionPath, writeConnectionFile, } from './connection.js';
|
|
9
|
+
export const CONNECT_NOTICE = 'Read-only (aws connect): it checks the profile with STS and reads the account alias, Organizations and IAM; nothing in AWS is changed. No credentials are stored, only the profile name and region.';
|
|
10
|
+
const reason = (r) => r.errorCode || r.raw.split('\n').map((l) => l.trim()).filter(Boolean).pop() || 'unknown error';
|
|
11
|
+
export function callerIdentity(d, profile, region) {
|
|
12
|
+
const r = d.aws(['sts', 'get-caller-identity'], profile, region);
|
|
13
|
+
if (!r.ok)
|
|
14
|
+
return { error: reason(r) };
|
|
15
|
+
const account = String(r.json?.Account || '');
|
|
16
|
+
return account ? { account, arn: String(r.json?.Arn || '') } : { error: 'get-caller-identity returned no account' };
|
|
17
|
+
}
|
|
18
|
+
export function accountAlias(d, profile, region) {
|
|
19
|
+
const r = d.aws(['iam', 'list-account-aliases'], profile, region);
|
|
20
|
+
const a = r.ok && Array.isArray(r.json?.AccountAliases) ? r.json.AccountAliases[0] : null;
|
|
21
|
+
return a ? String(a) : null;
|
|
22
|
+
}
|
|
23
|
+
/** Whether the account is its organization's management account. AccessDenied is "unknown", never "no". */
|
|
24
|
+
export function orgRole(d, profile, region, account) {
|
|
25
|
+
const r = d.aws(['organizations', 'describe-organization'], profile, region);
|
|
26
|
+
if (r.ok) {
|
|
27
|
+
const org = r.json?.Organization ?? {};
|
|
28
|
+
// The API names the management account's id field MasterAccountId.
|
|
29
|
+
const managementId = String(org.MasterAccountId || '');
|
|
30
|
+
return managementId === account ? { kind: 'management', orgId: String(org.Id || '') } : { kind: 'member', orgId: String(org.Id || '') };
|
|
31
|
+
}
|
|
32
|
+
if (r.errorCode === 'AWSOrganizationsNotInUseException')
|
|
33
|
+
return { kind: 'none' };
|
|
34
|
+
return { kind: 'unknown', reason: reason(r) };
|
|
35
|
+
}
|
|
36
|
+
const ADMIN_POLICY = /^(AdministratorAccess|PowerUserAccess)$|FullAccess$/;
|
|
37
|
+
const READ_POLICY = /^(ReadOnlyAccess|ViewOnlyAccess|SecurityAudit)$|ReadOnly/;
|
|
38
|
+
const ADMIN_NAME = /admin|poweruser|fullaccess/i;
|
|
39
|
+
const READ_NAME = /read-?only|view-?only|audit/i;
|
|
40
|
+
/** The principal behind a caller ARN: an assumed role, an IAM user, or root. */
|
|
41
|
+
export function principalOf(arn) {
|
|
42
|
+
const m = /^arn:[^:]+:(sts|iam)::\d{12}:(assumed-role|user|root|role)(?:\/(.*))?$/.exec(arn);
|
|
43
|
+
if (!m)
|
|
44
|
+
return { kind: 'other', name: '' };
|
|
45
|
+
if (m[2] === 'root')
|
|
46
|
+
return { kind: 'root', name: 'root' };
|
|
47
|
+
const parts = (m[3] || '').split('/');
|
|
48
|
+
if (m[2] === 'assumed-role' || m[2] === 'role')
|
|
49
|
+
return { kind: 'role', name: m[2] === 'assumed-role' ? parts[0] : parts[parts.length - 1] };
|
|
50
|
+
return { kind: 'user', name: parts[parts.length - 1] };
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Admin or read-only, as far as can be told without simulating policies:
|
|
54
|
+
* the attached managed policies when they can be read, else the role or user
|
|
55
|
+
* name. "unknown" whenever neither is conclusive.
|
|
56
|
+
*/
|
|
57
|
+
export function accessLevel(d, profile, region, arn) {
|
|
58
|
+
const p = principalOf(arn);
|
|
59
|
+
if (p.kind === 'root')
|
|
60
|
+
return { level: 'admin', basis: 'the root user' };
|
|
61
|
+
if (p.kind === 'other' || !p.name)
|
|
62
|
+
return { level: 'unknown', basis: 'the caller ARN has an unexpected form' };
|
|
63
|
+
const call = p.kind === 'role' ? ['iam', 'list-attached-role-policies', '--role-name', p.name] : ['iam', 'list-attached-user-policies', '--user-name', p.name];
|
|
64
|
+
const r = d.aws(call, profile, region);
|
|
65
|
+
const names = r.ok ? (r.json?.AttachedPolicies || []).map((x) => String(x?.PolicyName || '')).filter(Boolean) : [];
|
|
66
|
+
if (names.some((n) => ADMIN_POLICY.test(n)))
|
|
67
|
+
return { level: 'admin', basis: `attached policy ${names.find((n) => ADMIN_POLICY.test(n))}` };
|
|
68
|
+
if (names.length && names.every((n) => READ_POLICY.test(n)))
|
|
69
|
+
return { level: 'read-only', basis: `attached policies ${names.join(', ')}` };
|
|
70
|
+
const why = r.ok ? (names.length ? `custom policies (${names.join(', ')})` : 'no managed policies attached') : `policies not readable (${reason(r)})`;
|
|
71
|
+
if (ADMIN_NAME.test(p.name))
|
|
72
|
+
return { level: 'admin', basis: `the ${p.kind} name ${p.name}; ${why}` };
|
|
73
|
+
if (READ_NAME.test(p.name))
|
|
74
|
+
return { level: 'read-only', basis: `the ${p.kind} name ${p.name}; ${why}` };
|
|
75
|
+
return { level: 'unknown', basis: why };
|
|
76
|
+
}
|
|
77
|
+
const createHint = (profile) => `Check the name, or create it with aws configure sso --profile ${profile} (or aws configure --profile ${profile}).`;
|
|
78
|
+
/** Signing in cannot fix a profile the AWS CLI cannot find, so that case gets the create hint instead. */
|
|
79
|
+
function fixHint(profile, error, signIn) {
|
|
80
|
+
return /config profile .* could not be found/i.test(error) ? createHint(profile) : signIn.replace('<p>', profile);
|
|
81
|
+
}
|
|
82
|
+
const orgText = (o) => o.kind === 'management' ? `yes, the management account of ${o.orgId}`
|
|
83
|
+
: o.kind === 'member' ? `no, a member account of ${o.orgId}` : o.kind === 'none' ? 'no, not in an organization' : `unknown (${o.reason})`;
|
|
84
|
+
async function chooseProfile(o, d, saved) {
|
|
85
|
+
if (o.profile)
|
|
86
|
+
return o.profile;
|
|
87
|
+
const profiles = d.listProfiles();
|
|
88
|
+
if (!d.isTTY) {
|
|
89
|
+
if (d.env.AWS_PROFILE)
|
|
90
|
+
return d.env.AWS_PROFILE;
|
|
91
|
+
return { error: 'no --profile given and there is no terminal to choose on. Pass --profile <name> (see aws configure list-profiles).' };
|
|
92
|
+
}
|
|
93
|
+
if (!profiles.length)
|
|
94
|
+
return { error: 'no AWS profiles are configured. Create one with aws configure sso (or aws configure --profile <name>), then re-run.' };
|
|
95
|
+
const preferred = d.env.AWS_PROFILE || saved?.profile || (profiles.includes('default') ? 'default' : profiles[0]);
|
|
96
|
+
const def = Math.max(0, profiles.indexOf(preferred));
|
|
97
|
+
d.log('AWS profiles (from aws configure list-profiles):');
|
|
98
|
+
profiles.forEach((p, i) => d.log(` ${i + 1}) ${p}${i === def ? ' (default)' : ''}`));
|
|
99
|
+
const a = (await d.ask(`Profile [${def + 1}]: `)).trim();
|
|
100
|
+
if (!a)
|
|
101
|
+
return profiles[def];
|
|
102
|
+
const n = Number.parseInt(a, 10);
|
|
103
|
+
if (String(n) === a && n >= 1 && n <= profiles.length)
|
|
104
|
+
return profiles[n - 1];
|
|
105
|
+
return profiles.includes(a) ? a : { error: `"${a}" is not one of the listed profiles.` };
|
|
106
|
+
}
|
|
107
|
+
async function chooseRegion(o, d, profile) {
|
|
108
|
+
if (o.region)
|
|
109
|
+
return o.region;
|
|
110
|
+
const def = d.env.AWS_REGION || d.env.AWS_DEFAULT_REGION || d.configRegion(profile) || '';
|
|
111
|
+
if (!d.isTTY)
|
|
112
|
+
return def || { error: `no --region given and profile ${profile} has no configured region. Pass --region <region>.` };
|
|
113
|
+
const a = (await d.ask(`Region${def ? ` [${def}]` : ''}: `)).trim();
|
|
114
|
+
return a || def || { error: 'a region is required.' };
|
|
115
|
+
}
|
|
116
|
+
function repoRoot(d) {
|
|
117
|
+
return repoRootOf(d.cwd(), d.git);
|
|
118
|
+
}
|
|
119
|
+
/** `--clear`: removes the user file, or the repo file with --repo. */
|
|
120
|
+
function clear(o, d) {
|
|
121
|
+
let path;
|
|
122
|
+
if (o.repo) {
|
|
123
|
+
const root = repoRoot(d);
|
|
124
|
+
if (!root) {
|
|
125
|
+
d.log('Error: --repo needs to run inside a git repository.');
|
|
126
|
+
return 1;
|
|
127
|
+
}
|
|
128
|
+
path = repoConnectionPath(root);
|
|
129
|
+
}
|
|
130
|
+
else
|
|
131
|
+
path = userConnectionPath(d.home);
|
|
132
|
+
d.log(clearConnectionFile(path) ? `Removed ${path}. Nothing in AWS was changed.` : `Nothing to clear: ${path} does not exist.`);
|
|
133
|
+
return 0;
|
|
134
|
+
}
|
|
135
|
+
function describeFile(label, path, d) {
|
|
136
|
+
const c = readConnectionFile(path);
|
|
137
|
+
if (c)
|
|
138
|
+
d.log(` ${label}: ${path}\n profile ${c.profile}, region ${c.region}, account ${c.account}${c.alias ? ` (${c.alias})` : ''}, verified ${c.verifiedAt || 'unknown'}`);
|
|
139
|
+
else
|
|
140
|
+
d.log(` ${label}: ${path} (${existsSync(path) ? 'not a valid connection; ignored. Re-run prism-cli aws connect' : 'not set'})`);
|
|
141
|
+
}
|
|
142
|
+
/** `--status`: what is saved, which file applies, and whether it still validates. */
|
|
143
|
+
function status(d) {
|
|
144
|
+
const root = repoRoot(d);
|
|
145
|
+
d.log('Saved AWS connection:');
|
|
146
|
+
describeFile('user', userConnectionPath(d.home), d);
|
|
147
|
+
if (root)
|
|
148
|
+
describeFile('repo', repoConnectionPath(root), d);
|
|
149
|
+
else
|
|
150
|
+
d.log(' repo: (not in a git repository)');
|
|
151
|
+
const saved = loadConnection(d.home, root);
|
|
152
|
+
if (!saved) {
|
|
153
|
+
d.log('');
|
|
154
|
+
d.log('No saved connection: AWS commands use the default credential chain. Save one with: prism-cli aws connect');
|
|
155
|
+
return 0;
|
|
156
|
+
}
|
|
157
|
+
const applied = applyConnection({}, saved, d.env);
|
|
158
|
+
d.log('');
|
|
159
|
+
if (applied.profileSource)
|
|
160
|
+
d.log(`In use: profile ${saved.profile}, region ${saved.region} (${connectionLabel(saved)}, ${saved.path})`);
|
|
161
|
+
else {
|
|
162
|
+
const v = ENV_CREDENTIAL_VARS.find((k) => d.env[k]);
|
|
163
|
+
d.log(`Not in use for credentials: ${v} is set, and the environment wins over the saved connection${applied.connection ? ` (the saved region ${saved.region} still applies)` : ''}.`);
|
|
164
|
+
}
|
|
165
|
+
if (d.env.AWS_REGION || d.env.AWS_DEFAULT_REGION)
|
|
166
|
+
d.log(`Region note: ${d.env.AWS_REGION ? 'AWS_REGION' : 'AWS_DEFAULT_REGION'} is set and wins over the saved region.`);
|
|
167
|
+
const id = callerIdentity(d, saved.profile, saved.region);
|
|
168
|
+
if ('error' in id) {
|
|
169
|
+
d.log(`Validation: FAILED for profile ${saved.profile}: ${id.error}. ${fixHint(saved.profile, id.error, 'Sign in again (e.g. aws sso login --profile <p>) or re-run prism-cli aws connect.')}`);
|
|
170
|
+
return 1;
|
|
171
|
+
}
|
|
172
|
+
const w = accountChangeWarning(saved, id.account);
|
|
173
|
+
d.log(w ?? `Validation: ok, profile ${saved.profile} is account ${id.account} as saved (caller ${id.arn}).`);
|
|
174
|
+
return w ? 1 : 0;
|
|
175
|
+
}
|
|
176
|
+
/** Runs `aws connect`. Returns the exit code. */
|
|
177
|
+
export async function awsConnect(o, d) {
|
|
178
|
+
if (o.status && o.clear) {
|
|
179
|
+
d.log('Error: --status and --clear cannot be combined.');
|
|
180
|
+
return 1;
|
|
181
|
+
}
|
|
182
|
+
if (o.clear)
|
|
183
|
+
return clear(o, d);
|
|
184
|
+
d.log(CONNECT_NOTICE);
|
|
185
|
+
d.log('');
|
|
186
|
+
if (o.status)
|
|
187
|
+
return status(d);
|
|
188
|
+
const root = repoRoot(d);
|
|
189
|
+
if (o.repo && !root) {
|
|
190
|
+
d.log('Error: --repo needs to run inside a git repository.');
|
|
191
|
+
return 1;
|
|
192
|
+
}
|
|
193
|
+
const before = loadConnection(d.home, root);
|
|
194
|
+
const profile = await chooseProfile(o, d, before);
|
|
195
|
+
if (typeof profile !== 'string') {
|
|
196
|
+
d.log(`Error: ${profile.error}`);
|
|
197
|
+
return 1;
|
|
198
|
+
}
|
|
199
|
+
if (!PROFILE_RE.test(profile)) {
|
|
200
|
+
d.log(`Error: "${profile}" is not a valid profile name.`);
|
|
201
|
+
return 1;
|
|
202
|
+
}
|
|
203
|
+
const known = d.listProfiles();
|
|
204
|
+
if (!known.includes(profile)) {
|
|
205
|
+
d.log(`Error: profile ${profile} is not configured here (aws configure list-profiles lists ${known.length ? known.join(', ') : 'no profiles'}). ${createHint(profile)}`);
|
|
206
|
+
return 1;
|
|
207
|
+
}
|
|
208
|
+
const region = await chooseRegion(o, d, profile);
|
|
209
|
+
if (typeof region !== 'string') {
|
|
210
|
+
d.log(`Error: ${region.error}`);
|
|
211
|
+
return 1;
|
|
212
|
+
}
|
|
213
|
+
if (!REGION_RE.test(region)) {
|
|
214
|
+
d.log(`Error: "${region}" is not a valid AWS region name (e.g. us-west-2).`);
|
|
215
|
+
return 1;
|
|
216
|
+
}
|
|
217
|
+
const id = callerIdentity(d, profile, region);
|
|
218
|
+
if ('error' in id) {
|
|
219
|
+
d.log(`Error: profile ${profile} does not validate: ${id.error}. ${fixHint(profile, id.error, 'Sign in (e.g. aws sso login --profile <p>) and re-run.')} Nothing was saved.`);
|
|
220
|
+
return 1;
|
|
221
|
+
}
|
|
222
|
+
const alias = accountAlias(d, profile, region);
|
|
223
|
+
const org = orgRole(d, profile, region, id.account);
|
|
224
|
+
const access = accessLevel(d, profile, region, id.arn);
|
|
225
|
+
d.log(`Profile: ${profile}`);
|
|
226
|
+
d.log(`Region: ${region}`);
|
|
227
|
+
d.log(`Account: ${id.account}${alias ? ` (${alias})` : ' (no account alias)'}`);
|
|
228
|
+
d.log(`Caller: ${id.arn || 'unknown'}`);
|
|
229
|
+
d.log(`Org management account: ${orgText(org)}`);
|
|
230
|
+
d.log(`Access: ${access.level} (${access.basis})`);
|
|
231
|
+
if (access.level === 'admin')
|
|
232
|
+
d.log(' prism-cli aws check and aws recommend only need read access; a read-only profile is enough for them.');
|
|
233
|
+
const path = o.repo && root ? repoConnectionPath(root) : userConnectionPath(d.home);
|
|
234
|
+
const prev = readConnectionFile(path);
|
|
235
|
+
if (prev && prev.profile === profile && prev.account !== id.account) {
|
|
236
|
+
d.log(`Warning: profile ${profile} was saved as account ${prev.account}; it now resolves to account ${id.account}.`);
|
|
237
|
+
}
|
|
238
|
+
const conn = { profile, region, account: id.account, alias, verifiedAt: d.now().toISOString() };
|
|
239
|
+
if (o.repo && root) {
|
|
240
|
+
const excluded = ensureMarkerIgnored(root, d.git, REPO_CONNECTION_PATH, 'prism-cli aws connect');
|
|
241
|
+
if (excluded)
|
|
242
|
+
d.log(`Added ${REPO_CONNECTION_PATH} to ${excluded} so git ignores it in this clone.`);
|
|
243
|
+
}
|
|
244
|
+
writeConnectionFile(path, conn);
|
|
245
|
+
d.log('');
|
|
246
|
+
d.log(`Saved ${path} (profile name, region, account and alias; no credentials).`);
|
|
247
|
+
d.log(`AWS commands now default to profile ${profile} in ${region}${o.repo ? ' in this repo' : ''}. --profile/--region and AWS_PROFILE/AWS_REGION still win.`);
|
|
248
|
+
const env = ENV_CREDENTIAL_VARS.find((k) => d.env[k]);
|
|
249
|
+
if (env && d.env.AWS_PROFILE !== profile)
|
|
250
|
+
d.log(`Note: ${env} is set in this shell, so it wins here until it is unset.`);
|
|
251
|
+
if (!o.repo && root && readConnectionFile(repoConnectionPath(root)))
|
|
252
|
+
d.log(`Note: this repo has its own ${REPO_CONNECTION_PATH}, which wins over the user file here.`);
|
|
253
|
+
return 0;
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../../src/aws/connect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,oBAAoB,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,mBAAmB,EAAE,cAAc,EAChH,UAAU,EAAE,kBAAkB,EAAE,SAAS,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,UAAU,EAAE,kBAAkB,EACnH,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AA0BzB,MAAM,CAAC,MAAM,cAAc,GAAG,qMAAqM,CAAC;AAMpO,MAAM,MAAM,GAAG,CAAC,CAAY,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,IAAI,eAAe,CAAC;AAEhI,MAAM,UAAU,cAAc,CAAC,CAAc,EAAE,OAAe,EAAE,MAAc;IAC5E,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,qBAAqB,CAAC,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AAmB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,WAAW,KAAK,OAAO;QAAE,CAAC,CAAC,GAAG,CAAC,SAAS,GAAG,2DAA2D,CAAC,CAAC;IACzH,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,kBAAkB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAAE,CAAC,CAAC,GAAG,CAAC,+BAA+B,oBAAoB,uCAAuC,CAAC,CAAC;IACvK,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type RunResult } from '../utils/exec.js';
|
|
2
|
+
export declare const USER_CONNECTION_PATH = "~/.prism/aws.json";
|
|
3
|
+
export declare const REPO_CONNECTION_PATH = ".prism/aws.local.json";
|
|
4
|
+
export interface AwsConnection {
|
|
5
|
+
profile: string;
|
|
6
|
+
region: string;
|
|
7
|
+
account: string;
|
|
8
|
+
alias: string | null;
|
|
9
|
+
verifiedAt: string;
|
|
10
|
+
}
|
|
11
|
+
export type ConnectionScope = 'repo' | 'user';
|
|
12
|
+
export interface SavedConnection extends AwsConnection {
|
|
13
|
+
scope: ConnectionScope;
|
|
14
|
+
path: string;
|
|
15
|
+
}
|
|
16
|
+
/** What a command's options gain from the resolver. */
|
|
17
|
+
export interface ConnectionDefaults {
|
|
18
|
+
profile?: string;
|
|
19
|
+
/** Where `profile` came from, e.g. "--profile" or "aws connect, user". Unset when no profile is used. */
|
|
20
|
+
profileSource?: string;
|
|
21
|
+
/** The saved connection whose region (and account, for the change warning) applies. */
|
|
22
|
+
connection?: SavedConnection;
|
|
23
|
+
}
|
|
24
|
+
/** Credential env vars that the AWS CLI prefers over any profile; when set, the saved profile is not applied. */
|
|
25
|
+
export declare const ENV_CREDENTIAL_VARS: string[];
|
|
26
|
+
export declare const PROFILE_RE: RegExp;
|
|
27
|
+
export declare const REGION_RE: RegExp;
|
|
28
|
+
export declare const userConnectionPath: (home: string) => string;
|
|
29
|
+
export declare const repoConnectionPath: (root: string) => string;
|
|
30
|
+
/** The connection in `path`; null when the file is absent or not a valid connection. */
|
|
31
|
+
export declare function readConnectionFile(path: string): AwsConnection | null;
|
|
32
|
+
/** Atomic write, owner-only (no secrets inside, but it is per-user state). */
|
|
33
|
+
export declare function writeConnectionFile(path: string, c: AwsConnection): void;
|
|
34
|
+
/** Removes the file; true when there was one. */
|
|
35
|
+
export declare function clearConnectionFile(path: string): boolean;
|
|
36
|
+
/** The repo file first, then the user file. `home` '' means no user file. */
|
|
37
|
+
export declare function loadConnection(home: string, repoRoot: string | null): SavedConnection | null;
|
|
38
|
+
export declare const connectionLabel: (c: Pick<SavedConnection, "scope">) => string;
|
|
39
|
+
/**
|
|
40
|
+
* Fills the profile from the saved connection when neither a flag nor the
|
|
41
|
+
* environment chose the credentials, and attaches the connection whose region
|
|
42
|
+
* applies. Pure: the caller loads the connection.
|
|
43
|
+
*/
|
|
44
|
+
export declare function applyConnection<T extends {
|
|
45
|
+
profile?: string;
|
|
46
|
+
region?: string;
|
|
47
|
+
}>(opts: T, saved: SavedConnection | null, env: NodeJS.ProcessEnv): T & ConnectionDefaults;
|
|
48
|
+
/** `git -C dir rev-parse --show-toplevel`, or null outside a repository. */
|
|
49
|
+
export declare function repoRootOf(dir: string, git?: (args: string[]) => RunResult): string | null;
|
|
50
|
+
/**
|
|
51
|
+
* The real-runtime entry point: loads the saved connection for the working
|
|
52
|
+
* directory (or `opts.path`) and applies it. With an explicit `env` (tests),
|
|
53
|
+
* the user file is looked up under env.HOME only, so a developer's own saved
|
|
54
|
+
* connection never leaks into a test run.
|
|
55
|
+
*/
|
|
56
|
+
export declare function connectionDefaults<T extends {
|
|
57
|
+
profile?: string;
|
|
58
|
+
region?: string;
|
|
59
|
+
path?: string;
|
|
60
|
+
}>(opts: T, env?: NodeJS.ProcessEnv): T & ConnectionDefaults;
|
|
61
|
+
/** The account-change warning, or null when the account is the one that was verified. */
|
|
62
|
+
export declare function accountChangeWarning(c: SavedConnection | undefined, account: string): string | null;
|
|
63
|
+
/** `aws configure get region [--profile p]`: local config only, no AWS call. */
|
|
64
|
+
export declare function configuredRegion(profile?: string): string | null;
|
|
65
|
+
/** `aws configure list-profiles`: local config only, no AWS call. */
|
|
66
|
+
export declare function listProfiles(): string[];
|
|
67
|
+
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/aws/connection.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAO,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEvD,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AACxD,eAAO,MAAM,oBAAoB,0BAA0B,CAAC;AAE5D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,CAAC;AAC9C,MAAM,WAAW,eAAgB,SAAQ,aAAa;IAAG,KAAK,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AAE/F,uDAAuD;AACvD,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yGAAyG;IACzG,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uFAAuF;IACvF,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED,iHAAiH;AACjH,eAAO,MAAM,mBAAmB,UAAsJ,CAAC;AAEvL,eAAO,MAAM,UAAU,QAAiC,CAAC;AACzD,eAAO,MAAM,SAAS,QAAiC,CAAC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AAE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,GAAG,CAAC,GAAG,kBAAkB,CAK3J;AAED,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,eAAe,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAInG;AAED,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGhE;AAED,qEAAqE;AACrE,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAGvC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The saved AWS connection from `prism-cli aws connect`, and the one resolver
|
|
3
|
+
* every AWS command uses to pick its default profile and region.
|
|
4
|
+
*
|
|
5
|
+
* What is saved is a profile NAME, a region and what that pair was verified
|
|
6
|
+
* as (account, alias, when). Never a credential: the AWS CLI still resolves
|
|
7
|
+
* the profile's credentials itself, every time.
|
|
8
|
+
*
|
|
9
|
+
* Files:
|
|
10
|
+
* ~/.prism/aws.json per user
|
|
11
|
+
* .prism/aws.local.json per repo override (git-ignored via .git/info/exclude)
|
|
12
|
+
*
|
|
13
|
+
* Precedence, per field:
|
|
14
|
+
* profile: --profile > env credentials (AWS_PROFILE, AWS_ACCESS_KEY_ID, ...) > repo file > user file > default chain
|
|
15
|
+
* region: --region > AWS_REGION > AWS_DEFAULT_REGION > saved region > the profile's configured region
|
|
16
|
+
* The saved region is used only together with its saved profile (the two were
|
|
17
|
+
* verified as a pair): `--profile other` falls through to other's own region.
|
|
18
|
+
*/
|
|
19
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
20
|
+
import { homedir } from 'node:os';
|
|
21
|
+
import { dirname, join, resolve } from 'node:path';
|
|
22
|
+
import { run } from '../utils/exec.js';
|
|
23
|
+
export const USER_CONNECTION_PATH = '~/.prism/aws.json';
|
|
24
|
+
export const REPO_CONNECTION_PATH = '.prism/aws.local.json';
|
|
25
|
+
/** Credential env vars that the AWS CLI prefers over any profile; when set, the saved profile is not applied. */
|
|
26
|
+
export const ENV_CREDENTIAL_VARS = ['AWS_PROFILE', 'AWS_ACCESS_KEY_ID', 'AWS_WEB_IDENTITY_TOKEN_FILE', 'AWS_CONTAINER_CREDENTIALS_FULL_URI', 'AWS_CONTAINER_CREDENTIALS_RELATIVE_URI'];
|
|
27
|
+
export const PROFILE_RE = /^[A-Za-z0-9_.+=,@:-]{1,128}$/;
|
|
28
|
+
export const REGION_RE = /^[a-z]{2}(-[a-z]+)+-\d{1,2}$/;
|
|
29
|
+
const ACCOUNT_RE = /^\d{12}$/;
|
|
30
|
+
export const userConnectionPath = (home) => join(home, '.prism', 'aws.json');
|
|
31
|
+
export const repoConnectionPath = (root) => resolve(root, REPO_CONNECTION_PATH);
|
|
32
|
+
function parse(x) {
|
|
33
|
+
if (!x || typeof x !== 'object')
|
|
34
|
+
return null;
|
|
35
|
+
if (typeof x.profile !== 'string' || !PROFILE_RE.test(x.profile))
|
|
36
|
+
return null;
|
|
37
|
+
if (typeof x.region !== 'string' || !REGION_RE.test(x.region))
|
|
38
|
+
return null;
|
|
39
|
+
if (typeof x.account !== 'string' || !ACCOUNT_RE.test(x.account))
|
|
40
|
+
return null;
|
|
41
|
+
return {
|
|
42
|
+
profile: x.profile, region: x.region, account: x.account,
|
|
43
|
+
alias: typeof x.alias === 'string' && x.alias ? x.alias : null,
|
|
44
|
+
verifiedAt: typeof x.verifiedAt === 'string' ? x.verifiedAt : '',
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** The connection in `path`; null when the file is absent or not a valid connection. */
|
|
48
|
+
export function readConnectionFile(path) {
|
|
49
|
+
try {
|
|
50
|
+
return parse(JSON.parse(readFileSync(path, 'utf8')));
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Atomic write, owner-only (no secrets inside, but it is per-user state). */
|
|
57
|
+
export function writeConnectionFile(path, c) {
|
|
58
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
59
|
+
const tmp = `${path}.${process.pid}.tmp`;
|
|
60
|
+
const body = { profile: c.profile, region: c.region, account: c.account, alias: c.alias, verifiedAt: c.verifiedAt };
|
|
61
|
+
writeFileSync(tmp, JSON.stringify(body, null, 2) + '\n', { mode: 0o600 });
|
|
62
|
+
renameSync(tmp, path);
|
|
63
|
+
}
|
|
64
|
+
/** Removes the file; true when there was one. */
|
|
65
|
+
export function clearConnectionFile(path) {
|
|
66
|
+
if (!existsSync(path))
|
|
67
|
+
return false;
|
|
68
|
+
rmSync(path, { force: true });
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
/** The repo file first, then the user file. `home` '' means no user file. */
|
|
72
|
+
export function loadConnection(home, repoRoot) {
|
|
73
|
+
if (repoRoot) {
|
|
74
|
+
const p = repoConnectionPath(repoRoot);
|
|
75
|
+
const c = readConnectionFile(p);
|
|
76
|
+
if (c)
|
|
77
|
+
return { ...c, scope: 'repo', path: p };
|
|
78
|
+
}
|
|
79
|
+
if (home) {
|
|
80
|
+
const p = userConnectionPath(home);
|
|
81
|
+
const c = readConnectionFile(p);
|
|
82
|
+
if (c)
|
|
83
|
+
return { ...c, scope: 'user', path: p };
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
export const connectionLabel = (c) => `aws connect, ${c.scope}`;
|
|
88
|
+
/**
|
|
89
|
+
* Fills the profile from the saved connection when neither a flag nor the
|
|
90
|
+
* environment chose the credentials, and attaches the connection whose region
|
|
91
|
+
* applies. Pure: the caller loads the connection.
|
|
92
|
+
*/
|
|
93
|
+
export function applyConnection(opts, saved, env) {
|
|
94
|
+
if (opts.profile)
|
|
95
|
+
return { ...opts, profileSource: '--profile', connection: saved && saved.profile === opts.profile ? saved : undefined };
|
|
96
|
+
if (ENV_CREDENTIAL_VARS.some((k) => env[k])) {
|
|
97
|
+
return { ...opts, connection: saved && env.AWS_PROFILE === saved.profile ? saved : undefined };
|
|
98
|
+
}
|
|
99
|
+
if (saved)
|
|
100
|
+
return { ...opts, profile: saved.profile, profileSource: connectionLabel(saved), connection: saved };
|
|
101
|
+
return { ...opts };
|
|
102
|
+
}
|
|
103
|
+
/** `git -C dir rev-parse --show-toplevel`, or null outside a repository. */
|
|
104
|
+
export function repoRootOf(dir, git = (a) => run('git', a)) {
|
|
105
|
+
const r = git(['-C', dir, 'rev-parse', '--show-toplevel']);
|
|
106
|
+
return r.ok && r.stdout ? r.stdout.trim() : null;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The real-runtime entry point: loads the saved connection for the working
|
|
110
|
+
* directory (or `opts.path`) and applies it. With an explicit `env` (tests),
|
|
111
|
+
* the user file is looked up under env.HOME only, so a developer's own saved
|
|
112
|
+
* connection never leaks into a test run.
|
|
113
|
+
*/
|
|
114
|
+
export function connectionDefaults(opts, env) {
|
|
115
|
+
const e = env ?? process.env;
|
|
116
|
+
const home = env ? (env.HOME ?? '') : homedir();
|
|
117
|
+
const root = repoRootOf(opts.path ? resolve(opts.path) : process.cwd());
|
|
118
|
+
return applyConnection(opts, loadConnection(home, root), e);
|
|
119
|
+
}
|
|
120
|
+
/** The account-change warning, or null when the account is the one that was verified. */
|
|
121
|
+
export function accountChangeWarning(c, account) {
|
|
122
|
+
if (!c || !account || c.account === account)
|
|
123
|
+
return null;
|
|
124
|
+
return `Warning: aws connect verified profile ${c.profile} as account ${c.account}${c.verifiedAt ? ` on ${c.verifiedAt}` : ''}, but it now resolves to account ${account}. `
|
|
125
|
+
+ `Check the profile, then re-run prism-cli aws connect${c.scope === 'repo' ? ' --repo' : ''}.`;
|
|
126
|
+
}
|
|
127
|
+
/** `aws configure get region [--profile p]`: local config only, no AWS call. */
|
|
128
|
+
export function configuredRegion(profile) {
|
|
129
|
+
const r = run('aws', ['configure', 'get', 'region', ...(profile ? ['--profile', profile] : [])]);
|
|
130
|
+
return r.ok && r.stdout ? r.stdout.trim() : null;
|
|
131
|
+
}
|
|
132
|
+
/** `aws configure list-profiles`: local config only, no AWS call. */
|
|
133
|
+
export function listProfiles() {
|
|
134
|
+
const r = run('aws', ['configure', 'list-profiles']);
|
|
135
|
+
return r.ok ? r.stdout.split('\n').map((l) => l.trim()).filter(Boolean) : [];
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/aws/connection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,GAAG,EAAkB,MAAM,kBAAkB,CAAC;AAEvD,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AACxD,MAAM,CAAC,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAsB5D,iHAAiH;AACjH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,aAAa,EAAE,mBAAmB,EAAE,6BAA6B,EAAE,oCAAoC,EAAE,wCAAwC,CAAC,CAAC;AAEvL,MAAM,CAAC,MAAM,UAAU,GAAG,8BAA8B,CAAC;AACzD,MAAM,CAAC,MAAM,SAAS,GAAG,8BAA8B,CAAC;AACxD,MAAM,UAAU,GAAG,UAAU,CAAC;AAE9B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AAC7F,MAAM,CAAC,MAAM,kBAAkB,GAAG,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