Skip to content

Commit

Permalink
Comment out ipCountry / document country mismatch check
Browse files Browse the repository at this point in the history
  • Loading branch information
calebtuttle committed May 14, 2024
1 parent 8e0714e commit 9b1497f
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 34 deletions.
36 changes: 25 additions & 11 deletions src/services/idenfy/credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,26 @@ function validateSession(metaSession, statusData, verificationData, scanRef) {
};
}
// if !metaSession.ipCountry, then the session was created before we added
// the ipCountry attribute. Because this is only ~3k sessions and to reduce tickets,
// the ipCountry attribute. Because this is only ~3k sessions and to reduce tickets,
// we can ignore this check for such sessions.
if (metaSession.ipCountry && (countryCode != countryCodeToPrime[metaSession.ipCountry])) {
return {
error: `Country code mismatch. Session country is '${metaSession.ipCountry}', but document country is '${country}'. scanRef: ${scanRef}`,
log: {
msg: "Country code mismatch",
data: { expected: countryCodeToPrime[metaSession.ipCountry], got: countryCode },
},
};
}
// NOTE: May 14, 2024: We are disablign the ipCountry check because it seems to be
// turning down honest users while being game-able by sybils.
// if (metaSession.ipCountry && (countryCode != countryCodeToPrime[metaSession.ipCountry])) {
// if (
// metaSession.ipCountry &&
// countryCode != countryCodeToPrime[metaSession.ipCountry]
// ) {
// return {
// error: `Country code mismatch. Session country is '${metaSession.ipCountry}', but document country is '${country}'. scanRef: ${scanRef}`,
// log: {
// msg: "Country code mismatch",
// data: {
// expected: countryCodeToPrime[metaSession.ipCountry],
// got: countryCode,
// },
// },
// };
// }
return { success: true };
}

Expand Down Expand Up @@ -358,7 +367,12 @@ async function getCredentials(req, res) {
return res.status(400).json({ error: "Failed to retrieve iDenfy session." });
}

const validationResult = validateSession(metaSession, statusData, verificationData, scanRef);
const validationResult = validateSession(
metaSession,
statusData,
verificationData,
scanRef
);
if (validationResult.error) {
endpointLogger.error(validationResult.log.data, validationResult.log.msg);
await updateSessionStatus(scanRef, sessionStatusEnum.VERIFICATION_FAILED);
Expand Down
28 changes: 15 additions & 13 deletions src/services/onfido/credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,22 @@ function validateReports(reports, metaSession) {
};
}
// if !metaSession.ipCountry, then the session was created before we added
// the ipCountry attribute. Because this is only ~3k sessions and to reduce tickets,
// the ipCountry attribute. Because this is only ~3k sessions and to reduce tickets,
// we can ignore this check for such sessions.
if (metaSession.ipCountry && (countryCodeToPrime[report.properties.issuing_country] != countryCodeToPrime[metaSession.ipCountry])) {
return {
error: `Country code mismatch. Session country is '${metaSession.ipCountry}', but document country is '${report.properties.issuing_country}'.`,
log: {
msg: "Country code mismatch",
data: {
expected: countryCodeToPrime[metaSession.ipCountry],
got: countryCodeToPrime[report.properties.issuing_country]
},
},
};
}
// NOTE: May 14, 2024: We are disablign the ipCountry check because it seems to be
// turning down honest users while being game-able by sybils.
// if (metaSession.ipCountry && (countryCodeToPrime[report.properties.issuing_country] != countryCodeToPrime[metaSession.ipCountry])) {
// return {
// error: `Country code mismatch. Session country is '${metaSession.ipCountry}', but document country is '${report.properties.issuing_country}'.`,
// log: {
// msg: "Country code mismatch",
// data: {
// expected: countryCodeToPrime[metaSession.ipCountry],
// got: countryCodeToPrime[report.properties.issuing_country]
// },
// },
// };
// }
}
if (report.name === "device_intelligence") {
if (report?.properties?.device?.ip_reputation === "HIGH_RISK") {
Expand Down
22 changes: 12 additions & 10 deletions src/services/veriff/credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,19 @@ function validateSession(session, metaSession) {
};
}
// if !metaSession.ipCountry, then the session was created before we added
// the ipCountry attribute. Because this is only ~3k sessions and to reduce tickets,
// the ipCountry attribute. Because this is only ~3k sessions and to reduce tickets,
// we can ignore this check for such sessions.
if (metaSession.ipCountry && (countryCode != countryCodeToPrime[metaSession.ipCountry])) {
return {
error: `Country code mismatch. Session country is '${metaSession.ipCountry}', but document country is '${session?.verification?.document?.country}'.`,
log: {
msg: "Country code mismatch",
data: { expected: countryCodeToPrime[metaSession.ipCountry], got: countryCode },
},
};
}
// NOTE: May 14, 2024: We are disablign the ipCountry check because it seems to be
// turning down honest users while being game-able by sybils.
// if (metaSession.ipCountry && (countryCode != countryCodeToPrime[metaSession.ipCountry])) {
// return {
// error: `Country code mismatch. Session country is '${metaSession.ipCountry}', but document country is '${session?.verification?.document?.country}'.`,
// log: {
// msg: "Country code mismatch",
// data: { expected: countryCodeToPrime[metaSession.ipCountry], got: countryCode },
// },
// };
// }
return { success: true };
}

Expand Down

0 comments on commit 9b1497f

Please sign in to comment.