From b3bd38c6fc2df2771243abac6e4d309a753f0844 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 24 Jan 2022 15:18:42 +0000 Subject: [PATCH] Prevent generating presigned URLs for any S3 datasources that use custom endpoints --- packages/server/src/api/controllers/static/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/server/src/api/controllers/static/index.js b/packages/server/src/api/controllers/static/index.js index 6a8100220c..61b1898c74 100644 --- a/packages/server/src/api/controllers/static/index.js +++ b/packages/server/src/api/controllers/static/index.js @@ -122,6 +122,11 @@ exports.getSignedUploadURL = async function (ctx) { ctx.throw(400, "The specified datasource could not be found") } + // Ensure we aren't using a custom endpoint + if (datasource?.config?.endpoint) { + ctx.throw(400, "S3 datasources with custom endpoints are not supported") + } + // Determine type of datasource and generate signed URL let signedUrl let publicUrl