cdk-real-drift 0.12.18 → 0.12.19

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 CHANGED
@@ -634,9 +634,19 @@ valid JSON value nor JSONL; multi-stack `--json` was unparseable — issue #755.
634
634
  **Secret redaction.** Values on known secret-bearing properties — Lambda
635
635
  `Environment.Variables`, CodeBuild `Environment.EnvironmentVariables[].Value`,
636
636
  Elastic Beanstalk env-namespace `OptionSettings`, EC2 LaunchTemplate `UserData` —
637
- are masked as `<redacted:NN chars>` in both text and `--json` output, so a rotated
638
- secret surfacing as drift does not leak its plaintext into CI logs. The finding
639
- still surfaces (detection is preserved) and the property/key name stays visible —
637
+ are masked as `<redacted:NN chars:HHHHHHHH>` in both text and `--json` output, so a rotated
638
+ secret surfacing as drift does not leak its plaintext into CI logs. The `NN` is the
639
+ value's char length and `HHHHHHHH` is the first 8 hex of its sha256 — a **deterministic,
640
+ stable distinguisher** (#1308): the same secret masks to the same placeholder across runs,
641
+ so a consumer diffing two consecutive `--json` runs compares them correctly, while a
642
+ **rotated same-length** secret now masks to a **different** placeholder instead of a
643
+ byte-identical one (the length-only mask erased that change). The hash is non-reversible for
644
+ a high-entropy value; a low-entropy value's short hash is brute-forceable, so it is a
645
+ change-distinguisher, not a confidentiality guarantee — but the plaintext itself is never
646
+ printed. In `--json` a masked finding additionally carries a `"redacted": true` sibling, an
647
+ **out-of-band marker** so a consumer can tell a masked value from a literal live string that
648
+ happens to look like the placeholder (a non-secret finding has no `redacted` field). The
649
+ finding still surfaces (detection is preserved) and the property/key name stays visible —
640
650
  only the value is hidden. The same protection covers persistence: `record` writes a
641
651
  **hash** of these values into the git-committed baseline instead of the plaintext, so
642
652
  the secret never lands in a committed file while a later change still re-surfaces as
package/dist/cli.js CHANGED
@@ -11870,7 +11870,10 @@ function stackCountAnnouncement(stackNames) {
11870
11870
  //#endregion
11871
11871
  //#region src/report/redact.ts
11872
11872
  function maskPlaceholder(value) {
11873
- if (typeof value === "string") return `<redacted:${value.length} chars>`;
11873
+ if (typeof value === "string") {
11874
+ const sig = createHash("sha256").update(value).digest("hex").slice(0, 8);
11875
+ return `<redacted:${value.length} chars:${sig}>`;
11876
+ }
11874
11877
  return "<redacted>";
11875
11878
  }
11876
11879
  const maskWhole = (value) => maskPlaceholder(value);
@@ -11923,7 +11926,10 @@ function isRedactedPath(resourceType, path) {
11923
11926
  }
11924
11927
  function redactFinding(f) {
11925
11928
  if (!isRedactedPath(f.resourceType, f.path)) return f;
11926
- const out = { ...f };
11929
+ const out = {
11930
+ ...f,
11931
+ redacted: true
11932
+ };
11927
11933
  if ("desired" in f && f.desired !== void 0) out.desired = redactValue(f.resourceType, f.path, f.desired);
11928
11934
  if ("actual" in f && f.actual !== void 0) out.actual = redactValue(f.resourceType, f.path, f.actual);
11929
11935
  if (f.arrayDelta && typeof f.arrayDelta === "object") out.arrayDelta = redactArrayDelta(f.resourceType, f.path, f.arrayDelta);