Nền tảng quản lý bảo mật cho doanh nghiệp với các tính năng:
- Quản lý lỗ hổng bảo mật (Vulnerability Management)
- Công cụ DAST (Dynamic Application Security Testing)
- Công cụ SAST (Static Application Security Testing)
- Quản lý vòng đời lỗ hổng (Vulnerability Lifecycle)
- Quản lý Compliance (SOC 2, PCI/DSS, ISO 27001)
/app
├── /core # Config, Security, Database connection
├── /api # API Endpoints (FastAPI routers)
│ ├── /auth # Login, Register
│ ├── /tenants # CRUD Tenant, Project
│ ├── /vulns # Vulnerability Management
│ └── /compliance # Compliance Mapping
├── /worker # Celery workers
│ ├── /agents # AI Agent Logic (LangGraph)
│ ├── /mcp_server # Các tool wrappers (NmapWrapper, FfufWrapper)
│ └── /parsers # Đọc output XML/JSON của tool chuyển về DB
├── /models # SQLModel models
└── /services # Business Logic
Cách đơn giản nhất để chạy toàn bộ stack (Backend + Frontend + Database + Redis):
# Build và chạy tất cả services
docker-compose up -d
# Xem logs
docker-compose logs -f
# Dừng tất cả services
docker-compose downSau khi chạy, truy cập:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/docs
Lưu ý: Khi backend khởi động lần đầu, hệ thống sẽ tự động tạo Super Admin account. Xem logs để lấy password:
docker-compose logs backend | grep "Super Admin Password"- Tạo virtual environment:
python -m venv venv
source venv/bin/activate # Linux/Mac
# hoặc
venv\Scripts\activate # Windows- Cài đặt dependencies:
pip install -r requirements.txt- Tạo file
.envtừ.env.examplevà cấu hình:
cp env.example .env
# Chỉnh sửa .env với thông tin database, Redis, etc.- Chạy migrations (nếu cần):
alembic revision --autogenerate -m "Initial migration"
alembic upgrade head- Chạy server:
python run.py
# hoặc
uvicorn app.main:app --reloadLưu ý: Khi server khởi động lần đầu, hệ thống sẽ tự động:
- Khởi tạo database và tạo các tables
- Tạo tài khoản Super Admin với thông tin:
- Email:
admin@s4e.com - Username:
admin - Password: Sẽ được tạo ngẫu nhiên và hiển thị trong log
- Email:
Quan trọng: Hãy lưu lại password Super Admin được hiển thị trong log khi deploy!
- Chạy Celery worker (terminal khác):
celery -A app.worker.celery_app worker --loglevel=info
# hoặc
python run_worker.py- Cài đặt dependencies:
cd frontend
npm install- Chạy development server:
npm run devFrontend sẽ chạy tại http://localhost:3000
- Build production:
npm run buildSau khi chạy server, truy cập:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
Frontend được xây dựng với React + Vite + Ant Design. Xem chi tiết trong frontend/README.md
cd frontend
npm install
npm run devcd frontend
npm run buildFrontend sẽ được serve qua Nginx trong Docker container.
POST /api/auth/register- Đăng ký user mớiPOST /api/auth/login- Đăng nhậpGET /api/auth/me- Lấy thông tin user hiện tại
GET /api/users/- Danh sách usersGET /api/users/{id}- Chi tiết userPOST /api/users/- Tạo user mớiPUT /api/users/{id}- Cập nhật userDELETE /api/users/{id}- Xóa user (Chỉ Super Admin)PUT /api/users/{id}/password- Đổi password cho user
POST /api/tenants/- Tạo tenant (Super Admin)GET /api/tenants/- Danh sách tenantsGET /api/tenants/{id}- Chi tiết tenantPUT /api/tenants/{id}- Cập nhật tenantDELETE /api/tenants/{id}- Xóa tenant (Super Admin)
POST /api/projects/- Tạo projectGET /api/projects/- Danh sách projectsGET /api/projects/{id}- Chi tiết projectPOST /api/projects/{id}/targets- Tạo target trong projectGET /api/projects/{id}/targets- Danh sách targets
POST /api/vulns/- Tạo vulnerabilityGET /api/vulns/- Danh sách vulnerabilitiesGET /api/vulns/{id}- Chi tiết vulnerabilityPUT /api/vulns/{id}- Cập nhật vulnerabilityPOST /api/vulns/{id}/verify- Verify vulnerability (Pentester)POST /api/vulns/{id}/mark-fixed- Mark as fixed (Developer)GET /api/vulns/{id}/lifecycle- Lịch sử thay đổi trạng thái
POST /api/scan/targets/{id}/scan- Bắt đầu scanGET /api/scan/tasks/{task_id}/status- Trạng thái scan task
POST /api/compliance/- Tạo complianceGET /api/compliance/- Danh sách compliancesPOST /api/compliance/{id}/map-vulnerability- Map vulnerability với compliance
Chạy tests:
# Chạy tất cả tests
pytest
# Chạy với verbose output
pytest -v
# Chạy một file test cụ thể
pytest tests/test_auth.py
# Chạy với coverage
pytest --cov=app --cov-report=htmlXem chi tiết về tests trong tests/README.md
- Super Admin: Quản trị toàn hệ thống, tạo Tenant, quản lý gói subscription
- Tenant Admin: Quản lý project của công ty, thêm member, xem báo cáo
- Tenant Developer/Ops: Xem lỗ hổng, cập nhật trạng thái fix
- Pentester/Security Analyst: Vận hành công cụ scan, verify lỗ hổng, viết PoC
- Auditor: Chỉ có quyền xem báo cáo Compliance (Read-only)