File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
indexer/services/comlink/src Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,7 @@ export const configSchema = {
120120 TURNKEY_API_SENDER_PRIVATE_KEY : parseString ( { default : '' } ) ,
121121 TURNKEY_API_SENDER_PUBLIC_KEY : parseString ( { default : '' } ) ,
122122 TURNKEY_MAGIC_LINK_TEMPLATE : parseString ( { default : '' } ) ,
123+ TURNKEY_MAGIC_LINK_VALIDATION : parseString ( { default : 'https://dydx.trade' } ) ,
123124 TURNKEY_ORGANIZATION_ID : parseString ( { default : '' } ) ,
124125 SOLANA_SPONSOR_PUBLIC_KEY : parseString ( { default : '' } ) ,
125126 SKIP_SLIPPAGE_TOLERANCE_PERCENTAGE : parseString ( { default : '0' } ) ,
Original file line number Diff line number Diff line change @@ -167,6 +167,12 @@ export class TurnkeyController extends Controller {
167167 if ( ! userEmail || ! targetPublicKey ) {
168168 throw new Error ( 'userEmail and targetPublicKey are required for email signin' ) ;
169169 }
170+ if ( magicLink ) {
171+ const isValidMagicLink = magicLink . startsWith ( config . TURNKEY_MAGIC_LINK_VALIDATION ) ;
172+ if ( ! isValidMagicLink ) {
173+ throw new Error ( 'Invalid magic link template' ) ;
174+ }
175+ }
170176 try {
171177 const resp = await this . turnkeyHelpers . emailSignin ( userEmail , targetPublicKey ! , magicLink ) ;
172178 if ( resp . userId === undefined || resp . apiKeyId === undefined ) {
@@ -229,7 +235,7 @@ export class TurnkeyController extends Controller {
229235
230236 // Validate Apple configuration
231237 if ( ! config . APPLE_TEAM_ID || ! config . APPLE_SERVICE_ID ||
232- ! config . APPLE_KEY_ID || ! config . APPLE_PRIVATE_KEY ) {
238+ ! config . APPLE_KEY_ID || ! config . APPLE_PRIVATE_KEY ) {
233239 throw new TurnkeyError ( 'Apple Sign-In configuration is incomplete' ) ;
234240 }
235241
You can’t perform that action at this time.
0 commit comments