更新: 359 个文件 - 2026-03-16 23:30:01
这个提交包含在:
35
scripts/lab/validators.py
普通文件
35
scripts/lab/validators.py
普通文件
@@ -0,0 +1,35 @@
|
||||
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
|
||||
在新工单中引用
屏蔽一个用户