diff options
| author | Joe Carstairs <65492573+Sycamost@users.noreply.github.com> | 2023-12-24 22:31:18 +0000 |
|---|---|---|
| committer | Joe Carstairs <jcarstairs@scottlogic.com> | 2024-01-29 10:46:51 +0000 |
| commit | 7e5fd083800f4c029853dc8ca1f749342deaff31 (patch) | |
| tree | 6d32defcd4fdee33904c6f4499731ea9fda4fbab /api/auth/_verifyRegistrationResponse.ts | |
| parent | d1513b8b83dd4d007e400b0cf6f7f227baced23c (diff) | |
Sets expected origin correctly when verifying registration response (#56)
Diffstat (limited to 'api/auth/_verifyRegistrationResponse.ts')
| -rw-r--r-- | api/auth/_verifyRegistrationResponse.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/api/auth/_verifyRegistrationResponse.ts b/api/auth/_verifyRegistrationResponse.ts index 79b7736..99be2bb 100644 --- a/api/auth/_verifyRegistrationResponse.ts +++ b/api/auth/_verifyRegistrationResponse.ts @@ -6,6 +6,7 @@ import { verifyRegistrationResponse as innerVerifyRegistrationResponse } from '@ import RELYING_PARTY from './_relyingParty'; import addAuthenticator from '../db/_addAuthenticator'; import addUser from '../db/_addUser'; +import env from '../_env'; /** * Verifies the registration response returned by @simplewebauthn/browser's @@ -24,7 +25,9 @@ export default async function verifyRegistrationResponse( const verification = await innerVerifyRegistrationResponse({ response: registrationResponse, expectedChallenge, - expectedOrigin: origin, + expectedOrigin: env.ENVIRONMENT === 'dev' + ? 'https://scotsleidassocie.org' + : 'https://staging.scotsleidassocie.org', expectedRPID: RELYING_PARTY.id, }).catch((err) => { throw new Error('Registration response verification failed.', err); |
