cdk-insights 1.7.0 → 1.8.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.
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Curated registry of compliance-critical CDK Mixins that cdk-insights
3
+ * checks for stack-wide consistency. Keep this list small and high-signal —
4
+ * each entry should represent a property where a partial application is
5
+ * almost certainly an oversight rather than a deliberate exception.
6
+ *
7
+ * `cfnResourceType` is the CloudFormation resource type the mixin targets
8
+ * (per the AWS docs: each mixin targets exactly one resource type and is
9
+ * named after it). `displayName` is the short human-readable mixin name.
10
+ */
11
+ export type ComplianceCriticalMixin = {
12
+ fqn: string;
13
+ cfnResourceType: string;
14
+ displayName: string;
15
+ };
16
+ export declare const COMPLIANCE_CRITICAL_MIXINS: ComplianceCriticalMixin[];
@@ -0,0 +1,14 @@
1
+ import type { AnalysisResults, CloudFormationStack, CreateFindingFunction } from '../../../../types/analysis.types';
2
+ /**
3
+ * Detects when an anonymised custom CDK Mixin (reported as `'*'` by
4
+ * aws-cdk-lib's analytics writer) is applied across many distinct CFN
5
+ * resource types in the same stack — the template-visible signature of
6
+ * `.with(customMixin)` being called on a parent construct, where the
7
+ * applicator (`withMixins`) calls `target.node.findAll()` and the mixin's
8
+ * default `supports()` accepts every descendant.
9
+ *
10
+ * Emits a single per-stack finding (attached to the first affected
11
+ * resource) at LOW severity — false-positive rates here are non-trivial,
12
+ * so the message is framed as a verification prompt rather than a defect.
13
+ */
14
+ export declare const checkCustomMixinCrossTypeApplication: (template: CloudFormationStack, createFinding: CreateFindingFunction) => AnalysisResults;
@@ -0,0 +1,18 @@
1
+ import type { AnalysisResults, CloudFormationStack, CreateFindingFunction } from '../../../../types/analysis.types';
2
+ /**
3
+ * Detects when a compliance-critical CDK Mixin is applied to *some* but not
4
+ * *all* resources of its target type within a stack. This is the template-
5
+ * visible footprint of `Mixins.of(scope).apply(...)` being called without
6
+ * `requireAll()` — when the scope-wide application silently misses some
7
+ * constructs (e.g., a bucket added later, or one outside the scope), the
8
+ * inconsistency surfaces here.
9
+ *
10
+ * Findings fire on each resource that *lacks* the mixin, suggesting the
11
+ * user either add the mixin explicitly or migrate to
12
+ * `Mixins.of(scope).requireAll().apply(...)` to fail synth on misses.
13
+ *
14
+ * Mixin attribution is read from `__appliedMixins` populated by
15
+ * `parseManifestMetadata` from the `aws:cdk:analytics:mixin` manifest
16
+ * stream (see aws-cdk-lib core/lib/mixins/private/mixin-metadata.ts).
17
+ */
18
+ export declare const checkMixinAppliedWithoutStackCoverage: (template: CloudFormationStack, createFinding: CreateFindingFunction) => AnalysisResults;
@@ -4,7 +4,7 @@
4
4
  * Registers all template-level checks and provides the runner that
5
5
  * executes them against a CloudFormation template.
6
6
  */
7
- import type { CloudFormationStack, CreateFindingFunction, AnalysisResults } from '../../types/analysis.types';
7
+ import type { AnalysisResults, CloudFormationStack, CreateFindingFunction } from '../../types/analysis.types';
8
8
  import type { TemplateLevelCheckDefinition } from './types';
9
9
  /**
10
10
  * Run all template-level checks against a CloudFormation stack.
@@ -150,8 +150,13 @@ export interface CdkInsightsAspectOptions {
150
150
  }
151
151
  /**
152
152
  * Helper function to check if CDK stack traces are enabled.
153
- * Users should set CDK_DEBUG=true or add context @aws-cdk/core:stackTrace: true
154
- * for the most reliable source location capture.
153
+ * Three paths CDK honours, in order of how a user typically sets them:
154
+ * 1. `CDK_DEBUG=true` env var (per-shell, transient).
155
+ * 2. `CDK_CONTEXT_JSON` env containing the `@aws-cdk/core:stackTrace` flag
156
+ * (used by `cdk synth --context @aws-cdk/core:stackTrace=true`).
157
+ * 3. `cdk.json` `context['@aws-cdk/core:stackTrace'] = true` (durable, the
158
+ * path `cdk-insights setup` configures so users don't have to remember
159
+ * anything).
155
160
  */
156
161
  export declare const isCdkDebugEnabled: () => boolean;
157
162
  /**