Skip to content

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

Bring changes back

Fang-Pen Lin0f5fa785a63c
diff --git a/backend/src/ee/services/pki-acme/pki-acme-service.ts b/backend/src/ee/services/pki-acme/pki-acme-service.ts
index 57d5c6ebde..a0dbd65b44 100644
--- a/backend/src/ee/services/pki-acme/pki-acme-service.ts
+++ b/backend/src/ee/services/pki-acme/pki-acme-service.ts
@@ -130,7 +130,7 @@ export const pkiAcmeServiceFactory = ({
if (profile.enrollmentType !== EnrollmentType.ACME) {
throw new NotFoundError({ message: "Certificate profile is not configured for ACME enrollment" });
}
- const orgLicensePlan = await licenseService.getPlan(profile.project.orgId);
+ const orgLicensePlan = await licenseService.getPlan(profile.project!.orgId);
if (!orgLicensePlan.pkiAcme) {
throw new AcmeUnauthorizedError({ message: "The organization does not have a valid license to use ACME" });
}
diff --git a/backend/src/services/certificate-profile/certificate-profile-dal.ts b/backend/src/services/certificate-profile/certificate-profile-dal.ts
index 6415145ce8..53172b7440 100644
--- a/backend/src/services/certificate-profile/certificate-profile-dal.ts
+++ b/backend/src/services/certificate-profile/certificate-profile-dal.ts
@@ -85,6 +85,7 @@ export const certificateProfileDALFactory = (db: TDbClient) => {
const findByIdWithConfigs = async (id: string, tx?: Knex): Promise<TCertificateProfileWithConfigs | undefined> => {
try {
const query = (tx || db)(TableName.PkiCertificateProfile)
+ .leftJoin(TableName.Project, `${TableName.PkiCertificateProfile}.projectId`, `${TableName.Project}.id`)
.leftJoin(
TableName.CertificateAuthority,
`${TableName.PkiCertificateProfile}.caId`,
@@ -112,6 +113,8 @@ export const certificateProfileDALFactory = (db: TDbClient) => {
)
.select(selectAllTableCols(TableName.PkiCertificateProfile))
.select(
+ db.ref("id").withSchema(TableName.Project).as("projectId"),
+ db.ref("orgId").withSchema(TableName.Project).as("orgId"),
db.ref("id").withSchema(TableName.CertificateAuthority).as("caId"),
db.ref("projectId").withSchema(TableName.CertificateAuthority).as("caProjectId"),
db.ref("status").withSchema(TableName.CertificateAuthority).as("caStatus"),
@@ -185,6 +188,11 @@ export const certificateProfileDALFactory = (db: TDbClient) => {
} as TCertificateProfileWithConfigs["certificateTemplate"])
: undefined;
+ const project = {
+ id: result.projectId,
+ orgId: result.orgId
+ } as TCertificateProfileWithConfigs["project"];
+
const transformedResult: TCertificateProfileWithConfigs = {
id: result.id,
projectId: result.projectId,
@@ -201,6 +209,7 @@ export const certificateProfileDALFactory = (db: TDbClient) => {
estConfig,
apiConfig,
acmeConfig,
+ project,
certificateAuthority,
certificateTemplate
};
diff --git a/backend/src/services/certificate-profile/certificate-profile-types.ts b/backend/src/services/certificate-profile/certificate-profile-types.ts
index 4a33398578..030548e972 100644
--- a/backend/src/services/certificate-profile/certificate-profile-types.ts
+++ b/backend/src/services/certificate-profile/certificate-profile-types.ts
@@ -33,6 +33,10 @@ export type TCertificateProfileUpdate = Omit<TPkiCertificateProfilesUpdate, "enr
};
export type TCertificateProfileWithConfigs = TCertificateProfile & {
+ project?: {
+ id: string;
+ orgId: string;
+ };
certificateAuthority?: {
id: string;
projectId: string;