cdk-real-drift 0.26.0 → 0.26.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/cli.js +118 -9
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2546,6 +2546,8 @@ const KNOWN_DEFAULTS = {
|
|
|
2546
2546
|
ResolverCountLimit: 0,
|
|
2547
2547
|
XrayEnabled: false
|
|
2548
2548
|
},
|
|
2549
|
+
"AWS::AppSync::DataSource": { MetricsConfig: "DISABLED" },
|
|
2550
|
+
"AWS::AppSync::SourceApiAssociation": { SourceApiAssociationConfig: { MergeType: "MANUAL_MERGE" } },
|
|
2549
2551
|
"AWS::AppSync::Resolver": { MaxBatchSize: 0 },
|
|
2550
2552
|
"AWS::AppSync::FunctionConfiguration": { MaxBatchSize: 0 },
|
|
2551
2553
|
"AWS::Logs::SubscriptionFilter": { Distribution: "ByLogStream" },
|
|
@@ -2555,6 +2557,8 @@ const KNOWN_DEFAULTS = {
|
|
|
2555
2557
|
KeyUsage: "ENCRYPT_DECRYPT",
|
|
2556
2558
|
Origin: "AWS_KMS"
|
|
2557
2559
|
},
|
|
2560
|
+
"AWS::KMS::ReplicaKey": { Enabled: true },
|
|
2561
|
+
"AWS::EFS::AccessPoint": { RootDirectory: { Path: "/" } },
|
|
2558
2562
|
"AWS::DLM::LifecyclePolicy": {
|
|
2559
2563
|
RetainInterval: 7,
|
|
2560
2564
|
CreateInterval: 1
|
|
@@ -2643,7 +2647,10 @@ const KNOWN_DEFAULTS = {
|
|
|
2643
2647
|
NetworkType: "ipv4",
|
|
2644
2648
|
ReplicasPerNodeGroup: 0
|
|
2645
2649
|
},
|
|
2646
|
-
"AWS::ElastiCache::ServerlessCache": {
|
|
2650
|
+
"AWS::ElastiCache::ServerlessCache": {
|
|
2651
|
+
SnapshotRetentionLimit: 0,
|
|
2652
|
+
Description: " "
|
|
2653
|
+
},
|
|
2647
2654
|
"AWS::OpenSearchService::Domain": {
|
|
2648
2655
|
IPAddressType: "ipv4",
|
|
2649
2656
|
SnapshotOptions: { AutomatedSnapshotStartHour: 0 },
|
|
@@ -2975,6 +2982,9 @@ const KNOWN_DEFAULTS = {
|
|
|
2975
2982
|
},
|
|
2976
2983
|
"AWS::Transfer::Server": {
|
|
2977
2984
|
IpAddressType: "IPV4",
|
|
2985
|
+
Protocols: ["SFTP"],
|
|
2986
|
+
EndpointType: "PUBLIC",
|
|
2987
|
+
IdentityProviderType: "SERVICE_MANAGED",
|
|
2978
2988
|
ProtocolDetails: {
|
|
2979
2989
|
PassiveIp: "AUTO",
|
|
2980
2990
|
SetStatOption: "DEFAULT",
|
|
@@ -3728,7 +3738,7 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
|
3728
3738
|
"PreferredBackupWindow",
|
|
3729
3739
|
"EngineLifecycleSupport"
|
|
3730
3740
|
]),
|
|
3731
|
-
"AWS::RDS::GlobalCluster": new Set(["EngineLifecycleSupport"]),
|
|
3741
|
+
"AWS::RDS::GlobalCluster": new Set(["EngineLifecycleSupport", "EngineVersion"]),
|
|
3732
3742
|
"AWS::EKS::Cluster": new Set(["Version"]),
|
|
3733
3743
|
"AWS::EKS::Addon": new Set(["AddonVersion"]),
|
|
3734
3744
|
"AWS::Glue::Job": new Set([
|
|
@@ -3765,7 +3775,7 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
|
3765
3775
|
"SnapshotWindow",
|
|
3766
3776
|
"EngineVersion"
|
|
3767
3777
|
]),
|
|
3768
|
-
"AWS::ElastiCache::ServerlessCache": new Set(["DailySnapshotTime"]),
|
|
3778
|
+
"AWS::ElastiCache::ServerlessCache": new Set(["DailySnapshotTime", "MajorEngineVersion"]),
|
|
3769
3779
|
"AWS::MemoryDB::Cluster": new Set([
|
|
3770
3780
|
"MaintenanceWindow",
|
|
3771
3781
|
"SnapshotWindow",
|
|
@@ -3818,6 +3828,11 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
|
3818
3828
|
};
|
|
3819
3829
|
const VALUE_INDEPENDENT_DEFAULT_NESTED_PATHS = {
|
|
3820
3830
|
"AWS::Batch::ComputeEnvironment": new Set(["ComputeResources.DesiredvCpus"]),
|
|
3831
|
+
"AWS::Cognito::UserPoolIdentityProvider": new Set([
|
|
3832
|
+
"ProviderDetails.SSORedirectBindingURI",
|
|
3833
|
+
"ProviderDetails.SLORedirectBindingURI",
|
|
3834
|
+
"ProviderDetails.ActiveEncryptionCertificate"
|
|
3835
|
+
]),
|
|
3821
3836
|
"AWS::DLM::LifecyclePolicy": new Set(["PolicyDetails.Schedules.*.CreateRule.Times"]),
|
|
3822
3837
|
"AWS::AutoScaling::AutoScalingGroup": new Set(["Tags.*.ResourceId", "Tags.*.ResourceType"])
|
|
3823
3838
|
};
|
|
@@ -4089,8 +4104,10 @@ const CASE_INSENSITIVE_PATHS = {
|
|
|
4089
4104
|
"DBClusterIdentifier",
|
|
4090
4105
|
"DBClusterParameterGroupName",
|
|
4091
4106
|
"DBSubnetGroupName",
|
|
4092
|
-
"Engine"
|
|
4107
|
+
"Engine",
|
|
4108
|
+
"GlobalClusterIdentifier"
|
|
4093
4109
|
]),
|
|
4110
|
+
"AWS::RDS::GlobalCluster": new Set(["GlobalClusterIdentifier", "Engine"]),
|
|
4094
4111
|
"AWS::ElastiCache::SubnetGroup": new Set(["CacheSubnetGroupName"]),
|
|
4095
4112
|
"AWS::ElastiCache::ReplicationGroup": new Set([
|
|
4096
4113
|
"ReplicationGroupId",
|
|
@@ -4637,6 +4654,7 @@ const UNORDERED_ARRAY_PROPS = {
|
|
|
4637
4654
|
"AWS::CloudFront::Distribution": new Set(["DistributionConfig.Restrictions.GeoRestriction.Locations"]),
|
|
4638
4655
|
"AWS::Cognito::UserPool": new Set(["EnabledMfas"]),
|
|
4639
4656
|
"AWS::ECS::Cluster": new Set(["CapacityProviders"]),
|
|
4657
|
+
"AWS::ECS::ClusterCapacityProviderAssociations": new Set(["CapacityProviders"]),
|
|
4640
4658
|
"AWS::Cognito::UserPoolClient": new Set([
|
|
4641
4659
|
"AllowedOAuthFlows",
|
|
4642
4660
|
"AllowedOAuthScopes",
|
|
@@ -6133,6 +6151,7 @@ const ELB_ATTRIBUTE_BAGS = {
|
|
|
6133
6151
|
const notRestored = (...restoreSourceKeys) => ({ declared }) => restoreSourceKeys.every((k) => declared[k] === void 0);
|
|
6134
6152
|
const MEANINGFUL_WHEN_OFF = {
|
|
6135
6153
|
"AWS::KMS::Key": { Enabled: () => true },
|
|
6154
|
+
"AWS::KMS::ReplicaKey": { Enabled: () => true },
|
|
6136
6155
|
"AWS::ServiceCatalog::TagOption": { Active: () => true },
|
|
6137
6156
|
"AWS::VpcLattice::ResourceConfiguration": { AllowAssociationToSharableServiceNetwork: () => true },
|
|
6138
6157
|
"AWS::SQS::Queue": { SqsManagedSseEnabled: ({ declared, live }) => declared["KmsMasterKeyId"] === void 0 && live["KmsMasterKeyId"] === void 0 },
|
|
@@ -6242,7 +6261,8 @@ const DEFAULT_SG_LIST_PATHS = {
|
|
|
6242
6261
|
"AWS::DMS::ReplicationInstance": "VpcSecurityGroupIds",
|
|
6243
6262
|
"AWS::EC2::ClientVpnEndpoint": "SecurityGroupIds",
|
|
6244
6263
|
"AWS::VpcLattice::ResourceGateway": "SecurityGroupIds",
|
|
6245
|
-
"AWS::EC2::VPCEndpoint": "SecurityGroupIds"
|
|
6264
|
+
"AWS::EC2::VPCEndpoint": "SecurityGroupIds",
|
|
6265
|
+
"AWS::ElastiCache::ServerlessCache": "SecurityGroupIds"
|
|
6246
6266
|
};
|
|
6247
6267
|
/** #1269 fold decision for an UNDECLARED default-SUBNET list (RedshiftServerless Workgroup
|
|
6248
6268
|
* SubnetIds). Unlike the SG gate (which folds only a SINGLE default SG), a workgroup placed into
|
|
@@ -6260,7 +6280,10 @@ function shouldFoldDefaultSubnetList(resourceType, key, liveValue, defaultSubnet
|
|
|
6260
6280
|
if (!Array.isArray(liveValue)) return true;
|
|
6261
6281
|
return liveValue.every((s) => typeof s === "string" && defaultSubnetIds.has(s));
|
|
6262
6282
|
}
|
|
6263
|
-
const DEFAULT_SUBNET_LIST_PATHS = {
|
|
6283
|
+
const DEFAULT_SUBNET_LIST_PATHS = {
|
|
6284
|
+
"AWS::RedshiftServerless::Workgroup": "SubnetIds",
|
|
6285
|
+
"AWS::ElastiCache::ServerlessCache": "SubnetIds"
|
|
6286
|
+
};
|
|
6264
6287
|
const RS_WORKGROUP_CONFIG_PARAM_DEFAULTS = {
|
|
6265
6288
|
auto_mv: "true",
|
|
6266
6289
|
datestyle: "ISO, MDY",
|
|
@@ -9231,9 +9254,12 @@ async function enumerateHttpApiChildren(ctx) {
|
|
|
9231
9254
|
const CHATBOT_SUBSCRIPTION_ENDPOINT = "https://global.sns-api.chatbot.amazonaws.com";
|
|
9232
9255
|
function diffSnsTopicChildren(input) {
|
|
9233
9256
|
const declared = new Set(input.declaredSubscriptionArns);
|
|
9257
|
+
const inline = input.declaredInlineSubscriptions ?? [];
|
|
9258
|
+
const matchesInline = (s) => inline.some((d) => (d.protocol === void 0 || d.protocol.toLowerCase() === (s.protocol ?? "").toLowerCase()) && (d.endpointUnresolved || d.endpoint === s.endpoint));
|
|
9234
9259
|
const added = [];
|
|
9235
9260
|
for (const s of input.liveSubscriptions) {
|
|
9236
9261
|
if (declared.has(s.arn)) continue;
|
|
9262
|
+
if (matchesInline(s)) continue;
|
|
9237
9263
|
if (s.endpoint === CHATBOT_SUBSCRIPTION_ENDPOINT) continue;
|
|
9238
9264
|
added.push({
|
|
9239
9265
|
resourceType: "AWS::SNS::Subscription",
|
|
@@ -9265,6 +9291,17 @@ async function enumerateSnsTopicChildren(ctx) {
|
|
|
9265
9291
|
if (!topicArn) return [];
|
|
9266
9292
|
const declaredSubscriptionArns = [];
|
|
9267
9293
|
for (const r of desired.resources) if (r.resourceType === "AWS::SNS::Subscription" && parentRefMatches(r.declared.TopicArn, topicArn) && r.physicalId) declaredSubscriptionArns.push(r.physicalId);
|
|
9294
|
+
const declaredInlineSubscriptions = [];
|
|
9295
|
+
const inlineDecl = parent.declared?.Subscription;
|
|
9296
|
+
if (Array.isArray(inlineDecl)) for (const e of inlineDecl) {
|
|
9297
|
+
if (!e || typeof e !== "object") continue;
|
|
9298
|
+
const { Protocol, Endpoint } = e;
|
|
9299
|
+
declaredInlineSubscriptions.push({
|
|
9300
|
+
protocol: typeof Protocol === "string" ? Protocol : void 0,
|
|
9301
|
+
endpoint: typeof Endpoint === "string" ? Endpoint : void 0,
|
|
9302
|
+
endpointUnresolved: Endpoint !== void 0 && hasUnresolved(Endpoint)
|
|
9303
|
+
});
|
|
9304
|
+
}
|
|
9268
9305
|
let hasDeclaredPolicy = false;
|
|
9269
9306
|
for (const r of desired.resources) {
|
|
9270
9307
|
if (r.resourceType === "AWS::SNS::TopicInlinePolicy") {
|
|
@@ -9286,12 +9323,14 @@ async function enumerateSnsTopicChildren(ctx) {
|
|
|
9286
9323
|
const liveSubscriptions = (await pageSubscriptions(client, topicArn)).filter((s) => typeof s.SubscriptionArn === "string" && s.SubscriptionArn.startsWith("arn:")).map((s) => ({
|
|
9287
9324
|
arn: s.SubscriptionArn,
|
|
9288
9325
|
label: s.Protocol ? `${s.Protocol} ${s.Endpoint ?? ""}`.trim() : s.SubscriptionArn,
|
|
9326
|
+
protocol: s.Protocol,
|
|
9289
9327
|
endpoint: s.Endpoint,
|
|
9290
9328
|
owner: s.Owner
|
|
9291
9329
|
}));
|
|
9292
9330
|
const livePolicy = await readSnsTopicPolicyDocument(client, topicArn);
|
|
9293
9331
|
return diffSnsTopicChildren({
|
|
9294
9332
|
declaredSubscriptionArns,
|
|
9333
|
+
declaredInlineSubscriptions,
|
|
9295
9334
|
liveSubscriptions
|
|
9296
9335
|
}).concat(diffSnsTopicPolicy({
|
|
9297
9336
|
topicArn,
|
|
@@ -11611,6 +11650,7 @@ function diffGlueDatabaseChildren(input) {
|
|
|
11611
11650
|
const added = [];
|
|
11612
11651
|
for (const t of liveTables) {
|
|
11613
11652
|
if (declared.has(t.name)) continue;
|
|
11653
|
+
if (t.sourceDatabaseName !== void 0 && t.sourceDatabaseName !== databaseName) continue;
|
|
11614
11654
|
added.push({
|
|
11615
11655
|
resourceType: "AWS::Glue::Table",
|
|
11616
11656
|
identifier: `${databaseName}|${t.name}`,
|
|
@@ -11641,6 +11681,8 @@ async function enumerateGlueDatabaseChildren(ctx) {
|
|
|
11641
11681
|
const { parent, desired, region } = ctx;
|
|
11642
11682
|
const databaseName = parent.physicalId;
|
|
11643
11683
|
if (!databaseName) return [];
|
|
11684
|
+
const dbInput = parent.declared.DatabaseInput;
|
|
11685
|
+
if (dbInput?.TargetDatabase !== void 0 || dbInput?.FederatedDatabase !== void 0) return [];
|
|
11644
11686
|
const declaredTableNames = [];
|
|
11645
11687
|
for (const r of desired.resources) {
|
|
11646
11688
|
if (r.resourceType !== "AWS::Glue::Table" || !parentRefMatches(r.declared.DatabaseName, databaseName)) continue;
|
|
@@ -11657,7 +11699,8 @@ async function enumerateGlueDatabaseChildren(ctx) {
|
|
|
11657
11699
|
...READ_RETRY
|
|
11658
11700
|
}), databaseName, catalogId)).filter((t) => typeof t.Name === "string").map((t) => ({
|
|
11659
11701
|
name: t.Name,
|
|
11660
|
-
label: t.TableType ? `${t.Name} (${t.TableType})` : t.Name
|
|
11702
|
+
label: t.TableType ? `${t.Name} (${t.TableType})` : t.Name,
|
|
11703
|
+
sourceDatabaseName: t.DatabaseName
|
|
11661
11704
|
}))
|
|
11662
11705
|
});
|
|
11663
11706
|
}
|
|
@@ -15158,9 +15201,10 @@ const DEFAULT_SG_LIST_TYPES = new Set([
|
|
|
15158
15201
|
"AWS::DMS::ReplicationInstance",
|
|
15159
15202
|
"AWS::EC2::ClientVpnEndpoint",
|
|
15160
15203
|
"AWS::VpcLattice::ResourceGateway",
|
|
15161
|
-
"AWS::EC2::VPCEndpoint"
|
|
15204
|
+
"AWS::EC2::VPCEndpoint",
|
|
15205
|
+
"AWS::ElastiCache::ServerlessCache"
|
|
15162
15206
|
]);
|
|
15163
|
-
const DEFAULT_SUBNET_LIST_TYPES = new Set(["AWS::RedshiftServerless::Workgroup"]);
|
|
15207
|
+
const DEFAULT_SUBNET_LIST_TYPES = new Set(["AWS::RedshiftServerless::Workgroup", "AWS::ElastiCache::ServerlessCache"]);
|
|
15164
15208
|
const EB_SG_OPTION_KEYS = new Set(["aws:elb:loadbalancer|SecurityGroups", "aws:autoscaling:launchconfiguration|SecurityGroups"]);
|
|
15165
15209
|
function collectEbSecurityGroupIds(resources, liveById) {
|
|
15166
15210
|
const ids = /* @__PURE__ */ new Set();
|
|
@@ -20588,6 +20632,7 @@ const CC_REVERTABLE_DESPITE_READ_OVERRIDE = new Set([
|
|
|
20588
20632
|
"AWS::EC2::EIP"
|
|
20589
20633
|
]);
|
|
20590
20634
|
const REVERT_SET_DEFAULT_PATHS = new Set([
|
|
20635
|
+
"AWS::ElastiCache::ServerlessCache\0Description",
|
|
20591
20636
|
"AWS::EC2::CapacityReservation\0InstanceMatchCriteria",
|
|
20592
20637
|
"AWS::EC2::CapacityReservation\0EndDateType",
|
|
20593
20638
|
"AWS::CodeDeploy::DeploymentGroup\0DeploymentConfigName",
|
|
@@ -20796,6 +20841,69 @@ function nullHuskRemovalOps(model) {
|
|
|
20796
20841
|
ops.sort((a, b) => compareDocOrderDescending(a.path, b.path));
|
|
20797
20842
|
return ops;
|
|
20798
20843
|
}
|
|
20844
|
+
const GUARDDUTY_DS_FEATURE_BLOCKS = [
|
|
20845
|
+
{
|
|
20846
|
+
block: "S3Logs",
|
|
20847
|
+
feature: "S3_DATA_EVENTS"
|
|
20848
|
+
},
|
|
20849
|
+
{
|
|
20850
|
+
block: "Kubernetes",
|
|
20851
|
+
feature: "EKS_AUDIT_LOGS"
|
|
20852
|
+
},
|
|
20853
|
+
{
|
|
20854
|
+
block: "MalwareProtection",
|
|
20855
|
+
feature: "EBS_MALWARE_PROTECTION"
|
|
20856
|
+
}
|
|
20857
|
+
];
|
|
20858
|
+
function firstBooleanLeaf(v) {
|
|
20859
|
+
if (typeof v === "boolean") return v;
|
|
20860
|
+
if (v && typeof v === "object" && !Array.isArray(v)) for (const x of Object.values(v)) {
|
|
20861
|
+
const b = firstBooleanLeaf(x);
|
|
20862
|
+
if (b !== void 0) return b;
|
|
20863
|
+
}
|
|
20864
|
+
}
|
|
20865
|
+
function applyGuardDutyDetectorPatchShape(item, live) {
|
|
20866
|
+
const features = Array.isArray(live.Features) ? live.Features : [];
|
|
20867
|
+
const featureIdx = (name) => features.findIndex((f) => f && f.Name === name);
|
|
20868
|
+
const ops = [];
|
|
20869
|
+
for (const op of item.ops) {
|
|
20870
|
+
if (!op.path.startsWith("/DataSources")) {
|
|
20871
|
+
ops.push(op);
|
|
20872
|
+
continue;
|
|
20873
|
+
}
|
|
20874
|
+
const seg = op.path.split("/")[2];
|
|
20875
|
+
const blocks = seg ? GUARDDUTY_DS_FEATURE_BLOCKS.filter((b) => b.block === seg) : GUARDDUTY_DS_FEATURE_BLOCKS;
|
|
20876
|
+
const translated = [];
|
|
20877
|
+
for (const b of blocks) {
|
|
20878
|
+
const sub = seg ? op.value : op.value?.[b.block];
|
|
20879
|
+
const enabled = op.op === "remove" ? true : firstBooleanLeaf(sub);
|
|
20880
|
+
const idx = featureIdx(b.feature);
|
|
20881
|
+
if (enabled === void 0 || idx < 0) continue;
|
|
20882
|
+
translated.push({
|
|
20883
|
+
op: "add",
|
|
20884
|
+
path: `/Features/${idx}/Status`,
|
|
20885
|
+
value: enabled ? "ENABLED" : "DISABLED",
|
|
20886
|
+
prior: op.prior,
|
|
20887
|
+
human: `${b.feature} -> ${enabled ? "ENABLED" : "DISABLED"} (translated from ${op.path}, #1752)`
|
|
20888
|
+
});
|
|
20889
|
+
}
|
|
20890
|
+
ops.push(...translated.length > 0 ? translated : [op]);
|
|
20891
|
+
}
|
|
20892
|
+
if (live.DataSources !== void 0 && !ops.some((o) => o.path === "/DataSources")) ops.push({
|
|
20893
|
+
op: "remove",
|
|
20894
|
+
path: "/DataSources",
|
|
20895
|
+
contract: true,
|
|
20896
|
+
human: "DataSources -> remove from the write model (Features projection, #1752)"
|
|
20897
|
+
});
|
|
20898
|
+
const eksIdx = featureIdx("EKS_RUNTIME_MONITORING");
|
|
20899
|
+
if (eksIdx >= 0 && featureIdx("RUNTIME_MONITORING") >= 0) ops.push({
|
|
20900
|
+
op: "remove",
|
|
20901
|
+
path: `/Features/${eksIdx}`,
|
|
20902
|
+
contract: true,
|
|
20903
|
+
human: "EKS_RUNTIME_MONITORING -> remove (deprecated alias of RUNTIME_MONITORING, #1752)"
|
|
20904
|
+
});
|
|
20905
|
+
item.ops = ops;
|
|
20906
|
+
}
|
|
20799
20907
|
function compareDocOrderDescending(a, b) {
|
|
20800
20908
|
const as = a.split("/").slice(1);
|
|
20801
20909
|
const bs = b.split("/").slice(1);
|
|
@@ -21128,6 +21236,7 @@ function buildRevertPlan(findings, baseline, opts = {}) {
|
|
|
21128
21236
|
item.liveRaw = live;
|
|
21129
21237
|
const huskOps = nullHuskRemovalOps(live);
|
|
21130
21238
|
if (huskOps.length > 0) item.ops.unshift(...huskOps);
|
|
21239
|
+
if (item.resourceType === "AWS::GuardDuty::Detector") applyGuardDutyDetectorPatchShape(item, live);
|
|
21131
21240
|
}
|
|
21132
21241
|
const ordered = [...itemsByLogical.values()];
|
|
21133
21242
|
return {
|