feat: Phase 3 - AES encryption, SQL audit engine, audit logs (85 tests)

Phase 3.1: Instance password AES-256-GCM encryption
Phase 3.2: SQL audit rule engine (10 rules)
Phase 3.3: Auto-audit on ticket creation
Phase 3.4: Operation audit logs + GET /audit/logs
Tests: 44 -> 85 (41 new), Frontend: AuditLogsPage
This commit is contained in:
logan committed 2026-05-22 13:08:55 +08:00
1 parent 27989274f5
commit 66b09e4d85
16 files changed
+1146 -6

No files matched your search

+4
View File
@@ -9,6 +9,7 @@ from app.models.instance import Instance
from app.models.audit_log import AuditLog
from app.schemas.query import QueryRequest, QueryResult
from app.services.query_service import QueryService
from app.core.crypto import decrypt_password
router = APIRouter(prefix="/query", tags=["SQL 查询"])
@@ -27,6 +28,9 @@ async def execute_query(
if not instance:
raise HTTPException(status_code=404, detail="数据源不存在")
# Decrypt password for query execution
instance.password = decrypt_password(instance.password)
try:
query_result = await QueryService.execute_query(instance, req.database, req.sql, current_user.id)
except ValueError as e: