cdk-real-drift 0.2.42 → 0.2.43
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 +41 -16
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2486,22 +2486,37 @@ function deepCompareUnordered(a, b) {
|
|
|
2486
2486
|
const ak = Object.keys(ao);
|
|
2487
2487
|
return ak.length === Object.keys(bo).length && ak.every((k) => Object.hasOwn(bo, k) && deepCompareUnordered(ao[k], bo[k]));
|
|
2488
2488
|
}
|
|
2489
|
-
function
|
|
2490
|
-
|
|
2489
|
+
function parseStructured(s) {
|
|
2490
|
+
let parsed;
|
|
2491
|
+
try {
|
|
2492
|
+
parsed = JSON.parse(s);
|
|
2493
|
+
} catch {
|
|
2491
2494
|
try {
|
|
2492
|
-
|
|
2495
|
+
parsed = parse(s);
|
|
2493
2496
|
} catch {
|
|
2494
2497
|
return SENTINEL_UNPARSEABLE;
|
|
2495
2498
|
}
|
|
2496
|
-
}
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
+
}
|
|
2500
|
+
return parsed !== null && typeof parsed === "object" ? parsed : SENTINEL_UNPARSEABLE;
|
|
2501
|
+
}
|
|
2502
|
+
function isJsonStringStructEqual(a, b) {
|
|
2503
|
+
const aStr = typeof a === "string";
|
|
2504
|
+
const bStr = typeof b === "string";
|
|
2505
|
+
const aObj = !aStr && a !== null && typeof a === "object";
|
|
2506
|
+
if (aStr && !bStr && b !== null && typeof b === "object") {
|
|
2507
|
+
const pa = parseStructured(a);
|
|
2499
2508
|
return pa !== SENTINEL_UNPARSEABLE && deepCompareUnordered(pa, b);
|
|
2500
2509
|
}
|
|
2501
|
-
if (
|
|
2502
|
-
const pb =
|
|
2510
|
+
if (bStr && aObj) {
|
|
2511
|
+
const pb = parseStructured(b);
|
|
2503
2512
|
return pb !== SENTINEL_UNPARSEABLE && deepCompareUnordered(a, pb);
|
|
2504
2513
|
}
|
|
2514
|
+
if (aStr && bStr) {
|
|
2515
|
+
const pa = parseStructured(a);
|
|
2516
|
+
if (pa === SENTINEL_UNPARSEABLE) return false;
|
|
2517
|
+
const pb = parseStructured(b);
|
|
2518
|
+
return pb !== SENTINEL_UNPARSEABLE && deepCompareUnordered(pa, pb);
|
|
2519
|
+
}
|
|
2505
2520
|
return false;
|
|
2506
2521
|
}
|
|
2507
2522
|
const JSON_STRING_PROPS = { "AWS::Config::ConfigRule": new Set(["InputParameters"]) };
|
|
@@ -3300,14 +3315,7 @@ function prettyConstructPath(p) {
|
|
|
3300
3315
|
*/
|
|
3301
3316
|
function collectPrincipalsWithSiblingPolicies(resources, ctx) {
|
|
3302
3317
|
const principals = /* @__PURE__ */ new Map();
|
|
3303
|
-
|
|
3304
|
-
if (res?.Type !== "AWS::IAM::Policy") continue;
|
|
3305
|
-
const name = resolvePolicyName(res.Properties?.PolicyName, ctx);
|
|
3306
|
-
const refs = [
|
|
3307
|
-
...res.Properties?.Roles ?? [],
|
|
3308
|
-
...res.Properties?.Users ?? [],
|
|
3309
|
-
...res.Properties?.Groups ?? []
|
|
3310
|
-
];
|
|
3318
|
+
const attach = (name, refs) => {
|
|
3311
3319
|
for (const r of refs) {
|
|
3312
3320
|
const ref = r && typeof r === "object" ? r.Ref : void 0;
|
|
3313
3321
|
if (typeof ref !== "string") continue;
|
|
@@ -3316,9 +3324,26 @@ function collectPrincipalsWithSiblingPolicies(resources, ctx) {
|
|
|
3316
3324
|
if (name === void 0) principals.set(ref, "unresolved");
|
|
3317
3325
|
else principals.set(ref, [...prev ?? [], name]);
|
|
3318
3326
|
}
|
|
3327
|
+
};
|
|
3328
|
+
for (const res of Object.values(resources)) {
|
|
3329
|
+
const name = resolvePolicyName(res?.Properties?.PolicyName, ctx);
|
|
3330
|
+
if (res?.Type === "AWS::IAM::Policy") attach(name, [
|
|
3331
|
+
...res.Properties?.Roles ?? [],
|
|
3332
|
+
...res.Properties?.Users ?? [],
|
|
3333
|
+
...res.Properties?.Groups ?? []
|
|
3334
|
+
]);
|
|
3335
|
+
else {
|
|
3336
|
+
const singular = IAM_STANDALONE_INLINE_POLICY_TYPES.get(res?.Type);
|
|
3337
|
+
if (singular !== void 0) attach(name, [res?.Properties?.[singular]]);
|
|
3338
|
+
}
|
|
3319
3339
|
}
|
|
3320
3340
|
return principals;
|
|
3321
3341
|
}
|
|
3342
|
+
const IAM_STANDALONE_INLINE_POLICY_TYPES = new Map([
|
|
3343
|
+
["AWS::IAM::RolePolicy", "RoleName"],
|
|
3344
|
+
["AWS::IAM::UserPolicy", "UserName"],
|
|
3345
|
+
["AWS::IAM::GroupPolicy", "GroupName"]
|
|
3346
|
+
]);
|
|
3322
3347
|
/**
|
|
3323
3348
|
* The set of ECS Cluster logicalIds that a sibling AWS::ECS::ClusterCapacityProviderAssociations
|
|
3324
3349
|
* resource references (via its `Cluster: { Ref }`). CapacityProviders and
|