cdk-real-drift 0.2.61 → 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 +59 -13
- 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) {
|
|
@@ -3878,9 +3901,9 @@ function deepEqual(a, b) {
|
|
|
3878
3901
|
function isPlainObject(value) {
|
|
3879
3902
|
return typeof value === "object" && value !== null;
|
|
3880
3903
|
}
|
|
3881
|
-
const PATH_UNSAFE_KEY = /[.[\]]/;
|
|
3904
|
+
const PATH_UNSAFE_KEY$1 = /[.[\]]/;
|
|
3882
3905
|
function hasPathUnsafeKey(o) {
|
|
3883
|
-
return Object.keys(o).some((k) => PATH_UNSAFE_KEY.test(k));
|
|
3906
|
+
return Object.keys(o).some((k) => PATH_UNSAFE_KEY$1.test(k));
|
|
3884
3907
|
}
|
|
3885
3908
|
|
|
3886
3909
|
//#endregion
|
|
@@ -4173,12 +4196,17 @@ function collectNestedUndeclared(declaredVal, liveVal, path, emit, nestedArrayId
|
|
|
4173
4196
|
return;
|
|
4174
4197
|
}
|
|
4175
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
|
+
}
|
|
4176
4203
|
for (const [k, val] of Object.entries(liveVal)) {
|
|
4177
4204
|
const childPath = `${path}.${k}`;
|
|
4178
4205
|
if (k in declaredVal) collectNestedUndeclared(declaredVal[k], val, childPath, emit, nestedArrayIdentity);
|
|
4179
4206
|
else emit(childPath, val);
|
|
4180
4207
|
}
|
|
4181
4208
|
}
|
|
4209
|
+
const PATH_UNSAFE_KEY = /[.[\]]/;
|
|
4182
4210
|
function sortUnorderedSetProps(model, resourceType, schemaObjectArrayKeys = []) {
|
|
4183
4211
|
const objKeys = new Set([...UNORDERED_OBJECT_ARRAY_PROPS[resourceType] ?? [], ...schemaObjectArrayKeys]);
|
|
4184
4212
|
const orderSig = ORDER_SIGNIFICANT_ARRAY_KEYS[resourceType];
|
|
@@ -8367,13 +8395,25 @@ const EMPTY = {
|
|
|
8367
8395
|
unorderedObjectArrayPaths: [],
|
|
8368
8396
|
freeFormMapPaths: []
|
|
8369
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
|
+
}
|
|
8370
8402
|
async function getSchemaInfo(client, resourceType) {
|
|
8371
|
-
const
|
|
8403
|
+
const region = await client.config.region();
|
|
8404
|
+
const cacheKey = `${region}\0${resourceType}`;
|
|
8372
8405
|
const cached = cache.get(cacheKey);
|
|
8373
8406
|
if (cached) return cached;
|
|
8374
|
-
const
|
|
8375
|
-
|
|
8376
|
-
|
|
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;
|
|
8377
8417
|
}
|
|
8378
8418
|
const OVERRIDE_READABLE_WRITEONLY = {
|
|
8379
8419
|
"AWS::EC2::LaunchTemplate": ["LaunchTemplateData"],
|
|
@@ -8434,12 +8474,18 @@ function exemptOverrideReadable(info, resourceType) {
|
|
|
8434
8474
|
}
|
|
8435
8475
|
async function fetch$1(client, resourceType) {
|
|
8436
8476
|
try {
|
|
8437
|
-
return
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
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
|
+
};
|
|
8441
8484
|
} catch {
|
|
8442
|
-
return
|
|
8485
|
+
return {
|
|
8486
|
+
ok: false,
|
|
8487
|
+
info: EMPTY
|
|
8488
|
+
};
|
|
8443
8489
|
}
|
|
8444
8490
|
}
|
|
8445
8491
|
function pointerToDotted$1(p) {
|