Commit 26b9a35
committed
fix: harden amount validation to prevent replay attacks
SECURITY: Changed from blind 1-cent exception to absolute difference check.
Previous code: if amounts don't match AND amount != 1 cent, reject
- Allowed ANY 1-cent payment to complete ANY order (replay attack)
New code: if absolute difference > 1 cent, reject
- Allows exact matches
- Allows 0 EUR order + 1 cent (subscription validation)
- Prevents $0.01 payment completing $100 order
Applied to both IPN webhook and redirect verification.1 parent d9d2c41 commit 26b9a35
File tree
2 files changed
+10
-5
lines changed- includes
2 files changed
+10
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
204 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
205 | 206 | | |
206 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
207 | 210 | | |
208 | 211 | | |
209 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
221 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
222 | 224 | | |
223 | 225 | | |
224 | 226 | | |
| |||
0 commit comments