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
Fix link header overriding issue and challenge dal find method bug
Fang-Pen Lin2c53e744c23d
diff --git a/backend/src/ee/services/pki-acme/pki-acme-challenge-dal.ts b/backend/src/ee/services/pki-acme/pki-acme-challenge-dal.tsindex d23827a371..b8c9094975 100644--- a/backend/src/ee/services/pki-acme/pki-acme-challenge-dal.ts+++ b/backend/src/ee/services/pki-acme/pki-acme-challenge-dal.ts@@ -20,7 +20,7 @@ export const pkiAcmeChallengeDALFactory = (db: TDbClient) => {.join(TableName.PkiAcmeAuth, `${TableName.PkiAcmeChallenge}.authId`, `${TableName.PkiAcmeAuth}.id`).select(selectAllTableCols(TableName.PkiAcmeChallenge),- db.ref("token").withSchema(TableName.PkiAcmeChallenge).as("token")+ db.ref("token").withSchema(TableName.PkiAcmeAuth).as("token")).where(`${TableName.PkiAcmeChallenge}.id`, challengeId).where(`${TableName.PkiAcmeChallenge}.authId`, authId)diff --git a/backend/src/ee/services/pki-acme/pki-acme-schemas.ts b/backend/src/ee/services/pki-acme/pki-acme-schemas.tsindex 25a3db3f4c..0c9015700d 100644--- a/backend/src/ee/services/pki-acme/pki-acme-schemas.ts+++ b/backend/src/ee/services/pki-acme/pki-acme-schemas.ts@@ -158,6 +158,8 @@ export const GetAcmeAuthorizationResponseSchema = z.object({)});+export const RespondToAcmeChallengeBodySchema = z.object({});+export const RespondToAcmeChallengeResponseSchema = z.object({type: z.enum(Object.values(AcmeChallengeType) as [string, ...string[]]),url: z.string(),diff --git a/backend/src/ee/services/pki-acme/pki-acme-service.ts b/backend/src/ee/services/pki-acme/pki-acme-service.tsindex c55a465426..d47d480f01 100644--- a/backend/src/ee/services/pki-acme/pki-acme-service.ts+++ b/backend/src/ee/services/pki-acme/pki-acme-service.ts@@ -300,10 +300,10 @@ export const pkiAcmeServiceFactory = ({contact: existingAccount.emails,orders: buildUrl(profile.id, `/accounts/${existingAccount.id}/orders`)},- headers: [- ["Location", buildUrl(profile.id, `/accounts/${existingAccount.id}`)],- ["Link", `<${buildUrl(profile.id, "/directory")}>;rel="index"`]- ]+ headers: {+ Location: buildUrl(profile.id, `/accounts/${existingAccount.id}`),+ Link: `<${buildUrl(profile.id, "/directory")}>;rel="index"`+ }};}@@ -322,10 +322,10 @@ export const pkiAcmeServiceFactory = ({contact: newAccount.emails,orders: buildUrl(profile.id, `/accounts/${newAccount.id}/orders`)},- headers: [- ["Location", buildUrl(profile.id, `/accounts/${newAccount.id}`)],- ["Link", `<${buildUrl(profile.id, "/directory")}>;rel="index"`]- ]+ headers: {+ Location: buildUrl(profile.id, `/accounts/${newAccount.id}`),+ Link: `<${buildUrl(profile.id, "/directory")}>;rel="index"`+ }};};@@ -345,10 +345,10 @@ export const pkiAcmeServiceFactory = ({body: {status: "deactivated"},- headers: [- ["Location", buildUrl(profileId, `/accounts/${accountId}`)],- ["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]- ]+ headers: {+ Location: buildUrl(profileId, `/accounts/${accountId}`),+ Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`+ }};};@@ -432,10 +432,10 @@ export const pkiAcmeServiceFactory = ({profileId,order}),- headers: [- ["Location", buildUrl(profileId, `/orders/${order.id}`)],- ["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]- ]+ headers: {+ Location: buildUrl(profileId, `/orders/${order.id}`),+ Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`+ }};};@@ -455,10 +455,10 @@ export const pkiAcmeServiceFactory = ({return {status: 200,body: buildAcmeOrderResource({ profileId, order }),- headers: [- ["Location", buildUrl(profileId, `/orders/${orderId}`)],- ["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]- ]+ headers: {+ Location: buildUrl(profileId, `/orders/${orderId}`),+ Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`+ }};};@@ -482,10 +482,10 @@ export const pkiAcmeServiceFactory = ({return {status: 200,body: buildAcmeOrderResource({ profileId, order }),- headers: [- ["Location", buildUrl(profileId, `/orders/${orderId}`)],- ["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]- ]+ headers: {+ Location: buildUrl(profileId, `/orders/${orderId}`),+ Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`+ }};};@@ -507,10 +507,10 @@ export const pkiAcmeServiceFactory = ({return {status: 200,body: "FIXME-certificate-pem",- headers: [- ["Location", buildUrl(profileId, `/orders/${orderId}/certificate`)],- ["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]- ]+ headers: {+ Location: buildUrl(profileId, `/orders/${orderId}/certificate`),+ Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`+ }};};@@ -528,10 +528,10 @@ export const pkiAcmeServiceFactory = ({body: {orders: []},- headers: [- ["Location", buildUrl(profileId, `/accounts/${accountId}/orders`)],- ["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]- ]+ headers: {+ Location: buildUrl(profileId, `/accounts/${accountId}/orders`),+ Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`+ }};};@@ -569,10 +569,10 @@ export const pkiAcmeServiceFactory = ({};})},- headers: [- ["Location", buildUrl(profileId, `/authorizations/${authzId}`)],- ["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]- ]+ headers: {+ Location: buildUrl(profileId, `/authorizations/${authzId}`),+ Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`+ }};};@@ -600,11 +600,13 @@ export const pkiAcmeServiceFactory = ({status: challenge.status,token: challenge.token},- headers: [- ["Location", buildUrl(profileId, `/authorizations/${authzId}/challenges/http-01`)],- ["Link", `<${buildUrl(profileId, `/authorizations/${authzId}`)}>;rel="up"`],- ["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]- ]+ headers: {+ Location: buildUrl(profileId, `/authorizations/${authzId}/challenges/${challengeId}`),+ Link: [+ `<${buildUrl(profileId, `/authorizations/${authzId}`)}>;rel="up"`,+ `<${buildUrl(profileId, "/directory")}>;rel="index"`+ ]+ }};};diff --git a/backend/src/ee/services/pki-acme/pki-acme-types.ts b/backend/src/ee/services/pki-acme/pki-acme-types.tsindex dbd1ad25ff..d2f96deb46 100644--- a/backend/src/ee/services/pki-acme/pki-acme-types.ts+++ b/backend/src/ee/services/pki-acme/pki-acme-types.ts@@ -44,7 +44,7 @@ export type TAuthenciatedJwsPayload<T> = TJwsPayload<T> & {};export type TAcmeResponse<TPayload> = {status: number;- headers: [string, string][];+ headers: Record<string, string | string[]>;body: TPayload;};