ARTICLE · INTELLIGENCE

战地情报 · 详情页

来自尧图项目组的一线实战观察与深度解析

Agent Governance Toolkit 审计日志与合规实战:从 Merkle 链防篡改到 OWASP ASI 2026 门禁

Agent Governance Toolkit 审计日志与合规实战:从 Merkle 链防篡改到 OWASP ASI 2026 门禁 Agent Governance Toolkit 审计日志与合规实战从 Merkle 链防篡改到 OWASP ASI 2026 门禁【免费下载链接】agent-governance-toolkitAI Agent Governance Toolkit — Policy enforcement, zero-trust identity, execution sandboxing, and reliability engineering for autonomous AI agents. Covers 10/10 OWASP Agentic Top 10.项目地址: https://gitcode.com/GitHub_Trending/ag/agent-governance-toolkit本指南以 Agent Governance Toolkit 的审计与合规模块为主线带你从一次工具调用的事件记录出发逐步掌握基于 Merkle 树的防篡改审计链、AuditLog 完整 API、可插拔外部存储 Sink以及通过agtCLI 与程序化验证器将 OWASP ASI 2026 十项安全控制纳入 CI/CD 合规门禁的完整链路。读完本文你将能够为任何自主 AI Agent 构建可回答审计员问题的不可变审计轨迹并把供应链接完整性校验固化到发布流水线中。Agent 的每一次动作——工具调用、策略决策、信任握手——都必须被记录在防篡改日志中。否则你无法回答每个审计员都会问的问题这个 Agent 到底做了什么是谁授权的Agent Governance Toolkit 为此提供了两块互补的能力包安装用途agentmesh-platformpip install agentmesh-platformAuditLog内置 Merkle 链完整性校验agent-governance-toolkitpip install agent-governance-toolkitOWASP ASI 2026 合规 CLI 与验证器前者解决记录且不可篡改后者解决证明治理到位。本教程从一次audit.log()调用讲起一路做到 CI/CD 合规门禁。1 — 快速开始记录第一条审计事件from agentmesh.governance.audit import AuditLog # Create an in-memory audit log audit AuditLog() # Record a tool invocation entry audit.log( event_typetool_invocation, agent_diddid:web:sales-assistant.example.com, actionallow, resource/crm/contacts, data{tool: crm_lookup, query: acme corp}, outcomesuccess, trace_idtrace-7f3a, ) print(entry.entry_id) # unique UUID print(entry.entry_hash) # SHA-256 hash of the entry print(entry.timestamp) # UTC datetime # Verify nothing has been tampered with is_valid, error audit.verify_integrity() assert is_valid, fChain broken: {error} print(Audit chain intact)运行它pip install agentmesh-platform python quickstart_audit.py从源码看AuditLog.log()内部会依次完成三件事见 agentmesh/governance/audit.py构造AuditEntry数据模型 → 交给内部MerkleAuditChain.add_entry()完成哈希链接并更新 Merkle 树 → 若配置了外部 sink 则同步写入。之后按agent_did与event_type建立反向索引为后续查询做准备。这意味着一次调用同时完成记录、链式哈希与索引建立。2 — AuditLog API 参考2.1 创建 AuditLogfrom agentmesh.governance.audit import AuditLog # In-memory only audit AuditLog() # With an external sink (see §6) from agentmesh.governance.audit_backends import FileAuditSink sink FileAuditSink(pathaudit.jsonl, secret_keybmy-hmac-secret) audit AuditLog(sinksink)值得注意的实现细节AuditLog.__init__在初始化时通过_capture_env_context()一次性快照执行环境信息OPENSHELL_SANDBOX_ID/SANDBOX_ID→sandbox_idAGT_ENVIRONMENT→environmentOPENSHELL_COMPUTE_DRIVER→compute_driver并注入每条新条目的sandbox_id、environment、compute_driver字段实现日志自带部署上下文的可观测性且不会在每次写入时反复读取环境变量。2.2log()— 记录事件entry audit.log( event_typetool_invocation, # see event types below agent_diddid:web:agent.example.com, actionallow, # allow | deny | audit | quarantine | warning resource/api/users, # what the agent accessed data{method: GET}, # arbitrary metadata (secrets are stripped) outcomesuccess, # success | failure | denied | error policy_decisionallowed, # human-readable policy result trace_idtrace-abc123, # correlation ID for distributed tracing )事件类型Event Type触发时机tool_invocationAgent 成功调用工具tool_blocked策略拒绝了一次工具调用policy_evaluation策略引擎评估了一次请求policy_violationAgent 违反了治理策略rogue_detection异常检测标记了某个 Agentagent_invocation发生 Agent 到 Agent 的委派Outcomessuccess、failure、denied、errorActionsallow、deny、audit、quarantine、warning除上述位置参数外源码还暴露了一组仅限关键字传入的高级参数用于记录决策与执行时间线issued_at、completed_at、审批链身份approver_did、参数哈希arguments_hash与策略版本policy_version这些字段可防参数静默篡改与策略降级重放详见 audit.py。2.3query()— 检索审计轨迹from datetime import datetime, timezone, timedelta now datetime.now(timezone.utc) one_hour_ago now - timedelta(hours1) entries audit.query( agent_diddid:web:agent.example.com, # filter by agent event_typetool_invocation, # filter by event type start_timeone_hour_ago, # time range start end_timenow, # time range end outcomesuccess, # filter by outcome limit50, # max results (default 100) ) for e in entries: print(f{e.timestamp} | {e.action} | {e.resource})query()的过滤条件全部可组合最终返回按时间升序的最近limit条results[-limit:]。所有时间过滤均基于 UTC 时间戳比较因此在跨时区部署中保持一致。2.4get_entry()— 查找单条记录entry audit.get_entry(entry_idsome-uuid-here) print(entry.event_type, entry.outcome)2.5get_entries_for_agent()与get_entries_by_type()只需单一过滤条件时的便捷捷径# Everything agent X did (last 100 by default) agent_entries audit.get_entries_for_agent(did:web:agent.example.com, limit200) # All policy violations violations audit.get_entries_by_type(policy_violation, limit50)这两个方法基于AuditLog内部维护的_by_agent/_by_type反向索引实现返回该 Agent 或该类型最近的limit条适合最后 100 次操作这类高频运维查询。2.6verify_integrity()— 全链校验is_valid, error_msg audit.verify_integrity() if not is_valid: raise RuntimeError(fAudit trail tampered: {error_msg})该方法校验整条 Merkle 链 每一条目的哈希委托给MerkleAuditChain.verify_chain()逐条重算entry_hash并比对previous_hash与前一条的entry_hash是否衔接。建议定期调用或在导出数据前调用。2.7get_proof()— Merkle 包含性证明proof audit.get_proof(entry.entry_id) print(proof[entry]) # the AuditEntry print(proof[merkle_root]) # current Merkle root hash print(proof[merkle_proof]) # list of (hash, position) tuples print(proof[verified]) # True if the proof checks out第三方只需拿到公布的 root hash 与该证明即可在不接触完整日志的情况下确认某条目确实存在于链中。2.8export()与export_cloudevents()# Plain dict export (entries metadata) data audit.export(start_timeone_hour_ago, end_timenow) print(data[entries]) # list of entry dicts print(data[metadata]) # chain metadata # CloudEvents v1.0 JSON envelopes events audit.export_cloudevents(start_timeone_hour_ago) for ce in events: print(ce[type]) # e.g. ai.agentmesh.tool.invoked print(ce[source]) # agent DIDexport()返回包含merkle_root、entry_count与条目列表的字典export_cloudevents()将每条记录序列化为 CloudEvents v1.0 信封。类型映射表定义在 audit.py例如tool_invocation→ai.agentmesh.tool.invoked、tool_blocked→ai.agentmesh.tool.blocked、policy_violation→ai.agentmesh.policy.violation未命中的事件类型回退为ai.agentmesh.event_type。信封中会携带agentmeshentryhash与agentmeshprevioushash使 CloudEvents 消费者也能独立核验链完整性。3 — Merkle 链完整性工作原理每条进入AuditLog的记录都会被加入内部MerkleAuditChain。该链在所有记录之上构建一棵Merkle 树Root Hash / \ H(AB) H(CD) / \ / \ H(A) H(B) H(C) H(D) ← leaf SHA-256 of entry核心特性Append-only— 记录无法被删除或重排Tamper-evident— 改动任何一条记录都会改变 root hash高效证明— 证明某条记录存在只需 O(log n) 个哈希而非整个日志。从实现看MerkleAuditChain.add_entry()audit.py会先把上一条的entry_hash写入新条目的previous_hash再计算entry_hash并增量更新树路径容量不足时叶层翻倍并填充0*64占位节点然后自底向上重算父节点哈希。get_proof()通过兄弟节点索引异或idx ^ 1收集 (hash, position) 对verify_proof()则按position决定拼接顺序right时current siblingleft时sibling current逐层重算直至与 root hash 相等。程序化验证整条链from agentmesh.governance.audit import AuditLog audit AuditLog() # Log several events for i in range(100): audit.log( event_typetool_invocation, agent_didfdid:web:agent-{i % 5}.example.com, actionallow, resourcef/api/resource/{i}, outcomesuccess, ) # Full integrity check is_valid, error audit.verify_integrity() print(fChain valid: {is_valid}) # True # Get the Merkle root (publish this for external auditors) root audit._chain.get_root_hash() print(fMerkle root: {root}) # Prove a specific entry is in the log proof audit.get_proof(entry.entry_id) assert proof[verified], Proof failed外部验证证明只拥有 root hash 的验证者即可确认包含性from agentmesh.governance.audit import MerkleAuditChain # Auditor receives: entry_hash, proof, and published root_hash verified MerkleAuditChain.verify_proof( entry_hashabc123..., proof[(def456..., left), (789aaa..., right)], root_hashexpected-root..., ) print(fEntry in log: {verified})这套日志持有者与验证者分离的设计正是审计场景的关键持有完整日志的一方无法在事后偷偷修改记录而不被 root hash 变化暴露而外部审计员无需读取全部日志即可验证任意条目的存在性。4 — 检索审计轨迹找出最近 24 小时所有被拒绝的工具调用from datetime import datetime, timezone, timedelta yesterday datetime.now(timezone.utc) - timedelta(days1) denied audit.query( event_typetool_blocked, outcomedenied, start_timeyesterday, limit200, ) print(fBlocked {len(denied)} tool calls in the last 24h) for e in denied: print(f {e.agent_did} tried {e.resource} — {e.policy_decision})调查特定 Agentagent did:web:support-bot.example.com # Everything this agent did all_actions audit.get_entries_for_agent(agent, limit500) # Only violations violations audit.query( agent_didagent, event_typepolicy_violation, ) # Rogue detection alerts alerts audit.query( agent_didagent, event_typerogue_detection, ) print(fAgent {agent}:) print(f Total actions: {len(all_actions)}) print(f Violations: {len(violations)}) print(f Rogue alerts: {len(alerts)})这套组合查询可以直接支撑安全运营场景先看总量画像再按policy_violation与rogue_detection定位异常行为。跨 Agent 追踪一次请求多 Agent 工作流中用trace_id关联各环节条目trace trace-7f3a-b2c1 # query() doesnt filter by trace_id directly, so export and filter all_entries audit.export()[entries] trace_entries [e for e in all_entries if e.get(trace_id) trace] for e in trace_entries: print(f{e[timestamp]} | {e[agent_did]} | {e[action]} | {e[resource]})5 — 外部 Sink持久化审计轨迹内存审计适合开发阶段生产环境需要持久化存储。Toolkit 开箱提供FileAuditSink并定义了AuditSink协议audit_backends.py供你实现自己的后端。5.1 FileAuditSink — 磁盘上的 JSON-Linesfrom agentmesh.governance.audit import AuditLog from agentmesh.governance.audit_backends import FileAuditSink # Every entry is HMAC-signed and hash-chained sink FileAuditSink( pathaudit_trail.jsonl, secret_keybchange-me-to-a-real-secret, max_file_size50 * 1024 * 1024, # rotate at 50 MB (0 no rotation) ) audit AuditLog(sinksink) # Log events as normal — theyre persisted automatically audit.log( event_typetool_invocation, agent_diddid:web:agent.example.com, actionallow, resource/api/data, outcomesuccess, ) # Verify the on-disk chain independently is_valid, error sink.verify_integrity() print(fFile chain valid: {is_valid}) # Read back signed entries signed_entries sink.read_entries() for se in signed_entries: print(f{se.entry_id}: hash{se.content_hash[:16]}... sig{se.signature[:16]}...) # Always close when done sink.close()输出文件audit_trail.jsonl每行一个 JSON 对象每条包含content_hash、previous_hash与 HMACsignature。从源码看文件级完整性比内存链更强——SignedAuditEntryaudit_backends.py用规范 JSON 载荷排除content_hash、signature与执行上下文字段计算 SHA-256content_hash再用调用方提供的密钥对 content hash 做HMAC-SHA256 签名verify()同时校验哈希与签名。落盘写入使用O_APPEND | O_CREAT | O_NOFOLLOW与0600权限拒绝跟随符号链接、避免审计内容对系统其他用户可读同文件还通过fchmod收紧既有文件权限。HashChainVerifier.verify_file()则独立对磁盘文件执行链连续性、content hash、HMAC 三重校验对于中断写入产生的半行按跳过该行处理而非整体失败——因为替换真实记录仍会破坏下一条的链连续性没有签名密钥就无法掩盖。文件达到max_file_size时自动轮转重命名为带 UTC 时间戳的*.jsonl文件并重置链也兼容 logrotate 式的外部替换通过(st_dev, st_ino)检测文件被换走并重新续链。值得注意的是恢复续链时若发现既有链无法用当前密钥验证FileAuditSink会拒绝启动fail-closed避免在未经验证的篡改文件上继续追加。5.2 编写自定义 Sink实现AuditSink协议即可把条目推送到数据库、消息队列或云服务from agentmesh.governance.audit import AuditEntry from agentmesh.governance.audit_backends import AuditSink class PostgresSink: Push audit entries to a PostgreSQL table. def __init__(self, dsn: str): import psycopg2 self._conn psycopg2.connect(dsn) def write(self, entry: AuditEntry) - None: with self._conn.cursor() as cur: cur.execute( INSERT INTO audit_log (entry_id, timestamp, event_type, agent_did, action, resource, outcome, entry_hash, trace_id) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s) , ( entry.entry_id, entry.timestamp.isoformat(), entry.event_type, entry.agent_did, entry.action, entry.resource, entry.outcome, entry.entry_hash, entry.trace_id, ), ) self._conn.commit() def write_batch(self, entries: list[AuditEntry]) - None: for entry in entries: self.write(entry) def verify_integrity(self) - tuple[bool, str | None]: # Implement chain verification against DB rows return True, None def close(self) - None: self._conn.close() # Use it sink PostgresSink(dsnos.environ[DATABASE_URL]) # e.g., postgresql://user:***host/agents audit AuditLog(sinksink)提示协议用runtime_checkable声明因此可以直接用isinstance(my_sink, AuditSink)验证自己的实现是否满足接口。仓库还提供面向容器化部署的StdoutAuditSink每行一个 JSON 对象输出到 stdout适合 Kubernetes/Docker/日志采集侧车消费每次写入后立即 flush并用类级锁串行化所有实例的 stdout 写入防止交错但它不做签名与链校验需要密码学完整性时请使用FileAuditSink。6 — OWASP ASI 2026 合规检查agent-governance-toolkit包验证你的部署是否覆盖全部 10 项 OWASP ASI 2026 安全控制。6.1 安装pip install agent-governance-toolkit6.2 验证治理覆盖# Human-readable summary agt verify输出OWASP ASI 2026 Governance Verification OK ASI-01 Prompt Injection PromptInjectionDetector OK ASI-02 Insecure Tool Use ToolAliasRegistry OK ASI-03 Excessive Agency NativeAdapterRuntime OK ASI-04 Unauthorized Escalation EscalationPolicy OK ASI-05 Trust Boundary Violation CardRegistry OK ASI-06 Insufficient Logging AuditChain OK ASI-07 Insecure Identity AgentIdentity OK ASI-08 Policy Bypass PolicyConflictResolver OK ASI-09 Supply Chain Integrity IntegrityVerifier OK ASI-10 Behavioral Anomaly ComplianceEngine Coverage: 10/10 (100%)# Machine-readable JSON agt verify --json# Shields.io badge for your README agt verify --badge说明上表中每个控制对应的组件与模块取自 verify.py 中的OWASP_ASI_CONTROLS定义——验证器逐个importlib导入控制模块并getattr查找指定组件类能导入即视为该控制已部署。若未安装对应包该控制会标记为缺失。安全审计处理CLI 针对信息泄露做了加固。机器可读模式下命令失败时返回脱敏错误{ status: error, message: Audit log processing failed, type: InternalError }这避免了 CI/CD 流水线日志泄露内部系统细节。实现位于 cli/main.py已知错误类型IOError、ValueError、KeyError、PermissionError、FileNotFoundError输出ValidationError并回显可操作信息未知异常则保持 opaque 的InternalError只有设置AGENTOS_DEBUG1才会在开发环境暴露底层消息。6.3 10 项 ASI 控制ControlRiskGovernance ComponentASI-01Prompt InjectionPromptInjectionDetectorinagent_os.prompt_injectionASI-02Insecure Tool UseToolAliasRegistryinagent_os.integrations.tool_aliasesASI-03Excessive AgencyNativeAdapterRuntimeinagent_os.integrations._native_adapter_runtimeASI-04Unauthorized EscalationEscalationPolicyinagent_os.integrations.escalationASI-05Trust Boundary ViolationCardRegistryinagentmesh.trust.cardsASI-06Insufficient LoggingAuditChaininagentmesh.governance.auditASI-07Insecure IdentityAgentIdentityinagentmesh.identity.agent_idASI-08Policy BypassPolicyConflictResolverinagentmesh.governance.conflict_resolutionASI-09Supply Chain IntegrityIntegrityVerifierinagent_compliance.integrityASI-10Behavioral AnomalyComplianceEngineinagentmesh.governance.compliance动态导入被限制在 AGT 专属模块前缀白名单agent_os.、agentmesh.、agent_compliance.、agent_sre.、agent_hypervisor.、hypervisor.、agent_runtime.、agent_lightning_gov.、agent_marketplace.防止验证流程本身成为任意代码执行入口。6.4 验证供应链完整性检查治理模块源文件与关键函数是否被篡改# Generate a baseline manifest agt integrity --generate integrity.json # Later, verify against it agt integrity --manifest integrity.json# JSON output for automation agt integrity --manifest integrity.json --json完整性检查器验证两件事integrity.py文件哈希— 每个治理模块源文件的 SHA-256函数字节码哈希— 对PolicyEngine.evaluate、AuditChain.add_entry、CardRegistry.is_verified、PolicyConflictResolver.resolve等关键函数做字节码哈希以检测热修补patch。实现细节上函数字节码哈希使用marshal.dumps(func.__code__)覆盖co_code、co_names、co_consts、嵌套 code 对象等全部属性——仅哈希co_code的方案会被同 opcode 但改名引用的替换函数绕过。同时采用 fail-closed 语义一旦配置了 manifest清单中缺失某模块条目即视为失败过去缺条目默认通过会让攻击者通过删除清单条目掩盖篡改损坏的 manifest 也会直接抛错拒绝启动。6.5 程序化验证from agent_compliance.verify import GovernanceVerifier from agent_compliance.integrity import IntegrityVerifier # OWASP ASI coverage verifier GovernanceVerifier() attestation verifier.verify() print(fPassed: {attestation.passed}) print(fCoverage: {attestation.coverage_pct()}%) print(fHash: {attestation.attestation_hash}) # Print per-control results print(attestation.summary()) # Get JSON for storage or CI artifacts report_json attestation.to_json() # Supply chain integrity integrity IntegrityVerifier(manifest_pathintegrity.json) report integrity.verify() print(report.summary()) print(fModules checked: {report.modules_checked}) print(fMissing modules: {report.modules_missing})GovernanceAttestation还附带两个实用能力compliance_grade()依据覆盖率给出 A/B/C/D/F 等级badge_url()/badge_markdown()生成 Shields.io 徽章链接attestation_hash对全部语义字段控制列表、证据检查、通过数、时间等做 SHA-256任何字段被篡改都会导致哈希失配。此外GovernanceVerifier.verify_evidence()可对运行时生成的agt-evidence.json包含已加载策略文件、deny 语义、注册工具、审计 sink 配置、身份启用状态、包清单执行逐项证据检查证据失败默认强制passedFalse——allow_failuresTrue仅为开发测试逃生门使用时会发出UserWarning警告。7 — 合规报告7.1 为审计员生成报告把审计导出与合规 attestation 合并为一份报告import json from datetime import datetime, timezone, timedelta from pathlib import Path from agentmesh.governance.audit import AuditLog from agentmesh.governance.audit_backends import FileAuditSink from agent_compliance.verify import GovernanceVerifier from agent_compliance.integrity import IntegrityVerifier def generate_compliance_report( audit: AuditLog, output_path: str compliance_report.json, days: int 30, ) - dict: Generate a compliance report covering the last N days. now datetime.now(timezone.utc) start now - timedelta(daysdays) # 1. Audit trail summary export audit.export(start_timestart, end_timenow) entries export[entries] event_counts {} outcome_counts {} for e in entries: event_counts[e[event_type]] event_counts.get(e[event_type], 0) 1 outcome_counts[e[outcome]] outcome_counts.get(e[outcome], 0) 1 # 2. Chain integrity chain_valid, chain_error audit.verify_integrity() # 3. OWASP ASI attestation attestation GovernanceVerifier().verify() # 4. Supply chain integrity try: integrity IntegrityVerifier(manifest_pathintegrity.json) integrity_report integrity.verify() integrity_passed integrity_report.passed except FileNotFoundError: integrity_passed None # no manifest on file # Assemble report report { report_generated: now.isoformat(), period_start: start.isoformat(), period_end: now.isoformat(), audit_trail: { total_entries: len(entries), events_by_type: event_counts, events_by_outcome: outcome_counts, chain_integrity_valid: chain_valid, chain_integrity_error: chain_error, merkle_root: audit._chain.get_root_hash(), }, owasp_asi_2026: { passed: attestation.passed, controls_passed: attestation.controls_passed, controls_total: attestation.controls_total, coverage_pct: attestation.coverage_pct(), attestation_hash: attestation.attestation_hash, }, supply_chain_integrity: { passed: integrity_passed, }, } Path(output_path).write_text( json.dumps(report, indent2, defaultstr), encodingutf-8 ) print(fReport written to {output_path}) return report # Usage audit AuditLog() # ... after logging events ... report generate_compliance_report(audit, days30)这份报告将日志可审计事件统计 链完整性 Merkle root、治理可证明ASI 覆盖 attestation 哈希、代码未被篡改供应链完整性三类证据合而为一是审计交付物的标准形态。7.2 CI/CD 合规门禁把合规检查加入 CI 流水线任一检查失败即阻断部署# .github/workflows/compliance.yml name: Governance Compliance on: push: branches: [main] pull_request: jobs: compliance: runs-on: ubuntu-latest steps: - uses: actions/checkoutv4 - uses: actions/setup-pythonv5 with: python-version: 3.11 - name: Install governance packages run: | pip install agentmesh-platform agent-governance - name: Generate integrity manifest run: agt integrity --generate integrity.json - name: Verify OWASP ASI 2026 coverage run: agt verify --json asi_report.json - name: Verify supply-chain integrity run: agt integrity --manifest integrity.json --json integrity_report.json - name: Upload compliance artifacts if: always() uses: actions/upload-artifactv4 with: name: compliance-reports path: | asi_report.json integrity_report.json integrity.json提示agt verify在任一控制缺失时以退出码1结束见 cli/main.py 中return 0 if attestation.passed else 1因此流水线步骤会自动失败。8 — AuditEntry 参考每次audit.log()调用都会返回一个AuditEntry字段如下FieldTypeDescriptionentry_idstr唯一 UUIDtimestampdatetimeUTC 时间戳event_typestr上文事件类型之一agent_didstr行为 Agent 的 DIDactionstr采取的策略动作resourcestr \| None访问的资源target_didstr \| None目标 Agent 的 DID用于委派datadict任意元数据outcomestrsuccess / failure / denied / errorpolicy_decisionstr \| None人类可读的策略结果matched_rulestr \| None命中的策略规则 IDprevious_hashstr链上一条目的哈希entry_hashstr本条目的 SHA-256 哈希trace_idstr \| None分布式追踪关联 IDsession_idstr \| None会话标识AuditEntry上的关键方法entry.compute_hash() # recompute SHA-256 entry.verify_hash() # True if stored hash matches computed hash entry.to_cloudevent() # CloudEvents v1.0 JSON envelope关于哈希的规范细节compute_hash()只对规范字段entry_id、timestamp、event_type、agent_did、action、resource、data、outcome、previous_hash做sort_keysTrue的 JSON 序列化后取 SHA-256verify_hash()用常数时间比较hmac.compare_digest避免时序侧信道。issued_at、completed_at、arguments_hash、approver_did、policy_version等高级字段在 spec v1.0 中暂不参与规范哈希v1.1 将扩展覆盖但会被完整写入 CloudEvents 信封供需要决策-执行时间线、审批链或策略版本追溯的场景使用。延伸阅读前置教程Tutorial 01–03 覆盖身份Identity、信任Trust与策略Policy是搭建完整治理栈的前置条件。OWASP ASI 2026每个控制的具体风险语义可查阅完整规范。可运行示例仓库中的 examples/quickstart.py 与 examples/governed_agent.py 是可直接改造的演示程序。核心源码AuditLog/MerkleAuditChain 实现、FileAuditSink 与 AuditSink 协议、GovernanceVerifier 与 ASI 控制表、IntegrityVerifier 供应链接完整性、agt CLI 入口。【免费下载链接】agent-governance-toolkitAI Agent Governance Toolkit — Policy enforcement, zero-trust identity, execution sandboxing, and reliability engineering for autonomous AI agents. Covers 10/10 OWASP Agentic Top 10.项目地址: https://gitcode.com/GitHub_Trending/ag/agent-governance-toolkit创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
RELATED READING

延伸阅读

更多一线实战笔记与深度复盘,助您持续精进