summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/validateCertificatePath.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2020-07-07 16:15:53 -0700
committerMatthew Miller <matthew@millerti.me>2020-07-07 16:15:53 -0700
commit24955f56d61871531bee2d4c9618a305550bc963 (patch)
treeeed7a093d5d6cbefa0bc543b07ca51a68896f4c0 /packages/server/src/helpers/validateCertificatePath.ts
parentafd7ed9012f89d40f4d6fdcf4d500bf0f87c88e9 (diff)
Fix issue with potential cache miss
Diffstat (limited to 'packages/server/src/helpers/validateCertificatePath.ts')
-rw-r--r--packages/server/src/helpers/validateCertificatePath.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/packages/server/src/helpers/validateCertificatePath.ts b/packages/server/src/helpers/validateCertificatePath.ts
index 64422b0..1dd8c04 100644
--- a/packages/server/src/helpers/validateCertificatePath.ts
+++ b/packages/server/src/helpers/validateCertificatePath.ts
@@ -94,10 +94,13 @@ async function isCertRevoked(cert: X509): Promise<boolean> {
const certAuthKeyID = cert.getExtAuthorityKeyIdentifier();
if (certAuthKeyID) {
const cached = cacheRevokedCerts[certAuthKeyID.kid];
- const now = new Date();
- // If there's a nextUpdate then make sure we're before it
- if (!cached.nextUpdate || cached.nextUpdate > now) {
- return cached.revokedCerts.indexOf(certSerialHex) >= 0;
+ if (cached) {
+ console.log(`Found cached info for CA ID ${certAuthKeyID}`, cached);
+ const now = new Date();
+ // If there's a nextUpdate then make sure we're before it
+ if (!cached.nextUpdate || cached.nextUpdate > now) {
+ return cached.revokedCerts.indexOf(certSerialHex) >= 0;
+ }
}
}