Skip to content

Add notification email provider HTML/text injection and header-sanitization tests in src/tests/email.injection.test.ts #738

Description

@1nonlypiece

📌 Description

src/services/notifications/email.provider.ts composes outbound email. If
user-controlled fields (vault title, org name) flow into headers or HTML bodies
unsanitized, the system is exposed to header injection (CRLF) and HTML/script
injection. Existing provider tests do not cover injection.

This issue adds header- and content-injection sanitization tests for the email
provider.

Goal: prove user-controlled email fields cannot inject headers or unsafe
HTML into outbound mail.

🎯 Requirements and Context

  • Must assert CRLF in subject/recipient is stripped/rejected.
  • Must assert HTML in dynamic fields is escaped in the HTML body.
  • Must cover a benign field rendering correctly.
  • Must run with bun test.

🛠️ Suggested Execution

1. Fork the repo and create a branch

git checkout -b test/email-injection-guards

2. Implement changes

  • Add src/tests/email.injection.test.ts; add minimal sanitization in
    email.provider.ts if missing.

3. Test and commit

  • Run with bun test.
  • Cover edge cases: CRLF header, HTML body, script tag, benign content.

Example commit message

test: email provider header and HTML injection guards

✅ Guidelines

  • Minimum 95% test coverage on the new/changed lines.
  • Clear, reviewer-friendly documentation.
  • No regressions on existing email delivery.
  • Timeframe: 96 hours.

🏷️ Labels

type-testing · type-security · area-backend · MAYBE REWARDED · GRANTFOX OSS · OFFICIAL CAMPAIGN

💬 Community & Support

  • Join the Disciplr contributor Discord to coordinate, ask questions, and get
    unblocked fast: https://discord.gg/xvNAvMJf
  • Please introduce yourself in the channel before you start so we can avoid
    duplicate work, pair you with a reviewer, and get your PR merged quickly.
  • Maintainers actively triage this channel and aim for fast, clear, respectful
    reviews — reach out any time you're blocked.

Metadata

Metadata

Labels

GRANTFOX OSSGrantFox open-source campaignMAYBE REWARDEDEligible for GrantFox rewardOFFICIAL CAMPAIGNOfficial GrantFox campaign issueStellar WaveIssues in the Stellar wave programarea-backendBackend / API worktype-securitySecurity review / hardeningtype-testingTests and test coverage

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions