Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Merge remote-tracking branch 'origin/main' into PKI-336
Carlos Monastyrski46bd4465cf87
diff --cc frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsxindex 4960ad1d43,3516032b57..6a04cca10f--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx@@@ -572,284 -638,476 +588,296 @@@ export const CertificateIssuanceModal<p className="text-sm text-muted">Common Name: {cert.commonName}</p><p className="text-sm text-muted">Status: {cert.status}</p></div>- ) : (- <form onSubmit={(e) => e.preventDefault()} className="flex min-h-0 flex-1 flex-col">- <div className="flex min-h-0 flex-1 overflow-hidden">- <aside className="flex w-60 shrink-0 flex-col border-r border-border px-5 py-6">- <p className="mb-5 text-[11px] font-medium tracking-wider text-muted uppercase">- Setup steps- </p>- <Stepper- activeStep={step}- orientation="vertical"- onStepChange={(i) => {- if (isSubmitting) return;- if (i < step) setStep(i);- }}- >- <StepperList>- {stepKeys.map((key, i) => (- <StepperStep- key={key}- index={i}- title={STEP_META[key].name}- description={STEP_META[key].shortDescription}- />- ))}- </StepperList>- </Stepper>- </aside>-- <div className="flex min-w-0 flex-1 flex-col gap-y-2 overflow-y-auto px-8 py-6">- <div className="mb-6">- <h2 className="text-lg font-semibold text-foreground">{currentStepMeta.title}</h2>- <p className="mt-1 text-sm text-muted">{currentStepMeta.subtitle}</p>- </div>-- {currentStepKey === "profile" && (- <div className="space-y-5">- <Controller- control={control}- name="requestMethod"- render={({ field: { onChange, value } }) => (- <Field>- <FieldLabel>Request Method</FieldLabel>- <FieldContent>- <Select- value={value}- onValueChange={(val) => onChange(val as RequestMethod)}+ ) : undefined+ }+ >+ {currentStepKey === "profile" && (+ <div className="space-y-5">+ <Controller+ control={control}+ name="requestMethod"+ render={({ field: { onChange, value } }) => (+ <Field>+ <FieldLabel>Request Method</FieldLabel>+ <FieldContent>+ <Select value={value} onValueChange={(val) => onChange(val as RequestMethod)}>+ <SelectTrigger className="w-full">+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ <SelectItem value={RequestMethod.MANAGED}>Managed</SelectItem>+ <SelectItem value={RequestMethod.CSR}>+ Certificate Signing Request (CSR)+ </SelectItem>+ </SelectContent>+ </Select>+ <FieldDescription>+ Managed generates and manages the private key for you. CSR lets you provide your+ own certificate signing request when you need to manage your own private key.+ </FieldDescription>+ </FieldContent>+ </Field>+ )}+ />++ {!profileId && (+ <Controller+ control={control}+ name="profileId"+ render={({ field: { onChange, value }, fieldState: { error } }) => (+ <Field>+ <FieldLabel>+ Certificate Profile <span className="text-danger">*</span>+ </FieldLabel>+ <FieldContent>+ <Select value={value || ""} onValueChange={(val) => onChange(val)}>+ <SelectTrigger className="w-full" isError={Boolean(error)}>+ <SelectValue placeholder="Select a certificate profile" />+ </SelectTrigger>+ <SelectContent position="popper">- {availableProfiles.length === 0 && applicationId ? (++ {profileOptions.length === 0 && applicationId ? (+ <div className="px-3 py-3 text-xs leading-snug whitespace-normal text-muted">- Only profiles with API enrollment configured on this Application are- listed here. Configure API enrollment under this Application's- Settings tab.++ No certificate profiles are attached to this Application. Add one under++ this Application's Settings tab.+ </div>+ ) : (- availableProfiles.map((profile) => (- <SelectItem key={profile.id} value={profile.id}>++ profileOptions.map(({ profile, isApiEnabled }) => (++ <SelectItem++ key={profile.id}++ value={profile.id}++ disabled={!isApiEnabled}++ description={++ isApiEnabled ? undefined : "API enrollment not configured"++ }+ >- <SelectTrigger className="w-full">- <SelectValue />- </SelectTrigger>- <SelectContent position="popper">- <SelectItem value={RequestMethod.MANAGED}>Managed</SelectItem>- <SelectItem value={RequestMethod.CSR}>- Certificate Signing Request (CSR)- </SelectItem>- </SelectContent>- </Select>- <FieldDescription>- Managed generates and manages the private key for you. CSR lets you- provide your own certificate signing request when you need to manage- your own private key.- </FieldDescription>- </FieldContent>- </Field>- )}+ {profile.slug}+ </SelectItem>+ ))+ )}+ </SelectContent>+ </Select>++ {hasDisabledProfiles && (++ <FieldDescription>++ Profiles without API enrollment configured can't be used here.++ Configure API enrollment under this Application's Settings tab.++ </FieldDescription>++ )}+ {isAdcsProfile && <FieldDescription>{externalCaHint}</FieldDescription>}+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>+ )}+ />+ )}+ </div>+ )}++ {currentStepKey !== "profile" && (actualSelectedProfile || profileId) && (+ <div className="space-y-4">+ {currentStepKey === "options" && profileId && isAdcsProfile && (+ <p className="mb-4 text-xs text-mineshaft-400">{externalCaHint}</p>+ )}++ {currentStepKey === "csr" && (+ <Controller+ control={control}+ name="csr"+ render={({ field: { value, ...field }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Certificate Signing Request (CSR) <span className="text-danger">*</span>+ </FieldLabel>+ <TextArea+ {...field}+ value={value ?? ""}+ spellCheck={false}+ isError={Boolean(error)}+ placeholder={+ "-----BEGIN CERTIFICATE REQUEST-----\n" ++ "MIIByDCCAU4CAQAwfjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\n" ++ "FjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xEjAQBgNVBAoMCURlbW8gQ29ycDEUMBIG\n" ++ "A1UECwwLRW5naW5lZXJpbmcxGDAWBgNVBAMMD2FwcC5leGFtcGxlLmNvbTB2MBAG\n" ++ "ByqGSM49AgEGBSuBBAAiA2IABDHV5yengUugeBcpjsw+iAaxSkCr16LMr3ITyvlM\n" ++ "lDv+AE0Ddc6FsFXJicBfTalM3AKl5F14OCBRfI2jugWJOGCLcKYqRDTDevxQmgCI\n" ++ "IfpRM6+jzPkqe0PsuLhYiRfbFKBRME8GCSqGSIb3DQEJDjFCMEAwPgYDVR0RBDcw\n" ++ "NYIPYXBwLmV4YW1wbGUuY29tghEqLmFwcC5leGFtcGxlLmNvbYIJbG9jYWxob3N0\n" ++ "hwR/AAABMAoGCCqGSM49BAMCA2gAMGUCMGQQYs4lTSc3r/5MlabDx4m+sWaAtDhO\n" ++ "17c3TaoDZOMG6r45mgUskPGTripXV9ItTQIxAJypXNlHnMvks7MO4LmicPqku4MF\n" ++ "IeFqqXMFzC9uAO3iQ8/ji6ukvT6a9A3DE9LLIg==\n" ++ "-----END CERTIFICATE REQUEST-----"+ }+ rows={13}+ className="w-full font-mono text-xs"+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ )}++ {currentStepKey === "subject" && constraints.shouldShowSubjectSection && (+ <SubjectAttributesField+ control={control}+ allowedAttributeTypes={constraints.allowedSubjectAttributeTypes}+ error={+ (formState.errors as { subjectAttributes?: { message?: string } }).subjectAttributes+ ?.message+ }+ />+ )}++ {currentStepKey === "subject" && constraints.shouldShowSanSection && (+ <SubjectAltNamesField+ control={control}+ allowedSanTypes={constraints.allowedSanTypes}+ error={+ (formState.errors as { subjectAltNames?: { message?: string } }).subjectAltNames+ ?.message+ }+ />+ )}++ {(currentStepKey === "csr" || currentStepKey === "options") && !isAdcsProfile && (+ <Controller+ control={control}+ name="ttl"+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Time to Live (TTL) <span className="text-danger">*</span>+ </FieldLabel>+ <Input {...field} placeholder="30d, 1y, 8760h" isError={Boolean(error)} />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ )}++ {currentStepKey === "options" && (+ <>+ <AlgorithmSelectors+ control={control}+ availableSignatureAlgorithms={availableSignatureAlgorithms}+ availableKeyAlgorithms={availableKeyAlgorithms}+ hideSignatureAlgorithm={isAdcsProfile}+ signatureError={+ (formState.errors as { signatureAlgorithm?: { message?: string } })+ .signatureAlgorithm?.message+ }+ keyError={+ (formState.errors as { keyAlgorithm?: { message?: string } }).keyAlgorithm+ ?.message+ }+ />++ {!isAdcsProfile && (+ <div className="mt-4 space-y-6">+ <KeyUsageSection+ control={control}+ title="Key Usages"+ namePrefix="keyUsages"+ options={filteredKeyUsages}+ requiredUsages={constraints.requiredKeyUsages}+ />+ <KeyUsageSection+ control={control}+ title="Extended Key Usages"+ namePrefix="extendedKeyUsages"+ options={filteredExtendedKeyUsages}+ requiredUsages={constraints.requiredExtendedKeyUsages}+ />+ {constraints.templateAllowsCA && (+ <BasicConstraintsField+ control={control}+ setValue={setValue}+ isCA={watchedIsCA}+ templateRequiresCA={constraints.templateRequiresCA}+ maxPathLength={isAwsPcaProfile ? AWS_PCA_MAX_CA_PATH_LENGTH : undefined}+ isPathLengthRequired={+ isAwsPcaProfile ||+ (typeof constraints.maxPathLength === "number" &&+ constraints.maxPathLength !== -1)+ }+ idPrefix="issuance"/>-- {!profileId && (+ )}+ </div>+ )}+ </>+ )}++ {currentStepKey === "metadata" && (+ <div>+ <p className="text-sm font-medium text-foreground">Metadata</p>+ {metadataFields.length === 0 ? (+ <Empty className="mt-3 border py-8">+ <EmptyMedia variant="icon">+ <Tags />+ </EmptyMedia>+ <EmptyTitle>No metadata added</EmptyTitle>+ <EmptyContent>+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => appendMetadata({ key: "", value: "" })}+ >+ <Plus className="size-4" /> Add entry+ </Button>+ </EmptyContent>+ </Empty>+ ) : (+ <div className="mt-3 space-y-2">+ {metadataFields.map((metaField, index) => (+ <div key={metaField.id} className="flex items-start gap-2"><Controllercontrol={control}- name="profileId"- render={({ field: { onChange, value }, fieldState: { error } }) => (- <Field>- <FieldLabel>- Certificate Profile <span className="text-danger">*</span>- </FieldLabel>- <FieldContent>- <Select value={value || ""} onValueChange={(val) => onChange(val)}>- <SelectTrigger className="w-full" isError={Boolean(error)}>- <SelectValue placeholder="Select a certificate profile" />- </SelectTrigger>- <SelectContent position="popper">- {profileOptions.length === 0 && applicationId ? (- <div className="px-3 py-3 text-xs leading-snug whitespace-normal text-muted">- No certificate profiles are attached to this Application. Add- one under this Application's Settings tab.- </div>- ) : (- profileOptions.map(({ profile, isApiEnabled }) => (- <SelectItem- key={profile.id}- value={profile.id}- disabled={!isApiEnabled}- description={- isApiEnabled ? undefined : "API enrollment not configured"- }- >- {profile.slug}- </SelectItem>- ))- )}- </SelectContent>- </Select>- {hasDisabledProfiles && (- <FieldDescription>- Profiles without API enrollment configured can't be used- here. Configure API enrollment under this Application's- Settings tab.- </FieldDescription>- )}- {isAdcsProfile && (- <FieldDescription>{externalCaHint}</FieldDescription>- )}- <FieldError errors={[error]} />- </FieldContent>- </Field>+ name={`metadata.${index}.key`}+ render={({ field, fieldState: { error } }) => (+ <Input+ {...field}+ placeholder="Key"+ className="flex-1"+ isError={Boolean(error)}+ />)}/>- )}- </div>- )}-- {currentStepKey !== "profile" && (actualSelectedProfile || profileId) && (- <div className="space-y-4">- {currentStepKey === "options" && profileId && isAdcsProfile && (- <p className="mb-4 text-xs text-mineshaft-400">{externalCaHint}</p>- )}-- {currentStepKey === "csr" && (<Controllercontrol={control}- name="csr"- render={({ field: { value, ...field }, fieldState: { error } }) => (- <Field className="mb-4">- <FieldLabel>- Certificate Signing Request (CSR){" "}- <span className="text-danger">*</span>- </FieldLabel>- <TextArea- {...field}- value={value ?? ""}- spellCheck={false}- isError={Boolean(error)}- placeholder={- "-----BEGIN CERTIFICATE REQUEST-----\n" +- "MIIByDCCAU4CAQAwfjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\n" +- "FjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xEjAQBgNVBAoMCURlbW8gQ29ycDEUMBIG\n" +- "A1UECwwLRW5naW5lZXJpbmcxGDAWBgNVBAMMD2FwcC5leGFtcGxlLmNvbTB2MBAG\n" +- "ByqGSM49AgEGBSuBBAAiA2IABDHV5yengUugeBcpjsw+iAaxSkCr16LMr3ITyvlM\n" +- "lDv+AE0Ddc6FsFXJicBfTalM3AKl5F14OCBRfI2jugWJOGCLcKYqRDTDevxQmgCI\n" +- "IfpRM6+jzPkqe0PsuLhYiRfbFKBRME8GCSqGSIb3DQEJDjFCMEAwPgYDVR0RBDcw\n" +- "NYIPYXBwLmV4YW1wbGUuY29tghEqLmFwcC5leGFtcGxlLmNvbYIJbG9jYWxob3N0\n" +- "hwR/AAABMAoGCCqGSM49BAMCA2gAMGUCMGQQYs4lTSc3r/5MlabDx4m+sWaAtDhO\n" +- "17c3TaoDZOMG6r45mgUskPGTripXV9ItTQIxAJypXNlHnMvks7MO4LmicPqku4MF\n" +- "IeFqqXMFzC9uAO3iQ8/ji6ukvT6a9A3DE9LLIg==\n" +- "-----END CERTIFICATE REQUEST-----"- }- rows={13}- className="w-full font-mono text-xs"- />- <FieldError errors={[error]} />- </Field>+ name={`metadata.${index}.value`}+ render={({ field }) => (+ <Input+ {...field}+ value={field.value ?? ""}+ placeholder="Value (optional)"+ className="flex-1"+ />)}/>- )}-- {currentStepKey === "subject" && constraints.shouldShowSubjectSection && (- <SubjectAttributesField- control={control}- allowedAttributeTypes={constraints.allowedSubjectAttributeTypes}- error={- (formState.errors as { subjectAttributes?: { message?: string } })- .subjectAttributes?.message- }- />- )}-- {currentStepKey === "subject" && constraints.shouldShowSanSection && (- <SubjectAltNamesField- control={control}- allowedSanTypes={constraints.allowedSanTypes}- error={- (formState.errors as { subjectAltNames?: { message?: string } })- .subjectAltNames?.message- }- />- )}-- {(currentStepKey === "csr" || currentStepKey === "options") &&- !isAdcsProfile && (- <Controller- control={control}- name="ttl"- render={({ field, fieldState: { error } }) => (- <Field className="mb-4">- <FieldLabel>- Time to Live (TTL) <span className="text-danger">*</span>- </FieldLabel>- <Input- {...field}- placeholder="30d, 1y, 8760h"- isError={Boolean(error)}- />- <FieldError errors={[error]} />- </Field>- )}- />- )}-- {currentStepKey === "options" && (- <>- <AlgorithmSelectors- control={control}- availableSignatureAlgorithms={availableSignatureAlgorithms}- availableKeyAlgorithms={availableKeyAlgorithms}- hideSignatureAlgorithm={isAdcsProfile}- signatureError={- (formState.errors as { signatureAlgorithm?: { message?: string } })- .signatureAlgorithm?.message- }- keyError={- (formState.errors as { keyAlgorithm?: { message?: string } })- .keyAlgorithm?.message- }- />-- {!isAdcsProfile && (- <div className="mt-4 space-y-6">- <KeyUsageSection- control={control}- title="Key Usages"- namePrefix="keyUsages"- options={filteredKeyUsages}- requiredUsages={constraints.requiredKeyUsages}- />- <KeyUsageSection- control={control}- title="Extended Key Usages"- namePrefix="extendedKeyUsages"- options={filteredExtendedKeyUsages}- requiredUsages={constraints.requiredExtendedKeyUsages}- />- {constraints.templateAllowsCA && (- <div>- <p className="text-sm font-medium text-foreground">- Basic Constraints- </p>- <div className="mt-4 space-y-4">- <Controller- control={control}- name="basicConstraints.isCA"- render={({ field: { value, onChange } }) => (- <div className="flex items-start gap-3">- <Checkbox- id="isCA"- variant="project"- isChecked={- constraints.templateRequiresCA || value || false- }- isDisabled={constraints.templateRequiresCA}- onCheckedChange={(checked) => {- if (!constraints.templateRequiresCA) {- onChange(checked);- if (!checked) {- setValue("basicConstraints.pathLength", null);- }- }- }}- />- <span className="text-sm text-foreground">- Issue as Certificate Authority- <span className="mt-1 block text-xs text-muted">- This certificate will be issued with the CA:TRUE- extension.- </span>- </span>- </div>- )}- />-- {watchedIsCA && (- <Controller- control={control}- name="basicConstraints.pathLength"- render={({ field, fieldState: { error } }) => {- const isPathLengthRequired =- isAwsPcaProfile ||- (typeof constraints.maxPathLength === "number" &&- constraints.maxPathLength !== -1);- return (- <Field>- <FieldLabel>- Path Length{" "}- {isPathLengthRequired && (- <span className="text-danger">*</span>- )}- </FieldLabel>- <Input- {...field}- type="number"- min={0}- max={- isAwsPcaProfile- ? AWS_PCA_MAX_CA_PATH_LENGTH- : undefined- }- isError={Boolean(error)}- placeholder={- isPathLengthRequired- ? "Enter path length (required)"- : "Leave empty for no constraint"- }- value={field.value ?? ""}- onChange={(e) => {- const val = e.target.value;- if (val === "") {- field.onChange(null);- } else {- const numVal = parseInt(val, 10);- field.onChange(- Number.isNaN(numVal) ? null : numVal- );- }- }}- />- <FieldDescription>- {isAwsPcaProfile- ? `Sets the pathLen for this CA certificate. Controls how many levels of sub-CAs can exist below. AWS Private CA supports 0 to ${AWS_PCA_MAX_CA_PATH_LENGTH}; 0 means it can only sign end-entity certificates.`- : "Sets the pathLen for this CA certificate. Controls how many levels of sub-CAs can exist below. Empty means unlimited; 0 means it can only sign end-entity certificates."}- </FieldDescription>- <FieldError errors={[error]} />- </Field>- );- }}- />- )}- </div>- </div>- )}- </div>- )}- </>- )}-- {currentStepKey === "metadata" && (- <div>- <p className="text-sm font-medium text-foreground">Metadata</p>- {metadataFields.length === 0 ? (- <Empty className="mt-3 border py-8">- <EmptyMedia variant="icon">- <Tags />- </EmptyMedia>- <EmptyTitle>No metadata added</EmptyTitle>- <EmptyContent>- <Button- type="button"- variant="outline"- size="sm"- onClick={() => appendMetadata({ key: "", value: "" })}- >- <Plus className="size-4" /> Add entry- </Button>- </EmptyContent>- </Empty>- ) : (- <div className="mt-3 space-y-2">- {metadataFields.map((metaField, index) => (- <div key={metaField.id} className="flex items-start gap-2">- <Controller- control={control}- name={`metadata.${index}.key`}- render={({ field, fieldState: { error } }) => (- <Input- {...field}- placeholder="Key"- className="flex-1"- isError={Boolean(error)}- />- )}- />- <Controller- control={control}- name={`metadata.${index}.value`}- render={({ field }) => (- <Input- {...field}- value={field.value ?? ""}- placeholder="Value (optional)"- className="flex-1"- />- )}- />- <IconButton- type="button"- variant="ghost"- aria-label="Remove metadata entry"- onClick={() => removeMetadata(index)}- >- <Trash2 />- </IconButton>- </div>- ))}- <Button- type="button"- variant="outline"- size="sm"- onClick={() => appendMetadata({ key: "", value: "" })}- >- <Plus className="size-4" /> Add entry- </Button>- </div>- )}- </div>- )}- </div>- )}- </div>-- <aside className="hidden w-80 shrink-0 flex-col gap-4 overflow-y-auto border-l border-border px-6 py-6 lg:flex">- <div className="mb-auto">- <div className="flex items-center justify-between gap-2">- <p className="text-[11px] font-medium tracking-wider text-muted uppercase">- Step {step + 1} · {currentStepMeta.rightLabel}- </p>- <DocumentationLinkBadge href={PkiDocsUrls.applications.certificates} />- </div>- <p className="mt-4 text-sm font-semibold text-foreground">What this step does</p>- <p className="mt-2 text-sm leading-relaxed text-muted">- {currentStepMeta.rightDescription}- </p>- </div>- </aside>- </div>-- <div className="flex shrink-0 items-center justify-between gap-3 border-t border-border px-6 py-4">- <span className="text-xs text-muted" />- <div className="flex items-center gap-3">- <span className="text-xs text-muted">- Step {step + 1} of {stepKeys.length}- </span>- {step > 0 && (- <Button type="button" variant="outline" onClick={goBack}>- Back- </Button>- )}- {isLastStep ? (+ <IconButton+ type="button"+ variant="ghost"+ aria-label="Remove metadata entry"+ onClick={() => removeMetadata(index)}+ >+ <Trash2 />+ </IconButton>+ </div>+ ))}<Buttontype="button"- variant="project"- isPending={isSubmitting}- isDisabled={isSubmitting || (!actualSelectedProfile && !profileId)}- onClick={handleSubmit(onFormSubmit, onFormInvalid)}+ variant="outline"+ size="sm"+ onClick={() => appendMetadata({ key: "", value: "" })}>- Request Certificate+ <Plus className="size-4" /> Add entry</Button>- ) : (- <Button- type="button"- variant="project"- isDisabled={!selectedProfileReady}- onClick={goNext}- >- Continue- </Button>- )}- </div>+ </div>+ )}</div>- </form>- )}- </SheetContent>- </Sheet>+ )}+ </div>+ )}+ </CertificateWizardSheet>);};