Files
Agent-System-Backend/PROJECT.md
T
weichenandCursor 8eda35f365 Refuse open listeners and cross-site writes without auth
Why: The embedded tier starts without auth, and nothing checked Origin or Host, so a public bind or a foreign page could call write APIs.
Evidence: go test ./internal/config ./internal/server covering listen policy, origin rejection, and response headers.
Impact: Non-loopback without auth exits before opening the database. HTML artifacts get a sandbox CSP. Reverse proxies must list their public host in allowedHosts.
Refs: feature/sillytavern-review
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-04 17:28:46 +00:00

1.8 KiB
Raw Blame History

Agent-System-Backend 项目事实

  • 用途:见 README。定位与边界见设计文档(Agent-System-Documents)。
  • 技术栈:Go(静态链接,CGO_ENABLED=0)
  • 构建/验证:见仓内 Makefile 或 Dev 仓顶层 Makefile(待 P1 起补充并保持本节同步)。
  • 状态:P0 骨架;当前阶段见 Dev 仓任务记录。

验证(P1–P4 状态)

  • go test ./... — 单元 + 端到端(mock runner 全链路:流式/折叠部件/HITL 三分支/子代理任务树/工件/上传解析/中文检索/SSE 在线与重放/命令路由/插件装卸 fail-closed)。
  • CGO_ENABLED=0 go build ./cmd/agent-system — 单二进制(静态,内嵌前端后)。
  • 存储:嵌入式 SQLite(modernc.org/sqlite,纯 Go);FTS5 全文 + CJK LIKE 兜底。
  • 依赖:agent-system-core(deps submodule + replace)、agent-native(runtime/llm 复用)。

配置(启动层)

  • 来源优先级:内置默认 → 显式配置文件(--config <json>,无自动发现)→ 环境变量(AGENT_SYSTEM_ADDR/DATA/PLUGINS/DSN/ARTIFACTS/AUTH/MOCK/INSTANCE/INSECURE_LISTEN/ALLOWED_HOSTS)→ 显式 CLI(未传入的 flag 不覆盖)。
  • 监听守卫:非回环地址且未开认证时拒绝启动(在打开数据库之前)。出路是改用 127.0.0.1、--auth on,或显式 --insecure-listen(每次启动警告)。config explain 会打印 listen guard。
  • 只读诊断:agent-system config explain [--config …] [--<flag> …]——逐字段打印解析值与来源,DSN 脱敏;不建库、不写目录。
  • 多实例:envs/{dev,test,prod}.json 为隔离示例(data 根/DB 不得重叠);实例约定详见 Documents 仓 docs/proposals/2026-09-30-configuration-surface.md。
  • 运行时业务设置(/api/settings user/project scope、profiles 路由)是独立的业务策略层,不参与启动合并。