Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
logger.error(
`Internal Chrome TLS verification failed. Hostname: ${hostname}. Verification result: ${verificationResult}. Error code: ${errorCode}`,
);
const isCommonCertificateError =
errorCode === CertificateVerifyProcManager.CHROMIUM_ERRORS.CERT_COMMON_NAME_INVALID ||
errorCode === CertificateVerifyProcManager.CHROMIUM_ERRORS.CERT_AUTHORITY_INVALID;
if (isCommonCertificateError) {
await CertificateVerifyProcManager.displayCertificateChromiumError(hostname, certificate);
}
return cb(-2);
}
// Check certificate pinning
if (certificateUtils.hostnameShouldBePinned(hostname) && CertificateVerifyProcManager.isCertificatePinningEnabled()) {
const pinningResults = certificateUtils.verifyPinning(hostname, certificate);
const falsyValue = Object.values(pinningResults).some(val => val === false);
if (falsyValue || pinningResults.errorMessage) {
logger.error(`Certificate verification failed for "${hostname}".`);
logger.error(`Error: "${pinningResults.errorMessage}". Displaying certificate pinning error dialog.`);
await CertificateVerifyProcManager.displayCertificateError(hostname, certificate);
return cb(-2);
}
}
return cb(-3);
};
`Internal Chrome TLS verification failed. Hostname: ${hostname}. Verification result: ${verificationResult}. Error code: ${errorCode}`,
);
const isCommonCertificateError =
errorCode === CertificateVerifyProcManager.CHROMIUM_ERRORS.CERT_COMMON_NAME_INVALID ||
errorCode === CertificateVerifyProcManager.CHROMIUM_ERRORS.CERT_AUTHORITY_INVALID;
if (isCommonCertificateError) {
await CertificateVerifyProcManager.displayCertificateChromiumError(hostname, certificate);
}
return cb(-2);
}
// Check certificate pinning
if (certificateUtils.hostnameShouldBePinned(hostname) && CertificateVerifyProcManager.isCertificatePinningEnabled()) {
const pinningResults = certificateUtils.verifyPinning(hostname, certificate);
const falsyValue = Object.values(pinningResults).some(val => val === false);
if (falsyValue || pinningResults.errorMessage) {
logger.error(`Certificate verification failed for "${hostname}".`);
logger.error(`Error: "${pinningResults.errorMessage}". Displaying certificate pinning error dialog.`);
await CertificateVerifyProcManager.displayCertificateError(hostname, certificate);
return cb(-2);
}
}
return cb(-3);
};