Approvals in AI Workflows Require Exact Matching to Prevent Unauthorized Changes
A critical issue in AI workflow approvals is the risk of actions changing after being approved, leading to potential discrepancies. To address this, experts recommend hashing the exact action to ensure consistency.

A common gap in approval flows is when a person approves an action, but changes occur before it runs, leading to discrepancies. For example, a retry may rebuild the message with a new price, or a teammate may edit the amount, yet the approval still indicates 'yes'. To prevent this, the fix involves approving a fingerprint of the exact action and refusing to run anything that does not match. This approach ensures that only the specific action that was approved is executed. [1]
The method involves canonicalising and hashing the action. This is achieved by converting the action into a JSON string with sorted keys and specific separators, then generating a SHA-256 hash of the resulting string. This hash serves as the fingerprint of the action. For instance, an action with details such as type, order, amount, and currency is converted into a canonical form and hashed to create a unique identifier. [1]
The approval is then stored against the generated fingerprint. This includes the fingerprint itself, the name of the approver, and the timestamp of the approval. Before executing the action, the system checks if the fingerprint of the current action matches the stored fingerprint. If it does not match, a permission error is raised, indicating that the action has changed after approval and needs re-approval. [1]
To ensure transparency, the approval screen must display every field that contributes to the fingerprint. Approving a summary while hashing hidden fields defeats the purpose of the method. Additionally, it is important to log the fingerprint, the approver, and the full action for record-keeping. This allows for traceability and accountability in case of disputes or audits. [1]
Advertisement
The source describes a specific implementation context involving refund actions, with an example using an order labeled "A-1042" and an amount of "18.00" in USD. This suggests that the system is being used in a financial or e-commerce setting where refund processing is a common operation. The action is represented as a dictionary in Python, and the example includes fields like type, order, amount, and currency, indicating that the approval process is applied to structured data representing business operations. The use of JSON serialization and hashing implies that this approach is being used in a software development environment where Python is the primary programming language. [1]
The example code provided in the source includes a function called fingerprint(), which takes an action dictionary and returns a SHA-256 hash of the canonicalized JSON string. This hash is used to uniquely identify the action, ensuring that any changes to the action after approval will be detected. The canonicalization process involves sorting the keys of the dictionary and using a consistent separator in the JSON string, which helps eliminate differences due to formatting. This method ensures that the hash is consistent for the same action, even if the order of the fields in the JSON string changes. [1]
The source also mentions that the approval record must be stored with the fingerprint, the approver's identity, and the timestamp of the approval. This implies that the system is designed to maintain an audit trail, which is essential for compliance and accountability. The approval record is stored as a dictionary with keys like "fp", "approved_by", and "at". This record is used later during the execution phase to verify that the action being executed is the same one that was approved. If the hash of the current action does not match the stored fingerprint, a PermissionError is raised, preventing the execution of the action. [1]
The source highlights the importance of displaying all fields that contribute to the fingerprint on the approval screen. This ensures that the approver is fully aware of what they are approving and prevents situations where hidden or unshown fields could be modified without the approver's knowledge. This transparency is crucial for maintaining trust and ensuring that approvals are made based on complete information. Additionally, the source mentions that certain fields, such as a retry counter, may legitimately change and should be excluded from the fingerprint calculation. This indicates that the system is designed to handle scenarios where some fields are expected to change after approval without requiring re-approval. [1]
Advertisement
The source also discusses the need to normalize number formats before hashing, as differences in formatting (such as using commas versus periods for decimal points) could cause harmless variations in the hash. This normalization step is important to avoid unnecessary re-approvals due to minor formatting changes that do not affect the actual meaning of the data. The source suggests that these considerations are part of a broader system design that includes approval gates as part of a full build, indicating that this approach is integrated into larger software development and deployment processes. [1]
A common gap in approval flows occurs when a person approves an action, but changes occur before it runs, leading to discrepancies. This can be seen in scenarios where a retry rebuilds a message with a new price or a teammate edits the amount, yet the approval still says 'yes'. The solution involves canonicalising and hashing the action to ensure that what is approved is what runs. This is achieved by using a function that converts the action into a canonical form and generates a hash from it. The approval is then stored against the generated fingerprint, ensuring that any changes to the action will result in a different hash and thus require re-approval. [1]
To implement this method, the approval screen must display every field that contributes to the fingerprint. Approving a summary while hashing hidden fields defeats the purpose of the method. Additionally, the fingerprint, the approver, and the full action should be logged. This allows for transparency and accountability, as it ensures that when someone asks 'who approved this?', the exact details that were approved can be shown. This approach helps maintain consistency and integrity in the approval process by ensuring that only the exact action that was approved is executed. [1]
Edge cases such as normalising number formats before hashing or excluding fields that legitimately change, such as a retry counter, must be addressed in the code. This ensures that harmless differences do not force re-approval unnecessarily. The method also highlights the importance of transparency in the approval process, as it requires that the approval screen must display every field that contributes to the fingerprint. This ensures that the approver has a complete understanding of what they are approving, thereby reducing the risk of discrepancies and ensuring that the correct action is executed. [1]
Advertisement
The Cali Reporter newsletter
The stories worth your time.
California, the country, and what comes next. Join our free newsletter for reporting that keeps you informed.
More in Technology
- Modern Web Guidance 1.0 and Browser Compatibility
Modern Web Guidance 1.0, announced by Chrome for Developers on November 10, introduces browser compatibility data to assist coding agents in building web features. The initiative emphasizes the importance of fallback…
- Apache mod_http2 Vulnerability Detection with Nmap
A new Nmap scripting module has been developed to detect the Apache mod_http2 vulnerability (CVE-2026-119618), addressing the challenges of identifying affected systems accurately.
- Securing Remote Vendor Access in Industrial Networks
Best practices for managing remote vendor access in operational technology (OT) networks emphasize controlled access points, multifactor authentication, and time-bound sessions to reduce cybersecurity risks.
