cdk-real-drift 0.12.19 → 0.12.20
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 +9 -0
- package/dist/cli.js +35 -3
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -896,6 +896,15 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
|
|
|
896
896
|
"changed since record". The old code bytes are gone, so it is detect-only (not
|
|
897
897
|
revertable — redeploy with a forced code update). Without the permission the
|
|
898
898
|
signal is skipped, never false-flagged.
|
|
899
|
+
- Optional: `glue:GetJob` + `s3:GetObject` (on the script bucket) record a content
|
|
900
|
+
hash of an `AWS::Glue::Job`'s ETL script (`ScriptSha256`, fetched from
|
|
901
|
+
`Command.ScriptLocation`) so an out-of-band script swap at the **same S3 key**
|
|
902
|
+
(`aws s3 cp new.py s3://bucket/key`) re-surfaces as drift — otherwise invisible
|
|
903
|
+
(`GetJob` returns only the S3 path, never the bytes, and a later `cdk deploy` does
|
|
904
|
+
not heal it). Same behavior as the Lambda code digest: folds silently on a clean
|
|
905
|
+
deploy, `record` snapshots it, a swap re-surfaces as "changed since record",
|
|
906
|
+
detect-only (re-upload the intended script). Without the permission (or on any S3
|
|
907
|
+
read failure / a non-`s3://` location) the signal is skipped, never false-flagged.
|
|
899
908
|
- Optional: `kms:ListAliases` enables strict verification that a declared
|
|
900
909
|
`alias/aws/*` key was not swapped for a customer-managed key. Without it that case
|
|
901
910
|
is conservatively suppressed AND cdkrd prints a one-line warning per region (the
|
package/dist/cli.js
CHANGED
|
@@ -36,7 +36,7 @@ import { DescribeDBClustersCommand as DescribeDBClustersCommand$1, DescribeDBIns
|
|
|
36
36
|
import { DAXClient, DescribeClustersCommand, DescribeParameterGroupsCommand, DescribeParametersCommand as DescribeParametersCommand$1, DescribeSubnetGroupsCommand, UpdateClusterCommand, UpdateParameterGroupCommand } from "@aws-sdk/client-dax";
|
|
37
37
|
import { GetClassifierCommand, GetConnectionCommand, GetJobCommand, GetSecurityConfigurationCommand, GetTableCommand, GetWorkflowCommand, GlueClient, UpdateClassifierCommand, UpdateConnectionCommand, UpdateJobCommand, UpdateTableCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
|
|
38
38
|
import { AttachGroupPolicyCommand, AttachRolePolicyCommand, AttachUserPolicyCommand, CreatePolicyVersionCommand, DeletePolicyVersionCommand, DeleteRolePolicyCommand, DetachGroupPolicyCommand, DetachRolePolicyCommand, DetachUserPolicyCommand, GetGroupPolicyCommand, GetPolicyCommand as GetPolicyCommand$1, GetPolicyVersionCommand, GetRolePolicyCommand, GetUserPolicyCommand, IAMClient, ListAccessKeysCommand, ListEntitiesForPolicyCommand, ListPolicyVersionsCommand, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPolicyCommand } from "@aws-sdk/client-iam";
|
|
39
|
-
import { DeleteBucketPolicyCommand, GetBucketPolicyCommand, PutBucketPolicyCommand, S3Client } from "@aws-sdk/client-s3";
|
|
39
|
+
import { DeleteBucketPolicyCommand, GetBucketPolicyCommand, GetObjectCommand, PutBucketPolicyCommand, S3Client } from "@aws-sdk/client-s3";
|
|
40
40
|
import { DescribeCacheClustersCommand, DescribeCacheParameterGroupsCommand, DescribeCacheParametersCommand, DescribeReplicationGroupsCommand, DescribeUsersCommand, ElastiCacheClient, ModifyCacheParameterGroupCommand, ResetCacheParameterGroupCommand } from "@aws-sdk/client-elasticache";
|
|
41
41
|
import { DescribeParameterGroupsCommand as DescribeParameterGroupsCommand$1, DescribeParametersCommand as DescribeParametersCommand$2, DescribeUsersCommand as DescribeUsersCommand$1, MemoryDBClient, ResetParameterGroupCommand, UpdateParameterGroupCommand as UpdateParameterGroupCommand$1 } from "@aws-sdk/client-memorydb";
|
|
42
42
|
import { CloudWatchClient, DescribeAnomalyDetectorsCommand, PutAnomalyDetectorCommand } from "@aws-sdk/client-cloudwatch";
|
|
@@ -2908,6 +2908,7 @@ const GENERATED_TOPLEVEL_PATHS = {
|
|
|
2908
2908
|
]),
|
|
2909
2909
|
"AWS::Lambda::Version": new Set(["CodeSha256"]),
|
|
2910
2910
|
"AWS::Lambda::Function": new Set(["CodeSha256"]),
|
|
2911
|
+
"AWS::Glue::Job": new Set(["ScriptSha256"]),
|
|
2911
2912
|
"AWS::EFS::AccessPoint": new Set(["ClientToken"])
|
|
2912
2913
|
};
|
|
2913
2914
|
const DESCEND_UNDECLARED_OBJECT_PATHS = {
|
|
@@ -8753,6 +8754,10 @@ function hashCaBundle(pem) {
|
|
|
8753
8754
|
bodies.sort();
|
|
8754
8755
|
return createHash("sha256").update(bodies.join("\n")).digest("hex");
|
|
8755
8756
|
}
|
|
8757
|
+
function sha256Hex(bytes) {
|
|
8758
|
+
if (bytes === void 0 || bytes.length === 0) return void 0;
|
|
8759
|
+
return createHash("sha256").update(bytes).digest("hex");
|
|
8760
|
+
}
|
|
8756
8761
|
|
|
8757
8762
|
//#endregion
|
|
8758
8763
|
//#region src/read/overrides.ts
|
|
@@ -10441,6 +10446,28 @@ const supplementLambdaFunction = async ({ physicalId, region }) => {
|
|
|
10441
10446
|
}).send(new GetFunctionCommand({ FunctionName: name }))).Configuration?.CodeSha256);
|
|
10442
10447
|
return sha !== void 0 ? { CodeSha256: sha } : void 0;
|
|
10443
10448
|
};
|
|
10449
|
+
const supplementGlueJob = async ({ physicalId, region }) => {
|
|
10450
|
+
const name = str$1(physicalId);
|
|
10451
|
+
if (!name) return void 0;
|
|
10452
|
+
const loc = str$1((await new GlueClient({
|
|
10453
|
+
region,
|
|
10454
|
+
...READ_RETRY
|
|
10455
|
+
}).send(new GetJobCommand({ JobName: name }))).Job?.Command?.ScriptLocation);
|
|
10456
|
+
const m = loc !== void 0 ? /^s3:\/\/([^/]+)\/(.+)$/.exec(loc) : null;
|
|
10457
|
+
if (m === null) return void 0;
|
|
10458
|
+
try {
|
|
10459
|
+
const hash = sha256Hex(await (await new S3Client({
|
|
10460
|
+
region,
|
|
10461
|
+
...READ_RETRY
|
|
10462
|
+
}).send(new GetObjectCommand({
|
|
10463
|
+
Bucket: m[1],
|
|
10464
|
+
Key: m[2]
|
|
10465
|
+
}))).Body?.transformToByteArray());
|
|
10466
|
+
return hash !== void 0 ? { ScriptSha256: hash } : void 0;
|
|
10467
|
+
} catch {
|
|
10468
|
+
return;
|
|
10469
|
+
}
|
|
10470
|
+
};
|
|
10444
10471
|
function projectLexPrompt(p) {
|
|
10445
10472
|
const ps = p;
|
|
10446
10473
|
if (!ps || typeof ps !== "object") return void 0;
|
|
@@ -10668,6 +10695,7 @@ const SDK_SUPPLEMENTS = {
|
|
|
10668
10695
|
"AWS::MSK::Configuration": supplementMskConfiguration,
|
|
10669
10696
|
"AWS::ElasticLoadBalancingV2::TrustStore": supplementTrustStore,
|
|
10670
10697
|
"AWS::Lambda::Function": supplementLambdaFunction,
|
|
10698
|
+
"AWS::Glue::Job": supplementGlueJob,
|
|
10671
10699
|
"AWS::SSM::Parameter": supplementSsmParameter,
|
|
10672
10700
|
"AWS::ElastiCache::ReplicationGroup": supplementElastiCacheReplicationGroup,
|
|
10673
10701
|
"AWS::ECS::Service": supplementEcsService,
|
|
@@ -12271,7 +12299,10 @@ function checkBaselineAccount(baseline, currentAccountId, stackName, warn = cons
|
|
|
12271
12299
|
}
|
|
12272
12300
|
if (currentAccountId && baseline.accountId !== currentAccountId) throw new Error(`baseline file for ${stackName} was captured in account ${baseline.accountId}, but the current account is ${currentAccountId} (the file was likely copied or renamed to the wrong account path). Baselines are per-account — run \`cdkrd record\` to write this account's own baseline file, or restore the correct file from git.`);
|
|
12273
12301
|
}
|
|
12274
|
-
const RECORDABLE_GENERATED_PATHS = {
|
|
12302
|
+
const RECORDABLE_GENERATED_PATHS = {
|
|
12303
|
+
"AWS::Lambda::Function": new Set(["CodeSha256"]),
|
|
12304
|
+
"AWS::Glue::Job": new Set(["ScriptSha256"])
|
|
12305
|
+
};
|
|
12275
12306
|
function isRecordableGenerated(f) {
|
|
12276
12307
|
return f.tier === "generated" && (RECORDABLE_GENERATED_PATHS[f.resourceType]?.has(f.path) ?? false);
|
|
12277
12308
|
}
|
|
@@ -14744,7 +14775,8 @@ function resolveSdkWriter(resourceType, ops) {
|
|
|
14744
14775
|
const WRITEONLY_NESTED_NO_CC_REVERT = {};
|
|
14745
14776
|
const SYNTHETIC_READ_SIGNAL_PATHS = {
|
|
14746
14777
|
"AWS::ElasticLoadBalancingV2::TrustStore": ["CaCertificatesBundleSha256"],
|
|
14747
|
-
"AWS::Lambda::Function": ["CodeSha256"]
|
|
14778
|
+
"AWS::Lambda::Function": ["CodeSha256"],
|
|
14779
|
+
"AWS::Glue::Job": ["ScriptSha256"]
|
|
14748
14780
|
};
|
|
14749
14781
|
const CC_REVERTABLE_DESPITE_READ_OVERRIDE = new Set(["AWS::Scheduler::Schedule", "AWS::Cognito::IdentityPool"]);
|
|
14750
14782
|
const REVERT_SET_DEFAULT_PATHS = new Set([
|