T-106: Create test_workflow_service.py with state-machine transitions for the complete test lifecycle (draft -> red_executing -> blue_evaluating -> in_review -> validated/rejected), dual validation by Red/Blue leads, and reopen capability with field cleanup. T-107: Update status_service.py to use detection_result from Blue Team instead of legacy result field, and differentiate between partial progress (some validated) vs all-in-progress states. T-108: Create atomic_import_service.py that downloads the Atomic Red Team repo as a ZIP (avoiding API rate limits), parses all atomics YAML files, and creates idempotent TestTemplate records mapped to MITRE techniques. Includes validation tests for all three tasks (19 checks total).
35 lines
805 B
Python
35 lines
805 B
Python
"""Pydantic schemas for Evidence endpoints."""
|
|
|
|
import uuid
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
from app.models.enums import TeamSide
|
|
|
|
|
|
class EvidenceOut(BaseModel):
|
|
"""Representation of an evidence record returned by the API.
|
|
|
|
``download_url`` is a presigned URL generated at response time.
|
|
"""
|
|
|
|
id: uuid.UUID
|
|
test_id: uuid.UUID
|
|
file_name: str
|
|
sha256_hash: str
|
|
uploaded_by: uuid.UUID | None = None
|
|
uploaded_at: datetime | None = None
|
|
team: TeamSide = TeamSide.red
|
|
notes: str | None = None
|
|
download_url: str | None = None
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class EvidenceUpload(BaseModel):
|
|
"""Metadata sent alongside an evidence file upload."""
|
|
|
|
team: TeamSide
|
|
notes: str | None = None
|