Skip to content

feat(core): synthesized templates validate against a comprehensive default rule set#38135

Open
kaizencc wants to merge 9 commits into
mainfrom
conroyka/default-validation-plugin
Open

feat(core): synthesized templates validate against a comprehensive default rule set#38135
kaizencc wants to merge 9 commits into
mainfrom
conroyka/default-validation-plugin

Conversation

@kaizencc

@kaizencc kaizencc commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds CloudFormationValidatePlugin class that wraps @aws/cloudformation-validate (WASM-based CloudFormation linter) to validate synthesized templates against schema rules, best-practice checks, and misconfiguration detection
  • To achieve validation as intended, users must set a context key "@aws-cdk/core:validateAgainstDefaultRules"
  • If the flag is not set, we treat errors as warnings and report: [Warning] CloudFormation Validate found issues in your templates (reported as warnings). Set context key "@aws-cdk/core:validateAgainstDefaultRules" to true to turn these into errors.
  • Users can also instantiate CloudFormationValidatePlugin directly with custom Rego or Guard rules

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

…synthesis

Adds a built-in validation plugin that uses the `@aws/cloudformation-validate`
package (WASM-based CloudFormation linter) to validate synthesized templates
against schema rules, best-practice checks, and misconfiguration detection.

The plugin is gated behind the `@aws-cdk/core:validateAgainstDefaultRules`
feature flag (off by default, recommended: true). When enabled, all stack
templates are validated during synthesis and violations appear in the policy
validation report.

Users can also instantiate `DefaultValidationPlugin` directly with custom
Rego or Guard rules for additional validation beyond the built-in rule set.
@kaizencc kaizencc requested a review from a team as a code owner June 12, 2026 20:33
@github-actions github-actions Bot added the p2 label Jun 12, 2026
@mergify mergify Bot added the contribution/core This is a PR that came from AWS. label Jun 12, 2026
@mergify mergify Bot temporarily deployed to automation June 12, 2026 20:34 Inactive
@mergify mergify Bot temporarily deployed to automation June 12, 2026 20:36 Inactive
@mergify mergify Bot requested a deployment to test-pipeline June 12, 2026 20:37 Waiting
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

⚠️ This pull request description does not follow the correct template structure.

PRs without a linked issue will receive lower priority for review and merging. Please update the description to follow the PR template and include a line like Closes #123 in the Issue section. If no existing issue matches your change, create one first.

@aws-cdk-automation aws-cdk-automation left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@kaizencc kaizencc added pr-linter/exempt-readme The PR linter will not require README changes pr-linter/exempt-integ-test The PR linter will not require integ test changes labels Jun 12, 2026
@aws-cdk-automation aws-cdk-automation dismissed their stale review June 12, 2026 20:47

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

pkglint requires third-party attribution entries in the NOTICE file
for all bundled dependencies.
@aws-cdk-automation aws-cdk-automation added the pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. label Jun 12, 2026
@rix0rrr rix0rrr changed the title feat(core): register default CloudFormation validation plugin during synthesis feat(core): CloudFormation templates validate against a comprehensive default rule set Jun 15, 2026

@aws-cdk-automation aws-cdk-automation left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@kaizencc kaizencc changed the title feat(core): CloudFormation templates validate against a comprehensive default rule set feat(core): synthesized templates validate against a comprehensive default rule set Jun 15, 2026
@aws-cdk-automation aws-cdk-automation dismissed their stale review June 15, 2026 20:21

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

…ngs when flag unconfigured

The plugin now runs unconditionally. When the feature flag
@aws-cdk/core:validateAgainstDefaultRules is explicitly set to true,
violations are treated as errors and fail synthesis. When unconfigured,
violations are downgraded to warnings and a nudge message is printed
suggesting users opt in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution/core This is a PR that came from AWS. p2 pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-readme The PR linter will not require README changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants