cdk-insights 1.16.0 → 1.17.0

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.
@@ -5,6 +5,13 @@ import type { IConstruct } from 'constructs';
5
5
  declare const CDK_INSIGHTS_METADATA_VERSION = "2.2.0";
6
6
  /** Prefix used to identify cdk-insights annotations in CloudFormation metadata */
7
7
  declare const CDK_INSIGHTS_ANNOTATION_PREFIX = "cdk-insights::";
8
+ /**
9
+ * Sub-prefix for nag findings captured by `CdkInsightsNagDelegate` and emitted
10
+ * as Info annotations. Format: `cdk-insights::nagFinding::<json>`. The scan-side
11
+ * parser branches on this so nag findings flow through the same findings stream
12
+ * as cdk-insights' native rules instead of polluting CDK's error/warning channel.
13
+ */
14
+ declare const CDK_INSIGHTS_NAG_FINDING_PREFIX = "cdk-insights::nagFinding::";
8
15
  /** Confidence level for source location detection */
9
16
  export type SourceLocationConfidence = 'high' | 'medium' | 'low';
10
17
  /** Source location information for a construct */
@@ -168,6 +175,38 @@ export declare const createCdkInsightsLogger: (options?: CdkInsightsLoggerOption
168
175
  * Useful for development and debugging.
169
176
  */
170
177
  export declare const createExtremelyHelpfulConsoleLogger: (options?: CdkInsightsLoggerOptions) => INagLogger;
178
+ /**
179
+ * Captures a non-compliant nag finding as a cdk-insights Info annotation.
180
+ *
181
+ * The on-the-wire shape is intentionally small and stable — the scan-side
182
+ * parser depends on it. Severity is mapped from cdk-nag's binary
183
+ * `NagMessageLevel` (ERROR/WARN) into cdk-insights' richer Severity enum:
184
+ *
185
+ * - `NagMessageLevel.ERROR` → `HIGH` (rule pack author rated it security-critical)
186
+ * - `NagMessageLevel.WARN` → `MEDIUM` (advisory)
187
+ *
188
+ * `HIGH` is the conservative choice for ERROR — it preserves today's behaviour
189
+ * when the Validation Plugin is set to `minimumSeverity: "CRITICAL"` (nothing
190
+ * blocks deploy from nag), while letting users tighten to `HIGH` later to
191
+ * promote ERROR-rated nag findings into deploy gates.
192
+ */
193
+ interface CdkInsightsNagFinding {
194
+ source: 'cdk-nag';
195
+ ruleId: string;
196
+ ruleOriginalName: string;
197
+ ruleInfo: string;
198
+ ruleExplanation: string;
199
+ /** Mapped from NagMessageLevel: ERROR→HIGH, WARN→MEDIUM. */
200
+ severity: 'HIGH' | 'MEDIUM';
201
+ /** Original cdk-nag level — kept so consumers can recover the source signal. */
202
+ level: 'Error' | 'Warning';
203
+ /** Sub-finding identifier from rules that emit multiple findings per resource. */
204
+ findingId?: string;
205
+ /** Construct path of the resource that failed the rule. */
206
+ resourcePath: string;
207
+ /** CloudFormation logical ID of the resource. */
208
+ logicalId: string;
209
+ }
171
210
  /**
172
211
  * Creates a CDK Insights aspect using functional composition.
173
212
  * This is the recommended approach for new projects.
@@ -230,7 +269,8 @@ export declare class CdkInsightsAspect extends NagPack implements IAspect {
230
269
  visit(node: IConstruct): void;
231
270
  }
232
271
  /** Re-export constants for external use */
233
- export { CDK_INSIGHTS_METADATA_VERSION, CDK_INSIGHTS_ANNOTATION_PREFIX };
272
+ export { CDK_INSIGHTS_METADATA_VERSION, CDK_INSIGHTS_ANNOTATION_PREFIX, CDK_INSIGHTS_NAG_FINDING_PREFIX, };
273
+ export type { CdkInsightsNagFinding };
234
274
  /**
235
275
  * Clears all internal caches. Useful for testing or when processing
236
276
  * multiple independent CDK apps in the same process.