-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 统一证据查询第 5 源(tickets)+ self-cloud-pool entry 注记 W2-C1 落地(IR-0006 W2-C1 / ADR-0103) #444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,4 @@ __pycache__/ | |
| .archive-w1d1/ | ||
| .ciw/ | ||
| env-defs/ | ||
| .scratch/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,9 @@ | |
| # 源 3 butler Cloudbird-Software/.github @ butler-ledger governance/butler/shadow-evidence.jsonl | ||
| # 源 4 elevation Cloudbird-Software/.github @ elevation-ledger governance/elevation/shadow-evidence.jsonl | ||
| # (W2-C4 JIT 提权裁决/收回记录——subject 可查询即 AC-9c 锚点) | ||
| # 源 5 tickets Cloudbird-Software/cnb-bridge @ tickets-ledger tickets.jsonl | ||
| # (W2-C1 内网调度器短票据 grant/revoke——AC-5b 统一账本;Go 发射器产出, | ||
| # 链形态与 evidence_shadow.py 逐字节兼容,金向量锚定) | ||
| # | ||
| # 用法: | ||
| # bash governance/evidence-query.sh [--card owner/repo#n] [--json] # --json=汇总行也走 stdout | ||
|
|
@@ -70,20 +73,22 @@ fi | |
| DRILL_OK=0; fetch_file "Cloudbird-Software/.github" "drill-ledger" "governance/drill/shadow-evidence.jsonl" "$TMP/drill.jsonl" && DRILL_OK=1 || [[ $? -eq 1 ]] || exit 2 | ||
| BUTLER_OK=0; fetch_file "Cloudbird-Software/.github" "butler-ledger" "governance/butler/shadow-evidence.jsonl" "$TMP/butler.jsonl" && BUTLER_OK=1 || [[ $? -eq 1 ]] || exit 2 | ||
| ELEV_OK=0; fetch_file "Cloudbird-Software/.github" "elevation-ledger" "governance/elevation/shadow-evidence.jsonl" "$TMP/elev.jsonl" && ELEV_OK=1 || [[ $? -eq 1 ]] || exit 2 | ||
| TICKET_OK=0; fetch_file "Cloudbird-Software/cnb-bridge" "tickets-ledger" "tickets.jsonl" "$TMP/tickets.jsonl" && TICKET_OK=1 || [[ $? -eq 1 ]] || exit 2 | ||
|
qodo-code-review[bot] marked this conversation as resolved.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3. 权限失败伪装源缺席 新增 cnb-bridge 仓未纳入脚本仍声明的“两仓可读”令牌契约,而 fetch_file 把所有 HTTP 404 都视为合法源缺席。GitHub 对无权访问的私有资源也返回 404,因此符合现有文档的细粒度 PAT 可让查询以 rc=0 成功却完全漏掉 tickets。 Agent Prompt
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 4. 大账本被静默清空 tickets 是持续追加的单一 tickets.jsonl,但新增拉取沿用默认 Contents API JSON 响应;文件超过 1 MB 后 GitHub 会返回空 content 和 encoding: none。当前解码会写出空文件,随后查询跳过它并返回成功,造成整个 tickets 源静默消失。 Agent Prompt
|
||
|
|
||
| # ---- 逐源验链 + 归并输出(链断=exit 3:不可信数据不出结果) ---- | ||
| export CARD_FILTER JSON_ONLY DRILL_OK BUTLER_OK ELEV_OK | ||
| python3 - "$DIR/evidence_shadow.py" "$SRC_METER" "$TMP/drill.jsonl" "$TMP/butler.jsonl" "$TMP/elev.jsonl" "$TMP" <<'PYEOF' | ||
| export CARD_FILTER JSON_ONLY DRILL_OK BUTLER_OK ELEV_OK TICKET_OK | ||
| python3 - "$DIR/evidence_shadow.py" "$SRC_METER" "$TMP/drill.jsonl" "$TMP/butler.jsonl" "$TMP/elev.jsonl" "$TMP/tickets.jsonl" "$TMP" <<'PYEOF' | ||
| import glob, json, os, sys | ||
|
|
||
| sys.path.insert(0, os.path.dirname(os.path.abspath(sys.argv[1]))) | ||
| import evidence_shadow # noqa: E402 验链与 CI-Workflows 侧同源语义 | ||
|
|
||
| metering_dir, drill_f, butler_f, elev_f, tmp = sys.argv[2:7] | ||
| metering_dir, drill_f, butler_f, elev_f, tickets_f, tmp = sys.argv[2:8] | ||
| sources = {"metering": sorted(glob.glob(os.path.join(metering_dir, "shadow-evidence-*.jsonl"))), | ||
| "drill": [drill_f] if os.environ.get("DRILL_OK") == "1" else [], | ||
| "butler": [butler_f] if os.environ.get("BUTLER_OK") == "1" else [], | ||
| "elevation": [elev_f] if os.environ.get("ELEV_OK") == "1" else []} | ||
| "elevation": [elev_f] if os.environ.get("ELEV_OK") == "1" else [], | ||
| "tickets": [tickets_f] if os.environ.get("TICKET_OK") == "1" else []} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 5. Tickets 绕过完整模式校验 新增 tickets 文件只经过 verify_file(),该函数不校验 schema v1 必需的 ts、kind、action、verdict、actor 或禁止额外字段。于是哈希链正确但 schema 非法的 Go 发射记录仍会被统一查询输出并计入证据统计。 Agent Prompt
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 6. 畸形票据返回错误码 当 tickets 中存在畸形 JSON 时,verify_file() 会记录链错误,但查询随即再次对同一行执行未捕获的 json.loads,在检查 errs 前抛出异常。命令因此返回 Python 的 exit 1 和 traceback,而不是脚本契约规定的链断 exit 3。 Agent Prompt
|
||
| errs, recs = [], [] | ||
| for src, files in sources.items(): | ||
| for f in files: | ||
|
|
@@ -106,7 +111,7 @@ for r in out: | |
|
|
||
| summary = { | ||
| "total": len(out), | ||
| "by_source": {s: sum(1 for r in out if r["source"] == s) for s in ("metering", "drill", "butler", "elevation")}, | ||
| "by_source": {s: sum(1 for r in out if r["source"] == s) for s in ("metering", "drill", "butler", "elevation", "tickets")}, | ||
| "by_tenant": {}, | ||
| "by_card_top": {}, | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. tickets fetch bypasses app identity
📘 Rule violation⛨ SecurityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools