feat: Update security notification settings and enhance compatibility for legacy configurations
This commit is contained in:
@@ -89,7 +89,7 @@ describe('notifications api', () => {
|
||||
})
|
||||
|
||||
it('reads and updates security notification settings', async () => {
|
||||
vi.mocked(client.get).mockResolvedValueOnce({ data: { enabled: true, min_log_level: 'info', notify_waf_blocks: true } })
|
||||
vi.mocked(client.get).mockResolvedValueOnce({ data: { enabled: true, min_log_level: 'info', security_waf_enabled: true, security_acl_enabled: false, security_rate_limit_enabled: true } })
|
||||
const settings = await getSecurityNotificationSettings()
|
||||
expect(settings.enabled).toBe(true)
|
||||
expect(client.get).toHaveBeenCalledWith('/notifications/settings/security')
|
||||
|
||||
@@ -135,8 +135,8 @@ describe('notifications api', () => {
|
||||
})
|
||||
|
||||
it('reads and updates security notification settings', async () => {
|
||||
mockedClient.get.mockResolvedValueOnce({ data: { enabled: true, min_log_level: 'info', notify_waf_blocks: true, notify_acl_denials: false, notify_rate_limit_hits: true } })
|
||||
mockedClient.put.mockResolvedValueOnce({ data: { enabled: false, min_log_level: 'error', notify_waf_blocks: false, notify_acl_denials: true, notify_rate_limit_hits: false } })
|
||||
mockedClient.get.mockResolvedValueOnce({ data: { enabled: true, min_log_level: 'info', security_waf_enabled: true, security_acl_enabled: false, security_rate_limit_enabled: true } })
|
||||
mockedClient.put.mockResolvedValueOnce({ data: { enabled: false, min_log_level: 'error', security_waf_enabled: false, security_acl_enabled: true, security_rate_limit_enabled: false } })
|
||||
|
||||
const settings = await getSecurityNotificationSettings()
|
||||
expect(settings.enabled).toBe(true)
|
||||
|
||||
@@ -14,6 +14,10 @@ export interface NotificationProvider {
|
||||
notify_domains: boolean;
|
||||
notify_certs: boolean;
|
||||
notify_uptime: boolean;
|
||||
notify_security_waf_blocks: boolean;
|
||||
notify_security_acl_denies: boolean;
|
||||
notify_security_rate_limit_hits: boolean;
|
||||
managed_legacy_security?: boolean;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
@@ -173,10 +177,15 @@ export const previewExternalTemplate = async (templateId?: string, template?: st
|
||||
export interface SecurityNotificationSettings {
|
||||
enabled: boolean;
|
||||
min_log_level: string;
|
||||
notify_waf_blocks: boolean;
|
||||
notify_acl_denials: boolean;
|
||||
notify_rate_limit_hits: boolean;
|
||||
security_waf_enabled: boolean;
|
||||
security_acl_enabled: boolean;
|
||||
security_rate_limit_enabled: boolean;
|
||||
destination_ambiguous?: boolean;
|
||||
webhook_url?: string;
|
||||
discord_webhook_url?: string;
|
||||
slack_webhook_url?: string;
|
||||
gotify_url?: string;
|
||||
gotify_token?: string;
|
||||
email_recipients?: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user