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

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.

Policy + input
Evaluate, then explain
  • 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
Keep the rule fixed and change the input. A missing value or an evaluation error does not turn into a passing result.
  1. 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.

  2. 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.
  3. 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.

    Why a rejected policy needs a test for the reason it failed

  4. 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.
  5. 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.

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 public branch

Policy 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 release

Pattern 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.