fix: crypto errors and disable acme

This commit is contained in:
Daniel Hougaard
2025-07-09 13:45:59 +04:00
parent c0b296b86b
commit 419db549ea
3 changed files with 27 additions and 13 deletions

View File

@@ -433,12 +433,9 @@ const cryptographyFactory = () => {
getRandomValues: crypto.getRandomValues,
randomUUID: crypto.randomUUID,
subtle: {
// eslint-disable-next-line @typescript-eslint/unbound-method
generateKey: subtle.generateKey,
// eslint-disable-next-line @typescript-eslint/unbound-method
importKey: subtle.importKey,
// eslint-disable-next-line @typescript-eslint/unbound-method
exportKey: subtle.exportKey
generateKey: subtle.generateKey.bind(subtle),
importKey: subtle.importKey.bind(subtle),
exportKey: subtle.exportKey.bind(subtle)
},
constants: crypto.constants,
X509Certificate: crypto.X509Certificate,

View File

@@ -18,6 +18,7 @@ import {
} from "@app/ee/services/secret-scanning-v2/secret-scanning-v2-types";
import { getConfig } from "@app/lib/config/env";
import { buildRedisFromConfig, TRedisConfigKeys } from "@app/lib/config/redis";
import { crypto } from "@app/lib/crypto";
import { logger } from "@app/lib/logger";
import { QueueWorkerProfile } from "@app/lib/types";
import { CaType } from "@app/services/certificate-authority/certificate-authority-enums";
@@ -438,9 +439,14 @@ export const queueServiceFactory = (
queueContainer[name] = new Queue(name as string, {
...queueSettings,
settings: {
repeatKeyHashAlgorithm: "sha256"
},
...(crypto.isFipsModeEnabled()
? {
settings: {
...queueSettings?.settings,
repeatKeyHashAlgorithm: "sha256"
}
}
: {}),
connection
});
@@ -448,9 +454,14 @@ export const queueServiceFactory = (
if (appCfg.QUEUE_WORKERS_ENABLED && isQueueEnabled(name)) {
workerContainer[name] = new Worker(name, jobFn, {
...queueSettings,
settings: {
repeatKeyHashAlgorithm: "sha256"
},
...(crypto.isFipsModeEnabled()
? {
settings: {
...queueSettings?.settings,
repeatKeyHashAlgorithm: "sha256"
}
}
: {}),
connection
});
}

View File

@@ -5,7 +5,7 @@ import acme from "acme-client";
import { TableName } from "@app/db/schemas";
import { CustomAWSHasher } from "@app/lib/aws/hashing";
import { crypto } from "@app/lib/crypto/cryptography";
import { BadRequestError, NotFoundError } from "@app/lib/errors";
import { BadRequestError, CryptographyError, NotFoundError } from "@app/lib/errors";
import { OrgServiceActor } from "@app/lib/types";
import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";
import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";
@@ -190,6 +190,12 @@ export const AcmeCertificateAuthorityFns = ({
enableDirectIssuance: boolean;
actor: OrgServiceActor;
}) => {
if (crypto.isFipsModeEnabled()) {
throw new CryptographyError({
message: "ACME is currently not supported in FIPS mode of operation."
});
}
const { dnsAppConnectionId, directoryUrl, accountEmail, dnsProviderConfig } = configuration;
const appConnection = await appConnectionDAL.findById(dnsAppConnectionId);