mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 00:27:30 +00:00
Merge pull request #4185 from Infisical/fix/pkiImportCertToCaIssueWithDn
On importCertToCa use serialNumber instead of dn to get the parentCa
This commit is contained in:
@@ -218,7 +218,7 @@ export const certificateAuthorityDALFactory = (db: TDbClient) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const findWithAssociatedCa = async (
|
const findWithAssociatedCa = async (
|
||||||
filter: Parameters<(typeof caOrm)["find"]>[0] & { dn?: string; type?: string },
|
filter: Parameters<(typeof caOrm)["find"]>[0] & { dn?: string; type?: string; serialNumber?: string },
|
||||||
{ offset, limit, sort = [["createdAt", "desc"]] }: TFindOpt<TCertificateAuthorities> = {},
|
{ offset, limit, sort = [["createdAt", "desc"]] }: TFindOpt<TCertificateAuthorities> = {},
|
||||||
tx?: Knex
|
tx?: Knex
|
||||||
) => {
|
) => {
|
||||||
|
|||||||
+2
-2
@@ -1068,11 +1068,11 @@ export const internalCertificateAuthorityServiceFactory = ({
|
|||||||
throw new BadRequestError({ message: "Invalid certificate chain" });
|
throw new BadRequestError({ message: "Invalid certificate chain" });
|
||||||
|
|
||||||
const parentCertObj = chainItems[1];
|
const parentCertObj = chainItems[1];
|
||||||
const parentCertSubject = parentCertObj.subject;
|
const parentSerialNumber = parentCertObj.serialNumber;
|
||||||
|
|
||||||
const [parentCa] = await certificateAuthorityDAL.findWithAssociatedCa({
|
const [parentCa] = await certificateAuthorityDAL.findWithAssociatedCa({
|
||||||
[`${TableName.CertificateAuthority}.projectId` as "projectId"]: ca.projectId,
|
[`${TableName.CertificateAuthority}.projectId` as "projectId"]: ca.projectId,
|
||||||
[`${TableName.InternalCertificateAuthority}.dn` as "dn"]: parentCertSubject
|
[`${TableName.InternalCertificateAuthority}.serialNumber` as "serialNumber"]: parentSerialNumber
|
||||||
});
|
});
|
||||||
|
|
||||||
const certificateManagerKmsId = await getProjectKmsCertificateKeyId({
|
const certificateManagerKmsId = await getProjectKmsCertificateKeyId({
|
||||||
|
|||||||
Reference in New Issue
Block a user