Commit e0fafcc
Parse forwarded email bodies to extract original recipients (#549)
When users forward emails to addie+prospect@, the actual prospect
recipients are in the email body as quoted headers, not in the
webhook TO/CC fields. This adds a parser to extract them.
- Add forwarded-email-parser.ts utility with detection for Gmail,
Apple Mail, and Outlook forwarding formats
- Integrate into handleProspectEmail() to merge extracted recipients
- Add 39 unit tests covering parsing, edge cases, and security
Security improvements based on code review:
- Added MAX_BODY_SIZE (1MB) limit to prevent DoS
- Rewrote parseHeaderValue to use iterative approach (avoids ReDoS)
- Fixed unbalanced bracket handling in splitAddresses
- Added tests for XSS-like display names and large recipient lists
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.5 <[email protected]>1 parent 0ddfbf5 commit e0fafcc
File tree
4 files changed
+963
-2
lines changed- .changeset
- server
- src
- routes
- utils
- tests/unit
4 files changed
+963
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| |||
549 | 554 | | |
550 | 555 | | |
551 | 556 | | |
552 | | - | |
553 | | - | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
554 | 582 | | |
555 | 583 | | |
556 | 584 | | |
557 | 585 | | |
558 | 586 | | |
559 | 587 | | |
| 588 | + | |
| 589 | + | |
560 | 590 | | |
| 591 | + | |
561 | 592 | | |
562 | 593 | | |
563 | 594 | | |
| |||
0 commit comments