---
title: "Discussion on \"The agent sorted the JSON body keys to tidy it up, and the request signature stopped matching\" | Hashnode"
description: "Discussion on \"The agent sorted the JSON body keys to tidy it up, and the request signature stopped matching\". The agent sorted the webhook body's JSON keys alphabetically after signing. Shape-only tests passed, CI went green, but production returned 401 signature_invalid: the receiver rehashed the reordered bytes and got a different digest. Order is cosmetic to a parser; bytes are everything to a signature."
url: "https://hashnode.com/posts/agent-sorted-json-keys-broke-request-signature/6ade82bde7a2fa2e5a44e31f"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [The agent sorted the JSON body keys to tidy it up, and the request signature stopped matching](https://blogs.powerduck.com/agent-sorted-json-keys-broke-request-signature?utm_source=hashnode&utm_medium=feed)

The agent sorted the webhook body's JSON keys alphabetically after signing. Shape-only tests passed, CI went green, but production returned 401 signature\_invalid: the receiver rehashed the reordered bytes and got a different digest. Order is cosmetic to a parser; bytes are everything to a signature.

Oct 25 · 3 min read · blogs.powerduck.com  
Read the article

-   [#aiagents](https://hashnode.com/tag/aiagents)
-   [#aicode](https://hashnode.com/tag/aicode)
-   [#apicontract](https://hashnode.com/tag/apicontract)
-   [#security](https://hashnode.com/tag/security)

## Written by

[Powerduck](https://hashnode.com/@powerduck)

@powerduck · hon

  
[View profile](https://hashnode.com/@powerduck)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
