cdk-real-drift 0.2.60 → 0.2.62
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 +63 -15
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -510,9 +510,20 @@ function validateIgnoreEntry(entry, index) {
|
|
|
510
510
|
* key) so a rule is writable even on a non-CDK / metadata-stripped stack. Pure + exported;
|
|
511
511
|
* `applyIgnores` matches the within-stack path, the full construct path (older rules), AND
|
|
512
512
|
* the logicalId, so every form works.
|
|
513
|
+
*
|
|
514
|
+
* EXCEPTION — an `added`-tier finding always keys on `logicalId`, NEVER constructPath
|
|
515
|
+
* (issue #802). For an added child the constructPath is a display LABEL
|
|
516
|
+
* (`<parent> ▸ <label>`, gather.ts) built from a NON-unique, human name — a Cognito
|
|
517
|
+
* UserPoolClient's ClientName, an SNS subscription's `protocol endpoint` — so a rule
|
|
518
|
+
* written against it silently ignores EVERY same-labelled added child under the parent,
|
|
519
|
+
* present and future. The label can also carry glob metacharacters (an https endpoint's
|
|
520
|
+
* `?query` turns the `?` into a wildcard). The logicalId form `<parent>/<CC-identifier>`
|
|
521
|
+
* is the UNIQUE identity (and `applyIgnores` matches logicalId targets), so it is the only
|
|
522
|
+
* safe thing to write. This is scoped to `added` only; declared/undeclared keep the
|
|
523
|
+
* human-friendly constructPath, whose path IS unique.
|
|
513
524
|
*/
|
|
514
525
|
function ignoreRuleFor(finding, stackName = "", accountId = "", region = "") {
|
|
515
|
-
const id = finding.constructPath ? withinStackPath(finding.constructPath, stackName) : finding.logicalId;
|
|
526
|
+
const id = finding.constructPath && finding.tier !== "added" ? withinStackPath(finding.constructPath, stackName) : finding.logicalId;
|
|
516
527
|
const rule = { path: finding.path ? `${id}.${finding.path}` : id };
|
|
517
528
|
if (stackName) rule.stack = stackName;
|
|
518
529
|
if (accountId) rule.account = accountId;
|
|
@@ -987,7 +998,19 @@ function resolveGetAtt(v, ctx) {
|
|
|
987
998
|
}
|
|
988
999
|
const model = ctx.liveAttrs[logicalId];
|
|
989
1000
|
if (!model) return UNRESOLVED;
|
|
990
|
-
const
|
|
1001
|
+
const segs = attr.split(".");
|
|
1002
|
+
if (ctx.typeOf?.[logicalId] === "AWS::CloudFormation::Stack" && segs.length >= 2 && segs[0] === "Outputs") {
|
|
1003
|
+
const outputs = model["Outputs"];
|
|
1004
|
+
if (Array.isArray(outputs)) {
|
|
1005
|
+
const key = segs[1];
|
|
1006
|
+
const entry = outputs.find((o) => o !== null && typeof o === "object" && o["OutputKey"] === key);
|
|
1007
|
+
if (entry === void 0) return UNRESOLVED;
|
|
1008
|
+
const rest = segs.slice(2);
|
|
1009
|
+
const got = rest.length === 0 ? entry["OutputValue"] : getPath(entry, ["OutputValue", ...rest]);
|
|
1010
|
+
return got === void 0 ? UNRESOLVED : got;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
const got = getPath(model, segs);
|
|
991
1014
|
return got === void 0 ? UNRESOLVED : got;
|
|
992
1015
|
}
|
|
993
1016
|
function getPath(obj, segs) {
|
|
@@ -1572,7 +1595,8 @@ const KNOWN_DEFAULTS = {
|
|
|
1572
1595
|
"AWS::RDS::DBProxy": {
|
|
1573
1596
|
TargetConnectionNetworkType: "IPV4",
|
|
1574
1597
|
DefaultAuthScheme: "NONE",
|
|
1575
|
-
EndpointNetworkType: "IPV4"
|
|
1598
|
+
EndpointNetworkType: "IPV4",
|
|
1599
|
+
IdleClientTimeout: 1800
|
|
1576
1600
|
},
|
|
1577
1601
|
"AWS::RDS::DBInstance": {
|
|
1578
1602
|
AutoMinorVersionUpgrade: true,
|
|
@@ -1594,7 +1618,8 @@ const KNOWN_DEFAULTS = {
|
|
|
1594
1618
|
AutoMinorVersionUpgrade: true,
|
|
1595
1619
|
DatabaseInsightsMode: "standard",
|
|
1596
1620
|
NetworkType: "IPV4",
|
|
1597
|
-
EngineMode: "provisioned"
|
|
1621
|
+
EngineMode: "provisioned",
|
|
1622
|
+
BackupRetentionPeriod: 1
|
|
1598
1623
|
},
|
|
1599
1624
|
"AWS::Neptune::DBInstance": { AutoMinorVersionUpgrade: true },
|
|
1600
1625
|
"AWS::Neptune::DBCluster": {
|
|
@@ -3876,9 +3901,9 @@ function deepEqual(a, b) {
|
|
|
3876
3901
|
function isPlainObject(value) {
|
|
3877
3902
|
return typeof value === "object" && value !== null;
|
|
3878
3903
|
}
|
|
3879
|
-
const PATH_UNSAFE_KEY = /[.[\]]/;
|
|
3904
|
+
const PATH_UNSAFE_KEY$1 = /[.[\]]/;
|
|
3880
3905
|
function hasPathUnsafeKey(o) {
|
|
3881
|
-
return Object.keys(o).some((k) => PATH_UNSAFE_KEY.test(k));
|
|
3906
|
+
return Object.keys(o).some((k) => PATH_UNSAFE_KEY$1.test(k));
|
|
3882
3907
|
}
|
|
3883
3908
|
|
|
3884
3909
|
//#endregion
|
|
@@ -4171,12 +4196,17 @@ function collectNestedUndeclared(declaredVal, liveVal, path, emit, nestedArrayId
|
|
|
4171
4196
|
return;
|
|
4172
4197
|
}
|
|
4173
4198
|
if (!isNestedObject(declaredVal) || !isNestedObject(liveVal)) return;
|
|
4199
|
+
if (Object.keys(liveVal).some((k) => PATH_UNSAFE_KEY.test(k))) {
|
|
4200
|
+
emit(path, liveVal);
|
|
4201
|
+
return;
|
|
4202
|
+
}
|
|
4174
4203
|
for (const [k, val] of Object.entries(liveVal)) {
|
|
4175
4204
|
const childPath = `${path}.${k}`;
|
|
4176
4205
|
if (k in declaredVal) collectNestedUndeclared(declaredVal[k], val, childPath, emit, nestedArrayIdentity);
|
|
4177
4206
|
else emit(childPath, val);
|
|
4178
4207
|
}
|
|
4179
4208
|
}
|
|
4209
|
+
const PATH_UNSAFE_KEY = /[.[\]]/;
|
|
4180
4210
|
function sortUnorderedSetProps(model, resourceType, schemaObjectArrayKeys = []) {
|
|
4181
4211
|
const objKeys = new Set([...UNORDERED_OBJECT_ARRAY_PROPS[resourceType] ?? [], ...schemaObjectArrayKeys]);
|
|
4182
4212
|
const orderSig = ORDER_SIGNIFICANT_ARRAY_KEYS[resourceType];
|
|
@@ -8365,13 +8395,25 @@ const EMPTY = {
|
|
|
8365
8395
|
unorderedObjectArrayPaths: [],
|
|
8366
8396
|
freeFormMapPaths: []
|
|
8367
8397
|
};
|
|
8398
|
+
const failureWarned = /* @__PURE__ */ new Set();
|
|
8399
|
+
function describeTypeFailedWarning(resourceType, region) {
|
|
8400
|
+
return `warning: ${region}: cloudformation:DescribeType failed for ${resourceType} — schema-based drift suppression is degraded for this type. Undeclared read-only attributes may surface as [Potential Drift] and declared write-only properties may report false drift. Grant cloudformation:DescribeType (and retry if throttled) for full coverage.`;
|
|
8401
|
+
}
|
|
8368
8402
|
async function getSchemaInfo(client, resourceType) {
|
|
8369
|
-
const
|
|
8403
|
+
const region = await client.config.region();
|
|
8404
|
+
const cacheKey = `${region}\0${resourceType}`;
|
|
8370
8405
|
const cached = cache.get(cacheKey);
|
|
8371
8406
|
if (cached) return cached;
|
|
8372
|
-
const
|
|
8373
|
-
|
|
8374
|
-
|
|
8407
|
+
const result = await fetch$1(client, resourceType);
|
|
8408
|
+
if (result.ok) {
|
|
8409
|
+
cache.set(cacheKey, result.info);
|
|
8410
|
+
return result.info;
|
|
8411
|
+
}
|
|
8412
|
+
if (!failureWarned.has(cacheKey)) {
|
|
8413
|
+
failureWarned.add(cacheKey);
|
|
8414
|
+
console.error(describeTypeFailedWarning(resourceType, region));
|
|
8415
|
+
}
|
|
8416
|
+
return result.info;
|
|
8375
8417
|
}
|
|
8376
8418
|
const OVERRIDE_READABLE_WRITEONLY = {
|
|
8377
8419
|
"AWS::EC2::LaunchTemplate": ["LaunchTemplateData"],
|
|
@@ -8432,12 +8474,18 @@ function exemptOverrideReadable(info, resourceType) {
|
|
|
8432
8474
|
}
|
|
8433
8475
|
async function fetch$1(client, resourceType) {
|
|
8434
8476
|
try {
|
|
8435
|
-
return
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8477
|
+
return {
|
|
8478
|
+
ok: true,
|
|
8479
|
+
info: injectReaderGaps(exemptOverrideReadable(supplementReadOnly(parseSchema((await client.send(new DescribeTypeCommand({
|
|
8480
|
+
Type: "RESOURCE",
|
|
8481
|
+
TypeName: resourceType
|
|
8482
|
+
}))).Schema ?? "{}"), resourceType), resourceType), resourceType)
|
|
8483
|
+
};
|
|
8439
8484
|
} catch {
|
|
8440
|
-
return
|
|
8485
|
+
return {
|
|
8486
|
+
ok: false,
|
|
8487
|
+
info: EMPTY
|
|
8488
|
+
};
|
|
8441
8489
|
}
|
|
8442
8490
|
}
|
|
8443
8491
|
function pointerToDotted$1(p) {
|