mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 21:27:10 +00:00
Fix link header overriding issue and challenge dal find method bug
This commit is contained in:
@@ -20,7 +20,7 @@ export const pkiAcmeChallengeDALFactory = (db: TDbClient) => {
|
|||||||
.join(TableName.PkiAcmeAuth, `${TableName.PkiAcmeChallenge}.authId`, `${TableName.PkiAcmeAuth}.id`)
|
.join(TableName.PkiAcmeAuth, `${TableName.PkiAcmeChallenge}.authId`, `${TableName.PkiAcmeAuth}.id`)
|
||||||
.select(
|
.select(
|
||||||
selectAllTableCols(TableName.PkiAcmeChallenge),
|
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}.id`, challengeId)
|
||||||
.where(`${TableName.PkiAcmeChallenge}.authId`, authId)
|
.where(`${TableName.PkiAcmeChallenge}.authId`, authId)
|
||||||
|
|||||||
@@ -158,6 +158,8 @@ export const GetAcmeAuthorizationResponseSchema = z.object({
|
|||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const RespondToAcmeChallengeBodySchema = z.object({});
|
||||||
|
|
||||||
export const RespondToAcmeChallengeResponseSchema = z.object({
|
export const RespondToAcmeChallengeResponseSchema = z.object({
|
||||||
type: z.enum(Object.values(AcmeChallengeType) as [string, ...string[]]),
|
type: z.enum(Object.values(AcmeChallengeType) as [string, ...string[]]),
|
||||||
url: z.string(),
|
url: z.string(),
|
||||||
|
|||||||
@@ -300,10 +300,10 @@ export const pkiAcmeServiceFactory = ({
|
|||||||
contact: existingAccount.emails,
|
contact: existingAccount.emails,
|
||||||
orders: buildUrl(profile.id, `/accounts/${existingAccount.id}/orders`)
|
orders: buildUrl(profile.id, `/accounts/${existingAccount.id}/orders`)
|
||||||
},
|
},
|
||||||
headers: [
|
headers: {
|
||||||
["Location", buildUrl(profile.id, `/accounts/${existingAccount.id}`)],
|
Location: buildUrl(profile.id, `/accounts/${existingAccount.id}`),
|
||||||
["Link", `<${buildUrl(profile.id, "/directory")}>;rel="index"`]
|
Link: `<${buildUrl(profile.id, "/directory")}>;rel="index"`
|
||||||
]
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,10 +322,10 @@ export const pkiAcmeServiceFactory = ({
|
|||||||
contact: newAccount.emails,
|
contact: newAccount.emails,
|
||||||
orders: buildUrl(profile.id, `/accounts/${newAccount.id}/orders`)
|
orders: buildUrl(profile.id, `/accounts/${newAccount.id}/orders`)
|
||||||
},
|
},
|
||||||
headers: [
|
headers: {
|
||||||
["Location", buildUrl(profile.id, `/accounts/${newAccount.id}`)],
|
Location: buildUrl(profile.id, `/accounts/${newAccount.id}`),
|
||||||
["Link", `<${buildUrl(profile.id, "/directory")}>;rel="index"`]
|
Link: `<${buildUrl(profile.id, "/directory")}>;rel="index"`
|
||||||
]
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -345,10 +345,10 @@ export const pkiAcmeServiceFactory = ({
|
|||||||
body: {
|
body: {
|
||||||
status: "deactivated"
|
status: "deactivated"
|
||||||
},
|
},
|
||||||
headers: [
|
headers: {
|
||||||
["Location", buildUrl(profileId, `/accounts/${accountId}`)],
|
Location: buildUrl(profileId, `/accounts/${accountId}`),
|
||||||
["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]
|
Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`
|
||||||
]
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -432,10 +432,10 @@ export const pkiAcmeServiceFactory = ({
|
|||||||
profileId,
|
profileId,
|
||||||
order
|
order
|
||||||
}),
|
}),
|
||||||
headers: [
|
headers: {
|
||||||
["Location", buildUrl(profileId, `/orders/${order.id}`)],
|
Location: buildUrl(profileId, `/orders/${order.id}`),
|
||||||
["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]
|
Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`
|
||||||
]
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -455,10 +455,10 @@ export const pkiAcmeServiceFactory = ({
|
|||||||
return {
|
return {
|
||||||
status: 200,
|
status: 200,
|
||||||
body: buildAcmeOrderResource({ profileId, order }),
|
body: buildAcmeOrderResource({ profileId, order }),
|
||||||
headers: [
|
headers: {
|
||||||
["Location", buildUrl(profileId, `/orders/${orderId}`)],
|
Location: buildUrl(profileId, `/orders/${orderId}`),
|
||||||
["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]
|
Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`
|
||||||
]
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -482,10 +482,10 @@ export const pkiAcmeServiceFactory = ({
|
|||||||
return {
|
return {
|
||||||
status: 200,
|
status: 200,
|
||||||
body: buildAcmeOrderResource({ profileId, order }),
|
body: buildAcmeOrderResource({ profileId, order }),
|
||||||
headers: [
|
headers: {
|
||||||
["Location", buildUrl(profileId, `/orders/${orderId}`)],
|
Location: buildUrl(profileId, `/orders/${orderId}`),
|
||||||
["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]
|
Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`
|
||||||
]
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -507,10 +507,10 @@ export const pkiAcmeServiceFactory = ({
|
|||||||
return {
|
return {
|
||||||
status: 200,
|
status: 200,
|
||||||
body: "FIXME-certificate-pem",
|
body: "FIXME-certificate-pem",
|
||||||
headers: [
|
headers: {
|
||||||
["Location", buildUrl(profileId, `/orders/${orderId}/certificate`)],
|
Location: buildUrl(profileId, `/orders/${orderId}/certificate`),
|
||||||
["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]
|
Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`
|
||||||
]
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -528,10 +528,10 @@ export const pkiAcmeServiceFactory = ({
|
|||||||
body: {
|
body: {
|
||||||
orders: []
|
orders: []
|
||||||
},
|
},
|
||||||
headers: [
|
headers: {
|
||||||
["Location", buildUrl(profileId, `/accounts/${accountId}/orders`)],
|
Location: buildUrl(profileId, `/accounts/${accountId}/orders`),
|
||||||
["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]
|
Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`
|
||||||
]
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -569,10 +569,10 @@ export const pkiAcmeServiceFactory = ({
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
headers: [
|
headers: {
|
||||||
["Location", buildUrl(profileId, `/authorizations/${authzId}`)],
|
Location: buildUrl(profileId, `/authorizations/${authzId}`),
|
||||||
["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]
|
Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`
|
||||||
]
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -600,11 +600,13 @@ export const pkiAcmeServiceFactory = ({
|
|||||||
status: challenge.status,
|
status: challenge.status,
|
||||||
token: challenge.token
|
token: challenge.token
|
||||||
},
|
},
|
||||||
headers: [
|
headers: {
|
||||||
["Location", buildUrl(profileId, `/authorizations/${authzId}/challenges/http-01`)],
|
Location: buildUrl(profileId, `/authorizations/${authzId}/challenges/${challengeId}`),
|
||||||
["Link", `<${buildUrl(profileId, `/authorizations/${authzId}`)}>;rel="up"`],
|
Link: [
|
||||||
["Link", `<${buildUrl(profileId, "/directory")}>;rel="index"`]
|
`<${buildUrl(profileId, `/authorizations/${authzId}`)}>;rel="up"`,
|
||||||
|
`<${buildUrl(profileId, "/directory")}>;rel="index"`
|
||||||
]
|
]
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export type TAuthenciatedJwsPayload<T> = TJwsPayload<T> & {
|
|||||||
};
|
};
|
||||||
export type TAcmeResponse<TPayload> = {
|
export type TAcmeResponse<TPayload> = {
|
||||||
status: number;
|
status: number;
|
||||||
headers: [string, string][];
|
headers: Record<string, string | string[]>;
|
||||||
body: TPayload;
|
body: TPayload;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user