Conversation
There was a problem hiding this comment.
2 issues found across 7 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="server/src/libs/resend.ts">
<violation number="1" location="server/src/libs/resend.ts:3">
P2: Validate `RESEND_API_KEY` before constructing the Resend client to avoid creating a misconfigured singleton.</violation>
</file>
<file name="server/src/modules/invitation/invitationActions.ts">
<violation number="1" location="server/src/modules/invitation/invitationActions.ts:122">
P1: User-provided `message` is interpolated into HTML without escaping, enabling HTML injection in invitation emails.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
2 issues found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="server/src/modules/invitation/invitationActions.ts">
<violation number="1" location="server/src/modules/invitation/invitationActions.ts:122">
P2: `message` is not type-validated before calling `escapeHtml`, so non-string payloads can trigger a runtime `.replace is not a function` error.</violation>
<violation number="2" location="server/src/modules/invitation/invitationActions.ts:140">
P1: Throwing on email send failure after creating the invitation causes write-success/request-failure inconsistency and can lead to duplicate invitations on client retries.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| .replace(/"/g, """) | ||
| .replace(/'/g, "'"); | ||
|
|
||
| const safeMessage = escapeHtml(message); |
There was a problem hiding this comment.
P2: message is not type-validated before calling escapeHtml, so non-string payloads can trigger a runtime .replace is not a function error.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At server/src/modules/invitation/invitationActions.ts, line 122:
<comment>`message` is not type-validated before calling `escapeHtml`, so non-string payloads can trigger a runtime `.replace is not a function` error.</comment>
<file context>
@@ -110,27 +110,34 @@ const add: RequestHandler = async (req, res, next) => {
+ .replace(/"/g, """)
+ .replace(/'/g, "'");
+
+ const safeMessage = escapeHtml(message);
const { data, error } = await resend.emails.send({
</file context>
Suggested change
| const safeMessage = escapeHtml(message); | |
| const safeMessage = escapeHtml(typeof message === "string" ? message : String(message ?? "")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by cubic
Send trip invitation emails via
resendwith HTML-escaped messages, and improve the invitation UI with an optional link copy and better loading states.New Features
resendto email invitation links with an optional message; validatesRESEND_API_KEYat boot and escapes message HTML.Migration
.env: RESEND_API_KEY and RESEND_FROM (e.g., "Your Name name@domain.com").resend.Written for commit 5b614d3. Summary will update on new commits.