feat: Enhance LiveLogViewer with Security Mode and related tests

- Updated LiveLogViewer to support a new security mode, allowing for the display of security logs.
- Implemented mock functions for connecting to security logs in tests.
- Added tests for rendering, filtering, and displaying security log entries, including blocked requests and source filtering.
- Modified Security page to utilize the new security mode in LiveLogViewer.
- Updated Security page tests to reflect changes in log viewer and ensure proper rendering of security-related components.
- Introduced a new script for CrowdSec startup testing, ensuring proper configuration and parser installation.
- Added pre-flight checks in the CrowdSec integration script to verify successful startup and configuration.
This commit is contained in:
GitHub Actions
2025-12-12 22:18:28 +00:00
parent 7da24a2ffb
commit 4b49ec5f2b
29 changed files with 5900 additions and 107 deletions

View File

@@ -281,11 +281,11 @@ describe('Security Page - QA Security Audit', () => {
await waitFor(() => screen.getByText(/Cerberus Dashboard/i))
// All 4 cards should be present
expect(screen.getByText('CrowdSec')).toBeInTheDocument()
expect(screen.getByText('Access Control')).toBeInTheDocument()
expect(screen.getByText('Coraza')).toBeInTheDocument()
expect(screen.getByText('Rate Limiting')).toBeInTheDocument()
// All 4 cards should be present (use getAllByText since text may appear in multiple places like filter dropdowns)
expect(screen.getAllByText('CrowdSec').length).toBeGreaterThanOrEqual(1)
expect(screen.getAllByText('Access Control').length).toBeGreaterThanOrEqual(1)
expect(screen.getAllByText('Coraza').length).toBeGreaterThanOrEqual(1)
expect(screen.getAllByText('Rate Limiting').length).toBeGreaterThanOrEqual(1)
})
})
@@ -329,8 +329,8 @@ describe('Security Page - QA Security Audit', () => {
const cards = screen.getAllByRole('heading', { level: 3 })
const cardNames = cards.map(card => card.textContent)
// Spec requirement from current_spec.md plus Live Security Logs feature
expect(cardNames).toEqual(['CrowdSec', 'Access Control', 'Coraza', 'Rate Limiting', 'Live Security Logs'])
// Spec requirement from current_spec.md plus Security Access Logs feature
expect(cardNames).toEqual(['CrowdSec', 'Access Control', 'Coraza', 'Rate Limiting', 'Security Access Logs'])
})
it('layer indicators match spec descriptions', async () => {