mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 18:26:16 +00:00
Check empty payload
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
|||||||
CreateAcmeOrderBodySchema,
|
CreateAcmeOrderBodySchema,
|
||||||
DeactivateAcmeAccountBodySchema,
|
DeactivateAcmeAccountBodySchema,
|
||||||
DeactivateAcmeAccountResponseSchema,
|
DeactivateAcmeAccountResponseSchema,
|
||||||
|
DownloadAcmeCertificateBodySchema,
|
||||||
FinalizeAcmeOrderBodySchema,
|
FinalizeAcmeOrderBodySchema,
|
||||||
GetAcmeAuthorizationResponseSchema,
|
GetAcmeAuthorizationResponseSchema,
|
||||||
GetAcmeDirectoryResponseSchema,
|
GetAcmeDirectoryResponseSchema,
|
||||||
@@ -372,10 +373,12 @@ export const registerPkiAcmeRouter = async (server: FastifyZodProvider) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handler: async (req, res) => {
|
handler: async (req, res) => {
|
||||||
const { profileId, accountId } = await validateExistingAccount({
|
const { profileId, accountId, payload } = await validateExistingAccount({
|
||||||
req,
|
req
|
||||||
schema: FinalizeAcmeOrderBodySchema
|
|
||||||
});
|
});
|
||||||
|
if (payload !== "") {
|
||||||
|
throw new AcmeMalformedError({ detail: "Payload should be empty" });
|
||||||
|
}
|
||||||
return sendAcmeResponse(
|
return sendAcmeResponse(
|
||||||
res,
|
res,
|
||||||
profileId,
|
profileId,
|
||||||
|
|||||||
@@ -603,11 +603,12 @@ export const pkiAcmeServiceFactory = ({
|
|||||||
if (!order) {
|
if (!order) {
|
||||||
throw new NotFoundError({ message: "ACME order not found" });
|
throw new NotFoundError({ message: "ACME order not found" });
|
||||||
}
|
}
|
||||||
// FIXME: Implement ACME certificate download
|
if (order.status !== AcmeOrderStatus.Valid) {
|
||||||
// Return the certificate in PEM format
|
throw new AcmeOrderNotReadyError({ message: "ACME order is not valid" });
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
status: 200,
|
status: 200,
|
||||||
body: "FIXME-certificate-pem",
|
body: order.certificateChain! + "\n" + order.certificate!,
|
||||||
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"`
|
||||||
|
|||||||
Reference in New Issue
Block a user