From 913eb96ab04fdf54fc14af91f9668222af52598a Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 8 Nov 2022 11:34:16 +0000 Subject: [PATCH 01/14] Fixing an issue which was alerting, x-amz-meta-fieldname contains an invalid value, this error isn't really documented, but comes from if a metadata tag is sent up with nullish, or a non-string type. Fixing this in the core library, removing an invalid inputs. --- packages/backend-core/src/objectStore/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/backend-core/src/objectStore/index.ts b/packages/backend-core/src/objectStore/index.ts index 8453c9aee6..15b01795ab 100644 --- a/packages/backend-core/src/objectStore/index.ts +++ b/packages/backend-core/src/objectStore/index.ts @@ -163,6 +163,12 @@ export const upload = async ({ ContentType: type || CONTENT_TYPE_MAP[extension.toLowerCase()], } if (metadata) { + // remove any nullish keys from the metadata object, as these may be considered invalid + for (let key of Object.keys(metadata)) { + if (!metadata[key] || typeof metadata[key] !== "string") { + delete metadata[key] + } + } config.Metadata = metadata } return objectStore.upload(config).promise() From 2f01caa88d92cf03893eed30e29c91cf7d38e224 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 8 Nov 2022 11:49:07 +0000 Subject: [PATCH 02/14] Adding more type handling around the upload object store function. --- .../backend-core/src/objectStore/index.ts | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/packages/backend-core/src/objectStore/index.ts b/packages/backend-core/src/objectStore/index.ts index 15b01795ab..87b682b5bf 100644 --- a/packages/backend-core/src/objectStore/index.ts +++ b/packages/backend-core/src/objectStore/index.ts @@ -22,7 +22,19 @@ type ListParams = { ContinuationToken?: string } +type UploadParams = { + bucket: string + filename: string + path: string + type: string + // can be undefined, we will remove it + metadata: { + [key: string]: string | undefined + } +} + const CONTENT_TYPE_MAP: any = { + txt: "text/plain", html: "text/html", css: "text/css", js: "application/javascript", @@ -149,20 +161,26 @@ export const upload = async ({ path, type, metadata, -}: any) => { +}: UploadParams) => { const extension = filename.split(".").pop() const fileBytes = fs.readFileSync(path) const objectStore = ObjectStore(bucketName) await makeSureBucketExists(objectStore, bucketName) + let contentType = type + if (!contentType) { + contentType = extension + ? CONTENT_TYPE_MAP[extension.toLowerCase()] + : CONTENT_TYPE_MAP.txt + } const config: any = { // windows file paths need to be converted to forward slashes for s3 Key: sanitizeKey(filename), Body: fileBytes, - ContentType: type || CONTENT_TYPE_MAP[extension.toLowerCase()], + ContentType: contentType, } - if (metadata) { + if (metadata && typeof metadata === "object") { // remove any nullish keys from the metadata object, as these may be considered invalid for (let key of Object.keys(metadata)) { if (!metadata[key] || typeof metadata[key] !== "string") { From 63d745ada605111ec30021a07d6478cd61c942c7 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Tue, 8 Nov 2022 12:42:41 +0000 Subject: [PATCH 03/14] v2.1.19 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 8 ++++---- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/sdk/package.json | 2 +- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lerna.json b/lerna.json index 34c7d66763..60fea46a6a 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.1.18", + "version": "2.1.19", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 63306c1050..19e65138ab 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.1.18", + "version": "2.1.19", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "^2.1.18", + "@budibase/types": "^2.1.19", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index af2eba9fec..2b9cba8903 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "2.1.18", + "version": "2.1.19", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "^1.2.1", - "@budibase/string-templates": "^2.1.18", + "@budibase/string-templates": "^2.1.19", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 7e4047e70b..c88aad0fef 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.1.18", + "version": "2.1.19", "license": "GPL-3.0", "private": true, "scripts": { @@ -71,10 +71,10 @@ } }, "dependencies": { - "@budibase/bbui": "^2.1.18", - "@budibase/client": "^2.1.18", - "@budibase/frontend-core": "^2.1.18", - "@budibase/string-templates": "^2.1.18", + "@budibase/bbui": "^2.1.19", + "@budibase/client": "^2.1.19", + "@budibase/frontend-core": "^2.1.19", + "@budibase/string-templates": "^2.1.19", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 2ff3601a1a..d39e60d569 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.1.18", + "version": "2.1.19", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,9 +26,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "^2.1.18", - "@budibase/string-templates": "^2.1.18", - "@budibase/types": "^2.1.18", + "@budibase/backend-core": "^2.1.19", + "@budibase/string-templates": "^2.1.19", + "@budibase/types": "^2.1.19", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index 084c1c2982..ca15177c3c 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.1.18", + "version": "2.1.19", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^2.1.18", - "@budibase/frontend-core": "^2.1.18", - "@budibase/string-templates": "^2.1.18", + "@budibase/bbui": "^2.1.19", + "@budibase/frontend-core": "^2.1.19", + "@budibase/string-templates": "^2.1.19", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index d1184a4824..8b0d9b4be4 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "2.1.18", + "version": "2.1.19", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^2.1.18", + "@budibase/bbui": "^2.1.19", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index ab6b9873f8..4bf40add9a 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.1.18", + "version": "2.1.19", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index dcefeb4b1d..4700d9c07d 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.1.18", + "version": "2.1.19", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -77,11 +77,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "^2.1.18", - "@budibase/client": "^2.1.18", + "@budibase/backend-core": "^2.1.19", + "@budibase/client": "^2.1.19", "@budibase/pro": "2.1.18", - "@budibase/string-templates": "^2.1.18", - "@budibase/types": "^2.1.18", + "@budibase/string-templates": "^2.1.19", + "@budibase/types": "^2.1.19", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index d222fadae3..3158cd3323 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.1.18", + "version": "2.1.19", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 3ec352a4a0..13ca93a9cf 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.1.18", + "version": "2.1.19", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index bdbb5c2867..01ffee5b68 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.1.18", + "version": "2.1.19", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^2.1.18", + "@budibase/backend-core": "^2.1.19", "@budibase/pro": "2.1.18", - "@budibase/string-templates": "^2.1.18", - "@budibase/types": "^2.1.18", + "@budibase/string-templates": "^2.1.19", + "@budibase/types": "^2.1.19", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 963fc738f41e178aba28b1b636668d163a939a60 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Tue, 8 Nov 2022 12:46:43 +0000 Subject: [PATCH 04/14] Update pro version to 2.1.19 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 4700d9c07d..b595d246f3 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "^2.1.19", "@budibase/client": "^2.1.19", - "@budibase/pro": "2.1.18", + "@budibase/pro": "2.1.19", "@budibase/string-templates": "^2.1.19", "@budibase/types": "^2.1.19", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index cea5e673ae..dad8abf590 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1094,12 +1094,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.1.18": - version "2.1.18" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.18.tgz#fdc63f7b1a9213b09f5b25bce101cca828a04f6c" - integrity sha512-3Mihsv1Vk0wXjWLBV9p9KuAzMxoCkMUvIUYl07Ovhldsj0nxYbDiANX+vK5LjF4CYHjbvtntjR0ExfaZB9LbXQ== +"@budibase/backend-core@2.1.19": + version "2.1.19" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.19.tgz#ebd5bc8351ccc159d3d9806c08664b9f02579bdf" + integrity sha512-LXOK0QWuuo8g1W4wBq1uxKMWb3rq5hq7K9FtL/89kDz0C5fhoSG9AOGZ2Iug6eZidP4m6cVhTm3Nu8ceFmaB+Q== dependencies: - "@budibase/types" "^2.1.18" + "@budibase/types" "^2.1.19" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -1181,13 +1181,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@2.1.18": - version "2.1.18" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.18.tgz#7f7b6b9205767cda3d640353e2cb2ce34fb3e1ac" - integrity sha512-6i+bwJYs92+v7DPX7TZ4drpa8BQrb1w5catZ1f4e/9A0UqEVnE1BiX8wJx3pD7PhLHUGXKz+BaKS+oaHusHkQQ== +"@budibase/pro@2.1.19": + version "2.1.19" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.19.tgz#9f5416ee2b4530ebe949430498b07fef568ae4aa" + integrity sha512-q9o5B5XdD75Br1VZPqGoQk+cj61/jKStzJudp2zAiVcPd0gaeVgIVgazJs5HGQ6Gj616pxlN+mmraRMHtt09rA== dependencies: - "@budibase/backend-core" "2.1.18" - "@budibase/types" "2.1.18" + "@budibase/backend-core" "2.1.19" + "@budibase/types" "2.1.19" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" @@ -1211,10 +1211,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@2.1.18", "@budibase/types@^2.1.18": - version "2.1.18" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.18.tgz#4c7859fdc815044b12c4ac7b5e09e5c920150c81" - integrity sha512-rZMqx0QtWKaaPWP7V7j2Il8xm7XZ5RvpN7xw/evOp8Jw3DuLe709Zt6teLt8uvsDuI0rEIC3XNNWQSXHxOhGzQ== +"@budibase/types@2.1.19", "@budibase/types@^2.1.19": + version "2.1.19" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.19.tgz#2c4ff2ba1eacc509903b1421e7f10009b278b3c6" + integrity sha512-GqqhuGNwKrJKxaJTizkOmyHRfhGhu0AYrS/iFvoWKXFE55f6cfbA1N4a1kTmTifdknCpoE4IznFm+AyrUKPk7g== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index 01ffee5b68..e21ad8a6df 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -37,7 +37,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^2.1.19", - "@budibase/pro": "2.1.18", + "@budibase/pro": "2.1.19", "@budibase/string-templates": "^2.1.19", "@budibase/types": "^2.1.19", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index ed02c447ad..21326d9b34 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -291,12 +291,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.1.18": - version "2.1.18" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.18.tgz#fdc63f7b1a9213b09f5b25bce101cca828a04f6c" - integrity sha512-3Mihsv1Vk0wXjWLBV9p9KuAzMxoCkMUvIUYl07Ovhldsj0nxYbDiANX+vK5LjF4CYHjbvtntjR0ExfaZB9LbXQ== +"@budibase/backend-core@2.1.19": + version "2.1.19" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.19.tgz#ebd5bc8351ccc159d3d9806c08664b9f02579bdf" + integrity sha512-LXOK0QWuuo8g1W4wBq1uxKMWb3rq5hq7K9FtL/89kDz0C5fhoSG9AOGZ2Iug6eZidP4m6cVhTm3Nu8ceFmaB+Q== dependencies: - "@budibase/types" "^2.1.18" + "@budibase/types" "^2.1.19" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -328,22 +328,22 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@2.1.18": - version "2.1.18" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.18.tgz#7f7b6b9205767cda3d640353e2cb2ce34fb3e1ac" - integrity sha512-6i+bwJYs92+v7DPX7TZ4drpa8BQrb1w5catZ1f4e/9A0UqEVnE1BiX8wJx3pD7PhLHUGXKz+BaKS+oaHusHkQQ== +"@budibase/pro@2.1.19": + version "2.1.19" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.19.tgz#9f5416ee2b4530ebe949430498b07fef568ae4aa" + integrity sha512-q9o5B5XdD75Br1VZPqGoQk+cj61/jKStzJudp2zAiVcPd0gaeVgIVgazJs5HGQ6Gj616pxlN+mmraRMHtt09rA== dependencies: - "@budibase/backend-core" "2.1.18" - "@budibase/types" "2.1.18" + "@budibase/backend-core" "2.1.19" + "@budibase/types" "2.1.19" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" node-fetch "^2.6.1" -"@budibase/types@2.1.18", "@budibase/types@^2.1.18": - version "2.1.18" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.18.tgz#4c7859fdc815044b12c4ac7b5e09e5c920150c81" - integrity sha512-rZMqx0QtWKaaPWP7V7j2Il8xm7XZ5RvpN7xw/evOp8Jw3DuLe709Zt6teLt8uvsDuI0rEIC3XNNWQSXHxOhGzQ== +"@budibase/types@2.1.19", "@budibase/types@^2.1.19": + version "2.1.19" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.19.tgz#2c4ff2ba1eacc509903b1421e7f10009b278b3c6" + integrity sha512-GqqhuGNwKrJKxaJTizkOmyHRfhGhu0AYrS/iFvoWKXFE55f6cfbA1N4a1kTmTifdknCpoE4IznFm+AyrUKPk7g== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From b159ed2da09659bb09f5a1268c8899c3ed8bc8ad Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Tue, 8 Nov 2022 17:20:53 +0000 Subject: [PATCH 05/14] v2.1.20 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 8 ++++---- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/sdk/package.json | 2 +- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lerna.json b/lerna.json index 60fea46a6a..c2882bda9d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.1.19", + "version": "2.1.20", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 19e65138ab..1207b9f9d9 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.1.19", + "version": "2.1.20", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "^2.1.19", + "@budibase/types": "^2.1.20", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 2b9cba8903..069f4bc3ab 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "2.1.19", + "version": "2.1.20", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "^1.2.1", - "@budibase/string-templates": "^2.1.19", + "@budibase/string-templates": "^2.1.20", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index c88aad0fef..78d189f290 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.1.19", + "version": "2.1.20", "license": "GPL-3.0", "private": true, "scripts": { @@ -71,10 +71,10 @@ } }, "dependencies": { - "@budibase/bbui": "^2.1.19", - "@budibase/client": "^2.1.19", - "@budibase/frontend-core": "^2.1.19", - "@budibase/string-templates": "^2.1.19", + "@budibase/bbui": "^2.1.20", + "@budibase/client": "^2.1.20", + "@budibase/frontend-core": "^2.1.20", + "@budibase/string-templates": "^2.1.20", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index d39e60d569..7c053f4e57 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.1.19", + "version": "2.1.20", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,9 +26,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "^2.1.19", - "@budibase/string-templates": "^2.1.19", - "@budibase/types": "^2.1.19", + "@budibase/backend-core": "^2.1.20", + "@budibase/string-templates": "^2.1.20", + "@budibase/types": "^2.1.20", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index ca15177c3c..5dcd4465ee 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.1.19", + "version": "2.1.20", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^2.1.19", - "@budibase/frontend-core": "^2.1.19", - "@budibase/string-templates": "^2.1.19", + "@budibase/bbui": "^2.1.20", + "@budibase/frontend-core": "^2.1.20", + "@budibase/string-templates": "^2.1.20", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 8b0d9b4be4..26f490429e 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "2.1.19", + "version": "2.1.20", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^2.1.19", + "@budibase/bbui": "^2.1.20", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 4bf40add9a..0e25847f31 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.1.19", + "version": "2.1.20", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index b595d246f3..ced779c46e 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.1.19", + "version": "2.1.20", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -77,11 +77,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "^2.1.19", - "@budibase/client": "^2.1.19", + "@budibase/backend-core": "^2.1.20", + "@budibase/client": "^2.1.20", "@budibase/pro": "2.1.19", - "@budibase/string-templates": "^2.1.19", - "@budibase/types": "^2.1.19", + "@budibase/string-templates": "^2.1.20", + "@budibase/types": "^2.1.20", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 3158cd3323..b0ae4d9226 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.1.19", + "version": "2.1.20", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 13ca93a9cf..2014dbd05f 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.1.19", + "version": "2.1.20", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index e21ad8a6df..7718b2675b 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.1.19", + "version": "2.1.20", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^2.1.19", + "@budibase/backend-core": "^2.1.20", "@budibase/pro": "2.1.19", - "@budibase/string-templates": "^2.1.19", - "@budibase/types": "^2.1.19", + "@budibase/string-templates": "^2.1.20", + "@budibase/types": "^2.1.20", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 195dc8c0de03817cde65779f73ea57b15f972509 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Tue, 8 Nov 2022 17:23:42 +0000 Subject: [PATCH 06/14] Update pro version to 2.1.20 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index ced779c46e..0e74bbbd27 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "^2.1.20", "@budibase/client": "^2.1.20", - "@budibase/pro": "2.1.19", + "@budibase/pro": "2.1.20", "@budibase/string-templates": "^2.1.20", "@budibase/types": "^2.1.20", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index dad8abf590..0d9e19c527 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1094,12 +1094,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.1.19": - version "2.1.19" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.19.tgz#ebd5bc8351ccc159d3d9806c08664b9f02579bdf" - integrity sha512-LXOK0QWuuo8g1W4wBq1uxKMWb3rq5hq7K9FtL/89kDz0C5fhoSG9AOGZ2Iug6eZidP4m6cVhTm3Nu8ceFmaB+Q== +"@budibase/backend-core@2.1.20": + version "2.1.20" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.20.tgz#3df3b9f69379640a1d4c474b8713493c55c6ddaa" + integrity sha512-y+QM3ddle2FZggrq3nNcAuYd5Sl9zMabFBVL/NPE3aW1dEO51C2D2mqEVhwqk80nEZTp4qzt69lJEJEtT0stEw== dependencies: - "@budibase/types" "^2.1.19" + "@budibase/types" "^2.1.20" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -1181,13 +1181,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@2.1.19": - version "2.1.19" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.19.tgz#9f5416ee2b4530ebe949430498b07fef568ae4aa" - integrity sha512-q9o5B5XdD75Br1VZPqGoQk+cj61/jKStzJudp2zAiVcPd0gaeVgIVgazJs5HGQ6Gj616pxlN+mmraRMHtt09rA== +"@budibase/pro@2.1.20": + version "2.1.20" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.20.tgz#641344899e42c5918f711d6d13fc71dbd994d0e3" + integrity sha512-GSo6WsG4hn/QbWAeYVwsdHeI9tRL/FaXwq89xamlyBHHcIFvZZ/fCU7WiRg+49gYTrGmzX3ZsoHaddAJU1xkLw== dependencies: - "@budibase/backend-core" "2.1.19" - "@budibase/types" "2.1.19" + "@budibase/backend-core" "2.1.20" + "@budibase/types" "2.1.20" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" @@ -1211,10 +1211,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@2.1.19", "@budibase/types@^2.1.19": - version "2.1.19" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.19.tgz#2c4ff2ba1eacc509903b1421e7f10009b278b3c6" - integrity sha512-GqqhuGNwKrJKxaJTizkOmyHRfhGhu0AYrS/iFvoWKXFE55f6cfbA1N4a1kTmTifdknCpoE4IznFm+AyrUKPk7g== +"@budibase/types@2.1.20", "@budibase/types@^2.1.20": + version "2.1.20" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.20.tgz#6c56c26caa67e259f27230ccd66fc900edef2092" + integrity sha512-OpumVq+Gt3jhCdr4yXzibymT4bc+E2aFBZ/+YHVCz1WidamTQn6iwIDLmSxz6OoyAi7cHk38afTRy0ZyFkZwhw== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index 7718b2675b..f5d5ccbfaa 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -37,7 +37,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^2.1.20", - "@budibase/pro": "2.1.19", + "@budibase/pro": "2.1.20", "@budibase/string-templates": "^2.1.20", "@budibase/types": "^2.1.20", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 21326d9b34..7bb34537e7 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -291,12 +291,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.1.19": - version "2.1.19" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.19.tgz#ebd5bc8351ccc159d3d9806c08664b9f02579bdf" - integrity sha512-LXOK0QWuuo8g1W4wBq1uxKMWb3rq5hq7K9FtL/89kDz0C5fhoSG9AOGZ2Iug6eZidP4m6cVhTm3Nu8ceFmaB+Q== +"@budibase/backend-core@2.1.20": + version "2.1.20" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.20.tgz#3df3b9f69379640a1d4c474b8713493c55c6ddaa" + integrity sha512-y+QM3ddle2FZggrq3nNcAuYd5Sl9zMabFBVL/NPE3aW1dEO51C2D2mqEVhwqk80nEZTp4qzt69lJEJEtT0stEw== dependencies: - "@budibase/types" "^2.1.19" + "@budibase/types" "^2.1.20" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -328,22 +328,22 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@2.1.19": - version "2.1.19" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.19.tgz#9f5416ee2b4530ebe949430498b07fef568ae4aa" - integrity sha512-q9o5B5XdD75Br1VZPqGoQk+cj61/jKStzJudp2zAiVcPd0gaeVgIVgazJs5HGQ6Gj616pxlN+mmraRMHtt09rA== +"@budibase/pro@2.1.20": + version "2.1.20" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.20.tgz#641344899e42c5918f711d6d13fc71dbd994d0e3" + integrity sha512-GSo6WsG4hn/QbWAeYVwsdHeI9tRL/FaXwq89xamlyBHHcIFvZZ/fCU7WiRg+49gYTrGmzX3ZsoHaddAJU1xkLw== dependencies: - "@budibase/backend-core" "2.1.19" - "@budibase/types" "2.1.19" + "@budibase/backend-core" "2.1.20" + "@budibase/types" "2.1.20" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" node-fetch "^2.6.1" -"@budibase/types@2.1.19", "@budibase/types@^2.1.19": - version "2.1.19" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.19.tgz#2c4ff2ba1eacc509903b1421e7f10009b278b3c6" - integrity sha512-GqqhuGNwKrJKxaJTizkOmyHRfhGhu0AYrS/iFvoWKXFE55f6cfbA1N4a1kTmTifdknCpoE4IznFm+AyrUKPk7g== +"@budibase/types@2.1.20", "@budibase/types@^2.1.20": + version "2.1.20" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.20.tgz#6c56c26caa67e259f27230ccd66fc900edef2092" + integrity sha512-OpumVq+Gt3jhCdr4yXzibymT4bc+E2aFBZ/+YHVCz1WidamTQn6iwIDLmSxz6OoyAi7cHk38afTRy0ZyFkZwhw== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From 693d6b6242fe09a02e899ce3174662d9c7ae172a Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 8 Nov 2022 18:25:37 +0000 Subject: [PATCH 07/14] Typescript re-write of the roles layer, this is the backbone of a lot of our security features, and I believe the issue was generally to do with a lack of handling of null-ish inputs. --- .../backend-core/src/objectStore/index.ts | 4 +- .../src/security/{roles.js => roles.ts} | 171 ++++++++++-------- packages/types/src/documents/app/role.ts | 1 + 3 files changed, 97 insertions(+), 79 deletions(-) rename packages/backend-core/src/security/{roles.js => roles.ts} (68%) diff --git a/packages/backend-core/src/objectStore/index.ts b/packages/backend-core/src/objectStore/index.ts index 87b682b5bf..84eebeff81 100644 --- a/packages/backend-core/src/objectStore/index.ts +++ b/packages/backend-core/src/objectStore/index.ts @@ -26,9 +26,9 @@ type UploadParams = { bucket: string filename: string path: string - type: string + type?: string // can be undefined, we will remove it - metadata: { + metadata?: { [key: string]: string | undefined } } diff --git a/packages/backend-core/src/security/roles.js b/packages/backend-core/src/security/roles.ts similarity index 68% rename from packages/backend-core/src/security/roles.js rename to packages/backend-core/src/security/roles.ts index 33c9123b63..6286706935 100644 --- a/packages/backend-core/src/security/roles.js +++ b/packages/backend-core/src/security/roles.ts @@ -1,19 +1,21 @@ -const { cloneDeep } = require("lodash/fp") -const { BUILTIN_PERMISSION_IDS, PermissionLevels } = require("./permissions") -const { +import { BUILTIN_PERMISSION_IDS, PermissionLevels } from "./permissions" +import { generateRoleID, getRoleParams, DocumentType, SEPARATOR, -} = require("../db/utils") -const { getAppDB } = require("../context") -const { doWithDB } = require("../db") +} from "../db/utils" +import { getAppDB } from "../context" +import { doWithDB } from "../db" +import { Screen, Role as RoleDoc } from "@budibase/types" +const { cloneDeep } = require("lodash/fp") const BUILTIN_IDS = { ADMIN: "ADMIN", POWER: "POWER", BASIC: "BASIC", PUBLIC: "PUBLIC", + BUILDER: "BUILDER", } // exclude internal roles like builder @@ -24,19 +26,26 @@ const EXTERNAL_BUILTIN_ROLE_IDS = [ BUILTIN_IDS.PUBLIC, ] -function Role(id, name) { - this._id = id - this.name = name -} +export class Role { + _id: string + name: string + permissionId?: string + inherits?: string -Role.prototype.addPermission = function (permissionId) { - this.permissionId = permissionId - return this -} + constructor(id: string, name: string) { + this._id = id + this.name = name + } -Role.prototype.addInheritance = function (inherits) { - this.inherits = inherits - return this + addPermission(permissionId: string) { + this.permissionId = permissionId + return this + } + + addInheritance(inherits: string) { + this.inherits = inherits + return this + } } const BUILTIN_ROLES = { @@ -57,27 +66,30 @@ const BUILTIN_ROLES = { ), } -exports.getBuiltinRoles = () => { +export function getBuiltinRoles() { return cloneDeep(BUILTIN_ROLES) } -exports.BUILTIN_ROLE_ID_ARRAY = Object.values(BUILTIN_ROLES).map( +export const BUILTIN_ROLE_ID_ARRAY = Object.values(BUILTIN_ROLES).map( role => role._id ) -exports.BUILTIN_ROLE_NAME_ARRAY = Object.values(BUILTIN_ROLES).map( +export const BUILTIN_ROLE_NAME_ARRAY = Object.values(BUILTIN_ROLES).map( role => role.name ) -function isBuiltin(role) { - return exports.BUILTIN_ROLE_ID_ARRAY.some(builtin => role.includes(builtin)) +export function isBuiltin(role?: string) { + return BUILTIN_ROLE_ID_ARRAY.some(builtin => role?.includes(builtin)) } /** * Works through the inheritance ranks to see how far up the builtin stack this ID is. */ -exports.builtinRoleToNumber = id => { - const builtins = exports.getBuiltinRoles() +export function builtinRoleToNumber(id?: string) { + if (!id) { + return 0 + } + const builtins = getBuiltinRoles() const MAX = Object.values(builtins).length + 1 if (id === BUILTIN_IDS.ADMIN || id === BUILTIN_IDS.BUILDER) { return MAX @@ -97,14 +109,14 @@ exports.builtinRoleToNumber = id => { /** * Converts any role to a number, but has to be async to get the roles from db. */ -exports.roleToNumber = async id => { - if (exports.isBuiltin(id)) { - return exports.builtinRoleToNumber(id) +export async function roleToNumber(id?: string) { + if (isBuiltin(id)) { + return builtinRoleToNumber(id) } - const hierarchy = await exports.getUserRoleHierarchy(id) + const hierarchy = (await getUserRoleHierarchy(id)) as RoleDoc[] for (let role of hierarchy) { - if (isBuiltin(role.inherits)) { - return exports.builtinRoleToNumber(role.inherits) + 1 + if (isBuiltin(role?.inherits)) { + return builtinRoleToNumber(role.inherits) + 1 } } return 0 @@ -113,15 +125,14 @@ exports.roleToNumber = async id => { /** * Returns whichever builtin roleID is lower. */ -exports.lowerBuiltinRoleID = (roleId1, roleId2) => { +export function lowerBuiltinRoleID(roleId1?: string, roleId2?: string) { if (!roleId1) { return roleId2 } if (!roleId2) { return roleId1 } - return exports.builtinRoleToNumber(roleId1) > - exports.builtinRoleToNumber(roleId2) + return builtinRoleToNumber(roleId1) > builtinRoleToNumber(roleId2) ? roleId2 : roleId1 } @@ -132,11 +143,11 @@ exports.lowerBuiltinRoleID = (roleId1, roleId2) => { * @param {string|null} roleId The level ID to lookup. * @returns {Promise} The role object, which may contain an "inherits" property. */ -exports.getRole = async roleId => { +export async function getRole(roleId?: string) { if (!roleId) { return null } - let role = {} + let role: any = {} // built in roles mostly come from the in-code implementation, // but can be extended by a doc stored about them (e.g. permissions) if (isBuiltin(roleId)) { @@ -146,10 +157,10 @@ exports.getRole = async roleId => { } try { const db = getAppDB() - const dbRole = await db.get(exports.getDBRoleID(roleId)) + const dbRole = await db.get(getDBRoleID(roleId)) role = Object.assign(role, dbRole) // finalise the ID - role._id = exports.getExternalRoleID(role._id) + role._id = getExternalRoleID(role._id) } catch (err) { // only throw an error if there is no role at all if (Object.keys(role).length === 0) { @@ -162,12 +173,12 @@ exports.getRole = async roleId => { /** * Simple function to get all the roles based on the top level user role ID. */ -async function getAllUserRoles(userRoleId) { +async function getAllUserRoles(userRoleId?: string): Promise { // admins have access to all roles if (userRoleId === BUILTIN_IDS.ADMIN) { - return exports.getAllRoles() + return getAllRoles() } - let currentRole = await exports.getRole(userRoleId) + let currentRole = await getRole(userRoleId) let roles = currentRole ? [currentRole] : [] let roleIds = [userRoleId] // get all the inherited roles @@ -177,7 +188,7 @@ async function getAllUserRoles(userRoleId) { roleIds.indexOf(currentRole.inherits) === -1 ) { roleIds.push(currentRole.inherits) - currentRole = await exports.getRole(currentRole.inherits) + currentRole = await getRole(currentRole.inherits) roles.push(currentRole) } return roles @@ -191,7 +202,10 @@ async function getAllUserRoles(userRoleId) { * @returns {Promise} returns an ordered array of the roles, with the first being their * highest level of access and the last being the lowest level. */ -exports.getUserRoleHierarchy = async (userRoleId, opts = { idOnly: true }) => { +export async function getUserRoleHierarchy( + userRoleId?: string, + opts = { idOnly: true } +) { // special case, if they don't have a role then they are a public user const roles = await getAllUserRoles(userRoleId) return opts.idOnly ? roles.map(role => role._id) : roles @@ -200,9 +214,12 @@ exports.getUserRoleHierarchy = async (userRoleId, opts = { idOnly: true }) => { // this function checks that the provided permissions are in an array format // some templates/older apps will use a simple string instead of array for roles // convert the string to an array using the theory that write is higher than read -exports.checkForRoleResourceArray = (rolePerms, resourceId) => { +export function checkForRoleResourceArray( + rolePerms: { [key: string]: string[] }, + resourceId: string +) { if (rolePerms && !Array.isArray(rolePerms[resourceId])) { - const permLevel = rolePerms[resourceId] + const permLevel = rolePerms[resourceId] as any rolePerms[resourceId] = [permLevel] if (permLevel === PermissionLevels.WRITE) { rolePerms[resourceId].push(PermissionLevels.READ) @@ -215,7 +232,7 @@ exports.checkForRoleResourceArray = (rolePerms, resourceId) => { * Given an app ID this will retrieve all of the roles that are currently within that app. * @return {Promise} An array of the role objects that were found. */ -exports.getAllRoles = async appId => { +export async function getAllRoles(appId?: string) { if (appId) { return doWithDB(appId, internal) } else { @@ -227,30 +244,30 @@ exports.getAllRoles = async appId => { } return internal(appDB) } - async function internal(db) { - let roles = [] + async function internal(db: any) { + let roles: RoleDoc[] = [] if (db) { const body = await db.allDocs( getRoleParams(null, { include_docs: true, }) ) - roles = body.rows.map(row => row.doc) + roles = body.rows.map((row: any) => row.doc) } - const builtinRoles = exports.getBuiltinRoles() + const builtinRoles = getBuiltinRoles() // need to combine builtin with any DB record of them (for sake of permissions) for (let builtinRoleId of EXTERNAL_BUILTIN_ROLE_IDS) { const builtinRole = builtinRoles[builtinRoleId] const dbBuiltin = roles.filter( - dbRole => exports.getExternalRoleID(dbRole._id) === builtinRoleId + dbRole => getExternalRoleID(dbRole._id) === builtinRoleId )[0] if (dbBuiltin == null) { roles.push(builtinRole || builtinRoles.BASIC) } else { // remove role and all back after combining with the builtin roles = roles.filter(role => role._id !== dbBuiltin._id) - dbBuiltin._id = exports.getExternalRoleID(dbBuiltin._id) + dbBuiltin._id = getExternalRoleID(dbBuiltin._id) roles.push(Object.assign(builtinRole, dbBuiltin)) } } @@ -260,7 +277,7 @@ exports.getAllRoles = async appId => { continue } for (let resourceId of Object.keys(role.permissions)) { - role.permissions = exports.checkForRoleResourceArray( + role.permissions = checkForRoleResourceArray( role.permissions, resourceId ) @@ -277,11 +294,11 @@ exports.getAllRoles = async appId => { * @param subResourceId The sub resource being requested * @return {Promise<{permissions}|Object>} returns the permissions required to access. */ -exports.getRequiredResourceRole = async ( - permLevel, - { resourceId, subResourceId } -) => { - const roles = await exports.getAllRoles() +export async function getRequiredResourceRole( + permLevel: string, + { resourceId, subResourceId }: { resourceId?: string; subResourceId?: string } +) { + const roles = await getAllRoles() let main = [], sub = [] for (let role of roles) { @@ -289,8 +306,8 @@ exports.getRequiredResourceRole = async ( if (!role.permissions) { continue } - const mainRes = role.permissions[resourceId] - const subRes = role.permissions[subResourceId] + const mainRes = resourceId ? role.permissions[resourceId] : undefined + const subRes = subResourceId ? role.permissions[subResourceId] : undefined if (mainRes && mainRes.indexOf(permLevel) !== -1) { main.push(role._id) } else if (subRes && subRes.indexOf(permLevel) !== -1) { @@ -301,12 +318,13 @@ exports.getRequiredResourceRole = async ( return main.concat(sub) } -class AccessController { +export class AccessController { + userHierarchies: { [key: string]: string[] } constructor() { this.userHierarchies = {} } - async hasAccess(tryingRoleId, userRoleId) { + async hasAccess(tryingRoleId?: string, userRoleId?: string) { // special cases, the screen has no role, the roles are the same or the user // is currently in the builder if ( @@ -318,16 +336,18 @@ class AccessController { ) { return true } - let roleIds = this.userHierarchies[userRoleId] - if (!roleIds) { - roleIds = await exports.getUserRoleHierarchy(userRoleId) + let roleIds = userRoleId ? this.userHierarchies[userRoleId] : null + if (!roleIds && userRoleId) { + roleIds = (await getUserRoleHierarchy(userRoleId, { + idOnly: true, + })) as string[] this.userHierarchies[userRoleId] = roleIds } - return roleIds.indexOf(tryingRoleId) !== -1 + return roleIds?.indexOf(tryingRoleId) !== -1 } - async checkScreensAccess(screens, userRoleId) { + async checkScreensAccess(screens: Screen[], userRoleId: string) { let accessibleScreens = [] // don't want to handle this with Promise.all as this would mean all custom roles would be // retrieved at same time, it is likely a custom role will be re-used and therefore want @@ -341,8 +361,8 @@ class AccessController { return accessibleScreens } - async checkScreenAccess(screen, userRoleId) { - const roleId = screen && screen.routing ? screen.routing.roleId : null + async checkScreenAccess(screen: Screen, userRoleId: string) { + const roleId = screen && screen.routing ? screen.routing.roleId : undefined if (await this.hasAccess(roleId, userRoleId)) { return screen } @@ -353,8 +373,8 @@ class AccessController { /** * Adds the "role_" for builtin role IDs which are to be written to the DB (for permissions). */ -exports.getDBRoleID = roleId => { - if (roleId.startsWith(DocumentType.ROLE)) { +function getDBRoleID(roleId?: string) { + if (roleId?.startsWith(DocumentType.ROLE)) { return roleId } return generateRoleID(roleId) @@ -363,15 +383,12 @@ exports.getDBRoleID = roleId => { /** * Remove the "role_" from builtin role IDs that have been written to the DB (for permissions). */ -exports.getExternalRoleID = roleId => { - // for built in roles we want to remove the DB role ID element (role_) - if (roleId.startsWith(DocumentType.ROLE) && isBuiltin(roleId)) { +function getExternalRoleID(roleId?: string) { + // for built-in roles we want to remove the DB role ID element (role_) + if (roleId?.startsWith(DocumentType.ROLE) && isBuiltin(roleId)) { return roleId.split(`${DocumentType.ROLE}${SEPARATOR}`)[1] } return roleId } -exports.AccessController = AccessController -exports.BUILTIN_ROLE_IDS = BUILTIN_IDS -exports.isBuiltin = isBuiltin -exports.Role = Role +export const BUILTIN_ROLE_IDS = BUILTIN_IDS diff --git a/packages/types/src/documents/app/role.ts b/packages/types/src/documents/app/role.ts index 1c4b15ba2c..1f5d9bbecf 100644 --- a/packages/types/src/documents/app/role.ts +++ b/packages/types/src/documents/app/role.ts @@ -3,4 +3,5 @@ import { Document } from "../document" export interface Role extends Document { permissionId: string inherits: string + permissions: { [key: string]: string[] } } From eb251fb48ebed5dad4d8599283e47dcd92b7f6d0 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 8 Nov 2022 18:35:21 +0000 Subject: [PATCH 08/14] Exporting some functions that were previously exported. --- packages/backend-core/src/security/roles.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend-core/src/security/roles.ts b/packages/backend-core/src/security/roles.ts index 6286706935..b25532a04a 100644 --- a/packages/backend-core/src/security/roles.ts +++ b/packages/backend-core/src/security/roles.ts @@ -373,7 +373,7 @@ export class AccessController { /** * Adds the "role_" for builtin role IDs which are to be written to the DB (for permissions). */ -function getDBRoleID(roleId?: string) { +export function getDBRoleID(roleId?: string) { if (roleId?.startsWith(DocumentType.ROLE)) { return roleId } @@ -383,7 +383,7 @@ function getDBRoleID(roleId?: string) { /** * Remove the "role_" from builtin role IDs that have been written to the DB (for permissions). */ -function getExternalRoleID(roleId?: string) { +export function getExternalRoleID(roleId?: string) { // for built-in roles we want to remove the DB role ID element (role_) if (roleId?.startsWith(DocumentType.ROLE) && isBuiltin(roleId)) { return roleId.split(`${DocumentType.ROLE}${SEPARATOR}`)[1] From 2240b060d46a444dee262d0e0a03c8a1a98d36b1 Mon Sep 17 00:00:00 2001 From: Michael Drury Date: Tue, 8 Nov 2022 19:48:16 +0000 Subject: [PATCH 09/14] Quick fix to not expose the builder ID outside of the role impl. --- packages/backend-core/src/security/roles.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/backend-core/src/security/roles.ts b/packages/backend-core/src/security/roles.ts index b25532a04a..fb6ded2210 100644 --- a/packages/backend-core/src/security/roles.ts +++ b/packages/backend-core/src/security/roles.ts @@ -391,4 +391,9 @@ export function getExternalRoleID(roleId?: string) { return roleId } -export const BUILTIN_ROLE_IDS = BUILTIN_IDS +export const BUILTIN_ROLE_IDS = [ + BUILTIN_IDS.ADMIN, + BUILTIN_IDS.POWER, + BUILTIN_IDS.BASIC, + BUILTIN_IDS.PUBLIC, +] From 41a65bbe47d5ff76414fb8dd390471fff988d921 Mon Sep 17 00:00:00 2001 From: Michael Drury Date: Tue, 8 Nov 2022 20:01:01 +0000 Subject: [PATCH 10/14] Exporting roles differently to fix issue raised by test. --- packages/backend-core/src/security/roles.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/backend-core/src/security/roles.ts b/packages/backend-core/src/security/roles.ts index fb6ded2210..1064936fd7 100644 --- a/packages/backend-core/src/security/roles.ts +++ b/packages/backend-core/src/security/roles.ts @@ -10,11 +10,15 @@ import { doWithDB } from "../db" import { Screen, Role as RoleDoc } from "@budibase/types" const { cloneDeep } = require("lodash/fp") -const BUILTIN_IDS = { +export const BUILTIN_ROLE_IDS = { ADMIN: "ADMIN", POWER: "POWER", BASIC: "BASIC", PUBLIC: "PUBLIC", +} + +const BUILTIN_IDS = { + ...BUILTIN_ROLE_IDS, BUILDER: "BUILDER", } @@ -390,10 +394,3 @@ export function getExternalRoleID(roleId?: string) { } return roleId } - -export const BUILTIN_ROLE_IDS = [ - BUILTIN_IDS.ADMIN, - BUILTIN_IDS.POWER, - BUILTIN_IDS.BASIC, - BUILTIN_IDS.PUBLIC, -] From 2f6330db4fea92ee312e654922637fe039ed47b8 Mon Sep 17 00:00:00 2001 From: Michael Drury Date: Tue, 8 Nov 2022 20:12:32 +0000 Subject: [PATCH 11/14] Removing timeout for export apps - #8589. --- packages/server/src/api/controllers/backup.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/server/src/api/controllers/backup.ts b/packages/server/src/api/controllers/backup.ts index 0ffda2c733..53e1bd1792 100644 --- a/packages/server/src/api/controllers/backup.ts +++ b/packages/server/src/api/controllers/backup.ts @@ -5,6 +5,8 @@ import { isQsTrue } from "../../utilities" export async function exportAppDump(ctx: any) { let { appId, excludeRows } = ctx.query + // remove the 120 second limit for the request + ctx.req.setTimeout(0) const appName = decodeURI(ctx.query.appname) excludeRows = isQsTrue(excludeRows) const backupIdentifier = `${appName}-export-${new Date().getTime()}.tar.gz` From 7db103cd6e0cec34069ff8eeb7731b770c0e2988 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Tue, 8 Nov 2022 20:44:21 +0000 Subject: [PATCH 12/14] v2.1.21 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 8 ++++---- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/sdk/package.json | 2 +- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lerna.json b/lerna.json index c2882bda9d..6275d78747 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.1.20", + "version": "2.1.21", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 1207b9f9d9..8ef3588b7f 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.1.20", + "version": "2.1.21", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "^2.1.20", + "@budibase/types": "^2.1.21", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 069f4bc3ab..cb0a06aece 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "2.1.20", + "version": "2.1.21", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "^1.2.1", - "@budibase/string-templates": "^2.1.20", + "@budibase/string-templates": "^2.1.21", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 78d189f290..8b55d1e955 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.1.20", + "version": "2.1.21", "license": "GPL-3.0", "private": true, "scripts": { @@ -71,10 +71,10 @@ } }, "dependencies": { - "@budibase/bbui": "^2.1.20", - "@budibase/client": "^2.1.20", - "@budibase/frontend-core": "^2.1.20", - "@budibase/string-templates": "^2.1.20", + "@budibase/bbui": "^2.1.21", + "@budibase/client": "^2.1.21", + "@budibase/frontend-core": "^2.1.21", + "@budibase/string-templates": "^2.1.21", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 7c053f4e57..a390614cd2 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.1.20", + "version": "2.1.21", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,9 +26,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "^2.1.20", - "@budibase/string-templates": "^2.1.20", - "@budibase/types": "^2.1.20", + "@budibase/backend-core": "^2.1.21", + "@budibase/string-templates": "^2.1.21", + "@budibase/types": "^2.1.21", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index 5dcd4465ee..0c51890dff 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.1.20", + "version": "2.1.21", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^2.1.20", - "@budibase/frontend-core": "^2.1.20", - "@budibase/string-templates": "^2.1.20", + "@budibase/bbui": "^2.1.21", + "@budibase/frontend-core": "^2.1.21", + "@budibase/string-templates": "^2.1.21", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 26f490429e..7b87b2f5ac 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "2.1.20", + "version": "2.1.21", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^2.1.20", + "@budibase/bbui": "^2.1.21", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 0e25847f31..1475a862c8 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.1.20", + "version": "2.1.21", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index 0e74bbbd27..e2c1112bbd 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.1.20", + "version": "2.1.21", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -77,11 +77,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "^2.1.20", - "@budibase/client": "^2.1.20", + "@budibase/backend-core": "^2.1.21", + "@budibase/client": "^2.1.21", "@budibase/pro": "2.1.20", - "@budibase/string-templates": "^2.1.20", - "@budibase/types": "^2.1.20", + "@budibase/string-templates": "^2.1.21", + "@budibase/types": "^2.1.21", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index b0ae4d9226..58e0354181 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.1.20", + "version": "2.1.21", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 2014dbd05f..66dfd92698 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.1.20", + "version": "2.1.21", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index f5d5ccbfaa..1d475246ef 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.1.20", + "version": "2.1.21", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^2.1.20", + "@budibase/backend-core": "^2.1.21", "@budibase/pro": "2.1.20", - "@budibase/string-templates": "^2.1.20", - "@budibase/types": "^2.1.20", + "@budibase/string-templates": "^2.1.21", + "@budibase/types": "^2.1.21", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 0a5cdeb886e47841b2d2b090da2c94bb3a7938ca Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Tue, 8 Nov 2022 20:48:06 +0000 Subject: [PATCH 13/14] Update pro version to 2.1.21 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index e2c1112bbd..577aac9c9c 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "^2.1.21", "@budibase/client": "^2.1.21", - "@budibase/pro": "2.1.20", + "@budibase/pro": "2.1.21", "@budibase/string-templates": "^2.1.21", "@budibase/types": "^2.1.21", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 0d9e19c527..452e0afb39 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1094,12 +1094,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.1.20": - version "2.1.20" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.20.tgz#3df3b9f69379640a1d4c474b8713493c55c6ddaa" - integrity sha512-y+QM3ddle2FZggrq3nNcAuYd5Sl9zMabFBVL/NPE3aW1dEO51C2D2mqEVhwqk80nEZTp4qzt69lJEJEtT0stEw== +"@budibase/backend-core@2.1.21": + version "2.1.21" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.21.tgz#6e473385dd6329229e54a3299a261b44568721ee" + integrity sha512-ktfXBNzRuRUeAhmZ0EnEyTNteHcMGsY6AK8+j+nEJzdc6zP/6DMSISXJcGG8SkXT77fWQkem69ao21/XN5r+ZQ== dependencies: - "@budibase/types" "^2.1.20" + "@budibase/types" "^2.1.21" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -1181,13 +1181,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@2.1.20": - version "2.1.20" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.20.tgz#641344899e42c5918f711d6d13fc71dbd994d0e3" - integrity sha512-GSo6WsG4hn/QbWAeYVwsdHeI9tRL/FaXwq89xamlyBHHcIFvZZ/fCU7WiRg+49gYTrGmzX3ZsoHaddAJU1xkLw== +"@budibase/pro@2.1.21": + version "2.1.21" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.21.tgz#f5a73c47f2e8eebdf0b86bcfe9d1bf30c7be5f6b" + integrity sha512-nNouTv7RwRc0XtxNWimrkaoYyqFO+9ZIgJsEaFhzDv/p4D6i0tggyMkAC3TDSZNuPPzxMq/3pThjrdt7LBW/DQ== dependencies: - "@budibase/backend-core" "2.1.20" - "@budibase/types" "2.1.20" + "@budibase/backend-core" "2.1.21" + "@budibase/types" "2.1.21" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" @@ -1211,10 +1211,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@2.1.20", "@budibase/types@^2.1.20": - version "2.1.20" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.20.tgz#6c56c26caa67e259f27230ccd66fc900edef2092" - integrity sha512-OpumVq+Gt3jhCdr4yXzibymT4bc+E2aFBZ/+YHVCz1WidamTQn6iwIDLmSxz6OoyAi7cHk38afTRy0ZyFkZwhw== +"@budibase/types@2.1.21", "@budibase/types@^2.1.21": + version "2.1.21" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.21.tgz#ff607f0979e710f68469b0a586b3dc835ceaf236" + integrity sha512-KSvvUj2DQECVsZ2xbh0jsPz6u/WfoIQbkzsJa7wdRcC9goQ5fDdjLtHZrLDKKBRV9ceSVh0021BxFQ705+CaEA== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index 1d475246ef..979551c3fc 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -37,7 +37,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^2.1.21", - "@budibase/pro": "2.1.20", + "@budibase/pro": "2.1.21", "@budibase/string-templates": "^2.1.21", "@budibase/types": "^2.1.21", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 7bb34537e7..4647252bcc 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -291,12 +291,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.1.20": - version "2.1.20" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.20.tgz#3df3b9f69379640a1d4c474b8713493c55c6ddaa" - integrity sha512-y+QM3ddle2FZggrq3nNcAuYd5Sl9zMabFBVL/NPE3aW1dEO51C2D2mqEVhwqk80nEZTp4qzt69lJEJEtT0stEw== +"@budibase/backend-core@2.1.21": + version "2.1.21" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.21.tgz#6e473385dd6329229e54a3299a261b44568721ee" + integrity sha512-ktfXBNzRuRUeAhmZ0EnEyTNteHcMGsY6AK8+j+nEJzdc6zP/6DMSISXJcGG8SkXT77fWQkem69ao21/XN5r+ZQ== dependencies: - "@budibase/types" "^2.1.20" + "@budibase/types" "^2.1.21" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -328,22 +328,22 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@2.1.20": - version "2.1.20" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.20.tgz#641344899e42c5918f711d6d13fc71dbd994d0e3" - integrity sha512-GSo6WsG4hn/QbWAeYVwsdHeI9tRL/FaXwq89xamlyBHHcIFvZZ/fCU7WiRg+49gYTrGmzX3ZsoHaddAJU1xkLw== +"@budibase/pro@2.1.21": + version "2.1.21" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.21.tgz#f5a73c47f2e8eebdf0b86bcfe9d1bf30c7be5f6b" + integrity sha512-nNouTv7RwRc0XtxNWimrkaoYyqFO+9ZIgJsEaFhzDv/p4D6i0tggyMkAC3TDSZNuPPzxMq/3pThjrdt7LBW/DQ== dependencies: - "@budibase/backend-core" "2.1.20" - "@budibase/types" "2.1.20" + "@budibase/backend-core" "2.1.21" + "@budibase/types" "2.1.21" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" node-fetch "^2.6.1" -"@budibase/types@2.1.20", "@budibase/types@^2.1.20": - version "2.1.20" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.20.tgz#6c56c26caa67e259f27230ccd66fc900edef2092" - integrity sha512-OpumVq+Gt3jhCdr4yXzibymT4bc+E2aFBZ/+YHVCz1WidamTQn6iwIDLmSxz6OoyAi7cHk38afTRy0ZyFkZwhw== +"@budibase/types@2.1.21", "@budibase/types@^2.1.21": + version "2.1.21" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.21.tgz#ff607f0979e710f68469b0a586b3dc835ceaf236" + integrity sha512-KSvvUj2DQECVsZ2xbh0jsPz6u/WfoIQbkzsJa7wdRcC9goQ5fDdjLtHZrLDKKBRV9ceSVh0021BxFQ705+CaEA== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From 62f65d3c16eea91fa145e1282699f2836b351d9c Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 9 Nov 2022 11:33:57 +0000 Subject: [PATCH 14/14] Updating nginx conf to allow export a lot longer period before timeout. --- hosting/nginx.dev.conf.hbs | 9 +++++++++ hosting/nginx.prod.conf.hbs | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/hosting/nginx.dev.conf.hbs b/hosting/nginx.dev.conf.hbs index 39a8dc52af..7bc8100e45 100644 --- a/hosting/nginx.dev.conf.hbs +++ b/hosting/nginx.dev.conf.hbs @@ -66,6 +66,15 @@ http { proxy_set_header Connection ""; } + location /api/backups/ { + proxy_read_timeout 1800s; + proxy_connect_timeout 1800s; + proxy_send_timeout 1800s; + proxy_pass http://app-service; + proxy_http_version 1.1; + proxy_set_header Connection ""; + } + location /api/ { proxy_read_timeout 120s; proxy_connect_timeout 120s; diff --git a/hosting/nginx.prod.conf.hbs b/hosting/nginx.prod.conf.hbs index 114a4575d0..fe6f2529d3 100644 --- a/hosting/nginx.prod.conf.hbs +++ b/hosting/nginx.prod.conf.hbs @@ -116,6 +116,15 @@ http { rewrite ^/worker/(.*)$ /$1 break; } + location /api/backups/ { + proxy_read_timeout 1800s; + proxy_connect_timeout 1800s; + proxy_send_timeout 1800s; + proxy_pass http://app-service; + proxy_http_version 1.1; + proxy_set_header Connection ""; + } + location /api/ { # calls to the API are rate limited with bursting limit_req zone=ratelimit burst=20 nodelay;