feat: completed reptile reviews

This commit is contained in:
=
2025-05-30 17:53:22 +00:00
committed by Akhil Mohan
parent d31d28666a
commit 86348eb434
5 changed files with 14 additions and 4 deletions
@@ -281,7 +281,7 @@ export const registerPkiTemplatesRouter = async (server: FastifyZodProvider) =>
body: z.object({ body: z.object({
projectId: z.string(), projectId: z.string(),
ttl: z.string().refine((val) => ms(val) > 0, "TTL must be a positive number"), ttl: z.string().refine((val) => ms(val) > 0, "TTL must be a positive number"),
csr: z.string().trim().min(1) csr: z.string().trim().min(1).max(4096)
}), }),
response: { response: {
200: z.object({ 200: z.object({
@@ -490,7 +490,7 @@ export const InternalCertificateAuthorityFns = ({
notBefore: notBeforeDate, notBefore: notBeforeDate,
notAfter: notAfterDate, notAfter: notAfterDate,
keyUsages: selectedKeyUsages, keyUsages: selectedKeyUsages,
extendedKeyUsages: extendedKeyUsages as CertExtendedKeyUsage[], extendedKeyUsages: selectedExtendedKeyUsages,
projectId: ca.projectId, projectId: ca.projectId,
certificateTemplateId: certificateTemplate.id certificateTemplateId: certificateTemplate.id
}, },
@@ -120,6 +120,11 @@ export const pkiTemplatesServiceFactory = ({
subject(ProjectPermissionSub.CertificateTemplates, { name }) subject(ProjectPermissionSub.CertificateTemplates, { name })
); );
const existingTemplate = await pkiTemplatesDAL.findOne({ name, projectId: ca.projectId });
if (existingTemplate) {
throw new BadRequestError({ message: `Template with name ${name} already exists.` });
}
const newTemplate = await pkiTemplatesDAL.create({ const newTemplate = await pkiTemplatesDAL.create({
caId, caId,
name, name,
@@ -182,6 +187,11 @@ export const pkiTemplatesServiceFactory = ({
ProjectPermissionPkiTemplateActions.Edit, ProjectPermissionPkiTemplateActions.Edit,
subject(ProjectPermissionSub.CertificateTemplates, { name }) subject(ProjectPermissionSub.CertificateTemplates, { name })
); );
const existingTemplate = await pkiTemplatesDAL.findOne({ name, projectId });
if (existingTemplate && existingTemplate.id !== certTemplate.id) {
throw new BadRequestError({ message: `Template with name ${name} already exists.` });
}
} }
const updatedTemplate = await pkiTemplatesDAL.updateById(certTemplate.id, { const updatedTemplate = await pkiTemplatesDAL.updateById(certTemplate.id, {
@@ -21,7 +21,7 @@ A typical workflow for using the Infisical PKI Issuer to issue certificates for
3. Installing `cert-manager` into your Kubernetes cluster. 3. Installing `cert-manager` into your Kubernetes cluster.
4. Installing the Infisical PKI Issuer controller into your Kubernetes cluster. 4. Installing the Infisical PKI Issuer controller into your Kubernetes cluster.
5. Creating an `Issuer` or `ClusterIssuer` resource in your Kubernetes cluster to represent the Infisical PKI issuer you wish to use. 5. Creating an `Issuer` or `ClusterIssuer` resource in your Kubernetes cluster to represent the Infisical PKI issuer you wish to use.
6. Create an the approver policy to accept certificate request. 6. Create the approver policy to accept certificate request.
7. Creating a `Certificate` resource in your Kubernetes cluster to represent a certificate you wish to issue. As part of this step, you specify the Kubernetes `Secret` to create and store the issued certificate and private key. 7. Creating a `Certificate` resource in your Kubernetes cluster to represent a certificate you wish to issue. As part of this step, you specify the Kubernetes `Secret` to create and store the issued certificate and private key.
8. Consuming the issued certificate across your Kubernetes resources from the specified Kubernetes `Secret`. 8. Consuming the issued certificate across your Kubernetes resources from the specified Kubernetes `Secret`.
@@ -132,7 +132,7 @@ export const PkiTemplatePermissionConditions = ({ position = 0, isDisabled }: Pr
</div> </div>
<div> <div>
<IconButton <IconButton
ariaLabel="plus" ariaLabel="delete"
variant="outline_bg" variant="outline_bg"
className="p-2.5" className="p-2.5"
onClick={() => items.remove(index)} onClick={() => items.remove(index)}