cdk-real-drift 0.12.14 → 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/README.md +1 -1
- package/dist/cli.js +60 -4
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -576,7 +576,7 @@ that folds everything informational.
|
|
|
576
576
|
result: 1 drift(s) (declared=1)
|
|
577
577
|
───────────────────────────────
|
|
578
578
|
info:
|
|
579
|
-
- readGap=1 (declared but unverifiable —
|
|
579
|
+
- readGap=1 (declared but unverifiable — not drift: 1 write-only)
|
|
580
580
|
- skipped=2 (custom resource 2)
|
|
581
581
|
run with --verbose for the list
|
|
582
582
|
```
|
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.`));
|
|
@@ -16765,6 +16815,7 @@ function reasonKey(f) {
|
|
|
16765
16815
|
const n = f.note ?? "";
|
|
16766
16816
|
if (f.tier === "ignored") return n.replace(/^ignored by config rule /, "") || "ignored";
|
|
16767
16817
|
if (f.tier === "unresolved") return "intrinsic unresolved";
|
|
16818
|
+
if (n === "declared value unverifiable — CloudFormation GetTemplate masks non-ASCII characters as \"?\"") return "non-ASCII masked by GetTemplate";
|
|
16768
16819
|
if (n.includes("write-only")) return "write-only";
|
|
16769
16820
|
if (n.startsWith("custom resource")) return "custom resource";
|
|
16770
16821
|
if (n.includes("target not resolvable")) return "override target unresolved";
|
|
@@ -16858,9 +16909,14 @@ function report(rawFindings, header, opts = {}) {
|
|
|
16858
16909
|
if (t === "generated") return `generated=${items.length} (auto-generated identifiers not in your template, AWS-assigned at deploy — not drift)`;
|
|
16859
16910
|
if (t === "readGap") {
|
|
16860
16911
|
const writeOnly = items.filter((f) => (f.note ?? "").includes("write-only")).length;
|
|
16861
|
-
const
|
|
16862
|
-
const
|
|
16863
|
-
|
|
16912
|
+
const masked = items.filter((f) => f.note === GETTEMPLATE_MASK_NOTE).length;
|
|
16913
|
+
const notReturned = items.length - writeOnly - masked;
|
|
16914
|
+
const parts = [
|
|
16915
|
+
...notReturned > 0 ? [`${notReturned} not returned by AWS`] : [],
|
|
16916
|
+
...writeOnly > 0 ? [`${writeOnly} write-only`] : [],
|
|
16917
|
+
...masked > 0 ? [`${masked} non-ASCII masked by GetTemplate`] : []
|
|
16918
|
+
];
|
|
16919
|
+
return `readGap=${items.length} (declared but unverifiable — not drift: ${parts.join(", ")})`;
|
|
16864
16920
|
}
|
|
16865
16921
|
if (t === "unresolved") return `unresolved=${items.length} (declared values whose CloudFormation intrinsic cdkrd couldn't resolve to a concrete value — e.g. Fn::GetAZs, a {{resolve:...}} dynamic reference, or an Fn::GetAtt whose target wasn't readable — unverifiable, not drift)`;
|
|
16866
16922
|
if (t === "skipped") return `skipped=${items.length} — NOT checked (coverage incomplete: ${groupReasons(items)})`;
|