- Backend: Start/Stop handlers now sync both settings and security_configs tables - Frontend: CrowdSec toggle uses actual process status (crowdsecStatus.running) - Frontend: Fixed LiveLogViewer WebSocket race condition by using isPausedRef - Frontend: Removed deprecated mode toggle from CrowdSecConfig page - Frontend: Added info banner directing users to Security Dashboard - Frontend: Added "Start CrowdSec" button to enrollment warning panel Fixes dual-source state conflict causing toggle to show incorrect state. Fixes live log "disconnected" status appearing while logs stream. Simplifies CrowdSec control to single source (Security Dashboard toggle). Includes comprehensive test updates for new architecture.
4.1 KiB
QA Security Report - CrowdSec Fixes Verification
Date: December 15, 2025 Agent: QA_SECURITY Scope: CrowdSec fixes verification
Summary
| Category | Status | Details |
|---|---|---|
| Backend Tests | ✅ PASS | 18 packages, all tests passing |
| Frontend Tests | ✅ PASS | 91 test files, 956 tests passing, 2 skipped |
| TypeScript Check | ✅ PASS | No errors |
| Frontend Lint | ✅ PASS | 0 errors, 12 warnings (pre-existing) |
| Go Vet | ✅ PASS | No issues |
| Backend Build | ✅ PASS | Compiles successfully |
| Frontend Build | ✅ PASS | Production build successful |
Overall Status: ✅ PASS
1. Backend Tests
go test ./...
Result: All 18 packages pass
| Package | Status |
|---|---|
| cmd/api | ✅ PASS |
| cmd/seed | ✅ PASS |
| internal/api/handlers | ✅ PASS |
| internal/api/middleware | ✅ PASS |
| internal/api/routes | ✅ PASS |
| internal/api/tests | ✅ PASS |
| internal/caddy | ✅ PASS |
| internal/cerberus | ✅ PASS |
| internal/config | ✅ PASS |
| internal/crowdsec | ✅ PASS |
| internal/database | ✅ PASS |
| internal/logger | ✅ PASS |
| internal/metrics | ✅ PASS |
| internal/models | ✅ PASS |
| internal/server | ✅ PASS |
| internal/services | ✅ PASS |
| internal/util | ✅ PASS |
| internal/version | ✅ PASS |
2. Frontend Tests
npm run test
Result: 91 test files pass, 956 tests pass, 2 skipped
Tests Fixed During QA
The following tests were updated to match the new CrowdSec architecture where mode is controlled via the Security Dashboard toggle:
-
CrowdSecConfig.test.tsx
- Removed:
toggles mode between local and disabled - Added:
shows info banner directing to Security Dashboard
- Removed:
-
CrowdSecConfig.spec.tsx
- Removed:
persists crowdsec.mode via settings when changed - Added:
shows info banner directing to Security Dashboard for mode control - Removed unused
settingsApiimport
- Removed:
-
CrowdSecConfig.coverage.test.tsx
- Removed:
toggles mode success and error - Added:
shows info banner directing to Security Dashboard - Removed mode toggle loading overlay test
- Removed:
-
Security.audit.test.tsx
- Fixed:
displays error toast when toggle mutation fails- corrected expected message to "Failed to start CrowdSec" (since CrowdSec is not running, toggle tries to start it) - Fixed:
threat summaries match spec when services enabled- addedstatusCrowdsecmock withrunning: true
- Fixed:
-
Security.dashboard.test.tsx
- Fixed:
should display threat protection descriptions for each card- addedstatusCrowdsecmock withrunning: true
- Fixed:
-
Security.test.tsx
- Fixed:
should display threat protection summaries- addedstatusCrowdsecmock withrunning: true
- Fixed:
3. TypeScript Check
npm run type-check
Result: ✅ PASS - No errors
4. Frontend Linting
npm run lint
Result: ✅ PASS - 0 errors, 12 warnings
Warnings are pre-existing and not related to CrowdSec fixes:
@typescript-eslint/no-unused-vars(1)@typescript-eslint/no-explicit-any(10)react-hooks/exhaustive-deps(1)
5. Go Vet
go vet ./...
Result: ✅ PASS - No issues
6. Build Verification
Backend Build
go build ./...
Result: ✅ PASS
Frontend Build
npm run build
Result: ✅ PASS - 5.28s build time
Changes Verified
Backend Changes
- ✅
crowdsec_handler.go- Start/Stop now sync settings table - ✅
crowdsec_handler_state_sync_test.go- New tests pass
Frontend Changes
- ✅
Security.tsx- Toggle now usescrowdsecStatus?.running - ✅
LiveLogViewer.tsx- Fixed isPaused dependency, now uses ref - ✅
CrowdSecConfig.tsx- Removed mode toggle, added info banner and Start button
Conclusion
All CrowdSec fixes have been verified. The changes properly sync CrowdSec state between the frontend and backend. Test suites were updated to reflect the new architecture where CrowdSec mode is controlled via the Security Dashboard toggle rather than a separate mode toggle on the CrowdSec Config page.
QA Status: ✅ APPROVED