diff --git a/lib/email.ts b/lib/email.ts index 3c9ab41..66db4bb 100644 --- a/lib/email.ts +++ b/lib/email.ts @@ -6,6 +6,9 @@ const RESEND_ENDPOINT = "https://api.resend.com/emails"; +const escapeHtml = (s: string): string => + s.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """); + export function isEmailConfigured(): boolean { return Boolean(process.env.RESEND_API_KEY); } @@ -90,7 +93,7 @@ export function sendWaitlistVerification(opts: {
-

${brand} 🤘

+

${escapeHtml(brand)} 🤘

You're almost in. Confirm your email to lock in your spot in the pit.

@@ -135,10 +138,10 @@ export function sendGithubClosedNotification(opts: {
-

${opts.repo}

+

${escapeHtml(opts.repo)}

${opts.kind} #${opts.number} ${verb} 🤘

-

${opts.title}

-

by ${opts.actor}

+

${escapeHtml(opts.title)}

+

by ${escapeHtml(opts.actor)}

View on GitHub
@@ -167,7 +170,7 @@ export function sendPasswordReset(opts: {
-

${brand} 🤘

+

${escapeHtml(brand)} 🤘

Reset your password. This link expires in 1 hour.