Skip to content

anbeime/skill / antinet-agentteams/skills/security-scan

security-scan

Verified

对进入系统的文件或 URL 执行安全与合规扫描,输出 pass/reject 判定与扫描报告,作为所有文档处理的强制前置关卡。

FileKindSize
SKILL.mdskill md2.2 KB
scripts/run_security_scan.pyscript2.5 KB

scripts/run_security_scan.py

View on GitHub
#!/usr/bin/env python3
"""security-scan Skill 执行脚本(锦衣卫 / jinyiwei)。

对应 AgentTeams 子任务: security-scan
真实调用: core.runtime.AgentSession.run_stage("security-scan")
          -> security.jinyiwei.JinYiWeiAgent.scan()

零外部依赖,可离线运行。证明每个 AgentTeams Worker 背后都是可执行代码,
而非规划文档。
"""
from __future__ import annotations
import os
import sys
import json
import argparse

HERE = os.path.dirname(os.path.abspath(__file__))
SKILLS_ROOT = os.path.dirname(os.path.dirname(HERE))
PKG = os.path.dirname(SKILLS_ROOT)
sys.path.insert(0, os.path.join(PKG, "core"))

from runtime import AgentSession  # noqa: E402


def _safe(o):
    if hasattr(o, "to_dict"):
        return o.to_dict()
    if isinstance(o, (list, tuple)):
        return [_safe(x) for x in o]
    if isinstance(o, dict):
        return {k: _safe(v) for k, v in o.items()}
    if isinstance(o, (str, int, float, bool)) or o is None:
        return o
    return str(o)


def main() -> None:
    ap = argparse.ArgumentParser(description="security-scan skill runner")
    ap.add_argument("--topic", default=None, help="可选:覆盖默认调研主题")
    args = ap.parse_args()

    sess = AgentSession(PKG)
    if args.topic:
        sess.cfg["project"]["topic_example"] = args.topic

    result = sess.run_stage("security-scan")  # {"yellows":[Card], "scan_report":{...}}
    scan_report = result["scan_report"]
    intercepted = scan_report.get("intercepted_papers", [])

    payload = {
        "skill": "security-scan",
        "stage": "security-scan",
        "worker": "jinyiwei(锦衣卫)",
        "passed": len(intercepted) == 0,
        "intercepted_count": len(intercepted),
        "intercepted": _safe(intercepted),
        "no_local_cache_as_production": scan_report.get("no_local_cache_as_production"),
        "yellow_cards": _safe(result["yellows"]),
        "scan_report": _safe(scan_report),
    }

    out_dir = os.path.join(PKG, "examples", "snse_survey", "skill_outputs")
    os.makedirs(out_dir, exist_ok=True)
    out_path = os.path.join(out_dir, "security_scan.json")
    with open(out_path, "w", encoding="utf-8") as f:
        json.dump(payload, f, ensure_ascii=False, indent=2)

    print(f"[security-scan] verdict={'PASS' if payload['passed'] else 'REJECT'}"
          f" intercepted={payload['intercepted_count']}"
          f" yellows={len(payload['yellow_cards'])}")
    print(f"[security-scan] -> {out_path}")


if __name__ == "__main__":
    main()
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 193kUpdated Claude CodeCodexVerifiedInstall