From 5d080ac2f53bd4a23b0d31093fd24089e469c406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?LGD-Eval=20=E2=80=94=20Independent=20AI=20Evaluation?= Date: Wed, 28 Oct 2026 18:43:49 +0800 Subject: [PATCH 1/2] red-team: update reviews/cosai-ws4-issue158/attack_vectors.py --- reviews/cosai-ws4-issue158/attack_vectors.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/reviews/cosai-ws4-issue158/attack_vectors.py b/reviews/cosai-ws4-issue158/attack_vectors.py index 2d03fed..7f9aadf 100644 --- a/reviews/cosai-ws4-issue158/attack_vectors.py +++ b/reviews/cosai-ws4-issue158/attack_vectors.py @@ -15,8 +15,15 @@ sys.path.insert(0, r"D:\doubao\ls-proto\prototypes\openai-agent-trust-runtime\src") -from ls_agent_trust import TrustRuntime, TrustViolation # noqa: E402 -from ls_agent_trust.openai_demo import bounded_authority # noqa: E402 +try: + from ls_agent_trust import TrustRuntime, TrustViolation # noqa: E402 + from ls_agent_trust.openai_demo import bounded_authority # noqa: E402 + _HAVE_TRUST = True + _IMP_ERR = None +except ImportError as _err: + # 外部依赖缺失时优雅跳过,而非抛出回溯使 CI 误红(red-team finding P1) + _HAVE_TRUST = False + _IMP_ERR = _err def scenario(name: str, fn) -> dict: @@ -48,6 +55,10 @@ def completed_dispatch(runtime, child, scope): def main() -> None: + if not _HAVE_TRUST: + print("SKIP attack_vectors: 缺少外部依赖 ls_agent_trust (%s)。" % _IMP_ERR) + print(" 安装 LS Agent Trust Runtime(openai-agent-trust-runtime)后方可运行本独立评审脚本。") + sys.exit(2) results: list[dict] = [] # --- Attack scenario 1: submit as an agent other than the dispatched child --- From a21c0dd5a1548642bbedb67e7d037d664d5d98ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?LGD-Eval=20=E2=80=94=20Independent=20AI=20Evaluation?= Date: Wed, 28 Oct 2026 18:43:51 +0800 Subject: [PATCH 2/2] red-team: update reviews/verified-transition-loop/make_variants.py --- .../verified-transition-loop/make_variants.py | 55 +++++++++++++------ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/reviews/verified-transition-loop/make_variants.py b/reviews/verified-transition-loop/make_variants.py index ea69f2d..4119939 100644 --- a/reviews/verified-transition-loop/make_variants.py +++ b/reviews/verified-transition-loop/make_variants.py @@ -1,24 +1,47 @@ #!/usr/bin/env python # make_variants.py — build adversarial variants of the VTL transparency-log fixture. # Inputs: transparency-log-v0.14.json (prototype fixture). Outputs: _variant_A/B.json. -# Usage: python make_variants.py -import json, copy, sys, os +# Usage: python make_variants.py [outdir] +import json +import copy +import sys +import os +import argparse -fix = json.load(open(sys.argv[1], encoding="utf-8")) -outdir = sys.argv[2] if len(sys.argv) > 2 else "." -os.makedirs(outdir, exist_ok=True) -A = copy.deepcopy(fix) -A["base_bundle"].pop("inclusion_path", None) # evidence missing +def main() -> int: + ap = argparse.ArgumentParser( + description="构建 VTL transparency-log fixture 的对抗变体(缺 inclusion / 篡改 entry)。") + ap.add_argument("fixture", help="transparency-log-*.json 输入路径") + ap.add_argument("outdir", nargs="?", default=".", help="输出目录(默认当前目录)") + args = ap.parse_args() -B = copy.deepcopy(fix) -d = bytearray(B["base_bundle"]["entry"]["snapshot_digest"], "ascii") -d[0] = ord("0") if d[0] != ord("0") else ord("1") # evidence tampered -B["base_bundle"]["entry"]["snapshot_digest"] = d.decode() + try: + with open(args.fixture, encoding="utf-8") as fh: + fix = json.load(fh) + except (OSError, ValueError) as e: + print("ERROR: 无法读取 fixture %s: %s" % (args.fixture, e), file=sys.stderr) + return 2 -for name, obj in [("_variant_A_missing_inclusion.json", A), ("_variant_B_tampered_entry.json", B)]: - with open(os.path.join(outdir, name), "w", encoding="utf-8") as f: - json.dump(obj, f, ensure_ascii=False, separators=(",", ":")) - print("wrote", name) + outdir = args.outdir + os.makedirs(outdir, exist_ok=True) -print("run: node reference/transparency-log-strict-v0.14.mjs / [now_ms]") + A = copy.deepcopy(fix) + A["base_bundle"].pop("inclusion_path", None) # evidence missing + + B = copy.deepcopy(fix) + d = bytearray(B["base_bundle"]["entry"]["snapshot_digest"], "ascii") + d[0] = ord("0") if d[0] != ord("0") else ord("1") # evidence tampered + B["base_bundle"]["entry"]["snapshot_digest"] = d.decode() + + for name, obj in [("_variant_A_missing_inclusion.json", A), ("_variant_B_tampered_entry.json", B)]: + with open(os.path.join(outdir, name), "w", encoding="utf-8") as f: + json.dump(obj, f, ensure_ascii=False, separators=(",", ":")) + print("wrote", name) + + print("run: node reference/transparency-log-strict-v0.14.mjs / [now_ms]") + return 0 + + +if __name__ == "__main__": + sys.exit(main())