@contember/cli 2.2.0-alpha.20 → 2.2.0-alpha.22

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@contember/cli",
3
- "version": "2.2.0-alpha.20",
3
+ "version": "2.2.0-alpha.22",
4
4
  "license": "Apache-2.0",
5
5
  "bin": {
6
6
  "contember": "./dist/production/run.js"
@@ -37,19 +37,19 @@
37
37
  "tailwindcss": "^4.2.1"
38
38
  },
39
39
  "dependencies": {
40
- "@contember/cli-common": "2.2.0-alpha.20",
41
- "@contember/config-loader": "2.2.0-alpha.20",
42
- "@contember/database": "2.2.0-alpha.20",
43
- "@contember/dic": "2.2.0-alpha.20",
44
- "@contember/engine-common": "2.2.0-alpha.20",
45
- "@contember/engine-content-api": "2.2.0-alpha.20",
46
- "@contember/graphql-client": "2.2.0-alpha.20",
47
- "@contember/graphql-client-tenant": "2.2.0-alpha.20",
48
- "@contember/migrations-client": "2.2.0-alpha.20",
49
- "@contember/schema": "2.2.0-alpha.20",
50
- "@contember/schema-migrations": "2.2.0-alpha.20",
51
- "@contember/schema-utils": "2.2.0-alpha.20",
52
- "@contember/typesafe": "2.2.0-alpha.20",
40
+ "@contember/cli-common": "2.2.0-alpha.22",
41
+ "@contember/config-loader": "2.2.0-alpha.22",
42
+ "@contember/database": "2.2.0-alpha.22",
43
+ "@contember/dic": "2.2.0-alpha.22",
44
+ "@contember/engine-common": "2.2.0-alpha.22",
45
+ "@contember/engine-content-api": "2.2.0-alpha.22",
46
+ "@contember/graphql-client": "2.2.0-alpha.22",
47
+ "@contember/graphql-client-tenant": "2.2.0-alpha.22",
48
+ "@contember/migrations-client": "2.2.0-alpha.22",
49
+ "@contember/schema": "2.2.0-alpha.22",
50
+ "@contember/schema-migrations": "2.2.0-alpha.22",
51
+ "@contember/schema-utils": "2.2.0-alpha.22",
52
+ "@contember/typesafe": "2.2.0-alpha.22",
53
53
  "@graphql-tools/schema": "^10.0.31",
54
54
  "graphql": "^16.13.1",
55
55
  "graphql-ts-client-api": "^3.1.17",
@@ -115,8 +115,8 @@ export interface TenantRateLimitWindowState {
115
115
  /** The tenant-wide configuration returned by `Query.configuration` — the read side of {@link TenantGlobalConfig}. */
116
116
  export interface TenantConfigState {
117
117
  signup: { requireEmailVerification: boolean }
118
- emailChange: { requireVerification: boolean }
119
- passwordless: { enabled: ConfigPolicy; url: string | null; expiration: string }
118
+ emailChange: { requireVerification: boolean; requireReauthentication: boolean }
119
+ passwordless: { enabled: ConfigPolicy; url: string | null; expiration: string; uniformResponse: boolean }
120
120
  password: {
121
121
  minLength: number
122
122
  requireUppercase: number
@@ -126,6 +126,7 @@ export interface TenantConfigState {
126
126
  pattern: string | null
127
127
  checkBlacklist: boolean
128
128
  checkHibp: boolean
129
+ revokeSessionsOnChange: boolean
129
130
  }
130
131
  login: {
131
132
  baseBackoff: string
@@ -136,11 +137,13 @@ export interface TenantConfigState {
136
137
  defaultTokenExpiration: string
137
138
  maxTokenExpiration: string | null
138
139
  mfaGraceDuration: string
140
+ mfaChangeRequiresReauthentication: boolean
139
141
  anomalyDetection: {
140
142
  enabled: boolean
141
143
  historySize: number
142
144
  emailThreshold: number
143
145
  stepUpThreshold: number
146
+ missingSignalIsNew: boolean
144
147
  }
145
148
  }
146
149
  captcha: {
@@ -317,11 +320,15 @@ export class TenantProjectClient {
317
320
  const config = result.configuration
318
321
  return {
319
322
  signup: { requireEmailVerification: config.signup.requireEmailVerification },
320
- emailChange: { requireVerification: config.emailChange.requireVerification },
323
+ emailChange: {
324
+ requireVerification: config.emailChange.requireVerification,
325
+ requireReauthentication: config.emailChange.requireReauthentication,
326
+ },
321
327
  passwordless: {
322
328
  enabled: config.passwordless.enabled,
323
329
  url: config.passwordless.url ?? null,
324
330
  expiration: config.passwordless.expiration,
331
+ uniformResponse: config.passwordless.uniformResponse,
325
332
  },
326
333
  password: {
327
334
  minLength: config.password.minLength,
@@ -332,6 +339,7 @@ export class TenantProjectClient {
332
339
  pattern: config.password.pattern ?? null,
333
340
  checkBlacklist: config.password.checkBlacklist,
334
341
  checkHibp: config.password.checkHibp,
342
+ revokeSessionsOnChange: config.password.revokeSessionsOnChange,
335
343
  },
336
344
  login: {
337
345
  baseBackoff: config.login.baseBackoff,
@@ -342,11 +350,13 @@ export class TenantProjectClient {
342
350
  defaultTokenExpiration: config.login.defaultTokenExpiration,
343
351
  maxTokenExpiration: config.login.maxTokenExpiration ?? null,
344
352
  mfaGraceDuration: config.login.mfaGraceDuration,
353
+ mfaChangeRequiresReauthentication: config.login.mfaChangeRequiresReauthentication,
345
354
  anomalyDetection: {
346
355
  enabled: config.login.anomalyDetection.enabled,
347
356
  historySize: config.login.anomalyDetection.historySize,
348
357
  emailThreshold: config.login.anomalyDetection.emailThreshold,
349
358
  stepUpThreshold: config.login.anomalyDetection.stepUpThreshold,
359
+ missingSignalIsNew: config.login.anomalyDetection.missingSignalIsNew,
350
360
  },
351
361
  },
352
362
  captcha: {
@@ -230,6 +230,57 @@ describe('TenantApplyCommand', () => {
230
230
  expect(JSON.parse(stdout.text)).toEqual({ configPath: 'tenant.config.ts', dryRun: false, actions: [], warnings: [] })
231
231
  })
232
232
 
233
+ test('sends the session-revocation, re-authentication, uniform-response and strict-response-type options', async () => {
234
+ const tenantConfig: TenantConfig = {
235
+ config: {
236
+ password: { revokeSessionsOnChange: true },
237
+ emailChange: { requireReauthentication: true },
238
+ passwordless: { uniformResponse: true },
239
+ },
240
+ identityProviders: { sso: { type: 'oidc', configuration: { url: 'https://idp.test', strictResponseType: true } } },
241
+ }
242
+ const { command, output } = createCommand({ tenantConfig })
243
+
244
+ await command.run(['--json'], output)
245
+
246
+ expect(requestedVariables).toEqual([
247
+ {
248
+ config: {
249
+ password: { revokeSessionsOnChange: true },
250
+ emailChange: { requireReauthentication: true },
251
+ passwordless: { uniformResponse: true },
252
+ },
253
+ },
254
+ {},
255
+ { identityProvider: 'sso', type: 'oidc', configuration: { url: 'https://idp.test', strictResponseType: true } },
256
+ ])
257
+ })
258
+
259
+ test('an explicit false is sent, so the options can be turned off again', async () => {
260
+ const tenantConfig: TenantConfig = {
261
+ config: { password: { revokeSessionsOnChange: false }, emailChange: { requireReauthentication: false }, passwordless: { uniformResponse: false } },
262
+ }
263
+ const { command, output, stdout } = createCommand({ tenantConfig })
264
+
265
+ await command.run(['--json'], output)
266
+
267
+ expect(requestedVariables).toEqual([{ config: tenantConfig.config }])
268
+ expect(JSON.parse(stdout.text).actions).toEqual([{ action: 'configure', target: null }])
269
+ })
270
+
271
+ // the engine keeps the stored value for null on these non-nullable columns, so null must not read as a change
272
+ test('null on the options leaves them unset and skips configure', async () => {
273
+ const tenantConfig: TenantConfig = {
274
+ config: { password: { revokeSessionsOnChange: null }, emailChange: { requireReauthentication: null }, passwordless: { uniformResponse: null } },
275
+ }
276
+ const { command, output, stdout } = createCommand({ tenantConfig })
277
+
278
+ await command.run(['--json'], output)
279
+
280
+ expect(requestedUrls).toEqual([])
281
+ expect(JSON.parse(stdout.text).actions).toEqual([])
282
+ })
283
+
233
284
  test('an unresolvable project is a typed input error', async () => {
234
285
  const { command, output } = createCommand({ withProject: false })
235
286
 
@@ -556,9 +556,18 @@ describe('TenantConfigShowCommand ("tenant config show")', () => {
556
556
  responder = () => ({
557
557
  configuration: {
558
558
  signup: { requireEmailVerification: true },
559
- emailChange: { requireVerification: false },
560
- passwordless: { enabled: 'optIn', expiration: 'PT15M' },
561
- password: { minLength: 8, requireUppercase: 0, requireLowercase: 0, requireDigit: 0, requireSpecial: 0, checkBlacklist: true, checkHibp: false },
559
+ emailChange: { requireVerification: false, requireReauthentication: true },
560
+ passwordless: { enabled: 'optIn', expiration: 'PT15M', uniformResponse: true },
561
+ password: {
562
+ minLength: 8,
563
+ requireUppercase: 0,
564
+ requireLowercase: 0,
565
+ requireDigit: 0,
566
+ requireSpecial: 0,
567
+ checkBlacklist: true,
568
+ checkHibp: false,
569
+ revokeSessionsOnChange: true,
570
+ },
562
571
  login: {
563
572
  baseBackoff: 'PT1S',
564
573
  maxBackoff: 'PT1H',
@@ -567,7 +576,8 @@ describe('TenantConfigShowCommand ("tenant config show")', () => {
567
576
  revealLoginMethod: true,
568
577
  defaultTokenExpiration: 'PT30M',
569
578
  mfaGraceDuration: 'P0D',
570
- anomalyDetection: { enabled: false, historySize: 10, emailThreshold: 5, stepUpThreshold: 8 },
579
+ mfaChangeRequiresReauthentication: true,
580
+ anomalyDetection: { enabled: false, historySize: 10, emailThreshold: 5, stepUpThreshold: 8, missingSignalIsNew: true },
571
581
  },
572
582
  captcha: { protect: { signUp: false, passwordReset: false, passwordlessInit: false, emailVerification: false } },
573
583
  rateLimits: {
@@ -585,9 +595,13 @@ describe('TenantConfigShowCommand ("tenant config show")', () => {
585
595
  await new TenantConfigShowCommand(createTenantClientProvider()).run(['--json'], output)
586
596
 
587
597
  const parsed = JSON.parse(stdout.text)
588
- expect(parsed.passwordless).toEqual({ enabled: 'optIn', url: null, expiration: 'PT15M' })
598
+ expect(parsed.passwordless).toEqual({ enabled: 'optIn', url: null, expiration: 'PT15M', uniformResponse: true })
599
+ expect(parsed.emailChange).toEqual({ requireVerification: false, requireReauthentication: true })
600
+ expect(parsed.password.revokeSessionsOnChange).toBe(true)
589
601
  expect(parsed.password.pattern).toBeNull()
590
602
  expect(parsed.login.maxTokenExpiration).toBeNull()
603
+ expect(parsed.login.mfaChangeRequiresReauthentication).toBe(true)
604
+ expect(parsed.login.anomalyDetection).toEqual({ enabled: false, historySize: 10, emailThreshold: 5, stepUpThreshold: 8, missingSignalIsNew: true })
591
605
  expect(parsed.captcha).toEqual({
592
606
  provider: null,
593
607
  threshold: null,