feat(evaluations): enrich eval tests with attack path, criteria and data sources
Aegis CI / lint-and-test (push) Has been cancelled
Aegis CI / lint-and-test (push) Has been cancelled
- Capture Step.Description (HTML stripped), step name/number, substep ref, criteria, and data sources from MITRE ATT&CK Evaluations API - _aggregate_by_technique() now accumulates ALL occurrences per technique (multiple substep refs, criteria, step contexts) instead of keeping only the best-scoring one - New helper functions _build_procedure_text(), _build_description(), _build_red_summary() generate rich narratives from accumulated occurrences - New re_enrich_evaluation_round() service function + POST endpoint /system/attck-evaluations/re-enrich to update already-imported tests without changing detection results or validation state - Frontend: Re-enrich button per imported round + result banner in SystemPage Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -747,6 +747,41 @@ def get_pending_evaluation_count(
|
||||
return {"pending": count}
|
||||
|
||||
|
||||
@router.post("/attck-evaluations/re-enrich")
|
||||
def re_enrich_evaluation_round(
|
||||
payload: dict,
|
||||
db: Session = Depends(get_db),
|
||||
current_user: User = Depends(require_role("admin")),
|
||||
):
|
||||
"""Re-enrich already-imported evaluation tests with rich data from the MITRE API.
|
||||
|
||||
Updates procedure_text (attack path + criteria), description (data sources +
|
||||
substep references) and red_summary — without changing detection results,
|
||||
state or validation status.
|
||||
|
||||
Body: { "adversary_name": "turla", "adversary_display": "Turla", "eval_round": 5 }
|
||||
|
||||
Useful to upgrade tests that were imported before the enrichment feature
|
||||
was added.
|
||||
"""
|
||||
from app.services.attck_evaluations_service import re_enrich_evaluation_round as _re_enrich
|
||||
|
||||
adversary_name = payload.get("adversary_name", "")
|
||||
adversary_display = payload.get("adversary_display", adversary_name)
|
||||
eval_round = payload.get("eval_round", 0)
|
||||
|
||||
if not adversary_name or not eval_round:
|
||||
raise HTTPException(status_code=400, detail="adversary_name and eval_round are required")
|
||||
|
||||
try:
|
||||
summary = _re_enrich(db, adversary_name, adversary_display, eval_round, current_user)
|
||||
except Exception as exc:
|
||||
logger.error("ATT&CK Evaluation re-enrich failed: %s", exc, exc_info=True)
|
||||
raise HTTPException(status_code=502, detail=f"Re-enrich failed: {exc}")
|
||||
|
||||
return summary
|
||||
|
||||
|
||||
@router.post("/email-test")
|
||||
def send_test_email(
|
||||
payload: EmailTestRequest,
|
||||
|
||||
Reference in New Issue
Block a user