Skip to content

Escape DSAR request fields in the staff HTML email (OY-07) - #22

Merged
phulin merged 1 commit into
phulin:mainfrom
jackowayed:claude/oy-07-dsar-html-escape
Aug 16, 2026
Merged

phulin merged 1 commit into
phulin:mainfrom
jackowayed:claude/oy-07-dsar-html-escape

Conversation

@jackowayed

Copy link
Copy Markdown
Contributor

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 payloads and assert the outgoing email html contains the escaped forms and not the raw tags.

This finding was OY-07 in the ID scheme my audit session came up with :P

Claude-Session: https://claude.ai/code/session_015EkRWLSbdRZqE9uCeuuQce

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>
@phulin
phulin merged commit f79d2bd into phulin:main Aug 16, 2026
1 check passed
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.

3 participants