cdk-real-drift 0.2.30 → 0.2.32
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 +21 -2
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import { dirname, join, resolve } from "node:path";
|
|
|
5
5
|
import { YAMLSeq, isSeq, parse, parseDocument } from "yaml";
|
|
6
6
|
import { CloudControlClient, DeleteResourceCommand, GetResourceCommand, GetResourceRequestStatusCommand, UpdateResourceCommand } from "@aws-sdk/client-cloudcontrol";
|
|
7
7
|
import { BaseCredentials, CdkAppMultiContext, NonInteractiveIoHost, Toolkit } from "@aws-cdk/toolkit-lib";
|
|
8
|
-
import { CloudFormationClient, DescribeStacksCommand, DescribeTypeCommand, GetTemplateCommand, ListExportsCommand, ListStackResourcesCommand } from "@aws-sdk/client-cloudformation";
|
|
8
|
+
import { CloudFormationClient, DescribeStackResourcesCommand, DescribeStacksCommand, DescribeTypeCommand, GetTemplateCommand, ListExportsCommand, ListStackResourcesCommand } from "@aws-sdk/client-cloudformation";
|
|
9
9
|
import { KMSClient, ListAliasesCommand } from "@aws-sdk/client-kms";
|
|
10
10
|
import { APIGatewayClient, GetAuthorizersCommand, GetGatewayResponsesCommand, GetModelsCommand, GetRequestValidatorsCommand, GetResourcesCommand, UpdateIntegrationCommand, UpdateIntegrationResponseCommand, UpdateMethodResponseCommand, UpdateRestApiCommand } from "@aws-sdk/client-api-gateway";
|
|
11
11
|
import { AppConfigClient, ListConfigurationProfilesCommand, ListEnvironmentsCommand } from "@aws-sdk/client-appconfig";
|
|
@@ -3280,7 +3280,10 @@ function stripCcApiAwsManagedFields(awsProps) {
|
|
|
3280
3280
|
}
|
|
3281
3281
|
function stripWalk(value, freeForm) {
|
|
3282
3282
|
if (value === null || value === void 0) return value;
|
|
3283
|
-
if (Array.isArray(value))
|
|
3283
|
+
if (Array.isArray(value)) {
|
|
3284
|
+
const mapped = value.map((v) => stripWalk(v, freeForm));
|
|
3285
|
+
return freeForm ? mapped : mapped.filter((v) => v !== null && v !== void 0);
|
|
3286
|
+
}
|
|
3284
3287
|
if (typeof value === "object") {
|
|
3285
3288
|
const out = {};
|
|
3286
3289
|
for (const [k, child] of Object.entries(value)) {
|
|
@@ -8222,6 +8225,20 @@ async function readAddedModel(cc, cfn, c, schemas, oaiCanonicalIds) {
|
|
|
8222
8225
|
};
|
|
8223
8226
|
}
|
|
8224
8227
|
}
|
|
8228
|
+
async function isManagedBySiblingStack(cfn, c, cache) {
|
|
8229
|
+
const physicalId = c.identifier;
|
|
8230
|
+
if (physicalId.includes("|")) return false;
|
|
8231
|
+
const cached = cache.get(physicalId);
|
|
8232
|
+
if (cached !== void 0) return cached;
|
|
8233
|
+
let managed = false;
|
|
8234
|
+
try {
|
|
8235
|
+
managed = ((await cfn.send(new DescribeStackResourcesCommand({ PhysicalResourceId: physicalId }))).StackResources ?? []).some((r) => r.PhysicalResourceId === physicalId && r.ResourceType === c.resourceType);
|
|
8236
|
+
} catch {
|
|
8237
|
+
managed = false;
|
|
8238
|
+
}
|
|
8239
|
+
cache.set(physicalId, managed);
|
|
8240
|
+
return managed;
|
|
8241
|
+
}
|
|
8225
8242
|
const SG_RULE_RESOURCE_SIDE = {
|
|
8226
8243
|
"AWS::EC2::SecurityGroupIngress": "ingress",
|
|
8227
8244
|
"AWS::EC2::SecurityGroupEgress": "egress"
|
|
@@ -8344,6 +8361,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
8344
8361
|
for (const r of desired.resources) if (r.declaredRaw) r.declared = resolveProperties(r.declaredRaw, desired.ctx);
|
|
8345
8362
|
}
|
|
8346
8363
|
const oaiCanonicalIds = buildOaiCanonicalIds(desired);
|
|
8364
|
+
const siblingStackCache = /* @__PURE__ */ new Map();
|
|
8347
8365
|
for (const r of desired.resources) {
|
|
8348
8366
|
const enumerate = CHILD_ENUMERATORS[r.resourceType];
|
|
8349
8367
|
if (!enumerate || !r.physicalId) continue;
|
|
@@ -8355,6 +8373,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
8355
8373
|
region
|
|
8356
8374
|
});
|
|
8357
8375
|
for (const c of children) {
|
|
8376
|
+
if (await isManagedBySiblingStack(cfn, c, siblingStackCache)) continue;
|
|
8358
8377
|
const read = await readAddedModel(cc, cfn, c, schemas, oaiCanonicalIds);
|
|
8359
8378
|
findings.push(addedFinding(r, c, read));
|
|
8360
8379
|
}
|