Skip to content
STIRUP

TECHNOLOGY INTELLIGENCE

Understand what's next.

Anti-unification for Formal Policy Comparison and Semantic Diffing

Anti-unification identifies structural similarities and differences in formal policies by finding the most general common structure and marking points of divergence.

Share
AI-generated conceptual illustration accompanying: Anti-unification for Formal Policy Comparison and Semantic Diffing
AI-generated editorial illustration of the article topic; not a photograph, product screenshot or measured result.

Anti-unification in formal policy comparison

Semantic diffing of formal policies with anti-unification offers a method to compare and contrast policy rules by identifying structural similarities and differences. In this approach, anti-unification is used to find the most general common structure between two policies, while marking points of divergence. For example, when comparing two rules, ruleA and ruleB, the anti-unifier identifies shared elements such as sensitive(data) and marks differences with Variants nodes. This technique is particularly useful in policy analysis, where understanding the nuances between rules is critical. According to the evidence, the anti-unifier stores shared structure once and marks each disagreement with a Variants node, enabling a clear and structured comparison of policies. This method is attributed to the source speaker and is based on the provided example.

Rewriting and saturation in policy analysis

In policy analysis, semantic diffing using anti-unification helps identify discrepancies between formal policy encodings. By rewriting domain facts and running them to saturation—where no new equalities are added—the system can compare policy versions effectively. For instance, after saturation, an anti-unifier might reveal that encryption is required in specific audit scenarios, as seen in the rule: (Implies (And (sensitive data) (external dst)) (Variants encrypted audited)). This highlights that only the explicitly stated laws are considered, and any additional identities must be defined through rewrites. Another anti-unifier example shows how differences in policy encodings can be resolved, with two of five differences disappearing after analysis. These results are attributed to the exact anti-unifier computation, with completion set to exact, and are based on the stated rules without assumptions. The process ensures that only the laws explicitly provided are applied, maintaining precision in policy comparison.

Implementation and execution of semantic diffing

The implementation of semantic diffing through anti-unification relies on a straightforward build process using Rust. As described in the documentation, the engine can be built from source with only a pinned Rust toolchain. To reproduce the worked examples, users are instructed to clone the semi-persistent repository, fetch a specific commit, and build the project in release mode. Once compiled, the tool can be executed with a command that processes example files and outputs a single anti-unification term. This process encompasses several stages, including parsing, declarations, saturation, and five anti-unification queries with their corresponding regression checks, as noted in the source material. The simplicity of the build and execution pipeline highlights the tool's focus on usability and efficiency in formal policy analysis.

Policy differences and alignment in anti-unification

Policy differences and alignment in anti-unification reveal how formal policies can be compared and generalized. Encoding A requires both the same-account check and server-side encryption with a customer managed key, as noted in AWS Machine Learning. When reconstructing B, the second child at each node is chosen, leading to the mandatory sseCmk weakening to (Lit true) and surviving only as an alternative inside the Or, according to AWS Machine Learning. However, a first-order anti-unifier cannot generalize the connective itself, meaning that differences such as And versus Or force the split into two alignments, as stated in AWS Machine Learning. These findings highlight the limitations and nuances of using anti-unification for policy comparison, emphasizing the need for careful handling of logical connectives in formal policy analysis.

Application to authorization policies

Semantic diffing of authorization policies, such as those used in Cedar and Dogwood, enables precise comparison of policy versions to detect unintended changes. In an authorization policy, a dropped guard widens what is permitted and can cause the policy to fail open, as noted in AWS Machine Learning. Dogwood extends Cedar authorization policies with temporal conditions for runtime verification of AI agents, as described in AWS Machine Learning. The engine’s user guide includes a worked example that diffs two independently produced Dogwood candidates for one requirement: The agent may POST to /deploy, but only if a health check has already come back 200 in the last 15 minutes, as outlined in AWS Machine Learning. This approach helps ensure that policy modifications align with intended security and operational constraints without introducing vulnerabilities.

Sources and reporting notes

Based on published source material. No independent hands-on testing is claimed.

Read more