From 16d17cefd31b660ce84357cabc40ee0c1df45b88 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Tue, 16 Aug 2022 09:58:47 +0100 Subject: [PATCH 1/4] fix password modal length in user onboarding flow --- .../portal/manage/users/_components/PasswordModal.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/portal/manage/users/_components/PasswordModal.svelte b/packages/builder/src/pages/builder/portal/manage/users/_components/PasswordModal.svelte index 02501f2de0..e7ee28411b 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/_components/PasswordModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/_components/PasswordModal.svelte @@ -42,7 +42,7 @@ Date: Tue, 13 Sep 2022 11:44:33 +0100 Subject: [PATCH 2/4] add backend name validation for app creation / update --- packages/server/src/api/routes/application.ts | 15 +++++++++++++-- .../server/src/api/routes/utils/validators.js | 3 ++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/server/src/api/routes/application.ts b/packages/server/src/api/routes/application.ts index 49ecc2ee6f..0ebdf548e3 100644 --- a/packages/server/src/api/routes/application.ts +++ b/packages/server/src/api/routes/application.ts @@ -2,16 +2,27 @@ import Router from "@koa/router" import * as controller from "../controllers/application" import authorized from "../../middleware/authorized" import { BUILDER } from "@budibase/backend-core/permissions" +import { applicationValidator } from "./utils/validators" const router = new Router() router .post("/api/applications/:appId/sync", authorized(BUILDER), controller.sync) - .post("/api/applications", authorized(BUILDER), controller.create) + .post( + "/api/applications", + authorized(BUILDER), + applicationValidator(), + controller.create + ) .get("/api/applications/:appId/definition", controller.fetchAppDefinition) .get("/api/applications", controller.fetch) .get("/api/applications/:appId/appPackage", controller.fetchAppPackage) - .put("/api/applications/:appId", authorized(BUILDER), controller.update) + .put( + "/api/applications/:appId", + authorized(BUILDER), + applicationValidator(), + controller.update + ) .post( "/api/applications/:appId/client/update", authorized(BUILDER), diff --git a/packages/server/src/api/routes/utils/validators.js b/packages/server/src/api/routes/utils/validators.js index b43eea9e36..000c9655bc 100644 --- a/packages/server/src/api/routes/utils/validators.js +++ b/packages/server/src/api/routes/utils/validators.js @@ -10,6 +10,7 @@ const Joi = require("joi") const OPTIONAL_STRING = Joi.string().optional().allow(null).allow("") const OPTIONAL_NUMBER = Joi.number().optional().allow(null) const OPTIONAL_BOOLEAN = Joi.boolean().optional().allow(null) +const APP_NAME_REGEX = /^[\w\s]+$/ exports.tableValidator = () => { // prettier-ignore @@ -214,7 +215,7 @@ exports.applicationValidator = () => { return joiValidator.body(Joi.object({ _id: OPTIONAL_STRING, _rev: OPTIONAL_STRING, - name: Joi.string().required(), + name: Joi.string().pattern(new RegExp(APP_NAME_REGEX)).required().error(new Error('App name must be letters, numbers and spaces only')), url: OPTIONAL_STRING, template: Joi.object({ templateString: OPTIONAL_STRING, From f38856431d7f9350c03fda51be74351339ae792a Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Tue, 13 Sep 2022 17:11:37 +0100 Subject: [PATCH 3/4] fix issue with date range filtering in automations --- packages/frontend-core/src/utils/lucene.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/frontend-core/src/utils/lucene.js b/packages/frontend-core/src/utils/lucene.js index 9ed5df3895..65e472b0c2 100644 --- a/packages/frontend-core/src/utils/lucene.js +++ b/packages/frontend-core/src/utils/lucene.js @@ -108,7 +108,7 @@ export const buildLuceneQuery = filter => { query.allOr = true return } - if (type === "datetime") { + if (type === "datetime" && !isHbs) { // Ensure date value is a valid date and parse into correct format if (!value) { return @@ -218,6 +218,7 @@ export const runLuceneQuery = (docs, query) => { // Process a range match const rangeMatch = match("range", (docValue, testValue) => { + console.log("test") return ( docValue == null || docValue === "" || From 449fa7b14b8eb461359e4aea8ed8de4db35ced02 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Wed, 14 Sep 2022 11:19:09 +0100 Subject: [PATCH 4/4] remove uneeded log --- packages/frontend-core/src/utils/lucene.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/frontend-core/src/utils/lucene.js b/packages/frontend-core/src/utils/lucene.js index 65e472b0c2..33099e9f6b 100644 --- a/packages/frontend-core/src/utils/lucene.js +++ b/packages/frontend-core/src/utils/lucene.js @@ -218,7 +218,6 @@ export const runLuceneQuery = (docs, query) => { // Process a range match const rangeMatch = match("range", (docValue, testValue) => { - console.log("test") return ( docValue == null || docValue === "" ||