feat(security): add strictness settings schema, multi-auth migration, and EmergencyRecoveryService
This commit is contained in:
parent
4ac7b5d1b4
commit
f3d05db412
5 changed files with 365 additions and 1 deletions
|
|
@ -9,6 +9,28 @@ export const ThemeIdSchema = z.enum([
|
|||
'paper-light',
|
||||
]);
|
||||
|
||||
export const StepUpPolicySchema = z.enum([
|
||||
'off',
|
||||
'every-action',
|
||||
'5m',
|
||||
'1h',
|
||||
'24h',
|
||||
'session',
|
||||
]);
|
||||
|
||||
export const StepUpMethodSchema = z.enum(['totp', 'password', 'both']);
|
||||
|
||||
export const SecuritySettingsSchema = z.object({
|
||||
requireTotpOnLogin: z.boolean().default(true),
|
||||
passwordMode: z.enum(['any', 'all']).default('any'),
|
||||
totpMode: z.enum(['any', 'all']).default('any'),
|
||||
stepUpPolicy: StepUpPolicySchema.default('1h'),
|
||||
stepUpMethod: StepUpMethodSchema.default('totp'),
|
||||
elevateOnLogin: z.boolean().default(true),
|
||||
keepElevationOnSafeMode: z.boolean().default(true),
|
||||
enableEmergencySecretsBackup: z.boolean().default(true),
|
||||
});
|
||||
|
||||
export const SettingsSchema = z.object({
|
||||
version: z.literal(1).default(1),
|
||||
theme: ThemeIdSchema.default('phosphor-green'),
|
||||
|
|
@ -20,6 +42,7 @@ export const SettingsSchema = z.object({
|
|||
ptyIdleTtlSec: z.number().int().min(60).max(604800).default(43200),
|
||||
sshKeepaliveMs: z.number().int().min(5000).max(120000).default(15000),
|
||||
sshReadyTimeoutMs: z.number().int().min(3000).max(120000).default(15000),
|
||||
security: SecuritySettingsSchema.default({}),
|
||||
ai: z
|
||||
.object({
|
||||
enabled: z.boolean().default(false),
|
||||
|
|
@ -37,4 +60,7 @@ export const SettingsSchema = z.object({
|
|||
});
|
||||
|
||||
export type ThemeId = z.infer<typeof ThemeIdSchema>;
|
||||
export type StepUpPolicy = z.infer<typeof StepUpPolicySchema>;
|
||||
export type StepUpMethod = z.infer<typeof StepUpMethodSchema>;
|
||||
export type SecuritySettings = z.infer<typeof SecuritySettingsSchema>;
|
||||
export type SettingsConfig = z.infer<typeof SettingsSchema>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue