cdk-real-drift 0.12.50 → 0.12.52
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 +5 -1
- package/dist/cli.js +57 -8
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -962,7 +962,11 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
|
|
|
962
962
|
- `AWS::Events::EventBus`: `events:ListRules`
|
|
963
963
|
- `AWS::Cognito::UserPool`: `cognito-idp:ListUserPoolClients`,
|
|
964
964
|
`cognito-idp:ListGroups`, `cognito-idp:ListResourceServers`,
|
|
965
|
-
`cognito-idp:ListIdentityProviders
|
|
965
|
+
`cognito-idp:ListIdentityProviders`, plus (only when an undeclared
|
|
966
|
+
service-prefix-named app client is present, to corroborate that an
|
|
967
|
+
OpenSearch/Elasticsearch domain targets the pool before skipping it)
|
|
968
|
+
`es:ListDomainNames`, `es:DescribeDomains` — a caller lacking these degrades
|
|
969
|
+
fail-safe (the service client is treated as corroborated, never falsely flagged)
|
|
966
970
|
- `AWS::AppSync::GraphQLApi`: `appsync:ListDataSources`, `appsync:ListResolvers`,
|
|
967
971
|
`appsync:ListFunctions`, `appsync:ListTypes`
|
|
968
972
|
- `AWS::Logs::LogGroup`: `logs:DescribeSubscriptionFilters` (plus
|
package/dist/cli.js
CHANGED
|
@@ -25,6 +25,7 @@ import { DescribeMountTargetsCommand, EFSClient } from "@aws-sdk/client-efs";
|
|
|
25
25
|
import { DescribeListenersCommand, DescribeRulesCommand, ElasticLoadBalancingV2Client, GetTrustStoreCaCertificatesBundleCommand, ModifyLoadBalancerAttributesCommand, ModifyTargetGroupAttributesCommand } from "@aws-sdk/client-elastic-load-balancing-v2";
|
|
26
26
|
import { DescribeEventBusCommand, EventBridgeClient, ListRulesCommand, PutPermissionCommand } from "@aws-sdk/client-eventbridge";
|
|
27
27
|
import { GetFunctionCommand, GetPolicyCommand, LambdaClient, ListAliasesCommand as ListAliasesCommand$1, ListEventSourceMappingsCommand, ListFunctionUrlConfigsCommand, ListVersionsByFunctionCommand } from "@aws-sdk/client-lambda";
|
|
28
|
+
import { DescribeDomainConfigCommand, DescribeDomainsCommand, ListDomainNamesCommand, OpenSearchClient, UpdateDomainConfigCommand } from "@aws-sdk/client-opensearch";
|
|
28
29
|
import { ChangeResourceRecordSetsCommand, ListResourceRecordSetsCommand, Route53Client } from "@aws-sdk/client-route-53";
|
|
29
30
|
import { GetTopicAttributesCommand, ListSubscriptionsByTopicCommand, SNSClient, SetTopicAttributesCommand } from "@aws-sdk/client-sns";
|
|
30
31
|
import { ACMClient, DescribeCertificateCommand, ListTagsForCertificateCommand } from "@aws-sdk/client-acm";
|
|
@@ -58,7 +59,6 @@ import pc from "picocolors";
|
|
|
58
59
|
import { MultiSelectPrompt, Prompt, isCancel as isCancel$1 } from "@clack/core";
|
|
59
60
|
import { CloudFrontClient, GetDistributionConfigCommand, UpdateDistributionCommand } from "@aws-sdk/client-cloudfront";
|
|
60
61
|
import { DescribeSignalingChannelCommand, DescribeStreamCommand, KinesisVideoClient, UpdateDataRetentionCommand, UpdateSignalingChannelCommand, UpdateStreamStorageConfigurationCommand } from "@aws-sdk/client-kinesis-video";
|
|
61
|
-
import { DescribeDomainConfigCommand, OpenSearchClient, UpdateDomainConfigCommand } from "@aws-sdk/client-opensearch";
|
|
62
62
|
import { GetWebACLCommand, UpdateWebACLCommand, WAFV2Client } from "@aws-sdk/client-wafv2";
|
|
63
63
|
import { ConfigServiceClient, DescribeConfigRulesCommand, PutConfigRuleCommand } from "@aws-sdk/client-config-service";
|
|
64
64
|
import { GetCallerIdentityCommand, STSClient } from "@aws-sdk/client-sts";
|
|
@@ -5887,6 +5887,37 @@ function substituteLeaf(obj, leafName, coerced) {
|
|
|
5887
5887
|
[leafName]: coerced
|
|
5888
5888
|
};
|
|
5889
5889
|
}
|
|
5890
|
+
function valueAtDottedPath$1(root, dottedPath) {
|
|
5891
|
+
let node = root;
|
|
5892
|
+
for (const seg of dottedPath.split(".")) {
|
|
5893
|
+
if (node == null || typeof node !== "object") return void 0;
|
|
5894
|
+
node = node[seg];
|
|
5895
|
+
}
|
|
5896
|
+
return node;
|
|
5897
|
+
}
|
|
5898
|
+
function matchesAncestorPropertyTransform(propertyTransforms, driftPath, declaredRoot, liveRoot) {
|
|
5899
|
+
const segs = driftPath.split(".");
|
|
5900
|
+
for (let end = segs.length - 1; end >= 1; end--) {
|
|
5901
|
+
const ancestor = segs.slice(0, end).join(".");
|
|
5902
|
+
const transformExpr = propertyTransforms[ancestor] ?? propertyTransforms[ancestor.replace(/\.\d+(?=\.|$)/g, ".*")];
|
|
5903
|
+
if (transformExpr === void 0) continue;
|
|
5904
|
+
const liveAtAncestor = valueAtDottedPath$1(liveRoot, ancestor);
|
|
5905
|
+
if (liveAtAncestor === void 0) continue;
|
|
5906
|
+
for (const alt of transformExpr.split(" $OR ")) {
|
|
5907
|
+
const expr = alt.trim();
|
|
5908
|
+
if (!expr) continue;
|
|
5909
|
+
const compiled = compileTransform(expr);
|
|
5910
|
+
if (!compiled) continue;
|
|
5911
|
+
try {
|
|
5912
|
+
const out = compiled.evaluate(declaredRoot);
|
|
5913
|
+
if (out === void 0) continue;
|
|
5914
|
+
const transformedAtAncestor = valueAtDottedPath$1(out, ancestor);
|
|
5915
|
+
if (transformedAtAncestor !== void 0 && deepEqual(transformedAtAncestor, liveAtAncestor)) return true;
|
|
5916
|
+
} catch {}
|
|
5917
|
+
}
|
|
5918
|
+
}
|
|
5919
|
+
return false;
|
|
5920
|
+
}
|
|
5890
5921
|
function resolveParentObject(root, dottedPath) {
|
|
5891
5922
|
const segs = dottedPath.split(".");
|
|
5892
5923
|
if (segs.length <= 1) return root;
|
|
@@ -6605,6 +6636,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
6605
6636
|
}) ?? false)) continue;
|
|
6606
6637
|
const transformExpr = schema.propertyTransforms?.[d.path] ?? schema.propertyTransforms?.[d.path.replace(/\.\d+(?=\.|$)/g, ".*")];
|
|
6607
6638
|
if (transformExpr !== void 0 && matchesPropertyTransform(transformExpr, d.stateValue, resolveParentObject(declared, d.path), declared, d.awsValue, d.path.split(".").at(-1) ?? d.path)) continue;
|
|
6639
|
+
if (schema.propertyTransforms !== void 0 && transformExpr === void 0 && matchesAncestorPropertyTransform(schema.propertyTransforms, d.path, declared, live)) continue;
|
|
6608
6640
|
const tagListWhole = !unorderedObjArray && Array.isArray(v) && isKeyValueTagList(v) && d.path.startsWith(`${k}.`);
|
|
6609
6641
|
const unorderedExtra = unorderedObjArray && Array.isArray(declaredVal) && declaredRemapSource ? {
|
|
6610
6642
|
path: remapSortedIndexToDeclared(d.path, k, declaredVal, declaredRemapSource),
|
|
@@ -7805,12 +7837,12 @@ function isOpenSearchServiceClient(name) {
|
|
|
7805
7837
|
return OPENSEARCH_SERVICE_CLIENT_PREFIXES.some((p) => name.startsWith(p));
|
|
7806
7838
|
}
|
|
7807
7839
|
function diffUserPoolChildren(input) {
|
|
7808
|
-
const { userPoolId, declaredClientIds, liveClients } = input;
|
|
7840
|
+
const { userPoolId, declaredClientIds, liveClients, openSearchCorroborated = true } = input;
|
|
7809
7841
|
const declared = new Set(declaredClientIds);
|
|
7810
7842
|
const added = [];
|
|
7811
7843
|
for (const c of liveClients) {
|
|
7812
7844
|
if (declared.has(c.id)) continue;
|
|
7813
|
-
if (isOpenSearchServiceClient(c.name ?? c.label)) continue;
|
|
7845
|
+
if (openSearchCorroborated && isOpenSearchServiceClient(c.name ?? c.label)) continue;
|
|
7814
7846
|
added.push({
|
|
7815
7847
|
resourceType: "AWS::Cognito::UserPoolClient",
|
|
7816
7848
|
identifier: `${userPoolId}|${c.id}`,
|
|
@@ -7936,6 +7968,19 @@ async function pageUserPoolIdentityProviders(client, userPoolId) {
|
|
|
7936
7968
|
} while (next);
|
|
7937
7969
|
return out;
|
|
7938
7970
|
}
|
|
7971
|
+
async function openSearchDomainTargetsPool(region, userPoolId) {
|
|
7972
|
+
try {
|
|
7973
|
+
const os = new OpenSearchClient({
|
|
7974
|
+
region,
|
|
7975
|
+
...READ_RETRY
|
|
7976
|
+
});
|
|
7977
|
+
const domainNames = ((await os.send(new ListDomainNamesCommand({}))).DomainNames ?? []).map((d) => d.DomainName).filter((n) => typeof n === "string");
|
|
7978
|
+
if (domainNames.length === 0) return false;
|
|
7979
|
+
return ((await os.send(new DescribeDomainsCommand({ DomainNames: domainNames }))).DomainStatusList ?? []).some((d) => d.CognitoOptions?.Enabled === true && d.CognitoOptions.UserPoolId === userPoolId);
|
|
7980
|
+
} catch {
|
|
7981
|
+
return true;
|
|
7982
|
+
}
|
|
7983
|
+
}
|
|
7939
7984
|
async function enumerateUserPoolChildren(ctx) {
|
|
7940
7985
|
const { parent, desired, region } = ctx;
|
|
7941
7986
|
const userPoolId = parent.physicalId;
|
|
@@ -7959,14 +8004,18 @@ async function enumerateUserPoolChildren(ctx) {
|
|
|
7959
8004
|
region,
|
|
7960
8005
|
...READ_RETRY
|
|
7961
8006
|
});
|
|
8007
|
+
const liveClients = (await pageUserPoolClients(client, userPoolId)).filter((c) => typeof c.ClientId === "string").map((c) => ({
|
|
8008
|
+
id: c.ClientId,
|
|
8009
|
+
name: c.ClientName,
|
|
8010
|
+
label: c.ClientName ?? c.ClientId
|
|
8011
|
+
}));
|
|
8012
|
+
let openSearchCorroborated = desired.resources.some((r) => (r.resourceType === "AWS::OpenSearchService::Domain" || r.resourceType === "AWS::Elasticsearch::Domain") && parentRefMatches(r.declared.CognitoOptions?.UserPoolId, userPoolId));
|
|
8013
|
+
if (!openSearchCorroborated && liveClients.some((c) => !declaredClientIds.includes(c.id) && isOpenSearchServiceClient(c.name ?? c.label))) openSearchCorroborated = await openSearchDomainTargetsPool(region, userPoolId);
|
|
7962
8014
|
const clientAdded = diffUserPoolChildren({
|
|
7963
8015
|
userPoolId,
|
|
7964
8016
|
declaredClientIds,
|
|
7965
|
-
liveClients
|
|
7966
|
-
|
|
7967
|
-
name: c.ClientName,
|
|
7968
|
-
label: c.ClientName ?? c.ClientId
|
|
7969
|
-
}))
|
|
8017
|
+
liveClients,
|
|
8018
|
+
openSearchCorroborated
|
|
7970
8019
|
});
|
|
7971
8020
|
const groupAdded = diffUserPoolGroups({
|
|
7972
8021
|
userPoolId,
|