cdk-real-drift 0.12.77 → 0.12.78
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/cli.js +82 -3
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -10,9 +10,10 @@ import { CloudControlClient, DeleteResourceCommand, GetResourceCommand, GetResou
|
|
|
10
10
|
import { homedir } from "node:os";
|
|
11
11
|
import { BaseCredentials, CdkAppMultiContext, NonInteractiveIoHost, StackSelectionStrategy, Toolkit } from "@aws-cdk/toolkit-lib";
|
|
12
12
|
import { CloudFormationClient, DescribeStackResourcesCommand, DescribeStacksCommand, DescribeTypeCommand, GetTemplateCommand, ListExportsCommand, ListStackResourcesCommand } from "@aws-sdk/client-cloudformation";
|
|
13
|
-
import { DescribeAddressesCommand, DescribeClientVpnAuthorizationRulesCommand, DescribeClientVpnEndpointsCommand, DescribeClientVpnTargetNetworksCommand, DescribeInternetGatewaysCommand, DescribeLaunchTemplateVersionsCommand, DescribeNetworkAclsCommand, DescribeRouteTablesCommand, DescribeSecurityGroupsCommand, DescribeSubnetsCommand, DescribeVpcEndpointsCommand, DescribeVpcsCommand, EC2Client, ModifyClientVpnEndpointCommand } from "@aws-sdk/client-ec2";
|
|
13
|
+
import { DescribeAddressesCommand, DescribeClientVpnAuthorizationRulesCommand, DescribeClientVpnEndpointsCommand, DescribeClientVpnTargetNetworksCommand, DescribeInternetGatewaysCommand, DescribeLaunchTemplateVersionsCommand, DescribeNetworkAclsCommand, DescribeRouteTablesCommand, DescribeSecurityGroupsCommand, DescribeSubnetsCommand, DescribeVpcEndpointsCommand, DescribeVpcsCommand, EC2Client, GetEbsEncryptionByDefaultCommand, ModifyClientVpnEndpointCommand } from "@aws-sdk/client-ec2";
|
|
14
|
+
import { DescribeServicesCommand, ECSClient, ListAccountSettingsCommand, ListServicesCommand, UpdateServiceCommand } from "@aws-sdk/client-ecs";
|
|
14
15
|
import { DescribeDBClustersCommand, DescribeDBInstancesCommand, DescribeOptionGroupOptionsCommand, RDSClient } from "@aws-sdk/client-rds";
|
|
15
|
-
import { DescribeParametersCommand, GetParametersCommand, SSMClient } from "@aws-sdk/client-ssm";
|
|
16
|
+
import { DescribeParametersCommand, GetParametersCommand, GetServiceSettingCommand, SSMClient } from "@aws-sdk/client-ssm";
|
|
16
17
|
import jsonata from "jsonata";
|
|
17
18
|
import { KMSClient, ListAliasesCommand } from "@aws-sdk/client-kms";
|
|
18
19
|
import { APIGatewayClient, GetAuthorizersCommand, GetGatewayResponsesCommand, GetModelsCommand, GetRequestValidatorsCommand, GetResourcesCommand, GetStagesCommand, UpdateIntegrationCommand, UpdateIntegrationResponseCommand, UpdateMethodResponseCommand, UpdateRestApiCommand } from "@aws-sdk/client-api-gateway";
|
|
@@ -21,7 +22,6 @@ import { AppSyncClient, DeleteApiKeyCommand, ListApiKeysCommand, ListDataSources
|
|
|
21
22
|
import { ApiGatewayV2Client, DeleteAccessLogSettingsCommand, DeleteRouteSettingsCommand, GetAuthorizersCommand as GetAuthorizersCommand$1, GetIntegrationsCommand, GetRoutesCommand, GetStagesCommand as GetStagesCommand$1, UpdateStageCommand } from "@aws-sdk/client-apigatewayv2";
|
|
22
23
|
import { CloudWatchLogsClient, DescribeMetricFiltersCommand, DescribeSubscriptionFiltersCommand, PutBearerTokenAuthenticationCommand, PutMetricFilterCommand } from "@aws-sdk/client-cloudwatch-logs";
|
|
23
24
|
import { CognitoIdentityProviderClient, ListGroupsCommand, ListIdentityProvidersCommand, ListResourceServersCommand, ListUserPoolClientsCommand } from "@aws-sdk/client-cognito-identity-provider";
|
|
24
|
-
import { DescribeServicesCommand, ECSClient, ListServicesCommand, UpdateServiceCommand } from "@aws-sdk/client-ecs";
|
|
25
25
|
import { DescribeMountTargetsCommand, EFSClient } from "@aws-sdk/client-efs";
|
|
26
26
|
import { DescribeListenersCommand, DescribeRulesCommand, ElasticLoadBalancingV2Client, GetTrustStoreCaCertificatesBundleCommand, ModifyLoadBalancerAttributesCommand, ModifyTargetGroupAttributesCommand } from "@aws-sdk/client-elastic-load-balancing-v2";
|
|
27
27
|
import { DescribeEventBusCommand, EventBridgeClient, ListRulesCommand, PutPermissionCommand } from "@aws-sdk/client-eventbridge";
|
|
@@ -5576,6 +5576,15 @@ function shouldFoldDefaultSgList(resourceType, key, liveValue, defaultSgIds) {
|
|
|
5576
5576
|
if (!Array.isArray(liveValue)) return true;
|
|
5577
5577
|
return liveValue.length === 1 && typeof liveValue[0] === "string" && defaultSgIds.has(liveValue[0]);
|
|
5578
5578
|
}
|
|
5579
|
+
function accountDerivedDefault(resourceType, key, ad) {
|
|
5580
|
+
if (!ad) return void 0;
|
|
5581
|
+
if (resourceType === "AWS::ECS::Cluster" && key === "ClusterSettings" && ad.ecsContainerInsights !== void 0) return { value: [{
|
|
5582
|
+
Name: "containerInsights",
|
|
5583
|
+
Value: ad.ecsContainerInsights
|
|
5584
|
+
}] };
|
|
5585
|
+
if (resourceType === "AWS::SSM::Parameter" && key === "Tier" && ad.ssmParameterTier !== void 0) return { value: ad.ssmParameterTier };
|
|
5586
|
+
if (resourceType === "AWS::EC2::Volume" && key === "Encrypted" && ad.ebsEncryptionByDefault !== void 0) return { value: ad.ebsEncryptionByDefault };
|
|
5587
|
+
}
|
|
5579
5588
|
const stripCognitoAttrPrefix = (id) => id.replace(/^(custom|dev):/, "");
|
|
5580
5589
|
const IDENTITY_KEYED_SUBSET_ARRAYS = {
|
|
5581
5590
|
"AWS::Cognito::UserPool": { Schema: {
|
|
@@ -7061,6 +7070,17 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
7061
7070
|
}
|
|
7062
7071
|
continue;
|
|
7063
7072
|
}
|
|
7073
|
+
const acctDefault = accountDerivedDefault(resourceType, k, opts.accountDefaults);
|
|
7074
|
+
if (acctDefault !== void 0) {
|
|
7075
|
+
findings.push({
|
|
7076
|
+
tier: matchesKnownDefault(v, acctDefault.value) ? "atDefault" : "undeclared",
|
|
7077
|
+
logicalId,
|
|
7078
|
+
resourceType,
|
|
7079
|
+
path: k,
|
|
7080
|
+
actual: v
|
|
7081
|
+
});
|
|
7082
|
+
continue;
|
|
7083
|
+
}
|
|
7064
7084
|
if (k in schema.defaults && matchesKnownDefault(v, schema.defaults[k]) || k in schema.defaultPaths && matchesKnownDefault(v, schema.defaultPaths[k]) || k in knownDef && matchesKnownDefault(v, knownDef[k]) || KNOWN_DEFAULT_ONE_OF[resourceType]?.[k]?.some((d) => matchesKnownDefault(v, d)) || VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS[resourceType]?.has(k) && !isTrivialEmpty(v) && !(k in knownDef) || clbDefaultSslPoliciesAtDefault(resourceType, k, v)) {
|
|
7065
7085
|
findings.push({
|
|
7066
7086
|
tier: "atDefault",
|
|
@@ -12571,6 +12591,51 @@ async function fetchDefaultVpcSubnetIds(region) {
|
|
|
12571
12591
|
defaultSubnetIdsCache.set(region, ids);
|
|
12572
12592
|
return ids;
|
|
12573
12593
|
}
|
|
12594
|
+
const ecsContainerInsightsCache = /* @__PURE__ */ new Map();
|
|
12595
|
+
async function fetchEcsContainerInsightsDefault(region) {
|
|
12596
|
+
if (ecsContainerInsightsCache.has(region)) return ecsContainerInsightsCache.get(region);
|
|
12597
|
+
try {
|
|
12598
|
+
const value = (await new ECSClient({
|
|
12599
|
+
region,
|
|
12600
|
+
...READ_RETRY
|
|
12601
|
+
}).send(new ListAccountSettingsCommand({
|
|
12602
|
+
name: "containerInsights",
|
|
12603
|
+
effectiveSettings: true
|
|
12604
|
+
}))).settings?.find((s) => s.name === "containerInsights")?.value;
|
|
12605
|
+
ecsContainerInsightsCache.set(region, value);
|
|
12606
|
+
return value;
|
|
12607
|
+
} catch {
|
|
12608
|
+
return;
|
|
12609
|
+
}
|
|
12610
|
+
}
|
|
12611
|
+
const ssmParameterTierCache = /* @__PURE__ */ new Map();
|
|
12612
|
+
async function fetchSsmDefaultParameterTier(region) {
|
|
12613
|
+
if (ssmParameterTierCache.has(region)) return ssmParameterTierCache.get(region);
|
|
12614
|
+
try {
|
|
12615
|
+
const value = (await new SSMClient({
|
|
12616
|
+
region,
|
|
12617
|
+
...READ_RETRY
|
|
12618
|
+
}).send(new GetServiceSettingCommand({ SettingId: "/ssm/parameter-store/default-parameter-tier" }))).ServiceSetting?.SettingValue;
|
|
12619
|
+
ssmParameterTierCache.set(region, value);
|
|
12620
|
+
return value;
|
|
12621
|
+
} catch {
|
|
12622
|
+
return;
|
|
12623
|
+
}
|
|
12624
|
+
}
|
|
12625
|
+
const ebsEncryptionByDefaultCache = /* @__PURE__ */ new Map();
|
|
12626
|
+
async function fetchEbsEncryptionByDefault(region) {
|
|
12627
|
+
if (ebsEncryptionByDefaultCache.has(region)) return ebsEncryptionByDefaultCache.get(region);
|
|
12628
|
+
try {
|
|
12629
|
+
const value = (await new EC2Client({
|
|
12630
|
+
region,
|
|
12631
|
+
...READ_RETRY
|
|
12632
|
+
}).send(new GetEbsEncryptionByDefaultCommand({}))).EbsEncryptionByDefault;
|
|
12633
|
+
ebsEncryptionByDefaultCache.set(region, value);
|
|
12634
|
+
return value;
|
|
12635
|
+
} catch {
|
|
12636
|
+
return;
|
|
12637
|
+
}
|
|
12638
|
+
}
|
|
12574
12639
|
const kmsDeniedWarned = /* @__PURE__ */ new Set();
|
|
12575
12640
|
const kmsTransientWarned = /* @__PURE__ */ new Set();
|
|
12576
12641
|
const POOL_SIZE = 6;
|
|
@@ -13148,6 +13213,19 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
13148
13213
|
if (desired.resources.some((r) => DEFAULT_SG_LIST_TYPES.has(r.resourceType))) defaultSgIds = await fetchDefaultSgIds(region);
|
|
13149
13214
|
let defaultSubnetIds = /* @__PURE__ */ new Set();
|
|
13150
13215
|
if (desired.resources.some((r) => DEFAULT_SUBNET_LIST_TYPES.has(r.resourceType))) defaultSubnetIds = await fetchDefaultVpcSubnetIds(region);
|
|
13216
|
+
const accountDefaults = {};
|
|
13217
|
+
if (desired.resources.some((r) => r.resourceType === "AWS::ECS::Cluster")) {
|
|
13218
|
+
const v = await fetchEcsContainerInsightsDefault(region);
|
|
13219
|
+
if (v !== void 0) accountDefaults.ecsContainerInsights = v;
|
|
13220
|
+
}
|
|
13221
|
+
if (desired.resources.some((r) => r.resourceType === "AWS::SSM::Parameter")) {
|
|
13222
|
+
const v = await fetchSsmDefaultParameterTier(region);
|
|
13223
|
+
if (v !== void 0) accountDefaults.ssmParameterTier = v;
|
|
13224
|
+
}
|
|
13225
|
+
if (desired.resources.some((r) => r.resourceType === "AWS::EC2::Volume")) {
|
|
13226
|
+
const v = await fetchEbsEncryptionByDefault(region);
|
|
13227
|
+
if (v !== void 0) accountDefaults.ebsEncryptionByDefault = v;
|
|
13228
|
+
}
|
|
13151
13229
|
const classifyOpts = {
|
|
13152
13230
|
accountId: desired.accountId,
|
|
13153
13231
|
region,
|
|
@@ -13155,6 +13233,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
13155
13233
|
stackTags: desired.stackTags ?? {},
|
|
13156
13234
|
defaultSgIds,
|
|
13157
13235
|
defaultSubnetIds,
|
|
13236
|
+
accountDefaults,
|
|
13158
13237
|
oaiCanonicalIds,
|
|
13159
13238
|
siblingSgRules: buildSiblingSgRules(desired),
|
|
13160
13239
|
siblingEventBusPolicies: buildSiblingEventBusPolicies(desired),
|