Files
Charon/docs/reports/qa_report.md
GitHub Actions 71e44f79a7 fix: resolve CrowdSec state sync issues and remove deprecated mode toggle
- 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.
2025-12-15 23:36:07 +00:00

170 lines
4.1 KiB
Markdown

# 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
```bash
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
```bash
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:
1. **CrowdSecConfig.test.tsx**
- Removed: `toggles mode between local and disabled`
- Added: `shows info banner directing to Security Dashboard`
2. **CrowdSecConfig.spec.tsx**
- Removed: `persists crowdsec.mode via settings when changed`
- Added: `shows info banner directing to Security Dashboard for mode control`
- Removed unused `settingsApi` import
3. **CrowdSecConfig.coverage.test.tsx**
- Removed: `toggles mode success and error`
- Added: `shows info banner directing to Security Dashboard`
- Removed mode toggle loading overlay test
4. **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` - added `statusCrowdsec` mock with `running: true`
5. **Security.dashboard.test.tsx**
- Fixed: `should display threat protection descriptions for each card` - added `statusCrowdsec` mock with `running: true`
6. **Security.test.tsx**
- Fixed: `should display threat protection summaries` - added `statusCrowdsec` mock with `running: true`
---
## 3. TypeScript Check
```bash
npm run type-check
```
**Result:** ✅ PASS - No errors
---
## 4. Frontend Linting
```bash
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
```bash
go vet ./...
```
**Result:** ✅ PASS - No issues
---
## 6. Build Verification
### Backend Build
```bash
go build ./...
```
**Result:** ✅ PASS
### Frontend Build
```bash
npm run build
```
**Result:** ✅ PASS - 5.28s build time
---
## Changes Verified
### Backend Changes
1.`crowdsec_handler.go` - Start/Stop now sync settings table
2.`crowdsec_handler_state_sync_test.go` - New tests pass
### Frontend Changes
1.`Security.tsx` - Toggle now uses `crowdsecStatus?.running`
2.`LiveLogViewer.tsx` - Fixed isPaused dependency, now uses ref
3.`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**