36 行
1.2 KiB
Python
36 行
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
from typing import Any, Dict, List
|
|
|
|
from lab.config import ENV_CATALOG_DIR, REPRO_MAP_PATH, REPRO_PROFILES_DIR
|
|
from lab.utils import read_yaml
|
|
|
|
|
|
def validate_assets() -> List[str]:
|
|
errors: List[str] = []
|
|
if not REPRO_MAP_PATH.exists():
|
|
errors.append(f"missing repro map: {REPRO_MAP_PATH}")
|
|
if not ENV_CATALOG_DIR.exists():
|
|
errors.append(f"missing environment catalog dir: {ENV_CATALOG_DIR}")
|
|
for path in sorted(REPRO_PROFILES_DIR.rglob("*.yaml")):
|
|
content = read_yaml(path, default=None)
|
|
if not isinstance(content, dict):
|
|
errors.append(f"invalid repro profile yaml: {path}")
|
|
continue
|
|
for field in [
|
|
"profile_id",
|
|
"match_rules",
|
|
"vuln_family",
|
|
"provisioning_mode",
|
|
"attack_actions",
|
|
"baseline_actions",
|
|
"success_criteria",
|
|
"cleanup_policy",
|
|
"destructive_risk",
|
|
"allowed_target_types",
|
|
]:
|
|
if field not in content:
|
|
errors.append(f"repro profile missing {field}: {path}")
|
|
return errors
|