Commit 09fed94
committed
review pass-2 fix (#573): hash-check payload for falsy-parsed bodies too
Copilot pass-2 (separate from the Buffer fix): the
`if (payloadTag && request.body)` guard skipped payload validation
when a JSON body parsed to a falsy value (null/false/0/""), so a
client could sign a payload tag, send a falsy body, and the integrity
check silently didn't run. Guard on `request.body !== undefined`
instead — Fastify leaves body undefined only when no body was sent —
so falsy-but-present bodies are still verified while genuinely
bodyless requests stay skipped.
New test: a `false` body with a WRONG payload tag is now rejected
(was skipped), and with the correct tag passes. 8/8 in file; full
suite green.1 parent 3dda984 commit 09fed94
2 files changed
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
247 | 252 | | |
248 | 253 | | |
249 | 254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
137 | 154 | | |
138 | 155 | | |
139 | 156 | | |
| |||
0 commit comments