cdk-real-drift 0.18.12 → 0.18.14

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
@@ -2091,6 +2091,7 @@ const KNOWN_DEFAULTS = {
2091
2091
  IngressConfiguration: { IsPubliclyAccessible: true }
2092
2092
  }
2093
2093
  },
2094
+ "AWS::GuardDuty::Filter": { Action: "NOOP" },
2094
2095
  "AWS::GuardDuty::Detector": {
2095
2096
  FindingPublishingFrequency: "SIX_HOURS",
2096
2097
  DataSources: {
@@ -2234,7 +2235,9 @@ const KNOWN_DEFAULTS = {
2234
2235
  MaximumRetryAttempts: -1,
2235
2236
  MaximumRecordAgeInSeconds: -1,
2236
2237
  Enabled: true,
2237
- MaximumBatchingWindowInSeconds: 0
2238
+ MaximumBatchingWindowInSeconds: 0,
2239
+ ParallelizationFactor: 1,
2240
+ TumblingWindowInSeconds: 0
2238
2241
  },
2239
2242
  "AWS::Lambda::Alias": { Description: "" },
2240
2243
  "AWS::Lambda::Version": { RuntimePolicy: { UpdateRuntimeOn: "Auto" } },
@@ -2933,6 +2936,7 @@ const KNOWN_DEFAULT_ONE_OF = {
2933
2936
  "AWS::ApiGatewayV2::Integration": { TimeoutInMillis: [29e3, 3e4] },
2934
2937
  "AWS::SecurityHub::Hub": { ControlFindingGenerator: ["SECURITY_CONTROL", "STANDARD_CONTROL"] },
2935
2938
  "AWS::Glue::Job": { Timeout: [2880, 480] },
2939
+ "AWS::CodePipeline::Pipeline": { PipelineType: ["V1", "V2"] },
2936
2940
  "AWS::OpenSearchService::Domain": { DomainEndpointOptions: [{
2937
2941
  CustomEndpointEnabled: false,
2938
2942
  EnforceHTTPS: false,
@@ -3082,7 +3086,9 @@ const KNOWN_DEFAULT_PATHS = {
3082
3086
  MaximumEventAgeInSeconds: 86400,
3083
3087
  MaximumRetryAttempts: 185
3084
3088
  } },
3089
+ "AWS::CodePipeline::Pipeline": { "Stages.*.Actions.*.RunOrder": 1 },
3085
3090
  "AWS::ECS::Service": {
3091
+ "NetworkConfiguration.AwsvpcConfiguration.AssignPublicIp": "DISABLED",
3086
3092
  "DeploymentConfiguration.Strategy": "ROLLING",
3087
3093
  "DeploymentConfiguration.BakeTimeInMinutes": 0,
3088
3094
  "DeploymentConfiguration.DeploymentCircuitBreaker.ResetOnHealthyTask": true,
@@ -3551,6 +3557,7 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
3551
3557
  "LifecycleHookSpecificationList"
3552
3558
  ]),
3553
3559
  "AWS::ApiGateway::Authorizer": new Set(["AuthType"]),
3560
+ "AWS::GuardDuty::Filter": new Set(["Rank"]),
3554
3561
  "AWS::DMS::Endpoint": new Set(["KmsKeyId"]),
3555
3562
  "AWS::DMS::ReplicationInstance": new Set([
3556
3563
  "EngineVersion",
@@ -3966,6 +3973,40 @@ function isBooleanTokenEquivalent(a, b) {
3966
3973
  return ta !== void 0 && ta === tok(b);
3967
3974
  }
3968
3975
  const CASE_INSENSITIVE_KEY_PATHS = { "AWS::DataBrew::Recipe": new Set(["Steps[].Action.Parameters"]) };
3976
+ const GUARDDUTY_CONDITION_KEY_ALIASES = {
3977
+ Eq: "Equals",
3978
+ Neq: "NotEquals",
3979
+ Gt: "GreaterThan",
3980
+ Gte: "GreaterThanOrEqual",
3981
+ Lt: "LessThan",
3982
+ Lte: "LessThanOrEqual"
3983
+ };
3984
+ function canonicalizeGuardDutyCriterionKeys(declared) {
3985
+ const fc = declared["FindingCriteria"];
3986
+ if (fc === null || typeof fc !== "object" || Array.isArray(fc)) return declared;
3987
+ const criterion = fc["Criterion"];
3988
+ if (criterion === null || typeof criterion !== "object" || Array.isArray(criterion)) return declared;
3989
+ const outCriterion = {};
3990
+ for (const [field, cond] of Object.entries(criterion)) {
3991
+ if (cond === null || typeof cond !== "object" || Array.isArray(cond)) {
3992
+ outCriterion[field] = cond;
3993
+ continue;
3994
+ }
3995
+ const outCond = {};
3996
+ for (const [k, v] of Object.entries(cond)) {
3997
+ const long = GUARDDUTY_CONDITION_KEY_ALIASES[k];
3998
+ outCond[long !== void 0 && !(long in cond) ? long : k] = v;
3999
+ }
4000
+ outCriterion[field] = outCond;
4001
+ }
4002
+ return {
4003
+ ...declared,
4004
+ FindingCriteria: {
4005
+ ...fc,
4006
+ Criterion: outCriterion
4007
+ }
4008
+ };
4009
+ }
3969
4010
  function isCaseInsensitiveKeyMapEqual(a, b) {
3970
4011
  if (a === null || b === null || typeof a !== "object" || typeof b !== "object") return false;
3971
4012
  if (Array.isArray(a) || Array.isArray(b)) return false;
@@ -5842,6 +5883,7 @@ const MEANINGFUL_WHEN_OFF_NESTED = {
5842
5883
  } }
5843
5884
  };
5844
5885
  const GUARDDUTY_FEATURE_CREATION_STATUS = {
5886
+ AI_PROTECTION: ["DISABLED"],
5845
5887
  AI_ANALYST: ["DISABLED"],
5846
5888
  RUNTIME_MONITORING: ["DISABLED", "ENABLED"],
5847
5889
  EKS_RUNTIME_MONITORING: ["DISABLED", "ENABLED"],
@@ -6757,7 +6799,8 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
6757
6799
  oaiCanonicalIds: oaiMap,
6758
6800
  resourceType
6759
6801
  }), opts.stackTags ?? {}, declaredTagKeys(declaredForCompare));
6760
- const declared = canonicalizeForCompare(rewriteOaiPrincipalsDeep(declaredForCompare, oaiMap), resourceType);
6802
+ let declared = canonicalizeForCompare(rewriteOaiPrincipalsDeep(declaredForCompare, oaiMap), resourceType);
6803
+ if (resourceType === "AWS::GuardDuty::Filter") declared = canonicalizeGuardDutyCriterionKeys(declared);
6761
6804
  const reflected = REFLECTED_CHILD_PROPS[resourceType];
6762
6805
  if (reflected && !(reflected in declared)) delete live[reflected];
6763
6806
  if (resourceType === EVENT_BUS_TYPE && !(EVENT_BUS_POLICY_PROP in declared)) {
@@ -15583,23 +15626,39 @@ function isRecordableGenerated(f) {
15583
15626
  }
15584
15627
  const RECORDABLE_GENERATED_SOURCE_PATHS = {
15585
15628
  "AWS::Lambda::Function": { CodeSha256: "Code" },
15586
- "AWS::Glue::Job": { ScriptSha256: "Command.ScriptLocation" }
15629
+ "AWS::Glue::Job": { ScriptSha256: "Command.ScriptLocation" },
15630
+ "AWS::ElasticLoadBalancingV2::TrustStore": { CaCertificatesBundleSha256: [
15631
+ "CaCertificatesBundleS3Bucket",
15632
+ "CaCertificatesBundleS3Key",
15633
+ "CaCertificatesBundleS3ObjectVersion"
15634
+ ] }
15587
15635
  };
15636
+ function resolveDeclaredSourcePath(declared, sourcePath) {
15637
+ let node = declared;
15638
+ for (const seg of pathSegments$1(sourcePath)) {
15639
+ node = descendDeclared(node, seg);
15640
+ if (node === void 0) return void 0;
15641
+ }
15642
+ return node;
15643
+ }
15588
15644
  /**
15589
15645
  * Fingerprint of a recordable-generated entry's DECLARED SOURCE value (deep key-sorted
15590
15646
  * content hash), or undefined when the (resourceType, path) has no source mapping, no
15591
15647
  * declared model is available, or the source path does not resolve in it — the undefined
15592
- * cases all fall back to today's behavior (never void on unknown).
15648
+ * cases all fall back to today's behavior (never void on unknown). For a TUPLE source
15649
+ * (#1615) the ordered projection of each sibling path is fingerprinted; undefined only when
15650
+ * EVERY member is unresolvable (an absent optional member is kept positionally, not dropped).
15593
15651
  */
15594
15652
  function declaredSourceFingerprint(resourceType, path, declared) {
15595
15653
  const sourcePath = RECORDABLE_GENERATED_SOURCE_PATHS[resourceType]?.[path];
15596
15654
  if (sourcePath === void 0 || declared === void 0) return void 0;
15597
- let node = declared;
15598
- for (const seg of pathSegments$1(sourcePath)) {
15599
- node = descendDeclared(node, seg);
15600
- if (node === void 0) return void 0;
15655
+ if (Array.isArray(sourcePath)) {
15656
+ const parts = sourcePath.map((sp) => resolveDeclaredSourcePath(declared, sp));
15657
+ if (parts.every((p) => p === void 0)) return void 0;
15658
+ return stableValueHash(parts);
15601
15659
  }
15602
- return stableValueHash(node);
15660
+ const node = resolveDeclaredSourcePath(declared, sourcePath);
15661
+ return node === void 0 ? void 0 : stableValueHash(node);
15603
15662
  }
15604
15663
  /**
15605
15664
  * Build the `recordedSourceFingerprints` map for the entries being written. For each entry
@@ -16032,7 +16091,9 @@ function applyBaseline(findings, baseline, opts = {}) {
16032
16091
  continue;
16033
16092
  }
16034
16093
  const matched = replacedLogical.has(f.logicalId) ? void 0 : recorded.find((a) => entryMatches(a, f));
16035
- const entry = matched !== void 0 && sourceRedeployedVoid.has(recordedKey(matched)) ? void 0 : matched;
16094
+ const sourceRedeployVoided = matched !== void 0 && sourceRedeployedVoid.has(recordedKey(matched));
16095
+ if (sourceRedeployVoided && f.tier === "undeclared") continue;
16096
+ const entry = sourceRedeployVoided ? void 0 : matched;
16036
16097
  if (entry && baselineValueMatches(entry.value, f.actual, f.resourceType, f.path)) continue;
16037
16098
  if (entry) {
16038
16099
  const delta = identityArrayDelta(canonicalizeForCompare(entry.value, f.resourceType), f.actual);
@@ -18825,6 +18886,10 @@ const REVERT_SET_DEFAULT_PATHS = new Set([
18825
18886
  "AWS::ECR::Repository\0ImageTagMutability",
18826
18887
  "AWS::ECR::Repository\0ImageScanningConfiguration",
18827
18888
  "AWS::SQS::Queue\0MaximumMessageSize",
18889
+ "AWS::SQS::Queue\0SqsManagedSseEnabled",
18890
+ "AWS::StepFunctions::StateMachine\0LoggingConfiguration",
18891
+ "AWS::ApiGateway::RestApi\0DisableExecuteApiEndpoint",
18892
+ "AWS::Cognito::UserPoolClient\0RefreshTokenValidity",
18828
18893
  "AWS::Lambda::Url\0InvokeMode",
18829
18894
  "AWS::RolesAnywhere::Profile\0DurationSeconds",
18830
18895
  "AWS::RolesAnywhere::Profile\0AttributeMappings",
@@ -19414,7 +19479,8 @@ const CC_UPDATE_REJECTED_EMPTY_PATHS = {
19414
19479
  "/Distributions/*/FastLaunchConfigurations",
19415
19480
  "/Distributions/*/LaunchTemplateConfigurations"
19416
19481
  ],
19417
- "AWS::Lambda::EventInvokeConfig": ["/DestinationConfig/OnSuccess", "/DestinationConfig/OnFailure"]
19482
+ "AWS::Lambda::EventInvokeConfig": ["/DestinationConfig/OnSuccess", "/DestinationConfig/OnFailure"],
19483
+ "AWS::Lambda::EventSourceMapping": ["/DestinationConfig/OnFailure"]
19418
19484
  };
19419
19485
  function expandPointer(model, pointer) {
19420
19486
  let frontier = [{
@@ -19825,10 +19891,28 @@ function previewValue(resourceType, path, v, max = 40) {
19825
19891
  * old value could not be paired) so the user does not silently bless a possibly-attacker-changed
19826
19892
  * value under a bare label. Pure + exported for unit tests.
19827
19893
  */
19828
- function changedRecordLabel(entry, recordedValue) {
19894
+ function changedRecordLabel(entry, recordedValue, sourceRedeployed = false) {
19829
19895
  const id = entry.path ? `${entry.logicalId}.${entry.path}` : `${entry.logicalId} (added resource)`;
19830
19896
  if (!recordedValue.hasRecorded) return id;
19831
- return `${id} (changed since record: ${previewValue(entry.resourceType, entry.path, recordedValue.recordedValue)} → ${previewValue(entry.resourceType, entry.path, entry.value)})`;
19897
+ const recorded = previewValue(entry.resourceType, entry.path, recordedValue.recordedValue);
19898
+ const live = previewValue(entry.resourceType, entry.path, entry.value);
19899
+ if (sourceRedeployed) return `${id} (declared source redeployed via CloudFormation — refreshing watch: ${recorded} → ${live})`;
19900
+ return `${id} (changed since record: ${recorded} → ${live})`;
19901
+ }
19902
+ /**
19903
+ * #1616: true when a `changed` recorded entry is a content hash whose DECLARED SOURCE was
19904
+ * redeployed through CloudFormation since record — the SAME predicate `applyBaseline`'s
19905
+ * stale-source void (#1606) uses to fold the check-side false positive. Such an entry did NOT
19906
+ * change out of band (the IaC deploy moved the live hash with the template), so record must
19907
+ * label and summarize it as a legit refresh, not "CHANGED out of band". Fail-safe: false when
19908
+ * no source fingerprint was stored (an old baseline, or a path with no source mapping) or the
19909
+ * current declared source does not resolve — exactly the void's own gates. Pure + exported.
19910
+ */
19911
+ function isRecordedSourceRedeployed(entry, existing, declaredByLogical) {
19912
+ const storedFp = existing?.recordedSourceFingerprints?.[recordedKey(entry)];
19913
+ if (storedFp === void 0) return false;
19914
+ const currentFp = declaredSourceFingerprint(entry.resourceType, entry.path, declaredByLogical.get(entry.logicalId));
19915
+ return currentFp !== void 0 && currentFp !== storedFp;
19832
19916
  }
19833
19917
  /**
19834
19918
  * #790: the record multiselect label for a `baseline-only` drop-candidate — a recorded value
@@ -19985,9 +20069,14 @@ async function recordStack(p) {
19985
20069
  });
19986
20070
  const droppedKeys = /* @__PURE__ */ new Set();
19987
20071
  if (yes && existing) {
20072
+ const declaredModel = declaredKeysByLogical(desired.resources);
19988
20073
  const { changed } = splitRecordedByBaseline(recorded, existing);
19989
20074
  const changedExisting = changed.filter((e) => recordedValueForChanged(e, existing).hasRecorded);
19990
- if (changedExisting.length > 0) console.error(`note: ${stackName}: --yes accepted ${changedExisting.length} recorded value(s) CHANGED out of band since record (review the baseline diff): ` + changedExisting.map((e) => `${e.logicalId}.${e.path}`).join(", "));
20075
+ const redeployedViaCfn = changedExisting.filter((e) => isRecordedSourceRedeployed(e, existing, declaredModel));
20076
+ const redeployedKeys = new Set(redeployedViaCfn.map((e) => recordedKey(e)));
20077
+ const changedOob = changedExisting.filter((e) => !redeployedKeys.has(recordedKey(e)));
20078
+ if (changedOob.length > 0) console.error(`note: ${stackName}: --yes accepted ${changedOob.length} recorded value(s) CHANGED out of band since record (review the baseline diff): ` + changedOob.map((e) => `${e.logicalId}.${e.path}`).join(", "));
20079
+ if (redeployedViaCfn.length > 0) console.error(`note: ${stackName}: --yes refreshed ${redeployedViaCfn.length} recorded content hash(es) whose declared source was redeployed via CloudFormation since record (not an out-of-band change): ` + redeployedViaCfn.map((e) => `${e.logicalId}.${e.path}`).join(", "));
19991
20080
  if (dropCandidates.length > 0) console.error(`note: ${stackName}: --yes PRESERVED ${dropCandidates.length} recorded watch(es) whose value reverted-to-default / was removed since record (they still report as drift; re-run interactively to drop them)`);
19992
20081
  }
19993
20082
  let refreshedOnly = false;
@@ -20023,11 +20112,13 @@ async function recordStack(p) {
20023
20112
  }
20024
20113
  picked = changed.map((e) => recordedKey(e));
20025
20114
  } else {
20115
+ const declaredModel = declaredKeysByLogical(desired.resources);
20026
20116
  const fromPrompt = await bulkMultiselect(recordSelectMessage(stackName, region, folded.length), standout.map((e) => {
20027
20117
  const rec = recordedValueForChanged(e, existing);
20118
+ const redeployed = isRecordedSourceRedeployed(e, existing, declaredModel);
20028
20119
  return {
20029
20120
  value: recordedKey(e),
20030
- label: changedRecordLabel(e, rec),
20121
+ label: changedRecordLabel(e, rec, redeployed),
20031
20122
  selected: !rec.hasRecorded
20032
20123
  };
20033
20124
  }));