cdk-real-drift 0.12.1 → 0.12.3

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 CHANGED
@@ -2541,7 +2541,10 @@ const KNOWN_DEFAULTS = {
2541
2541
  "AWS::CodeStarConnections::Connection": { HostArn: "arn:aws:codestar-connections:us-west-2:000000000000:host/00000000-0000-0000-0000-000000000000" }
2542
2542
  };
2543
2543
  const KNOWN_DEFAULT_ONE_OF = { "AWS::ApiGatewayV2::Integration": { TimeoutInMillis: [29e3, 3e4] } };
2544
- const KNOWN_DEFAULT_ONE_OF_PATHS = { "AWS::EKS::Cluster": { "KubernetesNetworkConfig.ServiceIpv4Cidr": ["10.100.0.0/16", "172.20.0.0/16"] } };
2544
+ const KNOWN_DEFAULT_ONE_OF_PATHS = {
2545
+ "AWS::EKS::Cluster": { "KubernetesNetworkConfig.ServiceIpv4Cidr": ["10.100.0.0/16", "172.20.0.0/16"] },
2546
+ "AWS::S3::Bucket": { "LifecycleConfiguration.TransitionDefaultMinimumObjectSize": ["all_storage_classes_128K", "varies_by_storage_class"] }
2547
+ };
2545
2548
  const KNOWN_DEFAULT_PATHS = {
2546
2549
  "AWS::ElasticLoadBalancingV2::TargetGroup": { "Targets.*.AvailabilityZone": "all" },
2547
2550
  "AWS::ApiGatewayV2::Stage": { "DefaultRouteSettings.LoggingLevel": "OFF" },
@@ -2653,7 +2656,6 @@ const KNOWN_DEFAULT_PATHS = {
2653
2656
  "HealthCheckConfig.FailureThreshold": 3
2654
2657
  },
2655
2658
  "AWS::Route53::RecordSet": { "GeoProximityLocation.Bias": 0 },
2656
- "AWS::S3::Bucket": { "LifecycleConfiguration.TransitionDefaultMinimumObjectSize": "all_storage_classes_128K" },
2657
2659
  "AWS::Scheduler::Schedule": { "Target.RetryPolicy": {
2658
2660
  MaximumEventAgeInSeconds: 86400,
2659
2661
  MaximumRetryAttempts: 185
@@ -3618,6 +3620,24 @@ function isCfnTemplateNonAsciiMask(declared, live) {
3618
3620
  } else masked += ch;
3619
3621
  return sawNonAscii && masked === declared;
3620
3622
  }
3623
+ function deepEqualModuloNonAsciiMask(declared, live) {
3624
+ if (declared === live) return true;
3625
+ if (typeof declared === "string" && typeof live === "string") return isCfnTemplateNonAsciiMask(declared, live);
3626
+ if (typeof declared !== "object" || typeof live !== "object" || declared === null || live === null) return false;
3627
+ if (Array.isArray(declared) || Array.isArray(live)) {
3628
+ if (!Array.isArray(declared) || !Array.isArray(live) || declared.length !== live.length) return false;
3629
+ return declared.every((v, i) => deepEqualModuloNonAsciiMask(v, live[i]));
3630
+ }
3631
+ const declaredObj = declared;
3632
+ const liveObj = live;
3633
+ const keys = Object.keys(declaredObj);
3634
+ if (keys.length !== Object.keys(liveObj).length) return false;
3635
+ for (const key of keys) {
3636
+ if (!Object.hasOwn(liveObj, key)) return false;
3637
+ if (!deepEqualModuloNonAsciiMask(declaredObj[key], liveObj[key])) return false;
3638
+ }
3639
+ return true;
3640
+ }
3621
3641
  const ID_RE = /^[a-z][a-z0-9]*-[0-9a-f]{6,}$/;
3622
3642
  const isIdLike = (s) => typeof s === "string" && (s.startsWith("arn:") || ID_RE.test(s));
3623
3643
  const AZ_NAME_RE = /^[a-z]{2}-[a-z]+(-[a-z]+)?-\d{1,2}[a-z]$/;
@@ -5489,7 +5509,7 @@ function collectNestedUndeclared(declaredVal, liveVal, path, emit, nestedArrayId
5489
5509
  }
5490
5510
  if (!isNestedObject(declaredVal) || !isNestedObject(liveVal)) return;
5491
5511
  if (Object.keys(liveVal).some((k) => PATH_UNSAFE_KEY.test(k))) {
5492
- emit(path, liveVal);
5512
+ if (Object.keys(declaredVal).length === 0) emit(path, liveVal);
5493
5513
  return;
5494
5514
  }
5495
5515
  for (const [k, val] of Object.entries(liveVal)) {
@@ -6007,6 +6027,16 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
6007
6027
  declaredParsed = void 0;
6008
6028
  }
6009
6029
  if (declaredParsed !== void 0 && deepEqual(declaredParsed, liveParsed)) continue;
6030
+ if (declaredParsed !== void 0 && deepEqualModuloNonAsciiMask(declaredParsed, liveParsed) || isCfnTemplateNonAsciiMask(v, live[k])) {
6031
+ findings.push({
6032
+ tier: "readGap",
6033
+ logicalId,
6034
+ resourceType,
6035
+ path: k,
6036
+ note: "declared value unverifiable — CloudFormation GetTemplate masks non-ASCII characters as \"?\""
6037
+ });
6038
+ continue;
6039
+ }
6010
6040
  findings.push({
6011
6041
  tier: "declared",
6012
6042
  logicalId,