cdk-real-drift 0.18.13 → 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 +55 -12
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -15626,23 +15626,39 @@ function isRecordableGenerated(f) {
|
|
|
15626
15626
|
}
|
|
15627
15627
|
const RECORDABLE_GENERATED_SOURCE_PATHS = {
|
|
15628
15628
|
"AWS::Lambda::Function": { CodeSha256: "Code" },
|
|
15629
|
-
"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
|
+
] }
|
|
15630
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
|
+
}
|
|
15631
15644
|
/**
|
|
15632
15645
|
* Fingerprint of a recordable-generated entry's DECLARED SOURCE value (deep key-sorted
|
|
15633
15646
|
* content hash), or undefined when the (resourceType, path) has no source mapping, no
|
|
15634
15647
|
* declared model is available, or the source path does not resolve in it — the undefined
|
|
15635
|
-
* 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).
|
|
15636
15651
|
*/
|
|
15637
15652
|
function declaredSourceFingerprint(resourceType, path, declared) {
|
|
15638
15653
|
const sourcePath = RECORDABLE_GENERATED_SOURCE_PATHS[resourceType]?.[path];
|
|
15639
15654
|
if (sourcePath === void 0 || declared === void 0) return void 0;
|
|
15640
|
-
|
|
15641
|
-
|
|
15642
|
-
|
|
15643
|
-
|
|
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);
|
|
15644
15659
|
}
|
|
15645
|
-
|
|
15660
|
+
const node = resolveDeclaredSourcePath(declared, sourcePath);
|
|
15661
|
+
return node === void 0 ? void 0 : stableValueHash(node);
|
|
15646
15662
|
}
|
|
15647
15663
|
/**
|
|
15648
15664
|
* Build the `recordedSourceFingerprints` map for the entries being written. For each entry
|
|
@@ -16075,7 +16091,9 @@ function applyBaseline(findings, baseline, opts = {}) {
|
|
|
16075
16091
|
continue;
|
|
16076
16092
|
}
|
|
16077
16093
|
const matched = replacedLogical.has(f.logicalId) ? void 0 : recorded.find((a) => entryMatches(a, f));
|
|
16078
|
-
const
|
|
16094
|
+
const sourceRedeployVoided = matched !== void 0 && sourceRedeployedVoid.has(recordedKey(matched));
|
|
16095
|
+
if (sourceRedeployVoided && f.tier === "undeclared") continue;
|
|
16096
|
+
const entry = sourceRedeployVoided ? void 0 : matched;
|
|
16079
16097
|
if (entry && baselineValueMatches(entry.value, f.actual, f.resourceType, f.path)) continue;
|
|
16080
16098
|
if (entry) {
|
|
16081
16099
|
const delta = identityArrayDelta(canonicalizeForCompare(entry.value, f.resourceType), f.actual);
|
|
@@ -19873,10 +19891,28 @@ function previewValue(resourceType, path, v, max = 40) {
|
|
|
19873
19891
|
* old value could not be paired) so the user does not silently bless a possibly-attacker-changed
|
|
19874
19892
|
* value under a bare label. Pure + exported for unit tests.
|
|
19875
19893
|
*/
|
|
19876
|
-
function changedRecordLabel(entry, recordedValue) {
|
|
19894
|
+
function changedRecordLabel(entry, recordedValue, sourceRedeployed = false) {
|
|
19877
19895
|
const id = entry.path ? `${entry.logicalId}.${entry.path}` : `${entry.logicalId} (added resource)`;
|
|
19878
19896
|
if (!recordedValue.hasRecorded) return id;
|
|
19879
|
-
|
|
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;
|
|
19880
19916
|
}
|
|
19881
19917
|
/**
|
|
19882
19918
|
* #790: the record multiselect label for a `baseline-only` drop-candidate — a recorded value
|
|
@@ -20033,9 +20069,14 @@ async function recordStack(p) {
|
|
|
20033
20069
|
});
|
|
20034
20070
|
const droppedKeys = /* @__PURE__ */ new Set();
|
|
20035
20071
|
if (yes && existing) {
|
|
20072
|
+
const declaredModel = declaredKeysByLogical(desired.resources);
|
|
20036
20073
|
const { changed } = splitRecordedByBaseline(recorded, existing);
|
|
20037
20074
|
const changedExisting = changed.filter((e) => recordedValueForChanged(e, existing).hasRecorded);
|
|
20038
|
-
|
|
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(", "));
|
|
20039
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)`);
|
|
20040
20081
|
}
|
|
20041
20082
|
let refreshedOnly = false;
|
|
@@ -20071,11 +20112,13 @@ async function recordStack(p) {
|
|
|
20071
20112
|
}
|
|
20072
20113
|
picked = changed.map((e) => recordedKey(e));
|
|
20073
20114
|
} else {
|
|
20115
|
+
const declaredModel = declaredKeysByLogical(desired.resources);
|
|
20074
20116
|
const fromPrompt = await bulkMultiselect(recordSelectMessage(stackName, region, folded.length), standout.map((e) => {
|
|
20075
20117
|
const rec = recordedValueForChanged(e, existing);
|
|
20118
|
+
const redeployed = isRecordedSourceRedeployed(e, existing, declaredModel);
|
|
20076
20119
|
return {
|
|
20077
20120
|
value: recordedKey(e),
|
|
20078
|
-
label: changedRecordLabel(e, rec),
|
|
20121
|
+
label: changedRecordLabel(e, rec, redeployed),
|
|
20079
20122
|
selected: !rec.hasRecorded
|
|
20080
20123
|
};
|
|
20081
20124
|
}));
|