import html import json import sys def bandit_rows(path): for r in json.load(open(path, encoding="utf-8"))["results"]: where = f'{r["filename"]}:{r["line_number"]}' yield "Bandit", r["issue_severity"], r["test_id"], where, r["issue_text"] def semgrep_rows(path): run = json.load(open(path, encoding="utf-8"))["runs"][0] levels = {r["id"]: r.get("defaultConfiguration", {}).get("level", "error") for r in run["tool"]["driver"]["rules"]} for r in run["results"]: loc = r["locations"][0]["physicalLocation"] where = f'{loc["artifactLocation"]["uri"]}:{loc["region"]["startLine"]}' yield "Semgrep", levels.get(r["ruleId"], "error").upper(), r["ruleId"].split(".")[-1], where, r["message"]["text"].splitlines()[0] bandit_json, semgrep_sarif, out = sys.argv[1:4] rows = list(bandit_rows(bandit_json)) + list(semgrep_rows(semgrep_sarif)) ok = not rows body = "".join( f"
{html.escape(w)}| 도구 | 심각도 | 룰 | 위치 | 설명 |
|---|