INNER CODE UNIT · Python

run_kubescape

valqore/valqore · benchmarks/run_benchmark.py:156

def run_kubescape() -> dict:
    if not shutil.which("kubescape"):
        return {"available": False}
    data = _run_json(["kubescape", "scan", str(CORPUS), "--format", "json", "--format-version", "v2"])
    if not data:
        return {"available": False}
    # kubescape v2 JSON: summaryDetails.controls -> failed resources, or results list.
    failed = 0
    try:
        sd = data.get("summaryDetails", {}) if isinstance(data, dict) else {}
        ctrls = sd.get("controls", {}) or {}
        for c in ctrls.values():
            if (c.get("statusInfo", {}) or {}).get("status") == "failed" or c.get("failedResources", 0):
                failed += int(c.get("failedResources", 0)) or 1
    except Exception:
        pass
    return {"available": True, "failed": failed, "scope": "K8s security/posture only"}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…