✨ feat: Sandbox Runtime——isolated 插件子进程隔离执行(WP-06/07 收口)
- 迁移 17:plugin_execution(五态、退出码、时长、stdout 摘要、错误留痕) - 沙箱执行器:独立子进程(代码经 stdin JSON 安全传输,不进命令行)、CPU rlimit + RLIMIT_AS(平台不支持时尽力而为并注明)、墙钟超时强杀、输出限额;runner 仅暴露 input/output 作用域 - 执行端点:isolated_process 形态、已安装且启用后可执行;**未启用沙箱一律 503 fail-closed**(HUNJING_SANDBOX_ENABLED 显式开启,审计记录拒绝原因)——AGENTS 第 6 节"无符合策略的 Sandbox 时拒绝执行"落地 - 每次执行落 plugin_execution + 审计(状态/时长);进程级隔离的边界如实注明(网络/文件系统最小化在 Linux 容器档交付) - 测试 96 项全绿(+2):echo 真实执行回填、死循环 5s 超时强杀、异常 failed 含 stderr、无沙箱 503
This commit is contained in:
1 parent
21eacc8c75
commit
99a7789432
8 files changed
+389
No files matched your search
@@ -1304,3 +1304,32 @@ class DiagnosticGrant(Base):
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), nullable=False, server_default=func.now()
|
||||
)
|
||||
|
||||
|
||||
class PluginExecution(Base):
|
||||
"""插件沙箱执行记录(WP-06/07 Sandbox):结果与资源消耗如实留痕。"""
|
||||
|
||||
__tablename__ = "plugin_execution"
|
||||
|
||||
id: Mapped[str] = mapped_column(
|
||||
String, primary_key=True, default=lambda: new_id("execution_")
|
||||
)
|
||||
installation_id: Mapped[str] = mapped_column(
|
||||
ForeignKey("plugin_installation.id", ondelete="cascade"), nullable=False, index=True
|
||||
)
|
||||
status: Mapped[str] = mapped_column(String, nullable=False, default="running")
|
||||
exit_code: Mapped[int | None] = mapped_column(nullable=True)
|
||||
duration_ms: Mapped[int | None] = mapped_column(nullable=True)
|
||||
stdout_excerpt: Mapped[str | None] = mapped_column(String, nullable=True)
|
||||
error: Mapped[str | None] = mapped_column(String, nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), nullable=False, server_default=func.now()
|
||||
)
|
||||
completed_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
|
||||
__table_args__ = (
|
||||
CheckConstraint(
|
||||
"status IN ('running', 'succeeded', 'failed', 'timeout', 'killed')",
|
||||
name="status_values",
|
||||
),
|
||||
)
|
||||
Reference in new issue
Block a user