From 58963b8185665b5c206a223d9ea9e8dd173c2a38 Mon Sep 17 00:00:00 2001 From: Fang-Pen Lin Date: Wed, 12 Nov 2025 23:37:36 -0800 Subject: [PATCH] Lint --- .../ee/services/pki-acme/pki-acme-service.ts | 59 +++++++++---------- .../src/server/routes/v1/bdd-nock-router.ts | 4 +- .../acme/acme-certificate-authority-fns.ts | 4 +- 3 files changed, 31 insertions(+), 36 deletions(-) diff --git a/backend/src/ee/services/pki-acme/pki-acme-service.ts b/backend/src/ee/services/pki-acme/pki-acme-service.ts index 76277c0bd..c0031e0ff 100644 --- a/backend/src/ee/services/pki-acme/pki-acme-service.ts +++ b/backend/src/ee/services/pki-acme/pki-acme-service.ts @@ -687,7 +687,7 @@ export const pkiAcmeServiceFactory = ({ const csrIdentifierValues = new Set( (certificateRequest.subjectAlternativeNames ?? []) .map((san) => san.value.toLowerCase()) - .concat([certificateRequest.commonName!.toLowerCase()]) + .concat([certificateRequest.commonName.toLowerCase()]) ); if ( csrIdentifierValues.size !== orderWithAuthorizations.authorizations.length || @@ -727,38 +727,33 @@ export const pkiAcmeServiceFactory = ({ enrollmentType: EnrollmentType.ACME }); return { certificateId: result.certificateId }; - } else { - const { certificateAuthority } = (await certificateProfileDAL.findByIdWithConfigs(profileId, tx))!; - // TODO: for internal CA, we rely on the internal certificate authority service to check CSR against the template - // we should check the CSR against the template here - // TODO: this is pretty slow, and we are holding the transaction open for a long time, - // we should queue the certificate issuance to a background job instead - const cert = await orderCertificate( - { - caId: certificateAuthority!.id, - commonName: certificateRequest.commonName!, - altNames: certificateRequest.subjectAlternativeNames?.map((san) => san.value), - // TODO: not 100% sure what are these columns for, but let's put the values for common website SSL certs for now - keyUsages: [ - CertKeyUsage.DIGITAL_SIGNATURE, - CertKeyUsage.KEY_ENCIPHERMENT, - CertKeyUsage.KEY_AGREEMENT - ], - extendedKeyUsages: [CertExtendedKeyUsage.SERVER_AUTH] - }, - { - appConnectionDAL, - certificateAuthorityDAL, - externalCertificateAuthorityDAL, - certificateDAL, - certificateBodyDAL, - certificateSecretDAL, - kmsService, - projectDAL - } - ); - return { certificateId: cert.id }; } + const { certificateAuthority } = (await certificateProfileDAL.findByIdWithConfigs(profileId, tx))!; + // TODO: for internal CA, we rely on the internal certificate authority service to check CSR against the template + // we should check the CSR against the template here + // TODO: this is pretty slow, and we are holding the transaction open for a long time, + // we should queue the certificate issuance to a background job instead + const cert = await orderCertificate( + { + caId: certificateAuthority!.id, + commonName: certificateRequest.commonName!, + altNames: certificateRequest.subjectAlternativeNames?.map((san) => san.value), + // TODO: not 100% sure what are these columns for, but let's put the values for common website SSL certs for now + keyUsages: [CertKeyUsage.DIGITAL_SIGNATURE, CertKeyUsage.KEY_ENCIPHERMENT, CertKeyUsage.KEY_AGREEMENT], + extendedKeyUsages: [CertExtendedKeyUsage.SERVER_AUTH] + }, + { + appConnectionDAL, + certificateAuthorityDAL, + externalCertificateAuthorityDAL, + certificateDAL, + certificateBodyDAL, + certificateSecretDAL, + kmsService, + projectDAL + } + ); + return { certificateId: cert.id }; })(); await acmeOrderDAL.updateById( orderId, diff --git a/backend/src/server/routes/v1/bdd-nock-router.ts b/backend/src/server/routes/v1/bdd-nock-router.ts index b5b2aa448..4faaf53d8 100644 --- a/backend/src/server/routes/v1/bdd-nock-router.ts +++ b/backend/src/server/routes/v1/bdd-nock-router.ts @@ -61,7 +61,7 @@ export const registerBddNockRouter = async (server: FastifyZodProvider) => { } }, onRequest: verifyAuth([AuthMode.JWT]), - handler: async (req) => { + handler: async () => { checkIfBddNockApiEnabled(); logger.info("Cleaning all nocks"); nock.cleanAll(); @@ -78,7 +78,7 @@ export const registerBddNockRouter = async (server: FastifyZodProvider) => { } }, onRequest: verifyAuth([AuthMode.JWT]), - handler: async (req) => { + handler: async () => { checkIfBddNockApiEnabled(); logger.info("Restore network requests from nock"); nock.restore(); diff --git a/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts b/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts index ecbf5ddbb..ff06afde9 100644 --- a/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts +++ b/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts @@ -337,8 +337,8 @@ export const orderCertificate = async ( serialNumber: certObj.serialNumber, notBefore: certObj.notBefore, notAfter: certObj.notAfter, - keyUsages: keyUsages, - extendedKeyUsages: extendedKeyUsages, + keyUsages, + extendedKeyUsages, projectId: ca.projectId }, innerTx