cdk-real-drift 0.12.3 → 0.12.5
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 +19 -6
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1750,6 +1750,10 @@ const TAG_PROPERTY_NAMES = new Set([
|
|
|
1750
1750
|
function stripCcApiAwsManagedFields(awsProps) {
|
|
1751
1751
|
return stripWalk(awsProps, false);
|
|
1752
1752
|
}
|
|
1753
|
+
const MANAGED_TIMESTAMP_NAME = /^(creation|created|create|lastmodified|lastupdated|lastupdate|modification|modified|updated|update)(date|time|timestamp|at)$/;
|
|
1754
|
+
function isManagedTimestampName(key) {
|
|
1755
|
+
return MANAGED_TIMESTAMP_NAME.test(key.toLowerCase().replace(/[^a-z0-9]/g, ""));
|
|
1756
|
+
}
|
|
1753
1757
|
function stripWalk(value, freeForm) {
|
|
1754
1758
|
if (value === null || value === void 0) return value;
|
|
1755
1759
|
if (Array.isArray(value)) {
|
|
@@ -1759,7 +1763,7 @@ function stripWalk(value, freeForm) {
|
|
|
1759
1763
|
if (typeof value === "object") {
|
|
1760
1764
|
const out = {};
|
|
1761
1765
|
for (const [k, child] of Object.entries(value)) {
|
|
1762
|
-
if (!freeForm && ALWAYS_STRIPPED.has(k)) continue;
|
|
1766
|
+
if (!freeForm && (ALWAYS_STRIPPED.has(k) || isManagedTimestampName(k))) continue;
|
|
1763
1767
|
out[k] = stripWalk(child, freeForm || FREE_FORM_MAP_PARENTS.has(k));
|
|
1764
1768
|
}
|
|
1765
1769
|
return out;
|
|
@@ -5116,7 +5120,8 @@ function guardDutyFeaturesAllAtDefault(features) {
|
|
|
5116
5120
|
}
|
|
5117
5121
|
const DEFAULT_SG_LIST_PATHS = {
|
|
5118
5122
|
"AWS::ElasticLoadBalancingV2::LoadBalancer": "SecurityGroups",
|
|
5119
|
-
"AWS::EC2::NetworkInterface": "GroupSet"
|
|
5123
|
+
"AWS::EC2::NetworkInterface": "GroupSet",
|
|
5124
|
+
"AWS::Neptune::DBCluster": "VpcSecurityGroupIds"
|
|
5120
5125
|
};
|
|
5121
5126
|
/** #889 fold decision for an UNDECLARED default-SG list (ALB SecurityGroups / ENI GroupSet).
|
|
5122
5127
|
* Returns whether the value-independent fold should still apply for this live value:
|
|
@@ -5148,6 +5153,7 @@ const IDENTITY_KEYED_SUBSET_ARRAYS = {
|
|
|
5148
5153
|
foldHuskExtras: true
|
|
5149
5154
|
} }
|
|
5150
5155
|
};
|
|
5156
|
+
const VALUE_INDEPENDENT_KEYED_ELEMENTS = { "AWS::Cognito::UserPoolUser": { UserAttributes: new Set(["sub"]) } };
|
|
5151
5157
|
const NESTED_ARRAY_IDENTITY = {
|
|
5152
5158
|
"AWS::ApiGateway::Method": {
|
|
5153
5159
|
"Integration.IntegrationResponses": "StatusCode",
|
|
@@ -6191,7 +6197,9 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
6191
6197
|
for (const lEl of live[k]) {
|
|
6192
6198
|
const id = idOf(lEl);
|
|
6193
6199
|
if (id !== void 0 && !declaredIds.has(id)) {
|
|
6194
|
-
const
|
|
6200
|
+
const isHuskExtra = subsetSpec.foldHuskExtras === true && isNestedObject(lEl) && Object.entries(lEl).every(([ek, ev]) => ek === idField || isTrivialEmpty(ev));
|
|
6201
|
+
const isValueIndependentId = VALUE_INDEPENDENT_KEYED_ELEMENTS[resourceType]?.[k]?.has(id) ?? false;
|
|
6202
|
+
const atDefault = isHuskExtra || isValueIndependentId || defaultEls && id in defaultEls && deepEqual(lEl, defaultEls[id]);
|
|
6195
6203
|
findings.push({
|
|
6196
6204
|
tier: atDefault ? "atDefault" : "undeclared",
|
|
6197
6205
|
logicalId,
|
|
@@ -6523,7 +6531,8 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
6523
6531
|
}
|
|
6524
6532
|
const subsetSpecU = IDENTITY_KEYED_SUBSET_ARRAYS[resourceType]?.[k];
|
|
6525
6533
|
const defaultElsU = IDENTITY_KEYED_DEFAULT_ELEMENTS[resourceType]?.[k];
|
|
6526
|
-
|
|
6534
|
+
const viIdsU = VALUE_INDEPENDENT_KEYED_ELEMENTS[resourceType]?.[k];
|
|
6535
|
+
if (subsetSpecU !== void 0 && (defaultElsU !== void 0 || viIdsU !== void 0) && Array.isArray(v)) {
|
|
6527
6536
|
const { idField, normalizeId } = subsetSpecU;
|
|
6528
6537
|
for (const lEl of v) {
|
|
6529
6538
|
if (!isNestedObject(lEl) || typeof lEl[idField] !== "string") {
|
|
@@ -6538,7 +6547,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
6538
6547
|
}
|
|
6539
6548
|
const raw = lEl[idField];
|
|
6540
6549
|
const id = normalizeId ? normalizeId(raw) : raw;
|
|
6541
|
-
const atDefault = id in defaultElsU && deepEqual(lEl, defaultElsU[id]);
|
|
6550
|
+
const atDefault = (viIdsU?.has(id) ?? false) || defaultElsU !== void 0 && id in defaultElsU && deepEqual(lEl, defaultElsU[id]);
|
|
6542
6551
|
findings.push({
|
|
6543
6552
|
tier: atDefault ? "atDefault" : "undeclared",
|
|
6544
6553
|
logicalId,
|
|
@@ -11035,7 +11044,11 @@ function liveModelMap(reads) {
|
|
|
11035
11044
|
for (const [logicalId, read] of reads) if (read.live) out.set(logicalId, read.live);
|
|
11036
11045
|
return out;
|
|
11037
11046
|
}
|
|
11038
|
-
const DEFAULT_SG_LIST_TYPES = new Set([
|
|
11047
|
+
const DEFAULT_SG_LIST_TYPES = new Set([
|
|
11048
|
+
"AWS::ElasticLoadBalancingV2::LoadBalancer",
|
|
11049
|
+
"AWS::EC2::NetworkInterface",
|
|
11050
|
+
"AWS::Neptune::DBCluster"
|
|
11051
|
+
]);
|
|
11039
11052
|
const defaultSgIdsCache = /* @__PURE__ */ new Map();
|
|
11040
11053
|
async function fetchDefaultSgIds(region) {
|
|
11041
11054
|
const cached = defaultSgIdsCache.get(region);
|