Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Fix unit test and lint issue

Carlos Monastyrski6f5554710c8f
diff --git a/backend/src/services/certificate-est-v3/certificate-est-v3-service.test.ts b/backend/src/services/certificate-est-v3/certificate-est-v3-service.test.ts
index 6f483f7b7d..38e60740c6 100644
--- a/backend/src/services/certificate-est-v3/certificate-est-v3-service.test.ts
+++ b/backend/src/services/certificate-est-v3/certificate-est-v3-service.test.ts
@@ -78,41 +78,6 @@ vi.mock("@app/services/certificate-authority/certificate-authority-validators",
})
}));
-vi.mock("@app/services/certificate-common/certificate-constants", () => ({
- mapLegacyKeyUsageToStandard: vi.fn((usage: string) => {
- const mapping: Record<string, string> = {
- digitalSignature: "digital_signature",
- keyEncipherment: "key_encipherment",
- keyCertSign: "key_cert_sign"
- };
- return mapping[usage] || usage;
- }),
- mapLegacyExtendedKeyUsageToStandard: vi.fn((usage: string) => {
- const mapping: Record<string, string> = {
- clientAuth: "client_auth",
- serverAuth: "server_auth",
- codeSigning: "code_signing"
- };
- return mapping[usage] || usage;
- }),
- CertKeyUsageType: {
- DIGITAL_SIGNATURE: "digital_signature",
- KEY_ENCIPHERMENT: "key_encipherment",
- KEY_CERT_SIGN: "key_cert_sign"
- },
- CertExtendedKeyUsageType: {
- CLIENT_AUTH: "client_auth",
- SERVER_AUTH: "server_auth",
- CODE_SIGNING: "code_signing"
- },
- CertSubjectAlternativeNameType: {
- DNS_NAME: "dns_name",
- IP_ADDRESS: "ip_address",
- RFC822_NAME: "rfc822_name",
- UNIFORM_RESOURCE_IDENTIFIER: "uniform_resource_identifier"
- }
-}));
-
vi.mock("@app/services/certificate/certificate-types", () => ({
mapLegacyAltNameType: vi.fn((type: string) => {
const mapping: Record<string, string> = {
diff --git a/backend/src/services/certificate-v3/certificate-v3-service.ts b/backend/src/services/certificate-v3/certificate-v3-service.ts
index 9b8f525ea4..b6f376b77e 100644
--- a/backend/src/services/certificate-v3/certificate-v3-service.ts
+++ b/backend/src/services/certificate-v3/certificate-v3-service.ts
@@ -1059,7 +1059,7 @@ export const certificateV3ServiceFactory = ({
if (shouldIssueAsCA && policyIsCAState === CertPolicyState.DENIED) {
throw new BadRequestError({
message:
- "CA certificate issuance is not allowed by this policy. The policy's basicConstraints must be set to 'allowed' or 'required'."
+ "CA certificate issuance is not allowed by this policy. The policy's CA:true basicConstraints must be set to 'allowed' or 'required'."
});
}
@@ -1259,7 +1259,7 @@ export const certificateV3ServiceFactory = ({
if (shouldIssueAsCA && policyIsCAState === CertPolicyState.DENIED) {
throw new BadRequestError({
message:
- "CA certificate issuance is not allowed by this policy. The policy's basicConstraints must be set to 'allowed' or 'required'."
+ "CA certificate issuance is not allowed by this policy. The policy's CA:true basicConstraints must be set to 'allowed' or 'required'."
});
}
diff --git a/frontend/src/hooks/api/index.tsx b/frontend/src/hooks/api/index.tsx
index a88afe0e51..03dd7d94b3 100644
--- a/frontend/src/hooks/api/index.tsx
+++ b/frontend/src/hooks/api/index.tsx
@@ -13,8 +13,8 @@ export * from "./auditLogStreams";
export * from "./auth";
export * from "./bots";
export * from "./ca";
-export * from "./certificates";
export * from "./certificatePolicies";
+export * from "./certificates";
export * from "./certificateTemplates";
export * from "./dynamicSecret";
export * from "./dynamicSecretLease";
diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx
index be5ca5959d..effe35f21c 100644
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx
@@ -22,6 +22,7 @@ import {
import { useProject } from "@app/context";
import { CaType } from "@app/hooks/api/ca/enums";
import { useGetAzureAdcsTemplates, useListCasByProjectId } from "@app/hooks/api/ca/queries";
+import { useListCertificatePolicies } from "@app/hooks/api/certificatePolicies";
import {
EnrollmentType,
IssuerType,
@@ -31,7 +32,6 @@ import {
useCreateCertificateProfile,
useUpdateCertificateProfile
} from "@app/hooks/api/certificateProfiles";
-import { useListCertificatePolicies } from "@app/hooks/api/certificatePolicies";
const createSchema = z
.object({
diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
index f1ca503f95..55ab64ffe6 100644
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
@@ -31,8 +31,8 @@ import {
} from "@app/context/ProjectPermissionContext/types";
import { usePopUp, useToggle } from "@app/hooks";
import { useGetInternalCaById } from "@app/hooks/api/ca/queries";
-import { IssuerType, TCertificateProfile } from "@app/hooks/api/certificateProfiles";
import { useGetCertificatePolicyById } from "@app/hooks/api/certificatePolicies";
+import { IssuerType, TCertificateProfile } from "@app/hooks/api/certificateProfiles";
import { CertificateIssuanceModal } from "@app/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal";
interface Props {