feat(review-queue): trigger review_required on new test templates
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
Extends the review queue triggers to cover test template imports: - atomic_import_service: flags techniques when new Atomic Red Team templates are imported - caldera_import_service: same for Caldera templates - lolbas_import_service: same for LOLBAS templates - test_templates router (manual creation): flags the technique when an admin/lead creates a custom template via the API Pattern is identical to the Sigma/Elastic detection rule approach: collect new mitre_ids during the loop, bulk-update after commit. Manual creation does a single technique lookup and sets the flag inside the existing UnitOfWork. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,7 @@ from sqlalchemy.orm import Session
|
||||
from app.database import get_db
|
||||
from app.dependencies.auth import get_current_user, require_any_role
|
||||
from app.domain.unit_of_work import UnitOfWork
|
||||
from app.models.technique import Technique
|
||||
from app.models.user import User
|
||||
from app.schemas.test_template import (
|
||||
TestTemplateCreate,
|
||||
@@ -178,6 +179,15 @@ def create_template(
|
||||
"""Create a custom test template."""
|
||||
template = create_template_svc(db, **payload.model_dump())
|
||||
with UnitOfWork(db) as uow:
|
||||
# Flag the associated technique for review — new template available
|
||||
if template.mitre_technique_id:
|
||||
technique = (
|
||||
db.query(Technique)
|
||||
.filter(Technique.mitre_id == template.mitre_technique_id)
|
||||
.first()
|
||||
)
|
||||
if technique:
|
||||
technique.review_required = True
|
||||
log_action(
|
||||
db,
|
||||
user_id=current_user.id,
|
||||
|
||||
Reference in New Issue
Block a user