cdk-real-drift 0.12.90 → 0.12.92

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
@@ -297,6 +297,8 @@ needs `--remove-unrecorded`).
297
297
  with no declared `AWS::S3::BucketPolicy`)
298
298
  - **SQS**: queue access policies (an out-of-band `set-queue-attributes Policy` on a
299
299
  queue with no declared `AWS::SQS::QueuePolicy`)
300
+ - **Secrets Manager**: secret resource policies (an out-of-band `put-resource-policy`
301
+ on a secret with no declared `AWS::SecretsManager::ResourcePolicy`)
300
302
 
301
303
  </details>
302
304
 
@@ -1027,6 +1029,11 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
1027
1029
  access policy as a child `AWS::SQS::QueuePolicy`; a queue with no policy simply
1028
1030
  returns no `Policy` attribute). Reverting a detected one also needs
1029
1031
  `sqs:SetQueueAttributes` (the SDK deleter clears the `Policy`).
1032
+ - `AWS::SecretsManager::Secret`: `secretsmanager:GetResourcePolicy` (enumerates a
1033
+ secret's out-of-band resource policy as a child
1034
+ `AWS::SecretsManager::ResourcePolicy`; a secret with no policy returns none).
1035
+ Reverting a detected one also needs `secretsmanager:DeleteResourcePolicy` (the
1036
+ SDK deleter detaches the policy).
1030
1037
 
1031
1038
  The `added` tier also needs `cloudformation:DescribeStackResources` (grouped with
1032
1039
  the other CloudFormation actions above): before flagging a live child as
package/dist/cli.js CHANGED
@@ -29,6 +29,7 @@ import { GetFunctionCommand, GetPolicyCommand, LambdaClient, ListAliasesCommand
29
29
  import { DescribeDomainConfigCommand, DescribeDomainsCommand, ListDomainNamesCommand, OpenSearchClient, UpdateDomainConfigCommand } from "@aws-sdk/client-opensearch";
30
30
  import { ChangeResourceRecordSetsCommand, ListResourceRecordSetsCommand, Route53Client } from "@aws-sdk/client-route-53";
31
31
  import { DeleteBucketPolicyCommand, GetBucketPolicyCommand, GetObjectCommand, PutBucketPolicyCommand, S3Client } from "@aws-sdk/client-s3";
32
+ import { DeleteResourcePolicyCommand, GetResourcePolicyCommand, SecretsManagerClient } from "@aws-sdk/client-secrets-manager";
32
33
  import { GetTopicAttributesCommand, ListSubscriptionsByTopicCommand, SNSClient, SetTopicAttributesCommand } from "@aws-sdk/client-sns";
33
34
  import { GetQueueAttributesCommand, SQSClient, SetQueueAttributesCommand } from "@aws-sdk/client-sqs";
34
35
  import { ACMClient, DescribeCertificateCommand, ListTagsForCertificateCommand } from "@aws-sdk/client-acm";
@@ -2746,6 +2747,7 @@ const KNOWN_DEFAULTS = {
2746
2747
  },
2747
2748
  "AWS::CodeStarNotifications::NotificationRule": { Status: "ENABLED" },
2748
2749
  "AWS::Rbin::Rule": { Status: "available" },
2750
+ "AWS::Route53Resolver::FirewallRuleGroupAssociation": { MutationProtection: "DISABLED" },
2749
2751
  "AWS::RolesAnywhere::TrustAnchor": { NotificationSettings: [{
2750
2752
  Channel: "ALL",
2751
2753
  Enabled: true,
@@ -2870,6 +2872,7 @@ const KNOWN_DEFAULT_PATHS = {
2870
2872
  },
2871
2873
  "AWS::ApiGateway::UsagePlan": { "Quota.Offset": 0 },
2872
2874
  "AWS::CloudFront::Distribution": {
2875
+ "DistributionConfig.IPV6Enabled": true,
2873
2876
  "DistributionConfig.OriginGroups": {
2874
2877
  Quantity: 0,
2875
2878
  Items: []
@@ -2879,6 +2882,7 @@ const KNOWN_DEFAULT_PATHS = {
2879
2882
  "DistributionConfig.Origins.*.CustomOriginConfig.HTTPPort": 80,
2880
2883
  "DistributionConfig.Origins.*.CustomOriginConfig.HTTPSPort": 443,
2881
2884
  "DistributionConfig.Origins.*.CustomOriginConfig.OriginKeepaliveTimeout": 5,
2885
+ "DistributionConfig.Origins.*.CustomOriginConfig.OriginSSLProtocols": ["SSLv3", "TLSv1"],
2882
2886
  "DistributionConfig.Origins.*.S3OriginConfig.OriginReadTimeout": 30,
2883
2887
  "DistributionConfig.Restrictions": { GeoRestriction: {
2884
2888
  Locations: [],
@@ -4231,7 +4235,7 @@ const UNORDERED_OBJECT_ARRAY_IDENTITY = {
4231
4235
  };
4232
4236
  const UNORDERED_NESTED_OBJECT_ARRAY_PATHS = {
4233
4237
  "AWS::CloudFront::CachePolicy": new Set(["CachePolicyConfig.ParametersInCacheKeyAndForwardedToOrigin.HeadersConfig.Headers"]),
4234
- "AWS::CloudFront::Distribution": new Set(["DistributionConfig.Aliases"]),
4238
+ "AWS::CloudFront::Distribution": new Set(["DistributionConfig.Aliases", "DistributionConfig.CustomErrorResponses"]),
4235
4239
  "AWS::IoT::ThingType": new Set(["ThingTypeProperties.SearchableAttributes"]),
4236
4240
  "AWS::Bedrock::Guardrail": new Set([
4237
4241
  "ContentPolicyConfig.FiltersConfig",
@@ -4258,6 +4262,7 @@ const UNORDERED_NESTED_OBJECT_ARRAY_PATHS = {
4258
4262
  "AWS::Lambda::EventSourceMapping": new Set(["SelfManagedEventSource.Endpoints.KafkaBootstrapServers"])
4259
4263
  };
4260
4264
  const NESTED_OBJECT_ARRAY_IDENTITY = {
4265
+ "AWS::CloudFront::Distribution": { "DistributionConfig.CustomErrorResponses": "ErrorCode" },
4261
4266
  "AWS::Bedrock::Guardrail": {
4262
4267
  "ContentPolicyConfig.FiltersConfig": "Type",
4263
4268
  "TopicPolicyConfig.TopicsConfig": "Name",
@@ -7496,6 +7501,7 @@ function lambdaFunctionRefMatches(declaredValue, ...candidates) {
7496
7501
  const CHILD_ENUMERATORS = {
7497
7502
  "AWS::S3::Bucket": enumerateS3BucketChildren,
7498
7503
  "AWS::SQS::Queue": enumerateSqsQueueChildren,
7504
+ "AWS::SecretsManager::Secret": enumerateSecretsManagerSecretChildren,
7499
7505
  "AWS::ApiGateway::RestApi": enumerateRestApiChildren,
7500
7506
  "AWS::ApiGatewayV2::Api": enumerateHttpApiChildren,
7501
7507
  "AWS::SNS::Topic": enumerateSnsTopicChildren,
@@ -8565,6 +8571,53 @@ async function enumerateSqsQueueChildren(ctx) {
8565
8571
  livePolicy
8566
8572
  });
8567
8573
  }
8574
+ function diffSecretsManagerResourcePolicy(input) {
8575
+ if (input.hasDeclaredPolicy) return [];
8576
+ if (!input.livePolicy) return [];
8577
+ return [{
8578
+ resourceType: "AWS::SecretsManager::ResourcePolicy",
8579
+ identifier: input.secretId,
8580
+ siblingLookupId: input.secretId,
8581
+ label: `secret resource policy ${input.secretId}`,
8582
+ live: {
8583
+ SecretId: input.secretId,
8584
+ ResourcePolicy: input.livePolicy
8585
+ }
8586
+ }];
8587
+ }
8588
+ async function readSecretsManagerResourcePolicyDocument(client, secretId) {
8589
+ const policyJson = (await client.send(new GetResourcePolicyCommand({ SecretId: secretId }))).ResourcePolicy;
8590
+ if (!policyJson) return void 0;
8591
+ let parsed;
8592
+ try {
8593
+ parsed = JSON.parse(policyJson);
8594
+ } catch {
8595
+ return;
8596
+ }
8597
+ return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : void 0;
8598
+ }
8599
+ async function enumerateSecretsManagerSecretChildren(ctx) {
8600
+ const { parent, desired, region } = ctx;
8601
+ const secretId = parent.physicalId;
8602
+ if (!secretId) return [];
8603
+ let hasDeclaredPolicy = false;
8604
+ for (const r of desired.resources) {
8605
+ if (r.resourceType !== "AWS::SecretsManager::ResourcePolicy") continue;
8606
+ const sid = r.declared.SecretId;
8607
+ if (typeof sid === "string") {
8608
+ if (sid === secretId) hasDeclaredPolicy = true;
8609
+ } else if (sid !== void 0 && hasUnresolved(sid)) hasDeclaredPolicy = true;
8610
+ }
8611
+ const livePolicy = await readSecretsManagerResourcePolicyDocument(new SecretsManagerClient({
8612
+ region,
8613
+ ...READ_RETRY
8614
+ }), secretId);
8615
+ return diffSecretsManagerResourcePolicy({
8616
+ secretId,
8617
+ hasDeclaredPolicy,
8618
+ livePolicy
8619
+ });
8620
+ }
8568
8621
  function diffEventBusChildren(input) {
8569
8622
  const declared = new Set(input.declaredRuleNames);
8570
8623
  const added = [];
@@ -12956,7 +13009,11 @@ function addedFinding(parent, c, read) {
12956
13009
  ...read.ok ? {} : { modelReadFailed: true }
12957
13010
  };
12958
13011
  }
12959
- const CC_GET_UNSUPPORTED_ADDED_TYPES = new Set(["AWS::Route53::RecordSet", "AWS::SQS::QueuePolicy"]);
13012
+ const CC_GET_UNSUPPORTED_ADDED_TYPES = new Set([
13013
+ "AWS::Route53::RecordSet",
13014
+ "AWS::SQS::QueuePolicy",
13015
+ "AWS::SecretsManager::ResourcePolicy"
13016
+ ]);
12960
13017
  async function readAddedModel(cc, cfn, c, schemas, oaiCanonicalIds) {
12961
13018
  const normalizeWith = async (raw) => {
12962
13019
  let schema = schemas.get(c.resourceType);
@@ -17150,10 +17207,17 @@ const deleteSqsQueuePolicy = async (ctx) => {
17150
17207
  Attributes: { Policy: "" }
17151
17208
  }));
17152
17209
  };
17210
+ const deleteSecretsManagerResourcePolicy = async (ctx) => {
17211
+ await new SecretsManagerClient({
17212
+ region: ctx.region,
17213
+ ...CLIENT_TIMEOUTS
17214
+ }).send(new DeleteResourcePolicyCommand({ SecretId: ctx.physicalId }));
17215
+ };
17153
17216
  const SDK_DELETERS = {
17154
17217
  "AWS::AppSync::ApiKey": deleteAppSyncApiKey,
17155
17218
  "AWS::Route53::RecordSet": deleteRoute53RecordSet,
17156
- "AWS::SQS::QueuePolicy": deleteSqsQueuePolicy
17219
+ "AWS::SQS::QueuePolicy": deleteSqsQueuePolicy,
17220
+ "AWS::SecretsManager::ResourcePolicy": deleteSecretsManagerResourcePolicy
17157
17221
  };
17158
17222
 
17159
17223
  //#endregion