Skip to content

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

Address greptile comments

Carlos Monastyrskib41d5b3c103a
diff --git a/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts b/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts
index f47524e7f8..90d2b813ad 100644
--- a/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts
+++ b/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts
@@ -204,7 +204,7 @@ export const internalCertificateAuthorityServiceFactory = ({
// if undefined, set [notAfterDate] to 10 years from now
let notAfterDate: Date | undefined;
if (notAfter) {
- notAfterDate = new Date(new Date().setFullYear(new Date().getFullYear() + 10));
+ notAfterDate = new Date(notAfter);
}
const serialNumber = createSerialNumber();
@@ -1202,7 +1202,7 @@ export const internalCertificateAuthorityServiceFactory = ({
actorId: string;
actorAuthMethod: ActorAuthMethod;
actor: ActorType;
- actorOrgId: string | undefined;
+ actorOrgId: string;
tx?: Knex.Transaction;
}) => {
const intermediateCa = await certificateAuthorityDAL.findByIdWithAssociatedCa(caId, tx);
@@ -1225,6 +1225,11 @@ export const internalCertificateAuthorityServiceFactory = ({
subject(ProjectPermissionSub.CertificateAuthorities, { name: intermediateCa.name })
);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionCertificateAuthorityActions.Create,
+ subject(ProjectPermissionSub.CertificateAuthorities, { name: parentCa.name })
+ );
+
const caSecret = await certificateAuthoritySecretDAL.findOne(
{
caId: intermediateCa.id
@@ -1290,7 +1295,7 @@ export const internalCertificateAuthorityServiceFactory = ({
actorId,
actorAuthMethod,
actor,
- actorOrgId: actorOrgId!
+ actorOrgId
});
await importCertToCa({
@@ -1300,7 +1305,7 @@ export const internalCertificateAuthorityServiceFactory = ({
actorId,
actorAuthMethod,
actor,
- actorOrgId: actorOrgId!
+ actorOrgId
});
return {
diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaGenerateRootCertModal.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaGenerateRootCertModal.tsx
index 6fecf6e8fc..811b7c665b 100644
--- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaGenerateRootCertModal.tsx
+++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaGenerateRootCertModal.tsx
@@ -82,7 +82,7 @@ export const CaGenerateRootCertModal = ({ popUp, handlePopUpToggle }: Props) =>
caId: popUpData.caId,
notBefore: now,
notAfter,
- maxPathLength: maxPathLength !== "-1" ? Number(maxPathLength) : undefined
+ maxPathLength: maxPathLength ? Number(maxPathLength) : undefined
});
handlePopUpToggle("generateRootCaCert", false);