Skip to content

OY-07: Escape DSAR request fields in the staff HTML email - #7

Closed
jackowayed wants to merge 1 commit into
mainfrom
claude/oy-07-dsar-html-escape
Closed

jackowayed wants to merge 1 commit into
mainfrom
claude/oy-07-dsar-html-escape

Conversation

@jackowayed

Copy link
Copy Markdown
Owner

Split out from #5 — one finding per PR.

OY-07 — DSAR fields interpolated raw into a staff HTML email

buildDsarEmailHtml interpolated user.id, username, email, requestType, jurisdiction, and the user-controlled details/jurisdiction fields straight into an HTML email sent to contact@oyme.site. A requester could inject arbitrary markup (link/section spoofing, phishing) into mail that staff read.

Fix

Add an escapeHtml helper (& first, then <, >, ", ') and wrap every interpolated value.

  • worker/routes/dsar.ts: escapeHtml helper; every ${...} in buildDsarEmailHtml wrapped, user.id coerced via String().
  • tests/worker/dsar.test.ts: submit details/jurisdiction containing <script> and <img onerror> payloads and assert the outgoing email html contains the escaped forms and not the raw tags.

Testing

Full worker suite passes: 97/97 (npx tsx --test tests/utils.test.ts tests/worker/*.test.ts).

🤖 Generated with Claude Code


Generated by Claude Code

buildDsarEmailHtml interpolated user.id, username, email, requestType,
jurisdiction, and the user-controlled details/jurisdiction fields straight
into an HTML email sent to contact@oyme.site. A requester could inject
arbitrary markup (link/section spoofing, phishing) into mail that staff
read.

Add an escapeHtml helper (& first, then < > " ') and wrap every
interpolated value.

- worker/routes/dsar.ts: escapeHtml helper; every ${...} in
  buildDsarEmailHtml wrapped, user.id coerced via String().
- tests/worker/dsar.test.ts: submit details/jurisdiction containing
  <script> and <img onerror> payloads and assert the outgoing email html
  contains the escaped forms and not the raw tags.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015EkRWLSbdRZqE9uCeuuQce
Co-authored-by: jackowayed <18899+jackowayed@users.noreply.github.com>
@jackowayed
jackowayed force-pushed the claude/oy-07-dsar-html-escape branch from b82f1f3 to ea79d52 Compare August 11, 2026 16:04
@jackowayed

Copy link
Copy Markdown
Owner Author

phulin#22

@jackowayed jackowayed closed this Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants