---
title: "Comment by Arnold Holm on \"The Guard at Your API’s Gate : Middleware in Express, explained simply\" | Hashnode"
description: "One order-sensitive example is a signed webhook. I would verify the signature against the original request bytes before using the JSON as trusted input. Express"
url: "https://hashnode.com/posts/express-middleware-explained/6accc887fffa4b1c304b5eda/comment/6acd4894703bc71f21c25430"
---

[Discussion](https://hashnode.com/posts/express-middleware-explained/6accc887fffa4b1c304b5eda)

Comment [The Guard at Your API’s Gate : Middleware in Express, explained simply](https://hashnode.com/posts/express-middleware-explained/6accc887fffa4b1c304b5eda)

[Arnold Holm](https://hashnode.com/@stratcorealpha)

[Oct 12](https://hashnode.com/posts/express-middleware-explained/6accc887fffa4b1c304b5eda/comment/6acd4894703bc71f21c25430)

One order-sensitive example is a signed webhook. I would verify the signature against the original request bytes before using the JSON as trusted input. Express’s JSON parser has a verify(req, res, buf) hook for that; re-stringifying req.body can change whitespace and break the signature. Then validate the fields before the route performs any action. Three useful checks are: a valid signature succeeds, one changed byte fails, and malformed JSON reaches the error handler without triggering the action.

[Abdul Rahman](https://hashnode.com/@abdulrdeveloper)

[Oct 14](https://hashnode.com/posts/express-middleware-explained/6accc887fffa4b1c304b5eda/comment/6acd4894703bc71f21c25430#reply-6acf5b8d0e3d9a305ba134d0)

Good point, thanks. A signed webhook is a great example of order mattering, the signature must be checked against the raw bytes, and express.json()\`s verify hook is the right place for that. I kept this blog at beginner level, but I may cover it in a future post.
