cdk-real-drift 0.12.15 → 0.12.16
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 +51 -1
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -14812,6 +14812,34 @@ function isNestedSdkWritable(f) {
|
|
|
14812
14812
|
function isContractOp(op) {
|
|
14813
14813
|
return op.contract === true;
|
|
14814
14814
|
}
|
|
14815
|
+
function maskReadGapKeysOf(findings) {
|
|
14816
|
+
const keys = /* @__PURE__ */ new Set();
|
|
14817
|
+
for (const f of findings) if (f.tier === "readGap" && f.note === "declared value unverifiable — CloudFormation GetTemplate masks non-ASCII characters as \"?\"") keys.add(`${f.logicalId}\0${f.path}`);
|
|
14818
|
+
return keys;
|
|
14819
|
+
}
|
|
14820
|
+
function hasGetTemplateMaskedLeaf(desired, live) {
|
|
14821
|
+
if (typeof desired === "string" && typeof live === "string") {
|
|
14822
|
+
if (isCfnTemplateNonAsciiMask(desired, live)) return true;
|
|
14823
|
+
try {
|
|
14824
|
+
return hasGetTemplateMaskedLeaf(JSON.parse(desired), JSON.parse(live));
|
|
14825
|
+
} catch {
|
|
14826
|
+
return false;
|
|
14827
|
+
}
|
|
14828
|
+
}
|
|
14829
|
+
if (Array.isArray(desired) && Array.isArray(live)) {
|
|
14830
|
+
const n = Math.min(desired.length, live.length);
|
|
14831
|
+
for (let i = 0; i < n; i++) if (hasGetTemplateMaskedLeaf(desired[i], live[i])) return true;
|
|
14832
|
+
return false;
|
|
14833
|
+
}
|
|
14834
|
+
if (typeof desired === "object" && desired !== null && typeof live === "object" && live !== null && !Array.isArray(desired) && !Array.isArray(live)) {
|
|
14835
|
+
for (const key of Object.keys(desired)) {
|
|
14836
|
+
if (!Object.hasOwn(live, key)) continue;
|
|
14837
|
+
if (hasGetTemplateMaskedLeaf(desired[key], live[key])) return true;
|
|
14838
|
+
}
|
|
14839
|
+
return false;
|
|
14840
|
+
}
|
|
14841
|
+
return false;
|
|
14842
|
+
}
|
|
14815
14843
|
function nullHuskRemovalOps(model) {
|
|
14816
14844
|
const ops = [];
|
|
14817
14845
|
const walk = (value, pointer) => {
|
|
@@ -14889,6 +14917,8 @@ function buildRevertPlan(findings, baseline, opts = {}) {
|
|
|
14889
14917
|
const itemsByLogical = /* @__PURE__ */ new Map();
|
|
14890
14918
|
const notRevertable = [];
|
|
14891
14919
|
const recorded = baseline?.recorded ?? [];
|
|
14920
|
+
const maskGapKeys = maskReadGapKeysOf(findings);
|
|
14921
|
+
for (const k of opts.maskReadGapKeys ?? []) maskGapKeys.add(k);
|
|
14892
14922
|
const wholeArrayEmitted = /* @__PURE__ */ new Set();
|
|
14893
14923
|
for (let f of findings) {
|
|
14894
14924
|
const displayId = f.constructPath ? withinStackPath(f.constructPath, opts.stackName ?? "") : f.logicalId;
|
|
@@ -14963,6 +14993,25 @@ function buildRevertPlan(findings, baseline, opts = {}) {
|
|
|
14963
14993
|
continue;
|
|
14964
14994
|
}
|
|
14965
14995
|
if (!DRIFT_TIERS$1.has(f.tier)) continue;
|
|
14996
|
+
const maskedSiblingUnderPath = () => {
|
|
14997
|
+
if (maskGapKeys.size === 0) return false;
|
|
14998
|
+
for (const key of maskGapKeys) {
|
|
14999
|
+
const sep = key.indexOf("\0");
|
|
15000
|
+
if (key.slice(0, sep) !== f.logicalId) continue;
|
|
15001
|
+
const p = key.slice(sep + 1);
|
|
15002
|
+
if (p === f.path || p.startsWith(`${f.path}.`)) return true;
|
|
15003
|
+
}
|
|
15004
|
+
return false;
|
|
15005
|
+
};
|
|
15006
|
+
if (f.tier === "declared" && (hasGetTemplateMaskedLeaf(f.desired, f.actual) || f.wholeArrayRevert !== void 0 && maskedSiblingUnderPath())) {
|
|
15007
|
+
notRevertable.push({
|
|
15008
|
+
displayId,
|
|
15009
|
+
resourceType: f.resourceType,
|
|
15010
|
+
path: f.path,
|
|
15011
|
+
reason: "declared value is non-ASCII-masked by GetTemplate (\"?\") — writing it back would corrupt the live text; redeploy from your CDK app instead"
|
|
15012
|
+
});
|
|
15013
|
+
continue;
|
|
15014
|
+
}
|
|
14966
15015
|
if (SYNTHETIC_READ_SIGNAL_PATHS[f.resourceType]?.includes(f.path)) {
|
|
14967
15016
|
notRevertable.push({
|
|
14968
15017
|
displayId,
|
|
@@ -16103,7 +16152,8 @@ async function revertStack(p) {
|
|
|
16103
16152
|
schemas: gathered.schemas,
|
|
16104
16153
|
siblingSgRules: buildSiblingSgRules(gathered.desired),
|
|
16105
16154
|
stackName,
|
|
16106
|
-
liveByLogical: gathered.liveByLogical
|
|
16155
|
+
liveByLogical: gathered.liveByLogical,
|
|
16156
|
+
maskReadGapKeys: maskReadGapKeysOf(reconciled)
|
|
16107
16157
|
});
|
|
16108
16158
|
if (plan.items.length === 0 && plan.notRevertable.length === 0) {
|
|
16109
16159
|
out(style.clean(`${stackName} (${region}): no drift to revert.`));
|