@mavogel/awscdk-rootmail 0.0.336 → 0.1.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.
Files changed (50) hide show
  1. package/.codegraph/.gitignore +5 -0
  2. package/.jsii +460 -8
  3. package/CLAUDE.md +1 -1
  4. package/README.md +6 -1
  5. package/docs/plans/2026-08-09-bump-mvc-projen-cdk-nag-v3.md +199 -0
  6. package/integ-tests/integ.rootmail-custom-santa.ts +2 -2
  7. package/integ-tests/integ.rootmail-filter-subject.ts +2 -2
  8. package/integ-tests/integ.rootmail.ts +2 -2
  9. package/lib/hosted-zone-dkim-propagation.js +46 -15
  10. package/lib/hosted-zone-dkim-verification-records.js +47 -12
  11. package/lib/rootmail-autowire-dns.js +47 -15
  12. package/lib/rootmail.js +13 -16
  13. package/lib/ses-receipt-ruleset-activation.js +53 -15
  14. package/lib/ses-receive.js +12 -12
  15. package/node_modules/cdk-nag/.jsii +6331 -2945
  16. package/node_modules/cdk-nag/.jsii.tabl.json +1 -1
  17. package/node_modules/cdk-nag/API.md +490 -1778
  18. package/node_modules/cdk-nag/MIGRATION.md +239 -0
  19. package/node_modules/cdk-nag/README.md +88 -513
  20. package/node_modules/cdk-nag/lib/index.d.ts +0 -3
  21. package/node_modules/cdk-nag/lib/index.js +1 -4
  22. package/node_modules/cdk-nag/lib/nag-logger.d.ts +5 -145
  23. package/node_modules/cdk-nag/lib/nag-logger.js +4 -199
  24. package/node_modules/cdk-nag/lib/nag-pack.d.ts +57 -44
  25. package/node_modules/cdk-nag/lib/nag-pack.js +140 -114
  26. package/node_modules/cdk-nag/lib/nag-rules.d.ts +0 -2
  27. package/node_modules/cdk-nag/lib/nag-rules.js +3 -5
  28. package/node_modules/cdk-nag/lib/packs/aws-solutions.d.ts +4 -15
  29. package/node_modules/cdk-nag/lib/packs/aws-solutions.js +21 -40
  30. package/node_modules/cdk-nag/lib/packs/hipaa-security.d.ts +4 -2
  31. package/node_modules/cdk-nag/lib/packs/hipaa-security.js +31 -37
  32. package/node_modules/cdk-nag/lib/packs/nist-800-53-r4.d.ts +4 -2
  33. package/node_modules/cdk-nag/lib/packs/nist-800-53-r4.js +29 -35
  34. package/node_modules/cdk-nag/lib/packs/nist-800-53-r5.d.ts +4 -2
  35. package/node_modules/cdk-nag/lib/packs/nist-800-53-r5.js +30 -36
  36. package/node_modules/cdk-nag/lib/packs/pci-dss-321.d.ts +4 -2
  37. package/node_modules/cdk-nag/lib/packs/pci-dss-321.js +29 -35
  38. package/node_modules/cdk-nag/lib/packs/serverless.d.ts +4 -2
  39. package/node_modules/cdk-nag/lib/packs/serverless.js +14 -20
  40. package/node_modules/cdk-nag/lib/rules/ec2/EC2IMDSv2Enabled.js +5 -1
  41. package/node_modules/cdk-nag/package.json +5 -5
  42. package/package.json +16 -17
  43. package/node_modules/cdk-nag/lib/ignore-suppression-conditions.d.ts +0 -59
  44. package/node_modules/cdk-nag/lib/ignore-suppression-conditions.js +0 -97
  45. package/node_modules/cdk-nag/lib/models/nag-suppression.d.ts +0 -30
  46. package/node_modules/cdk-nag/lib/models/nag-suppression.js +0 -7
  47. package/node_modules/cdk-nag/lib/nag-suppressions.d.ts +0 -30
  48. package/node_modules/cdk-nag/lib/nag-suppressions.js +0 -96
  49. package/node_modules/cdk-nag/lib/utils/nag-suppression-helper.d.ts +0 -20
  50. package/node_modules/cdk-nag/lib/utils/nag-suppression-helper.js +0 -119
@@ -0,0 +1,239 @@
1
+ # Migrating from cdk-nag v2 to v3
2
+
3
+ ## Overview
4
+
5
+ cdk-nag v3 rewrites the core engine from an `IAspect` to an `IPolicyValidationPlugin`. Rule packs now participate in CDK's native [policy validation framework](https://docs.aws.amazon.com/cdk/v2/guide/policy-validation-synthesis.html) instead of emitting annotations during synthesis.
6
+
7
+ This guide covers every breaking change and the corresponding v3 equivalent.
8
+
9
+ ---
10
+
11
+ ## Minimum CDK Version
12
+
13
+ | Version | Minimum `aws-cdk-lib` |
14
+ |---------|----------------------|
15
+ | v2 | 2.176.0 |
16
+ | v3 | 2.257.0 |
17
+
18
+ ---
19
+
20
+ ## Registering a NagPack
21
+
22
+ ### v2
23
+
24
+ ```typescript
25
+ import { App, Aspects } from 'aws-cdk-lib';
26
+ import { AwsSolutionsChecks } from 'cdk-nag';
27
+
28
+ const app = new App();
29
+ Aspects.of(app).add(new AwsSolutionsChecks());
30
+ ```
31
+
32
+ ### v3
33
+
34
+ ```typescript
35
+ import { App, Validations } from 'aws-cdk-lib';
36
+ import { AwsSolutionsChecks } from 'cdk-nag';
37
+
38
+ const app = new App();
39
+ Validations.of(app).addPlugins(new AwsSolutionsChecks(app));
40
+ ```
41
+
42
+ **Key differences:**
43
+
44
+ - Use `Validations.of(scope).addPlugins(...)` instead of `Aspects.of(scope).add(...)`.
45
+ - The NagPack constructor now takes an optional `scope` as the first argument, followed by `props`.
46
+
47
+ ---
48
+
49
+ ## Acknowledging (Suppressing) Rules
50
+
51
+ ### v2
52
+
53
+ ```typescript
54
+ import { NagSuppressions } from 'cdk-nag';
55
+
56
+ NagSuppressions.addResourceSuppressions(myBucket, [
57
+ { id: 'AwsSolutions-S1', reason: 'Logging not required.' },
58
+ ]);
59
+
60
+ NagSuppressions.addStackSuppressions(stack, [
61
+ { id: 'AwsSolutions-S1', reason: 'Logging not required.' },
62
+ ]);
63
+ ```
64
+
65
+ ### v3
66
+
67
+ ```typescript
68
+ import { Validations } from 'aws-cdk-lib';
69
+
70
+ Validations.of(myBucket).acknowledge({
71
+ id: 'AwsSolutions-S1',
72
+ reason: 'Logging not required.',
73
+ });
74
+
75
+ // Stack-level acknowledgment
76
+ Validations.of(stack).acknowledge({
77
+ id: 'AwsSolutions-S1',
78
+ reason: 'Logging not required for any resource in this stack.',
79
+ });
80
+ ```
81
+
82
+ **Key differences:**
83
+
84
+ - `NagSuppressions` is removed. Use CDK's built-in `Validations.of(construct).acknowledge(...)`.
85
+ - Each call acknowledges a single rule. There is no bulk array form.
86
+ - Granular finding suppressions still use the `RuleId[FindingId]` format: `Validations.of(resource).acknowledge({ id: 'AwsSolutions-IAM5[Action::s3:*]', reason: '...' })`.
87
+
88
+ ---
89
+
90
+ ## Removed APIs
91
+
92
+ The following exports no longer exist in v3:
93
+
94
+ | Removed | Replacement |
95
+ |-------------------------------|-----------------------------------------------------|
96
+ | `NagSuppressions` | `Validations.of(construct).acknowledge(...)` |
97
+ | `NagPackSuppression` | Use `{ id, reason }` with `acknowledge()` |
98
+ | `INagSuppressionIgnore` | No equivalent (acknowledgments cannot be overridden)|
99
+ | `SuppressionIgnoreAlways` | Removed |
100
+ | `SuppressionIgnoreNever` | Removed |
101
+ | `SuppressionIgnoreOr` | Removed |
102
+ | `INagLogger` | Removed — violations surface in `policy-validation-report.json` |
103
+ | `AnnotationLogger` | Removed |
104
+ | `NagReportLogger` | Removed |
105
+ | `VALIDATION_FAILURE_ID` | Rule errors are reported as violations directly |
106
+ | `NagRulePostValidationStates.SUPPRESSED` | Removed |
107
+
108
+ ---
109
+
110
+ ## NagPackProps Changes
111
+
112
+ | v2 Property | v3 Status |
113
+ |-------------------------------|-----------------------------------------------------|
114
+ | `verbose` | Retained — controls whether explanations are included in violation descriptions |
115
+ | `logIgnores` | Removed — no separate suppression logging |
116
+ | `reports` | Removed — CDK writes `policy-validation-report.json` automatically |
117
+ | `reportFormats` | Removed |
118
+ | `suppressionIgnoreCondition` | Removed |
119
+ | `additionalLoggers` | Removed |
120
+ | `writeSuppressionsToCloudFormation` | **New** — writes acknowledged rules into CloudFormation Metadata for audit trail compatibility with v2 tooling |
121
+
122
+ ---
123
+
124
+ ## Custom NagPack Authors
125
+
126
+ ### v2
127
+
128
+ ```typescript
129
+ import { CfnResource, IAspect } from 'aws-cdk-lib';
130
+ import { IConstruct } from 'constructs';
131
+ import { NagPack, NagPackProps, NagMessageLevel, NagRuleCompliance } from 'cdk-nag';
132
+
133
+ export class MyPack extends NagPack {
134
+ constructor(props?: NagPackProps) {
135
+ super(props);
136
+ this.packName = 'MyPack';
137
+ }
138
+
139
+ public visit(node: IConstruct): void {
140
+ if (node instanceof CfnResource) {
141
+ this.applyRule({
142
+ info: 'My rule description.',
143
+ explanation: 'Why this matters.',
144
+ level: NagMessageLevel.ERROR,
145
+ rule: (resource) =>
146
+ resource.cfnResourceType === 'AWS::S3::Bucket'
147
+ ? NagRuleCompliance.COMPLIANT
148
+ : NagRuleCompliance.NON_COMPLIANT,
149
+ node,
150
+ });
151
+ }
152
+ }
153
+ }
154
+ ```
155
+
156
+ ### v3
157
+
158
+ ```typescript
159
+ import { CfnResource } from 'aws-cdk-lib';
160
+ import { IConstruct } from 'constructs';
161
+ import { NagPack, NagPackProps, NagMessageLevel, NagRuleCompliance } from 'cdk-nag';
162
+
163
+ export class MyPack extends NagPack {
164
+ public readonly name = 'MyPack';
165
+
166
+ constructor(scope?: IConstruct, props?: NagPackProps) {
167
+ super(scope, props);
168
+ this.packName = 'MyPack';
169
+ }
170
+
171
+ protected checkResource(node: CfnResource): void {
172
+ this.applyRule({
173
+ info: 'My rule description.',
174
+ explanation: 'Why this matters.',
175
+ level: NagMessageLevel.ERROR,
176
+ rule: (resource) =>
177
+ resource.cfnResourceType === 'AWS::S3::Bucket'
178
+ ? NagRuleCompliance.COMPLIANT
179
+ : NagRuleCompliance.NON_COMPLIANT,
180
+ node,
181
+ });
182
+ }
183
+ }
184
+ ```
185
+
186
+ **Key differences:**
187
+
188
+ - Add a `public readonly name` property (required by `IPolicyValidationPlugin`).
189
+ - Constructor signature is `(scope?: IConstruct, props?: NagPackProps)`.
190
+ - Replace `public visit(node: IConstruct)` with `protected checkResource(node: CfnResource)`. The base class handles tree-walking and only calls `checkResource` for `CfnResource` nodes.
191
+ - The `ignoreSuppressionCondition` option on `IApplyRule` is removed.
192
+
193
+ ---
194
+
195
+ ## Validation Output
196
+
197
+ ### v2
198
+
199
+ Violations appeared as CDK Annotations (warnings/errors) during `cdk synth` and in CSV/JSON report files in the cloud assembly output directory.
200
+
201
+ ### v3
202
+
203
+ Violations appear in CDK's `policy-validation-report.json` in the cloud assembly. The CDK CLI displays a formatted summary of all violations on `cdk synth` or `cdk deploy`. Reports (`NagReportLogger`) are no longer generated separately.
204
+
205
+ ---
206
+
207
+ ## Audit Trail (CloudFormation Metadata)
208
+
209
+ If you have existing tooling that reads the `cdk_nag` metadata block from synthesized CloudFormation templates, enable backwards-compatible metadata writing:
210
+
211
+ ```typescript
212
+ Validations.of(app).addPlugins(
213
+ new AwsSolutionsChecks(app, { writeSuppressionsToCloudFormation: true })
214
+ );
215
+ ```
216
+
217
+ This causes acknowledged rules to be written into each `CfnResource`'s Metadata as:
218
+
219
+ ```json
220
+ {
221
+ "cdk_nag": {
222
+ "rules_to_suppress": [
223
+ { "id": "AwsSolutions-S1", "reason": "..." }
224
+ ]
225
+ }
226
+ }
227
+ ```
228
+
229
+ ---
230
+
231
+ ## Quick Migration Checklist
232
+
233
+ - [ ] Update `aws-cdk-lib` to >= 2.257.0
234
+ - [ ] Replace `Aspects.of(scope).add(new Pack())` → `Validations.of(scope).addPlugins(new Pack(scope))`
235
+ - [ ] Replace all `NagSuppressions.addResourceSuppressions(...)` / `addStackSuppressions(...)` → `Validations.of(construct).acknowledge({ id, reason })`
236
+ - [ ] Remove imports of `NagSuppressions`, `NagPackSuppression`, `INagLogger`, `AnnotationLogger`, `NagReportLogger`, `INagSuppressionIgnore`, and related types
237
+ - [ ] If using custom NagPacks: rename `visit()` → `checkResource()`, add `public readonly name`, update constructor signature
238
+ - [ ] If relying on CSV/JSON reports: switch to reading `policy-validation-report.json` from the cloud assembly, or enable `writeSuppressionsToCloudFormation` for template-level metadata
239
+ - [ ] Remove `logIgnores`, `reports`, `reportFormats`, `suppressionIgnoreCondition`, and `additionalLoggers` from NagPack props