cdk-real-drift 0.29.0 → 0.29.1

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
@@ -1069,6 +1069,13 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
1069
1069
  code bytes are gone, so it is detect-only (not revertable — redeploy with a
1070
1070
  forced code update). Without the permission the signal is skipped, never
1071
1071
  false-flagged.
1072
+ - `kms:Decrypt` on a function's environment key (the AWS-managed `aws/lambda`
1073
+ key by default) lets cdkrd read `AWS::Lambda::Function` environment variables.
1074
+ A caller denied it — notably the CDK bootstrap **lookup role**, whose policy
1075
+ explicitly denies `kms:Decrypt` — gets an `Environment.Error` instead of the
1076
+ variables, so cdkrd reports `Environment` as an unverifiable `readGap`
1077
+ (counted in the `info:` footer) with a stderr warning, never as declared
1078
+ drift.
1072
1079
  - Optional: `glue:GetJob` + `s3:GetObject` (on the script bucket) record a content
1073
1080
  hash of an `AWS::Glue::Job`'s ETL script (`ScriptSha256`, fetched from
1074
1081
  `Command.ScriptLocation`) so an out-of-band script swap at the **same S3 key**
package/dist/cli.js CHANGED
@@ -2195,6 +2195,7 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
2195
2195
  ...echoModel && resource.physicalId ? { clusterEchoModel: { [resource.physicalId]: echoModel } } : {},
2196
2196
  ...rdsOptCatalog && resource.physicalId ? { rdsOptionSettingDefaults: { [resource.physicalId]: rdsOptCatalog } } : {},
2197
2197
  ...gaListenerPort ? { siblingListenerPorts: gaListenerPort } : {},
2198
+ ...opts.supplementReadGapPaths && opts.supplementReadGapPaths.length > 0 ? { supplementReadGapPaths: [...opts.supplementReadGapPaths] } : {},
2198
2199
  ...dmsStorageDefault || ebsEncDefault ? { accountDefaults: {
2199
2200
  ...dmsStorageDefault ?? {},
2200
2201
  ...ebsEncDefault ?? {}
@@ -14704,7 +14705,13 @@ const supplementLambdaFunction = async ({ physicalId, region }) => {
14704
14705
  ...READ_RETRY
14705
14706
  }).send(new GetFunctionCommand({ FunctionName: name }));
14706
14707
  const sha = str$1(r.Configuration?.CodeSha256);
14707
- return sha !== void 0 ? { CodeSha256: sha } : void 0;
14708
+ const extra = sha !== void 0 ? { CodeSha256: sha } : void 0;
14709
+ const envError = r.Configuration?.Environment?.Error;
14710
+ if (envError === void 0) return extra;
14711
+ const code = envError.ErrorCode ?? "unknown error";
14712
+ const cause = /AccessDenied/i.test(code) ? "the caller likely lacks kms:Decrypt on the function's key" : "the function's KMS key is unusable";
14713
+ process.stderr.write(`[cdkrd] warning: AWS::Lambda::Function ${name}: environment variables unreadable (${code} — ${cause}) — treating Environment as an unverifiable read-gap\n`);
14714
+ return overrideReadGap(extra ?? {}, ["Environment"]);
14708
14715
  };
14709
14716
  const supplementGlueJob = async ({ physicalId, region }) => {
14710
14717
  const name = str$1(physicalId);
@@ -15451,6 +15458,14 @@ async function readLive(cc, resource, region, accountId) {
15451
15458
  region,
15452
15459
  accountId
15453
15460
  });
15461
+ if (isOverrideReadResult(extra)) {
15462
+ Object.assign(live, extra.model);
15463
+ for (const p of extra.readGapPaths) delete live[p];
15464
+ return {
15465
+ live,
15466
+ readGapPaths: extra.readGapPaths
15467
+ };
15468
+ }
15454
15469
  if (extra) Object.assign(live, extra);
15455
15470
  } catch (e) {
15456
15471
  return {
@@ -16698,9 +16713,13 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
16698
16713
  for (const r of desired.resources) {
16699
16714
  const resourceFindings = await classifyRead(cfn, r, reads.get(r.logicalId), schemas, classifyOpts);
16700
16715
  findings.push(...resourceFindings);
16701
- const live = reads.get(r.logicalId)?.live;
16716
+ const read = reads.get(r.logicalId);
16717
+ const live = read?.live;
16702
16718
  const schema = schemas.get(r.resourceType);
16703
- if (corpusDir && live && schema) await recordCorpusCase(corpusDir, buildCorpusCase(r, live, schema, classifyOpts, resourceFindings));
16719
+ if (corpusDir && live && schema) await recordCorpusCase(corpusDir, buildCorpusCase(r, live, schema, {
16720
+ ...classifyOpts,
16721
+ supplementReadGapPaths: read?.readGapPaths
16722
+ }, resourceFindings));
16704
16723
  }
16705
16724
  return {
16706
16725
  desired,