Skip to content

feat(#215): Codex 联网 toggle 改用 danger-full-access + never (Codex 官方 "Full access" 配对) - #217

Closed
Cmochance wants to merge 2 commits into
mainfrom
feat/215-codex-full-access
Closed

Cmochance wants to merge 2 commits into
mainfrom
feat/215-codex-full-access

Conversation

@Cmochance

@Cmochance Cmochance commented May 19, 2026 •

Copy link
Copy Markdown
Owner

Closes #215, Refs #212

背景

#212 (PR #213) 用 workspace-write + network_access 真机仍弹审批弹窗:

  • Codex CLI 默认 approval_policy = OnRequest,sandbox 允许 ≠ 不弹窗
  • is_safe_command() 把 curl 等判"非 safe" 仍 escalate 审批
  • macOS seatbelt bug #10390 + Windows AppContainer 实现差异不彻底

方案

改用 Codex 官方推荐的 "Full access" 配对:

  • toggle on:sandbox_mode = "danger-full-access" + approval_policy = "never" 写 root level;strip [sandbox_workspace_write].network_access(避免 stale entry)
  • toggle off:strip 全部三条 → Codex 回 default(read-only + on-request)

Trade-off

full-access + never 模型可读写任何文件 + 所有命令无审批 = 完全信任模型。toggle 默认 on 接受 prompt-injection 风险换"小白开箱用",专业用户 toggle off 自己回 Codex default 沙箱。

测试

  • 72 codex-integration test 全 pass (含 round-trip 恢复用户原 network_access)
  • TOML crate parse 验证 apply output 不产 duplicate table

Followup #38 转 resolved

PR #213 时担心 macOS seatbelt bug 让 #212 失效,加 followup #38 active。本 PR 绕过整个 workspace_write.network_access 字段路径,本项目不再受上游 issue 影响(虽然 #10390 还 Open)。tracker 索引移到 Resolved 段。

Test plan

  • CI 全绿(workspace + Tauri check + 72 test)
  • macOS 真机:apply 后 ~/.codex/config.toml 含 sandbox_mode = "danger-full-access" + approval_policy = "never",Codex 重启后 curl 无审批联网
  • Windows 真机:同上(不再弹审批弹窗)

Open in Devin Review

…无审批联网)

#212 的 workspace-write + network_access 在真机仍弹审批弹窗:
- Codex 默认 `approval_policy = OnRequest`(`protocol.rs::AskForApproval`
  的 `#[default] OnRequest`), sandbox 允许 ≠ 不弹窗
- `is_safe_command()` 把 curl 等判"非 safe" 仍 escalate user 审批
- macOS seatbelt #10390 + Windows AppContainer 双重 sandbox 实现差异让
  workspace-write + network_access 路径不彻底

改用 Codex 官方推荐的 **"Full access" 配对**(Codex docs 原话:
"Full access means `sandbox_mode = danger-full-access` together with
`approval_policy = never`"):
- toggle on:写 sandbox_mode=danger-full-access + approval_policy=never
  到 root level; strip 之前 #212 可能写过的 [sandbox_workspace_write]
  network_access(避免 stale entry 误导)
- toggle off:strip 全部三条,让 Codex 回 default(read-only + on-request)

Trade-off: full-access + never 模型可读写任何文件 + 所有命令无审批 =
**完全信任模型**。toggle 默认 on 接受 prompt-injection 风险换"小白开箱
用",专业用户 toggle off 自己回 Codex default。

UI hint / README 都更新成 "全权限模式" 文案明示安全权衡。

followup #38 (macOS seatbelt bug) 状态 → resolved by PR #215:本项目
不再依赖 [sandbox_workspace_write].network_access, 上游 issue 仍 Open
但我们绕过了。tracker 索引行移到 Resolved 段。

测试: 72 个 codex-integration test 全 pass, 含:
- 主路径写 danger-full-access + never + strip workspace_write
- toggle off strip 全部三条
- restore round-trip 恢复用户原 network_access (dotted form / section form)
- toml crate parse 验证不产 duplicate table

Refs #212, Closes #215

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

Comment thread README.md Resolved
用户报告 Windows 上反馈功能炸:`error sending request for url
(https://codex-app-transfer-feedback.alysechencn.workers.dev/)`。verify
后定位国内 ISP / DNS 污染 `*.workers.dev` 域名,用户必须走代理才能反馈,
但代理同时把 127.0.0.1:18080 协议转发抢走 → 反馈跟主功能二选一。

修法: Cloudflare Worker 加 custom domain
`codex-app-transfer-feedback.mochance.xyz`, 域名 anycast 走 Cloudflare
主 IP 池, 国内可达性显著提升, 默认 DNS 不依赖代理就能解到。

verify:
- curl -I https://codex-app-transfer-feedback.mochance.xyz/ → HTTP 405
  (Worker alive, GET 不接但 endpoint reachable)
- TLS 1.3 cert chain 正常

代码改动: FEEDBACK_WORKER_URL const 一行替换 + 加注释解释为什么切。
搭车 #215 PR commit (memory rule 同对话内未 merge PR 默认搭车减 CI)。
@Cmochance Cmochance closed this May 19, 2026
@Cmochance
Cmochance deleted the feat/215-codex-full-access branch May 19, 2026 17:54
@Cmochance
Cmochance restored the feat/215-codex-full-access branch May 19, 2026 17:54
Cmochance added a commit that referenced this pull request May 19, 2026
#218)

* feat(#215): toggle on 改 danger-full-access + approval_policy=never(真正无审批联网)

#212 的 workspace-write + network_access 在真机仍弹审批弹窗:
- Codex 默认 `approval_policy = OnRequest`(`protocol.rs::AskForApproval`
  的 `#[default] OnRequest`), sandbox 允许 ≠ 不弹窗
- `is_safe_command()` 把 curl 等判"非 safe" 仍 escalate user 审批
- macOS seatbelt #10390 + Windows AppContainer 双重 sandbox 实现差异让
  workspace-write + network_access 路径不彻底

改用 Codex 官方推荐的 **"Full access" 配对**(Codex docs 原话:
"Full access means `sandbox_mode = danger-full-access` together with
`approval_policy = never`"):
- toggle on:写 sandbox_mode=danger-full-access + approval_policy=never
  到 root level; strip 之前 #212 可能写过的 [sandbox_workspace_write]
  network_access(避免 stale entry 误导)
- toggle off:strip 全部三条,让 Codex 回 default(read-only + on-request)

Trade-off: full-access + never 模型可读写任何文件 + 所有命令无审批 =
**完全信任模型**。toggle 默认 on 接受 prompt-injection 风险换"小白开箱
用",专业用户 toggle off 自己回 Codex default。

UI hint / README 都更新成 "全权限模式" 文案明示安全权衡。

followup #38 (macOS seatbelt bug) 状态 → resolved by PR #215:本项目
不再依赖 [sandbox_workspace_write].network_access, 上游 issue 仍 Open
但我们绕过了。tracker 索引行移到 Resolved 段。

测试: 72 个 codex-integration test 全 pass, 含:
- 主路径写 danger-full-access + never + strip workspace_write
- toggle off strip 全部三条
- restore round-trip 恢复用户原 network_access (dotted form / section form)
- toml crate parse 验证不产 duplicate table

Refs #212, Closes #215

* feat(feedback): 切自定义域名解决国内 workers.dev DNS 污染

用户报告 Windows 上反馈功能炸:`error sending request for url
(https://codex-app-transfer-feedback.alysechencn.workers.dev/)`。verify
后定位国内 ISP / DNS 污染 `*.workers.dev` 域名,用户必须走代理才能反馈,
但代理同时把 127.0.0.1:18080 协议转发抢走 → 反馈跟主功能二选一。

修法: Cloudflare Worker 加 custom domain
`codex-app-transfer-feedback.mochance.xyz`, 域名 anycast 走 Cloudflare
主 IP 池, 国内可达性显著提升, 默认 DNS 不依赖代理就能解到。

verify:
- curl -I https://codex-app-transfer-feedback.mochance.xyz/ → HTTP 405
  (Worker alive, GET 不接但 endpoint reachable)
- TLS 1.3 cert chain 正常

代码改动: FEEDBACK_WORKER_URL const 一行替换 + 加注释解释为什么切。
搭车 #215 PR commit (memory rule 同对话内未 merge PR 默认搭车减 CI)。

* docs(#215): 删 README v2.1.13+ 版本前缀防版本号漂移

Devin review 抓到 README 写 v2.1.13+ 但 code Cargo.toml 仍 2.1.12,
不一致。release pipeline 后续 bump 时再加版本号反而易遗漏,直接去掉
版本号前缀让文案描述当前/未来所有 build 都对。
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.

feat: 默认 Codex 用 danger-full-access + approval_policy=never(真正无弹窗联网)

1 participant