CloudFormation Guard
Policy results that preserve intent.
I corrected cases where Guard could hide a rejection between evaluating a rule and reporting the result. That fix shipped in Guard 3.2.1.
My decision. I tested which rule failed and why. A nonzero exit alone could mean that a different rule failed.
This change corrected cases where the evaluator or reporter could hide a rejection. Its regression tests cover those cases, not every policy in a rule pack.
Inspect the verdict correction in Guard PR #717 (opens in a new tab)Find the verdict fix in the Guard 3.2.1 release (opens in a new tab)- Who this helps
- Cloud platform and security teams that rely on policy checks to make safe infrastructure decisions.
- My role
- I traced policy errors across evaluation and reporting, corrected the semantics, and added regression coverage for the full verdict path.
- Current state
- Guard 3.2.1 corrected verdict reporting. Guard 3.2.2 preserves surrounding text during replacements and pairs rules with their intended tests.
- Public activity
- Public contribution activity · 2026
Other changes in this project
Other changes in this project
On GitHubOpen project: aws-cloudformation/cloudformation-guard (opens in a new tab)
Guard #727: query and reporting behaviorRead the reviewed change (opens in a new tab)Historical reversal within PR #727: this commit undid a change to text replacement during review.
aws-cloudformation/cloudformation-guard
Guard #720: outcomes for empty comparisonsRead the reviewed change (opens in a new tab)Historical reversal within PR #720: this commit undid a change to how Guard reported test files without a matching rule.
How it works / 06 stages
From constraint to a system a team can own.
Six stages connect the original pressure to the system that now exists.
Keep the meaning in the result.
- Meets the ruleA passing result
- Does not meet itA rejection and its reason
- Nothing to compareMissing is not a pass
- Evaluation errorThe check could not complete
Pressure
A policy verdict must carry its meaning end to end.
Infrastructure policy depends on more than avoiding a crash. A rule can report compliance for input it should reject, a negative test can pass for the wrong reason, or a published pack can differ from the source checked in isolation. Operators need the verdict to preserve the policy author’s intent.
Constraint
Correctness crosses every evaluator boundary.
Parser boundaries, empty collections, missing values, filters, captures, coercion, negation, reporting, test harnesses, and assembled rule packs all influence the final result. A superficial fix at the last symptom would leave neighboring false-confidence paths intact and make future regressions harder to localize.
- Distinguish missing data from true, false, and error outcomes.
- Preserve the rule path and diagnostic that produced a negative result.
- Test the assembled pack that users consume, not only isolated source files.
Decision
Trace meaning, not just the process exit.
The work treats correctness as a pipeline contract. Each change identifies the first semantic divergence, repairs it at the responsible layer, and then asserts both the outcome and the explanatory path. Negative tests must demonstrate that the intended rule failed, rather than accepting any nonzero process exit as proof.
Implementation
Strengthen the full verdict path.
Guard #717 corrected evaluator and reporter defects and shipped in 3.2.1. Two separate reviews explored how to handle empty comparisons (#720) and how to report query results (#727). Each review includes commits that reverse an individual edit. For released behavior, follow the release notes.
- Repair wrong-pass and missing-diagnostic behavior at the root semantic layer.
- Inspect the proposed fourth outcome for empty and absent comparisons in the #720 review history.
- Exercise published rule packs after assembly to catch duplicate declarations.
- Treat ranges inside lists as range membership and keep non-finite number comparisons consistent.
- Preserve unmatched text during replacements and pair each test with the most specific policy filename.
Inspect the build (opens in a new tab)More links from this decision
- Guard #720, historical review of four-valued outcomes (opens in a new tab)
- Guard #727, historical review of query and reporter behavior (opens in a new tab)
- Guard #747, range membership in policy lists (opens in a new tab)
- Guard #748, consistent non-finite number comparisons (opens in a new tab)
- Guard #749, preserve text around pattern replacements (opens in a new tab)
- Guard #750, match tests to the intended policy file (opens in a new tab)
- Guard Rules Registry #287, assembled-pack assurance (opens in a new tab)
State
The work spans a released fix and a broader integrity path.
Guard 3.2.1 includes the evaluator and reporter correction. Guard 3.2.2 makes two everyday tasks more predictable: replacing part of a string and pairing a policy file with its tests. The linked public implementations also explore range and numeric behavior.
See where it works (opens in a new tab)More links from this decision
- CloudFormation Guard 3.2.2 release notes (opens in a new tab)
- CloudFormation Guard #717, verdict integrity correction (opens in a new tab)
- Guard #749, preserve text around pattern replacements (opens in a new tab)
- Guard #750, match tests to the intended policy file (opens in a new tab)
- Guard #747, range membership in policy lists (opens in a new tab)
- Guard #748, consistent non-finite number comparisons (opens in a new tab)
Source
Trace the verdict through code, fixtures, and release notes.
The release notes credit the individual changes. The linked reviews and regression tests show how a rule’s meaning is preserved, from input to verdict.
Follow the public work (opens in a new tab)More links from this decision
- CloudFormation Guard 3.2.2 release notes (opens in a new tab)
- CloudFormation Guard #717, verdict integrity correction (opens in a new tab)
- Guard #749, preserve text around pattern replacements (opens in a new tab)
- Guard #750, match tests to the intended policy file (opens in a new tab)
- Guard #747, range membership in policy lists (opens in a new tab)
- Guard #748, consistent non-finite number comparisons (opens in a new tab)
- Guard Rules Registry #287, assembled-pack assurance (opens in a new tab)
Public work / Implementation trail
Inspect the work behind the result.
Open the working code, review discussions, exact changes, and documentation behind each part.
I write about these evaluator decisions on LinkedIn too: A policy evaluator needs words for unfinished answers, on LinkedIn, opens in a new tab covers the four outcomes; Keeping policy semantics visible during small refactors, on LinkedIn, opens in a new tab covers membership and replacement behavior; and A regression test should prove it can object, on LinkedIn, opens in a new tab covers how a check shows it would notice a change.
What changed
Available in releaseA verdict-integrity correction is available in CloudFormation Guard 3.2.1.
Implemented
Where this work lives
- Available now
- Available in the linked upstream release.
- Integration
- Merged upstream in Guard #717 and included in 3.2.1.
- What supports it
- Release-backed regression coverage for evaluator and reporter defects.
What changed
Available in public branchPolicy authors can try more consistent range membership and numeric comparisons in the linked implementations.
Implemented
Where this work lives
- Available now
- Available in linked public pull-request branches.
- Integration
- Guard #747 and #748 carry focused implementations. The earlier reviews #720 and #727 include reversals of individual changes; the review histories do not establish what shipped. Rules Registry #287 covers assembled rule packs.
- What supports it
- Executable implementations with targeted fixtures and regression tests.
What changed
Available in releasePattern replacements keep the surrounding text, and tests run against the intended rule file even when filenames share a prefix.
Implemented
Where this work lives
- Available now
- Available in CloudFormation Guard 3.2.2.
- Integration
- Guard #749 and #750 are credited in the 3.2.2 release notes.
- What supports it
- Focused regression tests cover replacement boundaries and the most specific matching rule filename.
Continue exploring
Compare the decisions across systems.
Move to another result, or return to the complete work collection.