Initial review findings:
-
[P1] Do not build emailed claim links from request-controlled origin
server/lib/tuist_web/controllers/agent_auth_controller.ex:74and:168deriveclaim_view_urlfromRequestOrigin.from_conn(conn), which trustsX-Forwarded-Host/Host. A caller can start email auth for a victim, set the forwarded host to an attacker domain, receive theclaim_token, and cause Tuist to email a claim-view link containing the secretclaim_view_tokento that attacker-controlled origin. If the user clicks it, the attacker can recover the OTP and complete the claim. Please use a canonical configured app URL, or validate the derived host against an allowlist before embedding secret tokens in outbound email links. -
[P2] Return a 400 for invalid claim email instead of raising
server/lib/tuist_web/controllers/agent_auth_controller.ex:168does not handle{:error, :invalid_email}fromAccounts.resend_agent_registration_claim/1. Missing or malformedemailon/agent/auth/claimfalls through thewithelseand raises instead of returning a client error. Add aninvalid_emailbranch and a controller test for anonymous/email-required claim with bad email.