Commit d57c47f
committed
fix: bind outgoing webhook signatures to a timestamp
registerWebhook's response has always documented HMAC-SHA256(timestamp +
"." + body) with an x-webhook-timestamp header as the signature contract
- middleware/webhookSecurity.ts already verifies inbound webhooks this
way - but outbound delivery never sent the header or included the
timestamp in what it signed. Any receiver following NEPA's own
documented instructions would fail every signature check.
- Add X-Webhook-Timestamp header; sign `${timestamp}.${body}` instead
of the body alone, across real delivery, retry, and testWebhook
- Compute the signature fresh inside attemptWebhookDelivery per attempt
rather than once at event-creation time - retries can now happen up
to an hour later (Phase 3's delay cap), so a signature computed at
attempt 0 would sign an already-stale timestamp by the time a retry
actually fires
- Add round-trip tests: capture the real axios.post call and verify it
via WebhookSecurityService.validateSignature (the real verification
path), plus a negative check that an un-timestamped signature is
correctly rejected
71/71 tests passing; tsc error count unchanged (760, all pre-existing)1 parent f810487 commit d57c47f
2 files changed
Lines changed: 95 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | 245 | | |
250 | 246 | | |
251 | 247 | | |
| |||
257 | 253 | | |
258 | 254 | | |
259 | 255 | | |
260 | | - | |
| 256 | + | |
261 | 257 | | |
262 | 258 | | |
263 | 259 | | |
| |||
270 | 266 | | |
271 | 267 | | |
272 | 268 | | |
273 | | - | |
274 | 269 | | |
275 | 270 | | |
276 | 271 | | |
277 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
278 | 285 | | |
279 | 286 | | |
280 | 287 | | |
| 288 | + | |
281 | 289 | | |
282 | 290 | | |
283 | 291 | | |
| |||
454 | 462 | | |
455 | 463 | | |
456 | 464 | | |
457 | | - | |
458 | 465 | | |
459 | | - | |
| 466 | + | |
460 | 467 | | |
461 | 468 | | |
462 | 469 | | |
| |||
590 | 597 | | |
591 | 598 | | |
592 | 599 | | |
593 | | - | |
| 600 | + | |
| 601 | + | |
594 | 602 | | |
595 | 603 | | |
596 | 604 | | |
597 | 605 | | |
| 606 | + | |
598 | 607 | | |
599 | 608 | | |
600 | 609 | | |
| |||
694 | 703 | | |
695 | 704 | | |
696 | 705 | | |
697 | | - | |
698 | 706 | | |
699 | 707 | | |
700 | 708 | | |
| |||
705 | 713 | | |
706 | 714 | | |
707 | 715 | | |
708 | | - | |
| 716 | + | |
709 | 717 | | |
710 | 718 | | |
711 | 719 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
388 | 438 | | |
389 | 439 | | |
390 | 440 | | |
| |||
629 | 679 | | |
630 | 680 | | |
631 | 681 | | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
632 | 708 | | |
633 | 709 | | |
634 | 710 | | |
| |||
0 commit comments