cdk-real-drift 0.2.24 → 0.2.26
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 +48 -9
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1306,11 +1306,14 @@ const KNOWN_DEFAULTS = {
|
|
|
1306
1306
|
"AWS::ApiGatewayV2::Api": {
|
|
1307
1307
|
RouteSelectionExpression: "$request.method $request.path",
|
|
1308
1308
|
IpAddressType: "ipv4",
|
|
1309
|
-
DisableExecuteApiEndpoint: false
|
|
1309
|
+
DisableExecuteApiEndpoint: false,
|
|
1310
|
+
ApiKeySelectionExpression: "$request.header.x-api-key"
|
|
1310
1311
|
},
|
|
1311
1312
|
"AWS::ApiGatewayV2::Integration": {
|
|
1312
1313
|
ConnectionType: "INTERNET",
|
|
1313
|
-
|
|
1314
|
+
PayloadFormatVersion: "1.0",
|
|
1315
|
+
IntegrationMethod: "POST",
|
|
1316
|
+
PassthroughBehavior: "WHEN_NO_MATCH"
|
|
1314
1317
|
},
|
|
1315
1318
|
"AWS::CodeBuild::Project": {
|
|
1316
1319
|
TimeoutInMinutes: 60,
|
|
@@ -1698,7 +1701,9 @@ const KNOWN_DEFAULTS = {
|
|
|
1698
1701
|
},
|
|
1699
1702
|
"AWS::CodeStarConnections::Connection": { HostArn: "arn:aws:codestar-connections:us-west-2:000000000000:host/00000000-0000-0000-0000-000000000000" }
|
|
1700
1703
|
};
|
|
1704
|
+
const KNOWN_DEFAULT_ONE_OF = { "AWS::ApiGatewayV2::Integration": { TimeoutInMillis: [29e3, 3e4] } };
|
|
1701
1705
|
const KNOWN_DEFAULT_PATHS = {
|
|
1706
|
+
"AWS::ApiGatewayV2::Stage": { "DefaultRouteSettings.LoggingLevel": "OFF" },
|
|
1702
1707
|
"AWS::ServiceCatalog::CloudFormationProduct": { "ProvisioningArtifactParameters.*.Type": "CLOUD_FORMATION_TEMPLATE" },
|
|
1703
1708
|
"AWS::KinesisAnalyticsV2::Application": { "ApplicationConfiguration.ApplicationEncryptionConfiguration": { KeyType: "AWS_OWNED_KEY" } },
|
|
1704
1709
|
"AWS::Lambda::Function": {
|
|
@@ -3646,6 +3651,17 @@ const CC_ALT_REPRESENTATION = {
|
|
|
3646
3651
|
},
|
|
3647
3652
|
"AWS::ElasticLoadBalancingV2::LoadBalancer": { SubnetMappings: "Subnets" }
|
|
3648
3653
|
};
|
|
3654
|
+
const SHAPE_ECHO_TWIN = { "AWS::KinesisFirehose::DeliveryStream": { ExtendedS3DestinationConfiguration: "S3DestinationConfiguration" } };
|
|
3655
|
+
function twinOverlapEchoes(source, twin) {
|
|
3656
|
+
for (const [k, tv] of Object.entries(twin)) {
|
|
3657
|
+
if (!(k in source)) continue;
|
|
3658
|
+
const sv = source[k];
|
|
3659
|
+
if (isNestedObject(sv) && isNestedObject(tv)) {
|
|
3660
|
+
if (!twinOverlapEchoes(sv, tv)) return false;
|
|
3661
|
+
} else if (!deepEqual(sv, tv)) return false;
|
|
3662
|
+
}
|
|
3663
|
+
return true;
|
|
3664
|
+
}
|
|
3649
3665
|
const IAM_ATTACHMENT_SUBSET = { "AWS::IAM::ManagedPolicy": new Set([
|
|
3650
3666
|
"Roles",
|
|
3651
3667
|
"Users",
|
|
@@ -3911,6 +3927,8 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
3911
3927
|
path: k,
|
|
3912
3928
|
note: "write-only — cannot be read back"
|
|
3913
3929
|
});
|
|
3930
|
+
const twinSources = {};
|
|
3931
|
+
for (const src of Object.values(SHAPE_ECHO_TWIN[resourceType] ?? {})) if (isNestedObject(declared[src])) twinSources[src] = declared[src];
|
|
3914
3932
|
deepStripPaths(declared, schema.writeOnlyPaths);
|
|
3915
3933
|
const sibling = resource.siblingPolicyNames;
|
|
3916
3934
|
if (sibling !== void 0 && sibling !== "unresolved" && Array.isArray(live.Policies)) {
|
|
@@ -4265,7 +4283,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
4265
4283
|
}
|
|
4266
4284
|
continue;
|
|
4267
4285
|
}
|
|
4268
|
-
if (k in schema.defaults && matchesKnownDefault(v, schema.defaults[k]) || k in knownDef && matchesKnownDefault(v, knownDef[k]) || VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS[resourceType]?.has(k)) {
|
|
4286
|
+
if (k in schema.defaults && matchesKnownDefault(v, schema.defaults[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)) {
|
|
4269
4287
|
findings.push({
|
|
4270
4288
|
tier: "atDefault",
|
|
4271
4289
|
logicalId,
|
|
@@ -4439,6 +4457,12 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
4439
4457
|
});
|
|
4440
4458
|
continue;
|
|
4441
4459
|
}
|
|
4460
|
+
const twinSourceKey = SHAPE_ECHO_TWIN[resourceType]?.[k];
|
|
4461
|
+
const twinSource = twinSourceKey !== void 0 ? twinSources[twinSourceKey] ?? declared[twinSourceKey] : void 0;
|
|
4462
|
+
if (isNestedObject(v) && isNestedObject(twinSource) && twinOverlapEchoes(twinSource, v)) {
|
|
4463
|
+
collectNestedUndeclared(twinSource, v, k, emitNested, NESTED_ARRAY_IDENTITY[resourceType]);
|
|
4464
|
+
continue;
|
|
4465
|
+
}
|
|
4442
4466
|
findings.push({
|
|
4443
4467
|
tier: "undeclared",
|
|
4444
4468
|
logicalId,
|
|
@@ -7852,6 +7876,12 @@ const CC_IDENTIFIER_ADAPTERS = {
|
|
|
7852
7876
|
if (pid.includes("|")) return pid;
|
|
7853
7877
|
const vpcId = declared.VpcId;
|
|
7854
7878
|
return typeof vpcId === "string" && vpcId.length > 0 ? `${pid}|${vpcId}` : void 0;
|
|
7879
|
+
},
|
|
7880
|
+
"AWS::ApiGatewayV2::RouteResponse": (pid, declared) => {
|
|
7881
|
+
if (pid.includes("|")) return pid;
|
|
7882
|
+
const apiId = declared.ApiId;
|
|
7883
|
+
const routeId = declared.RouteId;
|
|
7884
|
+
return typeof apiId === "string" && apiId.length > 0 && typeof routeId === "string" && routeId.length > 0 ? `${apiId}|${routeId}|${pid}` : void 0;
|
|
7855
7885
|
}
|
|
7856
7886
|
};
|
|
7857
7887
|
function scalingPolicyComposite(pid, declared) {
|
|
@@ -10476,8 +10506,10 @@ const REVERT_SET_DEFAULT_PATHS = new Set([
|
|
|
10476
10506
|
"AWS::SNS::Subscription\0FilterPolicyScope",
|
|
10477
10507
|
"AWS::InternetMonitor::Monitor\0Status",
|
|
10478
10508
|
"AWS::RolesAnywhere::Profile\0DurationSeconds",
|
|
10479
|
-
"AWS::RolesAnywhere::Profile\0AttributeMappings"
|
|
10509
|
+
"AWS::RolesAnywhere::Profile\0AttributeMappings",
|
|
10510
|
+
"AWS::EC2::Subnet\0EnableDns64"
|
|
10480
10511
|
]);
|
|
10512
|
+
const REVERT_SET_DEFAULT_VALUES = { "AWS::EC2::Subnet\0EnableDns64": false };
|
|
10481
10513
|
/**
|
|
10482
10514
|
* A nested undeclared value (a live sub-key inside a declared object, R96/R98) — a dotted
|
|
10483
10515
|
* path (`Conf.Destination`) or an identity-keyed array element (`Prop[<id>].sub`). Pure +
|
|
@@ -10743,8 +10775,9 @@ function revertOp(f, recorded) {
|
|
|
10743
10775
|
prior: f.actual,
|
|
10744
10776
|
human: `${f.path} -> baseline value`
|
|
10745
10777
|
};
|
|
10746
|
-
const
|
|
10747
|
-
|
|
10778
|
+
const setDefaultKey = `${f.resourceType}\0${f.path}`;
|
|
10779
|
+
const knownDefault = KNOWN_DEFAULTS[f.resourceType]?.[f.path] ?? REVERT_SET_DEFAULT_VALUES[setDefaultKey];
|
|
10780
|
+
if (knownDefault !== void 0 && REVERT_SET_DEFAULT_PATHS.has(setDefaultKey)) return {
|
|
10748
10781
|
op: "add",
|
|
10749
10782
|
path: pointer,
|
|
10750
10783
|
value: knownDefault,
|
|
@@ -10836,7 +10869,8 @@ const CC_UPDATE_REJECTED_EMPTY_PATHS = {
|
|
|
10836
10869
|
"/Distributions/*/AmiDistributionConfiguration/TargetAccountIds",
|
|
10837
10870
|
"/Distributions/*/FastLaunchConfigurations",
|
|
10838
10871
|
"/Distributions/*/LaunchTemplateConfigurations"
|
|
10839
|
-
]
|
|
10872
|
+
],
|
|
10873
|
+
"AWS::Lambda::EventInvokeConfig": ["/DestinationConfig/OnSuccess", "/DestinationConfig/OnFailure"]
|
|
10840
10874
|
};
|
|
10841
10875
|
function expandPointer(model, pointer) {
|
|
10842
10876
|
let frontier = [{
|
|
@@ -10861,17 +10895,22 @@ function expandPointer(model, pointer) {
|
|
|
10861
10895
|
value: node
|
|
10862
10896
|
}));
|
|
10863
10897
|
}
|
|
10898
|
+
function isEmptyHusk(value) {
|
|
10899
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
10900
|
+
if (value !== null && typeof value === "object") return Object.keys(value).length === 0;
|
|
10901
|
+
return false;
|
|
10902
|
+
}
|
|
10864
10903
|
function rejectedEmptyStripOps(resourceType, ops, liveRaw) {
|
|
10865
10904
|
const pointers = CC_UPDATE_REJECTED_EMPTY_PATHS[resourceType];
|
|
10866
10905
|
if (!pointers || !liveRaw || ops.length === 0) return [];
|
|
10867
10906
|
const out = [];
|
|
10868
10907
|
for (const pointer of pointers) for (const { pointer: concrete, value } of expandPointer(liveRaw, pointer)) {
|
|
10869
|
-
if (!
|
|
10908
|
+
if (!isEmptyHusk(value)) continue;
|
|
10870
10909
|
if (ops.some((o) => concrete === o.path || concrete.startsWith(`${o.path}/`))) continue;
|
|
10871
10910
|
out.push({
|
|
10872
10911
|
op: "remove",
|
|
10873
10912
|
path: concrete,
|
|
10874
|
-
human: `${concrete.slice(1).replaceAll("/", ".")} -> drop service-echoed empty
|
|
10913
|
+
human: `${concrete.slice(1).replaceAll("/", ".")} -> drop service-echoed empty husk (service rejects it on update)`
|
|
10875
10914
|
});
|
|
10876
10915
|
}
|
|
10877
10916
|
return out;
|