@prism-d1/cli 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +250 -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 +70 -0
- package/dist/src/aws/recommend.d.ts.map +1 -0
- package/dist/src/aws/recommend.js +244 -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 +91 -0
- package/dist/src/aws/run-check.js.map +1 -0
- 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/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/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/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/setup.d.ts +18 -2
- package/dist/src/security/setup.d.ts.map +1 -1
- package/dist/src/security/setup.js +28 -14
- package/dist/src/security/setup.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/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fixed mapping behind `prism-cli aws recommend`: one entry per check id
|
|
3
|
+
* aws check can return. A test fails when a check id has no entry.
|
|
4
|
+
*
|
|
5
|
+
* effort: quick = one command or console toggle; medium = a setup step that
|
|
6
|
+
* takes some decisions; large = a project (migrating users, redesigning access).
|
|
7
|
+
*/
|
|
8
|
+
export type Effort = 'quick' | 'medium' | 'large';
|
|
9
|
+
export interface Advice {
|
|
10
|
+
title: string;
|
|
11
|
+
why: string;
|
|
12
|
+
steps: string[];
|
|
13
|
+
/** The prism-cli command that fixes it, when there is one. */
|
|
14
|
+
command?: string;
|
|
15
|
+
doc: string;
|
|
16
|
+
effort: Effort;
|
|
17
|
+
/** IAM actions the check reads; shown when the check was INDETERMINATE. */
|
|
18
|
+
needs?: string[];
|
|
19
|
+
/** Replaces the generic "grant read access" item when INDETERMINATE means something else. */
|
|
20
|
+
indeterminate?: string;
|
|
21
|
+
/** Checks with the same key are one fix in aws recommend (default: the check id). */
|
|
22
|
+
key?: string;
|
|
23
|
+
/** The key of a fix this check can only be judged after (INDETERMINATE for that reason points at it). */
|
|
24
|
+
prerequisite?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Title and wording for a key that several checks share. `first` names the fix when another check waits on it. */
|
|
27
|
+
export declare const GROUPS: Record<string, {
|
|
28
|
+
title: string;
|
|
29
|
+
why: string;
|
|
30
|
+
first: string;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const ADVICE: Record<string, Advice>;
|
|
33
|
+
//# sourceMappingURL=advice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advice.d.ts","sourceRoot":"","sources":["../../../src/aws/advice.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElD,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,6FAA6F;IAC7F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yGAAyG;IACzG,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,mHAAmH;AACnH,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAMhF,CAAC;AAiBF,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA0JzC,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/** Title and wording for a key that several checks share. `first` names the fix when another check waits on it. */
|
|
2
|
+
export const GROUPS = {
|
|
3
|
+
budgets: {
|
|
4
|
+
title: 'Create AWS Budgets: one for all spend, plus filters for Bedrock and AWS Marketplace',
|
|
5
|
+
why: 'Without budgets unexpected spend raises no alert, and Bedrock\'s third-party models bill under Marketplace, so a Bedrock-only filter misses them.',
|
|
6
|
+
first: 'Create the budgets',
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
const IAM = 'https://docs.aws.amazon.com/IAM/latest/UserGuide';
|
|
10
|
+
const COST = 'https://docs.aws.amazon.com/cost-management/latest/userguide';
|
|
11
|
+
const BEDROCK = 'https://docs.aws.amazon.com/bedrock/latest/userguide';
|
|
12
|
+
const GUIDE = 'https://github.com/aws-samples/sample-prism-d1-velocity/blob/main/USER_GUIDE.md';
|
|
13
|
+
const CREDENTIAL_REPORT = ['iam:GetCredentialReport (the report must exist: run aws iam generate-credential-report once, or prism-cli bedrock-protection scan-account)'];
|
|
14
|
+
const rootMfa = {
|
|
15
|
+
title: 'Add MFA to the root user', why: 'Root cannot be limited by SCPs or permission boundaries; without MFA a leaked root password is a full account takeover.',
|
|
16
|
+
steps: [
|
|
17
|
+
'Sign in as the root user.', 'Security credentials > Assign MFA device; prefer a FIDO2 security key.',
|
|
18
|
+
'In some managed or organization accounts the root user is controlled centrally; check with your account owner.',
|
|
19
|
+
],
|
|
20
|
+
doc: `${IAM}/enable-mfa-for-root.html`, effort: 'quick', needs: ['iam:GetAccountSummary'],
|
|
21
|
+
};
|
|
22
|
+
export const ADVICE = {
|
|
23
|
+
// -- bedrock (bedrock-protection scan-account) ---------------------------------
|
|
24
|
+
'bedrock.root-mfa': rootMfa,
|
|
25
|
+
'bedrock.root-access-keys': {
|
|
26
|
+
title: 'Delete the root access keys', why: 'Root keys are long-lived and unconstrainable: the worst credential to leak.',
|
|
27
|
+
steps: ['Sign in as root > Security credentials > Access keys > Delete.', 'Move any automation that used them to an IAM role.'],
|
|
28
|
+
doc: `${IAM}/root-user-best-practices.html`, effort: 'quick', needs: ['iam:GetAccountSummary'],
|
|
29
|
+
},
|
|
30
|
+
'bedrock.password-policy': {
|
|
31
|
+
title: 'Set an account password policy', why: 'Without one only the AWS defaults apply (8 characters, no reuse rules).',
|
|
32
|
+
steps: ['aws iam update-account-password-policy --minimum-password-length 14 --require-symbols --require-numbers --password-reuse-prevention 24', 'Better: move console users to IAM Identity Center.'],
|
|
33
|
+
doc: `${IAM}/id_credentials_passwords_account-policy.html`, effort: 'quick', needs: ['iam:GetAccountPasswordPolicy'],
|
|
34
|
+
},
|
|
35
|
+
'bedrock.access-key-age': {
|
|
36
|
+
title: 'Rotate or remove long-lived access keys', why: 'Old static keys are what LLMjacking attackers steal and burn on Bedrock.',
|
|
37
|
+
steps: ['List the flagged keys (prism-cli bedrock-protection scan-account).', 'Replace each with a role (SSO, OIDC, instance profile), or rotate and delete the old key.'],
|
|
38
|
+
doc: `${IAM}/id_credentials_access-keys.html`, effort: 'medium', needs: CREDENTIAL_REPORT,
|
|
39
|
+
},
|
|
40
|
+
'bedrock.console-user-no-mfa': {
|
|
41
|
+
title: 'Require MFA for console users', why: 'A console password without MFA falls to phishing or reuse.',
|
|
42
|
+
steps: ['Assign an MFA device to each flagged user, or move them to IAM Identity Center.'],
|
|
43
|
+
doc: `${IAM}/id_credentials_mfa_enable.html`, effort: 'medium', needs: CREDENTIAL_REPORT,
|
|
44
|
+
},
|
|
45
|
+
'bedrock.unused-credentials': {
|
|
46
|
+
title: 'Remove unused credentials', why: 'Idle passwords and keys are attack surface nobody watches.',
|
|
47
|
+
steps: ['Deactivate the flagged passwords and keys, wait a week, then delete them.'],
|
|
48
|
+
doc: `${IAM}/id_credentials_finding-unused.html`, effort: 'quick', needs: CREDENTIAL_REPORT,
|
|
49
|
+
},
|
|
50
|
+
'bedrock.user-admin-policy': {
|
|
51
|
+
title: 'Take AdministratorAccess off IAM users', why: 'Any access key of such a user is an unbounded credential.',
|
|
52
|
+
steps: ['Create an admin role gated on MFA (or an Identity Center permission set).', 'Detach AdministratorAccess from the users.'],
|
|
53
|
+
doc: `${IAM}/best-practices.html`, effort: 'large', needs: ['iam:ListUsers', 'iam:ListAttachedUserPolicies'],
|
|
54
|
+
},
|
|
55
|
+
'bedrock.bedrock-budget': {
|
|
56
|
+
title: 'Add a budget that covers Bedrock', why: 'Runaway inference from a stolen key has no ceiling and raises no alert.',
|
|
57
|
+
steps: ['Billing > Budgets > Create a monthly COST budget filtered on Service contains "Bedrock".', 'Alert at 50/80/100% to an SNS topic.'],
|
|
58
|
+
doc: `${COST}/budgets-create.html`, effort: 'quick', needs: ['budgets:ViewBudget'], key: 'budgets',
|
|
59
|
+
},
|
|
60
|
+
'bedrock.marketplace-budget': {
|
|
61
|
+
title: 'Add a budget that covers AWS Marketplace (Bedrock Edition models)', why: 'Third-party models bill under Marketplace, so a Bedrock-only budget misses them.',
|
|
62
|
+
steps: ['Create a second COST budget filtered on Service = AWS Marketplace, or one Cost Category covering both.'],
|
|
63
|
+
doc: `${COST}/budgets-create.html`, effort: 'quick', needs: ['budgets:ViewBudget'], key: 'budgets',
|
|
64
|
+
},
|
|
65
|
+
'bedrock.budget-alerting': {
|
|
66
|
+
title: 'Make the Bedrock budgets notify someone', why: 'A budget with no subscriber records the overspend without telling anyone.',
|
|
67
|
+
steps: ['Add 50/80/100% notification thresholds with an SNS topic (or email) subscriber to each covering budget.'],
|
|
68
|
+
doc: `${COST}/budgets-sns-policy.html`, effort: 'quick', needs: ['budgets:ViewBudget'], prerequisite: 'budgets',
|
|
69
|
+
},
|
|
70
|
+
'bedrock.cost-explorer-enabled': {
|
|
71
|
+
title: 'Enable Cost Explorer', why: 'Anomaly detection and cost checks need it, and it stays off until someone turns it on.',
|
|
72
|
+
steps: ['Billing > Cost Explorer > Enable (data appears within 24 hours).'],
|
|
73
|
+
doc: `${COST}/ce-enable.html`, effort: 'quick', needs: ['ce:GetAnomalyMonitors'],
|
|
74
|
+
},
|
|
75
|
+
'bedrock.anomaly-monitor': {
|
|
76
|
+
title: 'Add a cost anomaly monitor with an alert subscription', why: 'It catches spend spikes a fixed budget threshold misses.',
|
|
77
|
+
steps: ['Billing > Cost Anomaly Detection > Create an AWS services monitor.', 'Add an alert subscription (SNS or email).'],
|
|
78
|
+
doc: `${COST}/getting-started-ad.html`, effort: 'quick', needs: ['ce:GetAnomalyMonitors', 'ce:GetAnomalySubscriptions'],
|
|
79
|
+
},
|
|
80
|
+
'bedrock.bedrock-invocation-alarm': {
|
|
81
|
+
title: 'Alarm on Bedrock invocation volume', why: 'Cost data lags up to a day; the AWS/Bedrock metrics are the only fast signal.',
|
|
82
|
+
steps: ['Create CloudWatch alarms on AWS/Bedrock Invocations and InputTokenCount above normal peak.'],
|
|
83
|
+
doc: `${BEDROCK}/monitoring.html`, effort: 'medium', needs: ['cloudwatch:DescribeAlarms'],
|
|
84
|
+
},
|
|
85
|
+
'bedrock.guardduty-ai-protection': {
|
|
86
|
+
title: 'Enable GuardDuty AI Protection', why: 'It detects cost-harvesting patterns against Bedrock.',
|
|
87
|
+
steps: ['Enable GuardDuty in the region if needed, then the AI_PROTECTION feature on the detector (org-wide from the delegated administrator if you can).'],
|
|
88
|
+
doc: 'https://docs.aws.amazon.com/guardduty/latest/ug/what-is-guardduty.html', effort: 'quick', needs: ['guardduty:ListDetectors', 'guardduty:GetDetector'],
|
|
89
|
+
},
|
|
90
|
+
'bedrock.provisioned-throughput': {
|
|
91
|
+
title: 'Review Provisioned Throughput commitments', why: 'A commitment bills whether or not it is used, and is a target for misuse.',
|
|
92
|
+
steps: ['Check each commitment is expected and owned; delete the ones nobody uses when their term allows.'],
|
|
93
|
+
doc: `${BEDROCK}/prov-throughput.html`, effort: 'medium', needs: ['bedrock:ListProvisionedModelThroughputs'],
|
|
94
|
+
},
|
|
95
|
+
'bedrock.model-invocation-logging': {
|
|
96
|
+
title: 'Turn on Bedrock model invocation logging', why: 'Without it you can see spend rose but not who or what caused it.',
|
|
97
|
+
steps: ['Bedrock console > Settings > Model invocation logging > CloudWatch Logs or S3.', 'Treat the destination as sensitive: it holds prompts and completions.'],
|
|
98
|
+
doc: `${BEDROCK}/model-invocation-logging.html`, effort: 'quick', needs: ['bedrock:GetModelInvocationLoggingConfiguration'],
|
|
99
|
+
},
|
|
100
|
+
// -- prism-setup -------------------------------------------------------------
|
|
101
|
+
'prism-setup.metrics-pipeline': {
|
|
102
|
+
title: 'Deploy the PRISM metrics pipeline', why: 'Without it CI and codeburn have nowhere to send PRISM metrics.',
|
|
103
|
+
steps: ['From the repo: cd infra && npm ci && npx cdk deploy PrismD1MetricsPipeline (see the workshop setup guide).'],
|
|
104
|
+
doc: `${GUIDE}`, effort: 'medium', needs: ['cloudformation:DescribeStacks'],
|
|
105
|
+
},
|
|
106
|
+
'prism-setup.security-agent-stack': {
|
|
107
|
+
title: 'Set up AWS Security Agent', why: 'The CI eval gate and the security commands need its stack.',
|
|
108
|
+
steps: ['Run the command below; it shows a diff and asks before any change.'], command: 'prism-cli enable security',
|
|
109
|
+
doc: `${GUIDE}#security-agent-setup-enable-security`, effort: 'quick', needs: ['cloudformation:DescribeStacks', 'cloudformation:GetTemplate'],
|
|
110
|
+
},
|
|
111
|
+
'prism-setup.security-agent-ssm': {
|
|
112
|
+
title: 'Restore the Security Agent SSM parameters', why: 'The CI gate and security commands find the agent space and scan bucket through /prism/continuum/*.',
|
|
113
|
+
steps: ['Run the command below (the stack owns these parameters; do not edit them by hand).'], command: 'prism-cli enable security',
|
|
114
|
+
doc: `${GUIDE}#security-agent-setup-enable-security`, effort: 'quick', needs: ['ssm:GetParameter', 'securityagent:ListAgentSpaces'],
|
|
115
|
+
},
|
|
116
|
+
'prism-setup.scan-bucket-listed': {
|
|
117
|
+
title: 'List the scan bucket on the Security Agent space', why: 'security threat-model fails when the agent space does not list the scan bucket.',
|
|
118
|
+
steps: ['Run the command below to update the stack.'], command: 'prism-cli enable security',
|
|
119
|
+
doc: `${GUIDE}#security-agent-setup-enable-security`, effort: 'quick', needs: ['securityagent:BatchGetAgentSpaces'],
|
|
120
|
+
},
|
|
121
|
+
'prism-setup.ci-oidc-role': {
|
|
122
|
+
title: 'Create the CI OIDC provider and role', why: 'CI should publish PRISM metrics with short-lived OIDC credentials, not stored keys.',
|
|
123
|
+
steps: ['Run the command below (or bootstrapper setup-gitlab-oidc for GitLab).', 'Set PRISM_METRICS_ROLE_ARN in the CI settings to the role it prints.'],
|
|
124
|
+
command: 'prism-cli bootstrapper setup-github-oidc', doc: GUIDE, effort: 'quick', needs: ['iam:ListOpenIDConnectProviders', 'iam:ListRoles'],
|
|
125
|
+
},
|
|
126
|
+
'prism-setup.codeburn-sync': {
|
|
127
|
+
title: 'Connect codeburn to the PRISM collector', why: 'This machine sends no AI usage telemetry to PRISM until codeburn sync is set up.',
|
|
128
|
+
steps: ['Run the command below; it installs codeburn if missing and schedules the sync.'], command: 'prism-cli enable codeburn',
|
|
129
|
+
doc: GUIDE, effort: 'quick', indeterminate: 'The codeburn sync config (~/.config/codeburn/sync.json) could not be read; check the file or re-run prism-cli enable codeburn.',
|
|
130
|
+
},
|
|
131
|
+
// -- baseline ----------------------------------------------------------------
|
|
132
|
+
'baseline.cloudtrail-multiregion': {
|
|
133
|
+
title: 'Log API activity in every region with a multi-region trail', why: 'Without it activity in other regions leaves no record for an investigation.',
|
|
134
|
+
steps: ['aws cloudtrail create-trail --name prism-audit --s3-bucket-name <bucket> --is-multi-region-trail', 'aws cloudtrail start-logging --name prism-audit', 'In an organization, prefer one organization trail from the management account.'],
|
|
135
|
+
doc: 'https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-and-update-a-trail.html', effort: 'medium', needs: ['cloudtrail:DescribeTrails', 'cloudtrail:GetTrailStatus'],
|
|
136
|
+
},
|
|
137
|
+
'baseline.guardduty': {
|
|
138
|
+
title: 'Enable GuardDuty', why: 'It is the managed threat detection for compromised credentials and instances.',
|
|
139
|
+
steps: ['aws guardduty create-detector --enable --region <region>', 'In an organization, enable it from a delegated administrator with auto-enable.'],
|
|
140
|
+
doc: 'https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_settingup.html', effort: 'quick', needs: ['guardduty:ListDetectors', 'guardduty:GetDetector'],
|
|
141
|
+
},
|
|
142
|
+
'baseline.securityhub': {
|
|
143
|
+
title: 'Enable Security Hub', why: 'It runs the AWS Foundational Security Best Practices checks continuously and collects findings in one place.',
|
|
144
|
+
steps: ['Security Hub console > Enable, with the AWS Foundational Security Best Practices standard.'],
|
|
145
|
+
doc: 'https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-settingup.html', effort: 'quick', needs: ['securityhub:DescribeHub'],
|
|
146
|
+
},
|
|
147
|
+
'baseline.access-analyzer': {
|
|
148
|
+
title: 'Create an IAM Access Analyzer', why: 'It flags buckets, roles and keys shared outside the account.',
|
|
149
|
+
steps: ['aws accessanalyzer create-analyzer --analyzer-name prism --type ACCOUNT --region <region>'],
|
|
150
|
+
doc: `${IAM}/access-analyzer-getting-started.html`, effort: 'quick', needs: ['access-analyzer:ListAnalyzers'],
|
|
151
|
+
},
|
|
152
|
+
'baseline.budget': {
|
|
153
|
+
title: 'Create an AWS Budget', why: 'Without a budget, unexpected spend raises no alert.',
|
|
154
|
+
steps: ['Billing > Budgets > Create a monthly cost budget for all services with 80% and 100% alerts.'],
|
|
155
|
+
doc: `${COST}/budgets-create.html`, effort: 'quick', needs: ['budgets:ViewBudget'], key: 'budgets',
|
|
156
|
+
},
|
|
157
|
+
'baseline.s3-account-bpa': {
|
|
158
|
+
title: 'Turn on S3 Block Public Access for the account', why: 'One misconfigured bucket policy or ACL is otherwise enough to publish data.',
|
|
159
|
+
steps: ['aws s3control put-public-access-block --account-id <account> --public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true', 'First check no bucket needs public access on purpose.'],
|
|
160
|
+
doc: 'https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html', effort: 'quick', needs: ['s3:GetAccountPublicAccessBlock'],
|
|
161
|
+
},
|
|
162
|
+
'baseline.ebs-default-encryption': {
|
|
163
|
+
title: 'Encrypt new EBS volumes by default', why: 'Unencrypted volumes and snapshots can expose data when shared or copied.',
|
|
164
|
+
steps: ['aws ec2 enable-ebs-encryption-by-default --region <region> (applies to new volumes only).'],
|
|
165
|
+
doc: 'https://docs.aws.amazon.com/ebs/latest/userguide/ebs-encryption.html', effort: 'quick', needs: ['ec2:GetEbsEncryptionByDefault'],
|
|
166
|
+
},
|
|
167
|
+
// -- startup-advisor ---------------------------------------------------------
|
|
168
|
+
'startup-advisor.not-integrated': {
|
|
169
|
+
title: 'Startup Advisor checks', why: 'Planned: PRISM will reuse Startup Advisor\'s account checks once how to consume them, and the license, are settled.',
|
|
170
|
+
steps: ['Nothing to do yet.'], doc: 'https://github.com/aws-samples/sample-prism-d1-velocity/blob/main/docs/PRISM-CLI-STATUS.md', effort: 'quick',
|
|
171
|
+
indeterminate: 'Not integrated yet; nothing to grant or fix.',
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
//# sourceMappingURL=advice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advice.js","sourceRoot":"","sources":["../../../src/aws/advice.ts"],"names":[],"mappings":"AA2BA,mHAAmH;AACnH,MAAM,CAAC,MAAM,MAAM,GAAkE;IACnF,OAAO,EAAE;QACP,KAAK,EAAE,qFAAqF;QAC5F,GAAG,EAAE,mJAAmJ;QACxJ,KAAK,EAAE,oBAAoB;KAC5B;CACF,CAAC;AAEF,MAAM,GAAG,GAAG,kDAAkD,CAAC;AAC/D,MAAM,IAAI,GAAG,8DAA8D,CAAC;AAC5E,MAAM,OAAO,GAAG,sDAAsD,CAAC;AACvE,MAAM,KAAK,GAAG,iFAAiF,CAAC;AAChG,MAAM,iBAAiB,GAAG,CAAC,4IAA4I,CAAC,CAAC;AAEzK,MAAM,OAAO,GAAW;IACtB,KAAK,EAAE,0BAA0B,EAAE,GAAG,EAAE,y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BAAiB,EAAE;QACjB,KAAK,EAAE,sBAAsB,EAAE,GAAG,EAAE,qDAAqD;QACzF,KAAK,EAAE,CAAC,6FAA6F,CAAC;QACtG,GAAG,EAAE,GAAG,IAAI,sBAAsB,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,oBAAoB,CAAC,EAAE,GAAG,EAAE,SAAS;KACnG;IACD,yBAAyB,EAAE;QACzB,KAAK,EAAE,gDAAgD,EAAE,GAAG,EAAE,6EAA6E;QAC3I,KAAK,EAAE,CAAC,+LAA+L,EAAE,uDAAuD,CAAC;QACjQ,GAAG,EAAE,+FAA+F,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,gCAAgC,CAAC;KACjK;IACD,iCAAiC,EAAE;QACjC,KAAK,EAAE,oCAAoC,EAAE,GAAG,EAAE,0EAA0E;QAC5H,KAAK,EAAE,CAAC,2FAA2F,CAAC;QACpG,GAAG,EAAE,sEAAsE,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,+BAA+B,CAAC;KACvI;IAED,+EAA+E;IAC/E,gCAAgC,EAAE;QAChC,KAAK,EAAE,wBAAwB,EAAE,GAAG,EAAE,qHAAqH;QAC3J,KAAK,EAAE,CAAC,oBAAoB,CAAC,EAAE,GAAG,EAAE,4FAA4F,EAAE,MAAM,EAAE,OAAO;QACjJ,aAAa,EAAE,8CAA8C;KAC9D;CACF,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `prism-cli aws check`: read-only account checks on the audit framework
|
|
3
|
+
* (utils/audit.ts), in pluggable sections. A section is a name, a heading,
|
|
4
|
+
* the check ids it can return, and a run function; SECTIONS is the registry.
|
|
5
|
+
*
|
|
6
|
+
* Every AWS call here is a read. INDETERMINATE (a denied or failed read) is
|
|
7
|
+
* never counted as a pass.
|
|
8
|
+
*/
|
|
9
|
+
import { type AwsTarget } from '../utils/aws.js';
|
|
10
|
+
import { type Finding, type Severity } from '../utils/audit.js';
|
|
11
|
+
import { type Ctx, type Deps, type Resolved } from '../security/setup.js';
|
|
12
|
+
export interface CheckContext {
|
|
13
|
+
target: AwsTarget;
|
|
14
|
+
account: string;
|
|
15
|
+
region: string;
|
|
16
|
+
home: string;
|
|
17
|
+
/** A read-only enable-security context, for the Security Agent rows. */
|
|
18
|
+
security: Ctx;
|
|
19
|
+
}
|
|
20
|
+
export interface CheckSection {
|
|
21
|
+
name: string;
|
|
22
|
+
heading: string;
|
|
23
|
+
/** Every check id run() can return (without the section prefix). */
|
|
24
|
+
ids: readonly string[];
|
|
25
|
+
run(c: CheckContext): Finding[];
|
|
26
|
+
}
|
|
27
|
+
/** `<section>.<id>`: one id space across sections (a check appears in one section only). */
|
|
28
|
+
export declare const checkId: (section: string, id: string) => string;
|
|
29
|
+
export declare const bedrockSection: CheckSection;
|
|
30
|
+
export declare function metricsPipeline(c: CheckContext): Finding;
|
|
31
|
+
/** Maps the enable security --status rows to findings. A row that never appeared (the report stopped) is INDETERMINATE. */
|
|
32
|
+
export declare function securityAgent(c: CheckContext): Finding[];
|
|
33
|
+
export declare function ciOidcRole(c: CheckContext): Finding;
|
|
34
|
+
/** Local only: the endpoint codeburn syncs to (~/.config/codeburn/sync.json). No AWS call. */
|
|
35
|
+
export declare function codeburnSync(c: CheckContext): Finding;
|
|
36
|
+
export declare const prismSetupSection: CheckSection;
|
|
37
|
+
export declare function cloudTrail(c: CheckContext): Finding;
|
|
38
|
+
export declare function guardDuty(c: CheckContext): Finding;
|
|
39
|
+
export declare function securityHub(c: CheckContext): Finding;
|
|
40
|
+
export declare function accessAnalyzer(c: CheckContext): Finding;
|
|
41
|
+
export declare function budget(c: CheckContext): Finding;
|
|
42
|
+
export declare function s3PublicAccess(c: CheckContext): Finding;
|
|
43
|
+
export declare function ebsEncryption(c: CheckContext): Finding;
|
|
44
|
+
export declare const baselineSection: CheckSection;
|
|
45
|
+
export declare const startupAdvisorSection: CheckSection;
|
|
46
|
+
export declare const SECTIONS: CheckSection[];
|
|
47
|
+
/** Every full check id any section can return. */
|
|
48
|
+
export declare const ALL_CHECK_IDS: string[];
|
|
49
|
+
/** The sections named by --section (all when none), or an error naming the valid ones. */
|
|
50
|
+
export declare function selectSections(names: string[] | undefined): CheckSection[] | {
|
|
51
|
+
error: string;
|
|
52
|
+
};
|
|
53
|
+
export interface SectionCounts {
|
|
54
|
+
pass: number;
|
|
55
|
+
fail: number;
|
|
56
|
+
indeterminate: number;
|
|
57
|
+
}
|
|
58
|
+
export declare function countFindings(findings: Finding[]): SectionCounts;
|
|
59
|
+
export declare function failBySeverity(findings: Finding[]): Record<Severity, number>;
|
|
60
|
+
/** FAIL findings at or above `failOn` (none when failOn is null). */
|
|
61
|
+
export declare function breaching(findings: Finding[], failOn: Severity | null): Finding[];
|
|
62
|
+
/** A read-only enable-security context for collectSecurityStatus. Repo rows are skipped (git reports no repo). */
|
|
63
|
+
export declare function securityContext(opts: Resolved, aws: Deps['aws'], env: NodeJS.ProcessEnv, awsVersion: () => string | null, log: (l?: string) => void): Ctx;
|
|
64
|
+
//# sourceMappingURL=check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/aws/check.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAgB,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EACkC,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAC1E,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,QAAQ,EAAE,GAAG,CAA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QAAQ,EAAE,YAAY,EAAgF,CAAC;AAEpH,kDAAkD;AAClD,eAAO,MAAM,aAAa,EAAE,MAAM,EAAoE,CAAC;AAEvG,0FAA0F;AAC1F,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,YAAY,EAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAK9F;AAED,MAAM,WAAW,aAAa;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE;AAEpF,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,aAAa,CAMhE;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAI5E;AAED,qEAAqE;AACrE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,GAAG,OAAO,EAAE,CAGjF;AAED,kHAAkH;AAClH,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,GAAG,CAazJ"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `prism-cli aws check`: read-only account checks on the audit framework
|
|
3
|
+
* (utils/audit.ts), in pluggable sections. A section is a name, a heading,
|
|
4
|
+
* the check ids it can return, and a run function; SECTIONS is the registry.
|
|
5
|
+
*
|
|
6
|
+
* Every AWS call here is a read. INDETERMINATE (a denied or failed read) is
|
|
7
|
+
* never counted as a pass.
|
|
8
|
+
*/
|
|
9
|
+
import { aws } from '../utils/aws.js';
|
|
10
|
+
import { severityRank } from '../utils/audit.js';
|
|
11
|
+
import { auditAccount, ACCOUNT_AUDIT_IDS } from '../utils/audit-account.js';
|
|
12
|
+
import { configuredSyncUrl } from '../commands/enable/codeburn.js';
|
|
13
|
+
import { collectSecurityStatus, PIPELINE_STACK, } from '../security/setup.js';
|
|
14
|
+
/** `<section>.<id>`: one id space across sections (a check appears in one section only). */
|
|
15
|
+
export const checkId = (section, id) => `${section}.${id}`;
|
|
16
|
+
const call = (c, args, region = c.region) => aws([...args, '--region', region], c.target);
|
|
17
|
+
const why = (r) => r.errorCode || r.raw.split('\n').map((l) => l.trim()).filter(Boolean).pop() || 'unknown error';
|
|
18
|
+
const pass = (b, detail) => ({ ...b, status: 'PASS', detail });
|
|
19
|
+
const fail = (b, detail, remediation) => ({ ...b, status: 'FAIL', detail, remediation });
|
|
20
|
+
/** A read that did not answer. `action` is the IAM action the check needs, when known. */
|
|
21
|
+
const unknown = (b, r, action) => ({
|
|
22
|
+
...b, status: 'INDETERMINATE',
|
|
23
|
+
detail: `Could not check (${typeof r === 'string' ? r : why(r)}).${action ? ` Needs ${action}.` : ''}`,
|
|
24
|
+
remediation: action ? `Grant ${action} (read-only) and re-run prism-cli aws check.` : undefined,
|
|
25
|
+
});
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
// bedrock: the bedrock-protection scan-account checks, unchanged
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
export const bedrockSection = {
|
|
30
|
+
name: 'bedrock',
|
|
31
|
+
heading: 'Bedrock protection (the bedrock-protection scan-account checks)',
|
|
32
|
+
ids: ACCOUNT_AUDIT_IDS,
|
|
33
|
+
run(c) {
|
|
34
|
+
// generateCredentialReport false: aws check never calls iam generate-credential-report.
|
|
35
|
+
return auditAccount(c.target, c.account, c.region, { maxKeyAge: 90, unusedDays: 90, runIam: true, runBedrock: true, generateCredentialReport: false })
|
|
36
|
+
.map((f) => ({ ...f, id: checkId('bedrock', f.id), category: 'bedrock' }));
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// prism-setup
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
const PS = (id, title, severity) => ({ id: checkId('prism-setup', id), category: 'prism-setup', title, severity });
|
|
43
|
+
const GITHUB_OIDC_HOST = 'token.actions.githubusercontent.com';
|
|
44
|
+
/** Role names bootstrapper setup-github-oidc / setup-gitlab-oidc create. */
|
|
45
|
+
const CI_ROLE = /^(GitHubActions|GitLabCI)-/;
|
|
46
|
+
export function metricsPipeline(c) {
|
|
47
|
+
const b = PS('metrics-pipeline', `PRISM metrics pipeline stack (${PIPELINE_STACK})`, 'MEDIUM');
|
|
48
|
+
const r = call(c, ['cloudformation', 'describe-stacks', '--stack-name', PIPELINE_STACK]);
|
|
49
|
+
const fix = `Deploy the metrics pipeline (infra/, cdk deploy ${PIPELINE_STACK}); see the PRISM workshop setup guide.`;
|
|
50
|
+
if (!r.ok)
|
|
51
|
+
return /does not exist/.test(r.raw) ? fail(b, `${PIPELINE_STACK} is not deployed in ${c.region}.`, fix) : unknown(b, r, 'cloudformation:DescribeStacks');
|
|
52
|
+
const status = String(r.json?.Stacks?.[0]?.StackStatus || 'UNKNOWN');
|
|
53
|
+
if (/_COMPLETE$/.test(status) && !/ROLLBACK_COMPLETE$|^DELETE_COMPLETE$/.test(status))
|
|
54
|
+
return pass(b, `${PIPELINE_STACK} is ${status} in ${c.region}.`);
|
|
55
|
+
return fail(b, `${PIPELINE_STACK} is ${status} in ${c.region}.`, fix);
|
|
56
|
+
}
|
|
57
|
+
/** Maps the enable security --status rows to findings. A row that never appeared (the report stopped) is INDETERMINATE. */
|
|
58
|
+
export function securityAgent(c) {
|
|
59
|
+
const { rows } = collectSecurityStatus(c.security);
|
|
60
|
+
const row = (label) => rows.find((r) => r[1] === label);
|
|
61
|
+
const stopped = rows.find((r) => r[1] === 'Stopped' || (r[1] === 'Credentials' && r[0] !== 'ok'));
|
|
62
|
+
const fix = 'Run prism-cli enable security (it shows a diff and asks before any change).';
|
|
63
|
+
const one = (b, r) => {
|
|
64
|
+
if (!r)
|
|
65
|
+
return unknown(b, stopped ? stopped[2] : 'not reached', undefined);
|
|
66
|
+
if (r[0] === 'ok')
|
|
67
|
+
return pass(b, r[2]);
|
|
68
|
+
if (r[0] === 'unknown')
|
|
69
|
+
return unknown(b, r[2]);
|
|
70
|
+
return fail(b, r[2], fix);
|
|
71
|
+
};
|
|
72
|
+
const ssm = ['SSM agent-space-id', 'SSM scan-bucket', 'SSM service-role-arn'].map(row);
|
|
73
|
+
const ssmB = PS('security-agent-ssm', 'Security Agent SSM parameters (/prism/continuum/*)', 'MEDIUM');
|
|
74
|
+
const ssmF = ssm.some((r) => !r) ? one(ssmB, undefined)
|
|
75
|
+
: ssm.every((r) => r[0] === 'ok') ? pass(ssmB, ssm.map((r) => r[2]).join('; '))
|
|
76
|
+
: fail(ssmB, ssm.filter((r) => r[0] !== 'ok').map((r) => r[2]).join('; '), fix);
|
|
77
|
+
return [
|
|
78
|
+
one(PS('security-agent-stack', 'Security Agent stack (PrismD1SecurityAgent or pipeline-hosted)', 'MEDIUM'), row('Stack')),
|
|
79
|
+
ssmF,
|
|
80
|
+
one(PS('scan-bucket-listed', 'Scan bucket listed on the Security Agent space', 'LOW'), row('Scan bucket on agent space')),
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
export function ciOidcRole(c) {
|
|
84
|
+
const b = PS('ci-oidc-role', 'GitHub/GitLab OIDC provider and CI role', 'MEDIUM');
|
|
85
|
+
const fix = 'Run prism-cli bootstrapper setup-github-oidc (or setup-gitlab-oidc) for the repo whose CI publishes PRISM metrics.';
|
|
86
|
+
const p = call(c, ['iam', 'list-open-id-connect-providers']);
|
|
87
|
+
if (!p.ok)
|
|
88
|
+
return unknown(b, p, 'iam:ListOpenIDConnectProviders');
|
|
89
|
+
const arns = (p.json?.OpenIDConnectProviderList || []).map((x) => String(x?.Arn || ''));
|
|
90
|
+
const providers = arns.filter((a) => a.endsWith(`/${GITHUB_OIDC_HOST}`) || /gitlab/i.test(a)).map((a) => a.split('oidc-provider/')[1]);
|
|
91
|
+
const r = call(c, ['iam', 'list-roles', '--query', 'Roles[].RoleName']);
|
|
92
|
+
if (!r.ok)
|
|
93
|
+
return unknown(b, r, 'iam:ListRoles');
|
|
94
|
+
const roles = (Array.isArray(r.json) ? r.json : []).map(String).filter((n) => CI_ROLE.test(n));
|
|
95
|
+
if (providers.length && roles.length)
|
|
96
|
+
return pass(b, `OIDC provider ${providers.join(', ')}; CI role ${roles.slice(0, 3).join(', ')}${roles.length > 3 ? ` and ${roles.length - 3} more` : ''}.`);
|
|
97
|
+
const missing = [providers.length ? '' : 'no GitHub or GitLab OIDC provider', roles.length ? '' : 'no GitHubActions-* or GitLabCI-* role'].filter(Boolean);
|
|
98
|
+
return fail(b, `${missing.join(' and ')}, so CI cannot publish PRISM metrics with short-lived credentials.`, fix);
|
|
99
|
+
}
|
|
100
|
+
/** Local only: the endpoint codeburn syncs to (~/.config/codeburn/sync.json). No AWS call. */
|
|
101
|
+
export function codeburnSync(c) {
|
|
102
|
+
const b = PS('codeburn-sync', 'codeburn sync endpoint configured on this machine', 'LOW');
|
|
103
|
+
const url = configuredSyncUrl(c.home);
|
|
104
|
+
if (url === null)
|
|
105
|
+
return fail(b, 'codeburn sync is not set up here, so this machine sends no usage telemetry to the PRISM collector.', 'Run prism-cli enable codeburn.');
|
|
106
|
+
if (!url)
|
|
107
|
+
return unknown(b, 'the codeburn sync config could not be read');
|
|
108
|
+
return pass(b, `codeburn syncs to ${url}.`);
|
|
109
|
+
}
|
|
110
|
+
export const prismSetupSection = {
|
|
111
|
+
name: 'prism-setup',
|
|
112
|
+
heading: 'PRISM setup',
|
|
113
|
+
ids: ['metrics-pipeline', 'security-agent-stack', 'security-agent-ssm', 'scan-bucket-listed', 'ci-oidc-role', 'codeburn-sync'],
|
|
114
|
+
run: (c) => [metricsPipeline(c), ...securityAgent(c), ciOidcRole(c), codeburnSync(c)],
|
|
115
|
+
};
|
|
116
|
+
// ---------------------------------------------------------------------------
|
|
117
|
+
// baseline
|
|
118
|
+
// ---------------------------------------------------------------------------
|
|
119
|
+
const BL = (id, title, severity) => ({ id: checkId('baseline', id), category: 'baseline', title, severity });
|
|
120
|
+
export function cloudTrail(c) {
|
|
121
|
+
const b = BL('cloudtrail-multiregion', 'CloudTrail: a multi-region trail that is logging', 'HIGH');
|
|
122
|
+
const fix = 'Create a multi-region trail (aws cloudtrail create-trail --is-multi-region-trail, then start-logging), or an organization trail from the management account.';
|
|
123
|
+
const r = call(c, ['cloudtrail', 'describe-trails']);
|
|
124
|
+
if (!r.ok)
|
|
125
|
+
return unknown(b, r, 'cloudtrail:DescribeTrails');
|
|
126
|
+
const multi = (r.json?.trailList || []).filter((t) => t?.IsMultiRegionTrail);
|
|
127
|
+
if (!multi.length)
|
|
128
|
+
return fail(b, 'No multi-region trail, so API activity in other regions is not recorded.', fix);
|
|
129
|
+
let readable = 0;
|
|
130
|
+
for (const t of multi) {
|
|
131
|
+
const s = call(c, ['cloudtrail', 'get-trail-status', '--name', String(t.TrailARN || t.Name)], String(t.HomeRegion || c.region));
|
|
132
|
+
if (!s.ok)
|
|
133
|
+
continue;
|
|
134
|
+
readable++;
|
|
135
|
+
if (s.json?.IsLogging)
|
|
136
|
+
return pass(b, `${t.Name} is multi-region and logging.`);
|
|
137
|
+
}
|
|
138
|
+
if (!readable)
|
|
139
|
+
return unknown(b, 'get-trail-status was denied for every multi-region trail', 'cloudtrail:GetTrailStatus');
|
|
140
|
+
return fail(b, `Multi-region trail(s) ${multi.map((t) => t.Name).join(', ')} exist but none is logging.`, 'Start logging: aws cloudtrail start-logging --name <trail>.');
|
|
141
|
+
}
|
|
142
|
+
export function guardDuty(c) {
|
|
143
|
+
const b = BL('guardduty', `GuardDuty detector enabled in ${c.region}`, 'HIGH');
|
|
144
|
+
const fix = `Enable GuardDuty in ${c.region} (aws guardduty create-detector --enable), ideally org-wide from a delegated administrator.`;
|
|
145
|
+
const r = call(c, ['guardduty', 'list-detectors']);
|
|
146
|
+
if (!r.ok)
|
|
147
|
+
return unknown(b, r, 'guardduty:ListDetectors');
|
|
148
|
+
const ids = r.json?.DetectorIds || [];
|
|
149
|
+
if (!ids.length)
|
|
150
|
+
return fail(b, `No GuardDuty detector in ${c.region}.`, fix);
|
|
151
|
+
const d = call(c, ['guardduty', 'get-detector', '--detector-id', ids[0]]);
|
|
152
|
+
if (!d.ok)
|
|
153
|
+
return unknown(b, d, 'guardduty:GetDetector');
|
|
154
|
+
return d.json?.Status === 'ENABLED' ? pass(b, `Detector ${ids[0]} is enabled.`) : fail(b, `Detector ${ids[0]} is ${d.json?.Status || 'not enabled'}.`, fix);
|
|
155
|
+
}
|
|
156
|
+
export function securityHub(c) {
|
|
157
|
+
const b = BL('securityhub', `Security Hub enabled in ${c.region}`, 'MEDIUM');
|
|
158
|
+
const r = call(c, ['securityhub', 'describe-hub']);
|
|
159
|
+
if (r.ok)
|
|
160
|
+
return pass(b, `Security Hub is enabled${r.json?.SubscribedAt ? ` (since ${r.json.SubscribedAt})` : ''}.`);
|
|
161
|
+
if (/^(InvalidAccessException|ResourceNotFoundException)$/.test(r.errorCode)) {
|
|
162
|
+
return fail(b, `Security Hub is not enabled in ${c.region}.`, `Enable Security Hub in ${c.region} with the AWS Foundational Security Best Practices standard.`);
|
|
163
|
+
}
|
|
164
|
+
return unknown(b, r, 'securityhub:DescribeHub');
|
|
165
|
+
}
|
|
166
|
+
export function accessAnalyzer(c) {
|
|
167
|
+
const b = BL('access-analyzer', `IAM Access Analyzer in ${c.region}`, 'MEDIUM');
|
|
168
|
+
const r = call(c, ['accessanalyzer', 'list-analyzers']);
|
|
169
|
+
if (!r.ok)
|
|
170
|
+
return unknown(b, r, 'access-analyzer:ListAnalyzers');
|
|
171
|
+
const active = (r.json?.analyzers || []).filter((a) => a?.status === 'ACTIVE');
|
|
172
|
+
return active.length ? pass(b, `Analyzer ${active[0].name} (${active[0].type}) is active.`)
|
|
173
|
+
: fail(b, `No active Access Analyzer in ${c.region}, so resources shared outside the account are not flagged.`, `Create one: aws accessanalyzer create-analyzer --analyzer-name prism --type ACCOUNT --region ${c.region}.`);
|
|
174
|
+
}
|
|
175
|
+
// Root MFA is not repeated here: the bedrock section's bedrock.root-mfa reads the same
|
|
176
|
+
// iam get-account-summary, and a second copy listed the same fix twice.
|
|
177
|
+
export function budget(c) {
|
|
178
|
+
const b = BL('budget', 'At least one AWS Budget', 'MEDIUM');
|
|
179
|
+
const r = call(c, ['budgets', 'describe-budgets', '--account-id', c.account]);
|
|
180
|
+
if (!r.ok)
|
|
181
|
+
return unknown(b, r, 'budgets:ViewBudget');
|
|
182
|
+
const n = (r.json?.Budgets || []).length;
|
|
183
|
+
return n ? pass(b, `${n} budget(s) defined.`) : fail(b, 'No budgets, so unexpected spend raises no alert.', 'Create a monthly cost budget with 80% and 100% alerts (Billing console > Budgets).');
|
|
184
|
+
}
|
|
185
|
+
export function s3PublicAccess(c) {
|
|
186
|
+
const b = BL('s3-account-bpa', 'S3 Block Public Access at the account level', 'HIGH');
|
|
187
|
+
const fix = `Turn on all four settings: aws s3control put-public-access-block --account-id ${c.account} --public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true.`;
|
|
188
|
+
const r = call(c, ['s3control', 'get-public-access-block', '--account-id', c.account]);
|
|
189
|
+
if (!r.ok)
|
|
190
|
+
return r.errorCode === 'NoSuchPublicAccessBlockConfiguration' ? fail(b, 'No account-level Block Public Access configuration.', fix) : unknown(b, r, 's3:GetAccountPublicAccessBlock');
|
|
191
|
+
const cfg = r.json?.PublicAccessBlockConfiguration ?? {};
|
|
192
|
+
const off = ['BlockPublicAcls', 'IgnorePublicAcls', 'BlockPublicPolicy', 'RestrictPublicBuckets'].filter((k) => cfg[k] !== true);
|
|
193
|
+
return off.length ? fail(b, `Off: ${off.join(', ')}.`, fix) : pass(b, 'All four account-level settings are on.');
|
|
194
|
+
}
|
|
195
|
+
export function ebsEncryption(c) {
|
|
196
|
+
const b = BL('ebs-default-encryption', `EBS encryption by default in ${c.region}`, 'MEDIUM');
|
|
197
|
+
const r = call(c, ['ec2', 'get-ebs-encryption-by-default']);
|
|
198
|
+
if (!r.ok)
|
|
199
|
+
return unknown(b, r, 'ec2:GetEbsEncryptionByDefault');
|
|
200
|
+
return r.json?.EbsEncryptionByDefault === true ? pass(b, 'New EBS volumes are encrypted by default.')
|
|
201
|
+
: fail(b, `New EBS volumes in ${c.region} are not encrypted by default.`, `aws ec2 enable-ebs-encryption-by-default --region ${c.region}.`);
|
|
202
|
+
}
|
|
203
|
+
export const baselineSection = {
|
|
204
|
+
name: 'baseline',
|
|
205
|
+
heading: 'Account baseline',
|
|
206
|
+
ids: ['cloudtrail-multiregion', 'guardduty', 'securityhub', 'access-analyzer', 'budget', 's3-account-bpa', 'ebs-default-encryption'],
|
|
207
|
+
run: (c) => [cloudTrail(c), guardDuty(c), securityHub(c), accessAnalyzer(c), budget(c), s3PublicAccess(c), ebsEncryption(c)],
|
|
208
|
+
};
|
|
209
|
+
// ---------------------------------------------------------------------------
|
|
210
|
+
// startup-advisor: placeholder until how it is consumed (and its license) is known
|
|
211
|
+
// ---------------------------------------------------------------------------
|
|
212
|
+
export const startupAdvisorSection = {
|
|
213
|
+
name: 'startup-advisor',
|
|
214
|
+
heading: 'Startup Advisor',
|
|
215
|
+
ids: ['not-integrated'],
|
|
216
|
+
run: () => [{
|
|
217
|
+
id: checkId('startup-advisor', 'not-integrated'), category: 'startup-advisor', title: 'Startup Advisor account checks',
|
|
218
|
+
status: 'INDETERMINATE', severity: 'INFO',
|
|
219
|
+
detail: 'Not integrated yet: how PRISM consumes Startup Advisor, and under what license, is still open.',
|
|
220
|
+
}],
|
|
221
|
+
};
|
|
222
|
+
export const SECTIONS = [bedrockSection, prismSetupSection, baselineSection, startupAdvisorSection];
|
|
223
|
+
/** Every full check id any section can return. */
|
|
224
|
+
export const ALL_CHECK_IDS = SECTIONS.flatMap((s) => s.ids.map((id) => checkId(s.name, id)));
|
|
225
|
+
/** The sections named by --section (all when none), or an error naming the valid ones. */
|
|
226
|
+
export function selectSections(names) {
|
|
227
|
+
if (!names?.length)
|
|
228
|
+
return SECTIONS;
|
|
229
|
+
const bad = names.filter((n) => !SECTIONS.some((s) => s.name === n));
|
|
230
|
+
if (bad.length)
|
|
231
|
+
return { error: `unknown --section ${bad.join(', ')}; choose from ${SECTIONS.map((s) => s.name).join(', ')}` };
|
|
232
|
+
return SECTIONS.filter((s) => names.includes(s.name));
|
|
233
|
+
}
|
|
234
|
+
export function countFindings(findings) {
|
|
235
|
+
return {
|
|
236
|
+
pass: findings.filter((f) => f.status === 'PASS').length,
|
|
237
|
+
fail: findings.filter((f) => f.status === 'FAIL').length,
|
|
238
|
+
indeterminate: findings.filter((f) => f.status === 'INDETERMINATE').length,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
export function failBySeverity(findings) {
|
|
242
|
+
const out = { CRITICAL: 0, HIGH: 0, MEDIUM: 0, LOW: 0, INFO: 0 };
|
|
243
|
+
for (const f of findings)
|
|
244
|
+
if (f.status === 'FAIL')
|
|
245
|
+
out[f.severity]++;
|
|
246
|
+
return out;
|
|
247
|
+
}
|
|
248
|
+
/** FAIL findings at or above `failOn` (none when failOn is null). */
|
|
249
|
+
export function breaching(findings, failOn) {
|
|
250
|
+
if (!failOn)
|
|
251
|
+
return [];
|
|
252
|
+
return findings.filter((f) => f.status === 'FAIL' && severityRank(f.severity) >= severityRank(failOn));
|
|
253
|
+
}
|
|
254
|
+
/** A read-only enable-security context for collectSecurityStatus. Repo rows are skipped (git reports no repo). */
|
|
255
|
+
export function securityContext(opts, aws, env, awsVersion, log) {
|
|
256
|
+
const unused = () => { throw new Error('internal: not available in aws check'); };
|
|
257
|
+
const deps = {
|
|
258
|
+
aws, env, awsVersion, log,
|
|
259
|
+
configRegion: () => null,
|
|
260
|
+
cdk: { synth: unused, diff: unused, deploy: unused },
|
|
261
|
+
git: () => ({ ok: false, stdout: '', stderr: 'not used by aws check' }),
|
|
262
|
+
makeTempDir: unused,
|
|
263
|
+
isTTY: false,
|
|
264
|
+
ask: async () => '',
|
|
265
|
+
now: () => new Date(),
|
|
266
|
+
};
|
|
267
|
+
return { opts, deps, cliVersion: awsVersion(), readOnly: true };
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../../src/aws/check.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,GAAG,EAAkC,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,YAAY,EAA+B,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EACL,qBAAqB,EAAE,cAAc,GACtC,MAAM,sBAAsB,CAAC;AAmB9B,4FAA4F;AAC5F,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAe,EAAE,EAAU,EAAU,EAAE,CAAC,GAAG,OAAO,IAAI,EAAE,EAAE,CAAC;AAEnF,MAAM,IAAI,GAAG,CAAC,CAAe,EAAE,IAAc,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,EAAa,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;AAC7H,MAAM,GAAG,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,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