@budibase/worker 3.18.4 → 3.18.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/worker",
3
3
  "email": "hi@budibase.com",
4
- "version": "3.18.4",
4
+ "version": "3.18.5",
5
5
  "description": "Budibase background service",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -109,5 +109,5 @@
109
109
  }
110
110
  }
111
111
  },
112
- "gitHead": "b82c05d3d0949d198b49415d20980e72cc61ca5b"
112
+ "gitHead": "ed229ab880f5eeb626d86fd1131e2e6e88f98f6b"
113
113
  }
@@ -1,18 +1,15 @@
1
- import * as email from "../../../utilities/email"
2
- import env from "../../../environment"
3
- import * as auth from "./auth"
4
1
  import {
5
2
  BadRequestError,
6
- ForbiddenError,
7
3
  cache,
8
4
  configs,
9
- db as dbCore,
10
5
  env as coreEnv,
6
+ db as dbCore,
11
7
  events,
8
+ ForbiddenError,
12
9
  objectStore,
13
10
  tenancy,
14
11
  } from "@budibase/backend-core"
15
- import { checkAnyUserExists } from "../../../utilities/users"
12
+ import * as pro from "@budibase/pro"
16
13
  import {
17
14
  AIInnerConfig,
18
15
  Config,
@@ -44,7 +41,10 @@ import {
44
41
  UploadConfigFileResponse,
45
42
  UserCtx,
46
43
  } from "@budibase/types"
47
- import * as pro from "@budibase/pro"
44
+ import env from "../../../environment"
45
+ import * as email from "../../../utilities/email"
46
+ import { checkAnyUserExists } from "../../../utilities/users"
47
+ import * as auth from "./auth"
48
48
 
49
49
  const getEventFns = async (config: Config, existing?: Config) => {
50
50
  const fns = []
@@ -241,6 +241,8 @@ async function processOIDCConfig(config: OIDCConfigs, existing?: OIDCConfigs) {
241
241
  throw new Error("License does not allow OIDC PKCE method support")
242
242
  }
243
243
 
244
+ config.configs.filter(c => c.pkce === null).forEach(c => delete c.pkce)
245
+
244
246
  if (existing) {
245
247
  for (const c of config.configs) {
246
248
  const existingConfig = existing.configs.find(e => e.uuid === c.uuid)
@@ -1,7 +1,7 @@
1
- import * as controller from "../../controllers/global/configs"
2
1
  import { auth } from "@budibase/backend-core"
3
- import Joi from "joi"
4
2
  import { ConfigType, PKCEMethod } from "@budibase/types"
3
+ import Joi from "joi"
4
+ import * as controller from "../../controllers/global/configs"
5
5
  import { adminRoutes, loggedInRoutes } from "../endpointGroups"
6
6
 
7
7
  function smtpValidation() {
@@ -51,7 +51,7 @@ function oidcValidation() {
51
51
  uuid: Joi.string().required(),
52
52
  activated: Joi.boolean().required(),
53
53
  scopes: Joi.array().optional(),
54
- pkce: Joi.string().valid(...Object.values(PKCEMethod)).optional()
54
+ pkce: Joi.string().valid(...Object.values(PKCEMethod)).optional().allow(null)
55
55
  })
56
56
  ).required()
57
57
  }).unknown(true)
@@ -1,9 +1,14 @@
1
1
  jest.mock("nodemailer")
2
- import { TestConfiguration, structures, mocks } from "../../../../tests"
2
+ import { configs, events } from "@budibase/backend-core"
3
+ import {
4
+ Config,
5
+ ConfigType,
6
+ GetPublicSettingsResponse,
7
+ PKCEMethod,
8
+ } from "@budibase/types"
9
+ import { TestConfiguration, mocks, structures } from "../../../../tests"
3
10
 
4
11
  mocks.email.mock()
5
- import { configs, events } from "@budibase/backend-core"
6
- import { GetPublicSettingsResponse, Config, ConfigType } from "@budibase/types"
7
12
 
8
13
  const { google, smtp, settings, oidc } = structures.configs
9
14
 
@@ -13,6 +18,7 @@ describe("configs", () => {
13
18
  beforeEach(async () => {
14
19
  await config.beforeAll()
15
20
  jest.clearAllMocks()
21
+ mocks.licenses.usePkceOidc()
16
22
  })
17
23
 
18
24
  afterAll(async () => {
@@ -189,6 +195,24 @@ describe("configs", () => {
189
195
  "--secret-value--"
190
196
  )
191
197
  })
198
+
199
+ it("should strip pkce field when null", async () => {
200
+ await saveConfig(oidc({ pkce: null as any }))
201
+
202
+ await config.doInTenant(async () => {
203
+ const rawConf = await configs.getOIDCConfig()
204
+ expect(rawConf!).not.toHaveProperty("pkce")
205
+ })
206
+ })
207
+
208
+ it("should preserve pkce field when set to valid value", async () => {
209
+ await saveConfig(oidc({ pkce: PKCEMethod.S256 }))
210
+
211
+ await config.doInTenant(async () => {
212
+ const rawConf = await configs.getOIDCConfig()
213
+ expect(rawConf!.pkce).toBe(PKCEMethod.S256)
214
+ })
215
+ })
192
216
  })
193
217
  })
194
218