Skip to content

feat(web): offer plain-HTTP node commands with allow_insecure_origin - #9

Merged
sunyalou merged 1 commit into
mainfrom
feat/web-allow-insecure-origin-c
Oct 3, 2026
Merged

sunyalou merged 1 commit into
mainfrom
feat/web-allow-insecure-origin-c

Conversation

@sunyalou

@sunyalou sunyalou commented Oct 3, 2026

Copy link
Copy Markdown
Owner

目标

在新架构(origin/main 8551deb4)上重做 Web 控制台的 allow_insecure_origin 支持(替代已关闭的 PR #4)。开关打开时 Add node 生成 http://IP:8080 注册命令并显示明文风险警告,主机清理同样生成 http 卸载命令;默认关闭时命令与文案逐字不变。不改 TLS 校验,不引入 InsecureSkipVerify。

关键设计(与旧 PR #4 的差异)

  • 单一来源:控制台只从 Core 的安装快照 CoreInstallation.configuration.settings 的 allow_insecure_origin 读取开关(allowsInsecureOrigin(installation))。不读 OAC_ALLOW_INSECURE_ORIGIN、不改 services/web/config.go / node_installation.go、不在 /console/config 新增字段、不改 console-config.ts——旧 PR feat(web): allow a plain-HTTP public URL with allow_insecure_origin #4 的 Web 侧 env 回退已按 OAC-9 设计移除。
  • 快照缺失或旧 Core 未上报 → 一律按关闭处理(fail-safe)。

改动

  • apps/web/src/lib/connection.ts:isValidDirectCoreBaseUrl(value, allowInsecure = false),仅开关打开时接受非 loopback HTTP;凭据/查询/片段/非 http(s) 仍拒绝。
  • apps/web/src/features/sandbox/core-origin.ts:nodeSourceUrl(installation, allowInsecure = false);新增 allowsInsecureOrigin(installation)(仅快照)。
  • apps/web/src/features/sandbox/NodeEnrollment.tsx:由快照计算开关,放宽命令来源;开关打开且 public_url 为 HTTP 时显示明文风险警告。
  • apps/web/src/features/sandbox/NodeCleanupDialog.tsx:同样由快照计算开关并放宽卸载命令来源;仅在开关打开时去掉提示文案里的 "HTTPS"。
  • apps/web/src/features/sandbox/SandboxManagerView.css:明文告警样式。
  • apps/web/src/lib/locale-strings.ts:明文告警与放宽后卸载文案的中文条目。
  • 验收 fixture:installation 新增 "http"(HTTP 地址、开关关)与 "insecure"(同一地址、开关开)两种模式;apps/web/e2e/nodes.spec.ts 覆盖开关开/关两侧。
  • 文档:docs/web/console-server.md + docs/zh/web/console-server.md(公开地址小节,含 source_hash)。

OAC-11 e2e 修复(并入本 PR)

  • nodes.spec.ts 新增用例在再次 openConsole 之前先 Close dialog 并断言弹窗隐藏,避免 same-document 导航不重载时残留遮罩拦截点击(根因见 OAC-11);用例保留。
  • 默认关闭文案断言使用当前实现:Set a public HTTPS address before adding nodes.(上游 a2946a7f 后)。

验证

  • make check-web-unit:通过(typecheck + agents-client 765 + web 448 单测 + build)。
  • make check-names:通过。
  • 聚焦单测:core-origin.test.ts、connection.test.ts、NodeCleanupDialog.test.tsx 共 57 例通过。
  • make check-web-acceptance:本环境无法执行——Chromium distribution 'chrome' is not found at /opt/google/chrome/chrome(本机无 Google Chrome、无 root 安装,自带 Chromium 需 GLIBC_2.25 而本机 2.17),82 failed 全为同一浏览器启动错误。已 push,CI 的 web-acceptance 作业会补跑,结果见 PR Checks。

已知限制

  • 浏览器验收依赖 CI 的 web-acceptance 作业(本机架构性不可执行,见上)。
  • 本 PR 只改 Web 控制台与文档;开关的部署侧归属(.env/compose)与节点链路在任务 B/D。

Redo the Web side of the switch on the current main. The console reads
`allow_insecure_origin` only from Core's installation settings snapshot, so
there is no second source and no `/console/config` field.

- apps/web: `isValidDirectCoreBaseUrl`/`nodeSourceUrl` take an `allowInsecure`
  flag; NodeEnrollment and NodeCleanupDialog compute the switch from the
  snapshot and offer `http://IP:8080` commands. Add node warns that the
  enrollment token and node credentials travel unencrypted; the cleanup dialog
  drops "HTTPS" from its message only when the switch is on.
- Fixture gains "http" (switch off) and "insecure" (switch on) installation
  modes; nodes.spec.ts covers both and closes the Add node dialog before
  reopening it over the same #nodes hash (OAC-11).
- Docs note the switch in the console's public-address section.

Co-authored-by: multica-agent <github@multica.ai>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sunyalou
sunyalou merged commit 7970329 into main Oct 3, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant