cdk-real-drift 0.2.14 → 0.2.16
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 +120 -5
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1581,7 +1581,38 @@ const KNOWN_DEFAULTS = {
|
|
|
1581
1581
|
},
|
|
1582
1582
|
"AWS::Bedrock::Agent": {
|
|
1583
1583
|
AgentCollaboration: "DISABLED",
|
|
1584
|
-
OrchestrationType: "DEFAULT"
|
|
1584
|
+
OrchestrationType: "DEFAULT",
|
|
1585
|
+
IdleSessionTTLInSeconds: 600
|
|
1586
|
+
},
|
|
1587
|
+
"AWS::EC2::VPNGateway": { AmazonSideAsn: 64512 },
|
|
1588
|
+
"AWS::CodeGuruProfiler::ProfilingGroup": { ComputePlatform: "Default" },
|
|
1589
|
+
"AWS::ServiceCatalog::CloudFormationProduct": { ProductType: "CLOUD_FORMATION_TEMPLATE" },
|
|
1590
|
+
"AWS::InternetMonitor::Monitor": { Status: "ACTIVE" },
|
|
1591
|
+
"AWS::RolesAnywhere::Profile": {
|
|
1592
|
+
DurationSeconds: 3600,
|
|
1593
|
+
AttributeMappings: [
|
|
1594
|
+
{
|
|
1595
|
+
CertificateField: "x509Issuer",
|
|
1596
|
+
MappingRules: [{ Specifier: "*" }]
|
|
1597
|
+
},
|
|
1598
|
+
{
|
|
1599
|
+
CertificateField: "x509SAN",
|
|
1600
|
+
MappingRules: [
|
|
1601
|
+
{ Specifier: "DNS" },
|
|
1602
|
+
{ Specifier: "URI" },
|
|
1603
|
+
{ Specifier: "Name/*" }
|
|
1604
|
+
]
|
|
1605
|
+
},
|
|
1606
|
+
{
|
|
1607
|
+
CertificateField: "x509Subject",
|
|
1608
|
+
MappingRules: [{ Specifier: "*" }]
|
|
1609
|
+
}
|
|
1610
|
+
]
|
|
1611
|
+
},
|
|
1612
|
+
"AWS::KinesisVideo::Stream": { DataRetentionInHours: 0 },
|
|
1613
|
+
"AWS::KinesisVideo::SignalingChannel": {
|
|
1614
|
+
Type: "SINGLE_MASTER",
|
|
1615
|
+
MessageTtlSeconds: 60
|
|
1585
1616
|
},
|
|
1586
1617
|
"AWS::CodeStarNotifications::NotificationRule": { Status: "ENABLED" },
|
|
1587
1618
|
"AWS::Rbin::Rule": { Status: "available" },
|
|
@@ -1667,6 +1698,7 @@ const KNOWN_DEFAULTS = {
|
|
|
1667
1698
|
"AWS::CodeStarConnections::Connection": { HostArn: "arn:aws:codestar-connections:us-west-2:000000000000:host/00000000-0000-0000-0000-000000000000" }
|
|
1668
1699
|
};
|
|
1669
1700
|
const KNOWN_DEFAULT_PATHS = {
|
|
1701
|
+
"AWS::ServiceCatalog::CloudFormationProduct": { "ProvisioningArtifactParameters.*.Type": "CLOUD_FORMATION_TEMPLATE" },
|
|
1670
1702
|
"AWS::KinesisAnalyticsV2::Application": { "ApplicationConfiguration.ApplicationEncryptionConfiguration": { KeyType: "AWS_OWNED_KEY" } },
|
|
1671
1703
|
"AWS::Lambda::Function": {
|
|
1672
1704
|
"LoggingConfig.LogFormat": "Text",
|
|
@@ -1893,6 +1925,10 @@ const GENERATED_PATHS = {
|
|
|
1893
1925
|
"AWS::XRay::SamplingRule": ["SamplingRule.RuleARN"]
|
|
1894
1926
|
};
|
|
1895
1927
|
const CONTEXT_DEFAULTS = { "AWS::EC2::VPCEndpointService": { SupportedRegions: "regionList" } };
|
|
1928
|
+
const CONTEXT_ARN_DEFAULTS = {
|
|
1929
|
+
"AWS::ResourceExplorer2::View": { Scope: "arn:{partition}:iam::{accountId}:root" },
|
|
1930
|
+
"AWS::KinesisVideo::Stream": { KmsKeyId: "arn:{partition}:kms:{region}:{accountId}:alias/aws/kinesisvideo" }
|
|
1931
|
+
};
|
|
1896
1932
|
const ENGINE_DEFAULTS = {
|
|
1897
1933
|
"AWS::RDS::DBInstance": {
|
|
1898
1934
|
StorageType: (e) => e.startsWith("aurora") ? "aurora" : void 0,
|
|
@@ -1944,7 +1980,8 @@ const GENERATED_TOPLEVEL_PATHS = {
|
|
|
1944
1980
|
};
|
|
1945
1981
|
const DESCEND_UNDECLARED_OBJECT_PATHS = {
|
|
1946
1982
|
"AWS::EKS::Cluster": new Set(["KubernetesNetworkConfig"]),
|
|
1947
|
-
"AWS::Athena::WorkGroup": new Set(["WorkGroupConfiguration"])
|
|
1983
|
+
"AWS::Athena::WorkGroup": new Set(["WorkGroupConfiguration"]),
|
|
1984
|
+
"AWS::KinesisVideo::Stream": new Set(["StreamStorageConfiguration"])
|
|
1948
1985
|
};
|
|
1949
1986
|
const GENERATED_LOGICALID_PREFIX_PATHS = {
|
|
1950
1987
|
"AWS::Cognito::UserPoolClient": new Set(["ClientName"]),
|
|
@@ -1960,7 +1997,8 @@ const GENERATED_NESTED_PATHS = {
|
|
|
1960
1997
|
"AWS::KMS::Key": new Set(["KeyPolicy.Id"]),
|
|
1961
1998
|
"AWS::ECR::Repository": new Set(["LifecyclePolicy.RegistryId"]),
|
|
1962
1999
|
"AWS::Lambda::Function": new Set(["LoggingConfig.LogGroup"]),
|
|
1963
|
-
"AWS::OpenSearchService::Domain": new Set(["EncryptionAtRestOptions.KmsKeyId"])
|
|
2000
|
+
"AWS::OpenSearchService::Domain": new Set(["EncryptionAtRestOptions.KmsKeyId"]),
|
|
2001
|
+
"AWS::ApiGateway::Stage": new Set(["CanarySetting.DeploymentId"])
|
|
1964
2002
|
};
|
|
1965
2003
|
const EB_OPTION_DEFAULTS = {
|
|
1966
2004
|
"aws:autoscaling:asg|Availability Zones": "Any",
|
|
@@ -2128,7 +2166,12 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
|
2128
2166
|
"AWS::EC2::EIP": new Set(["NetworkBorderGroup"]),
|
|
2129
2167
|
"AWS::EC2::VPCEndpoint": new Set(["ServiceRegion", "DnsOptions"]),
|
|
2130
2168
|
"AWS::EC2::VPCPeeringConnection": new Set(["PeerRegion"]),
|
|
2131
|
-
"AWS::Grafana::Workspace": new Set(["GrafanaVersion"])
|
|
2169
|
+
"AWS::Grafana::Workspace": new Set(["GrafanaVersion"]),
|
|
2170
|
+
"AWS::Bedrock::AgentAlias": new Set(["RoutingConfiguration"]),
|
|
2171
|
+
"AWS::AppSync::ApiKey": new Set(["Expires"]),
|
|
2172
|
+
"AWS::AppConfig::ExtensionAssociation": new Set(["ExtensionVersionNumber"]),
|
|
2173
|
+
"AWS::StepFunctions::StateMachineVersion": new Set(["StateMachineRevisionId"]),
|
|
2174
|
+
"AWS::StepFunctions::StateMachineAlias": new Set(["StateMachineArn"])
|
|
2132
2175
|
};
|
|
2133
2176
|
function isPhysicalIdSegment(value, physicalId) {
|
|
2134
2177
|
if (typeof value !== "string" || physicalId === void 0) return false;
|
|
@@ -3637,6 +3680,25 @@ function alignCompositeKeySubset(declared, live, spec) {
|
|
|
3637
3680
|
});
|
|
3638
3681
|
}
|
|
3639
3682
|
const isNestedObject = (x) => x !== null && typeof x === "object" && !Array.isArray(x);
|
|
3683
|
+
const DDB_TABLE_TYPES = new Set(["AWS::DynamoDB::Table", "AWS::DynamoDB::GlobalTable"]);
|
|
3684
|
+
function warmThroughputDefault(provisionedThroughput) {
|
|
3685
|
+
if (isNestedObject(provisionedThroughput) && typeof provisionedThroughput.ReadCapacityUnits === "number" && typeof provisionedThroughput.WriteCapacityUnits === "number") return {
|
|
3686
|
+
ReadUnitsPerSecond: provisionedThroughput.ReadCapacityUnits,
|
|
3687
|
+
WriteUnitsPerSecond: provisionedThroughput.WriteCapacityUnits
|
|
3688
|
+
};
|
|
3689
|
+
return {
|
|
3690
|
+
ReadUnitsPerSecond: 12e3,
|
|
3691
|
+
WriteUnitsPerSecond: 4e3
|
|
3692
|
+
};
|
|
3693
|
+
}
|
|
3694
|
+
function dynamoGsiWarmThroughputAtDefault(resourceType, path, value, live) {
|
|
3695
|
+
if (!DDB_TABLE_TYPES.has(resourceType)) return false;
|
|
3696
|
+
const m = /^GlobalSecondaryIndexes\[(.*)\]\.WarmThroughput$/.exec(path);
|
|
3697
|
+
if (m === null || !Array.isArray(live.GlobalSecondaryIndexes)) return false;
|
|
3698
|
+
const gsi = live.GlobalSecondaryIndexes.find((g) => isNestedObject(g) && g.IndexName === m[1]);
|
|
3699
|
+
if (!isNestedObject(gsi)) return false;
|
|
3700
|
+
return deepEqual(value, warmThroughputDefault(gsi.ProvisionedThroughput));
|
|
3701
|
+
}
|
|
3640
3702
|
const CFN_RANDOM_SUFFIX = /-[0-9A-Za-z]{12,}$/;
|
|
3641
3703
|
function stripInjectedJsonStringDefaults(declared, live, defaults) {
|
|
3642
3704
|
const stripObject = (d, l) => {
|
|
@@ -3851,7 +3913,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
3851
3913
|
const emitNested = (path, value) => {
|
|
3852
3914
|
if (isAllAwsTags(value) || isTrivialEmpty(value)) return;
|
|
3853
3915
|
const schemaPath = path.replace(/\[[^\]]*\]/g, ".*");
|
|
3854
|
-
const tier = schemaPath in schema.defaultPaths && matchesKnownDefault(value, schema.defaultPaths[schemaPath]) || schemaPath in knownDefPaths && matchesKnownDefault(value, knownDefPaths[schemaPath]) ? "atDefault" : generatedPaths.includes(schemaPath) && isPhysicalIdSegment(value, physicalId) || generatedNestedPaths?.has(schemaPath) ? "generated" : "undeclared";
|
|
3916
|
+
const tier = schemaPath in schema.defaultPaths && matchesKnownDefault(value, schema.defaultPaths[schemaPath]) || schemaPath in knownDefPaths && matchesKnownDefault(value, knownDefPaths[schemaPath]) || dynamoGsiWarmThroughputAtDefault(resourceType, path, value, live) ? "atDefault" : generatedPaths.includes(schemaPath) && isPhysicalIdSegment(value, physicalId) || generatedNestedPaths?.has(schemaPath) ? "generated" : "undeclared";
|
|
3855
3917
|
const freeFormKey = tier === "undeclared" && underFreeFormMap(schemaPath);
|
|
3856
3918
|
findings.push({
|
|
3857
3919
|
tier,
|
|
@@ -4196,6 +4258,20 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
4196
4258
|
continue;
|
|
4197
4259
|
}
|
|
4198
4260
|
}
|
|
4261
|
+
const ctxArnTemplate = CONTEXT_ARN_DEFAULTS[resourceType]?.[k];
|
|
4262
|
+
if (ctxArnTemplate !== void 0 && opts.region !== void 0 && opts.accountId !== void 0 && typeof v === "string") {
|
|
4263
|
+
const partition = opts.region.startsWith("cn-") ? "aws-cn" : opts.region.startsWith("us-gov-") ? "aws-us-gov" : "aws";
|
|
4264
|
+
if (v === ctxArnTemplate.replace("{partition}", partition).replace("{region}", opts.region).replace("{accountId}", opts.accountId)) {
|
|
4265
|
+
findings.push({
|
|
4266
|
+
tier: "atDefault",
|
|
4267
|
+
logicalId,
|
|
4268
|
+
resourceType,
|
|
4269
|
+
path: k,
|
|
4270
|
+
actual: v
|
|
4271
|
+
});
|
|
4272
|
+
continue;
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4199
4275
|
const engineDefault = ENGINE_DEFAULTS[resourceType]?.[k];
|
|
4200
4276
|
if (engineDefault !== void 0 && typeof live.Engine === "string") {
|
|
4201
4277
|
const def = engineDefault(live.Engine);
|
|
@@ -4210,6 +4286,16 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
4210
4286
|
continue;
|
|
4211
4287
|
}
|
|
4212
4288
|
}
|
|
4289
|
+
if (DDB_TABLE_TYPES.has(resourceType) && k === "WarmThroughput" && deepEqual(v, warmThroughputDefault(live.ProvisionedThroughput))) {
|
|
4290
|
+
findings.push({
|
|
4291
|
+
tier: "atDefault",
|
|
4292
|
+
logicalId,
|
|
4293
|
+
resourceType,
|
|
4294
|
+
path: k,
|
|
4295
|
+
actual: v
|
|
4296
|
+
});
|
|
4297
|
+
continue;
|
|
4298
|
+
}
|
|
4213
4299
|
const namePattern = DEFAULT_MANAGED_NAME_PATHS[resourceType]?.[k];
|
|
4214
4300
|
if (namePattern !== void 0 && typeof v === "string" && namePattern.test(v)) {
|
|
4215
4301
|
findings.push({
|
|
@@ -4284,6 +4370,35 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
4284
4370
|
collectNestedUndeclared({}, v, k, emitNested, NESTED_ARRAY_IDENTITY[resourceType]);
|
|
4285
4371
|
continue;
|
|
4286
4372
|
}
|
|
4373
|
+
const subsetSpecU = IDENTITY_KEYED_SUBSET_ARRAYS[resourceType]?.[k];
|
|
4374
|
+
const defaultElsU = IDENTITY_KEYED_DEFAULT_ELEMENTS[resourceType]?.[k];
|
|
4375
|
+
if (subsetSpecU !== void 0 && defaultElsU !== void 0 && Array.isArray(v)) {
|
|
4376
|
+
const { idField, normalizeId } = subsetSpecU;
|
|
4377
|
+
for (const lEl of v) {
|
|
4378
|
+
if (!isNestedObject(lEl) || typeof lEl[idField] !== "string") {
|
|
4379
|
+
findings.push({
|
|
4380
|
+
tier: "undeclared",
|
|
4381
|
+
logicalId,
|
|
4382
|
+
resourceType,
|
|
4383
|
+
path: k,
|
|
4384
|
+
actual: lEl
|
|
4385
|
+
});
|
|
4386
|
+
continue;
|
|
4387
|
+
}
|
|
4388
|
+
const raw = lEl[idField];
|
|
4389
|
+
const id = normalizeId ? normalizeId(raw) : raw;
|
|
4390
|
+
const atDefault = id in defaultElsU && deepEqual(lEl, defaultElsU[id]);
|
|
4391
|
+
findings.push({
|
|
4392
|
+
tier: atDefault ? "atDefault" : "undeclared",
|
|
4393
|
+
logicalId,
|
|
4394
|
+
resourceType,
|
|
4395
|
+
path: `${k}[${id}]`,
|
|
4396
|
+
actual: lEl,
|
|
4397
|
+
nested: true
|
|
4398
|
+
});
|
|
4399
|
+
}
|
|
4400
|
+
continue;
|
|
4401
|
+
}
|
|
4287
4402
|
findings.push({
|
|
4288
4403
|
tier: "undeclared",
|
|
4289
4404
|
logicalId,
|