dsh-use-codex 0.0.0-stage → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.en.md +400 -0
- package/README.md +404 -2
- package/SECURITY.md +30 -0
- package/cordis.patch.yml +19 -0
- package/lib/index.js +506 -0
- package/package.json +54 -4
package/README.md
CHANGED
|
@@ -1,3 +1,405 @@
|
|
|
1
|
-
#
|
|
1
|
+
# DSH Use Codex
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> 在 DeepSeek Harness 中用一句话把任务交给本机 Codex CLI,安全执行后把结果带回当前会话。
|
|
4
|
+
|
|
5
|
+
简体中文 | [English](README.en.md)
|
|
6
|
+
|
|
7
|
+
[](LICENSE)
|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
`dsh-use-codex` 为 [DeepSeek Harness (DSH)](https://github.com/deepseek-ai) 提供一组工具,把独立任务委派给本机 [OpenAI Codex CLI](https://github.com/openai/codex) 执行。它适合代码修改、故障排查、仓库分析和批量文件处理等一次性任务,并将执行结果返回 DSH 当前会话。
|
|
13
|
+
|
|
14
|
+
## 目录
|
|
15
|
+
|
|
16
|
+
- [功能特性](#功能特性)
|
|
17
|
+
- [运行要求](#运行要求)
|
|
18
|
+
- [安装](#安装)
|
|
19
|
+
- [配置](#配置)
|
|
20
|
+
- [使用方式](#使用方式)
|
|
21
|
+
- [工具参考](#工具参考)
|
|
22
|
+
- [运行原理](#运行原理)
|
|
23
|
+
- [安全模型](#安全模型)
|
|
24
|
+
- [开发与测试](#开发与测试)
|
|
25
|
+
- [常见问题](#常见问题)
|
|
26
|
+
- [项目状态](#项目状态)
|
|
27
|
+
- [许可证](#许可证)
|
|
28
|
+
|
|
29
|
+
## 功能特性
|
|
30
|
+
|
|
31
|
+
- **自然语言委派**:在 DSH 中说“让 Codex 做……”或“交给 Codex 执行……”。
|
|
32
|
+
- **四个内置工具**:任务执行、状态检查、危险模式开关、即时启停开关。
|
|
33
|
+
- **工作目录白名单**:只允许 Codex 在显式授权的真实目录中运行。
|
|
34
|
+
- **软链逃逸防护**:同时解析工作目录与白名单的真实路径。
|
|
35
|
+
- **默认安全沙箱**:默认使用 Codex 的 `workspace-write` 模式。
|
|
36
|
+
- **危险模式双重授权**:`danger-full-access` 必须由宿主配置 `allowDangerFullAccess: true` 允许,再由 `codex_danger` 运行时开关打开。
|
|
37
|
+
- **无 shell 拼接**:任务正文作为单个 argv 参数传递,避免 shell 注入。
|
|
38
|
+
- **进程组清理**:超时或取消时终止完整 Codex 进程组。
|
|
39
|
+
- **输出限长**:限制 stdout/stderr,避免单次结果淹没会话。
|
|
40
|
+
- **最小状态持久化**:状态文件只记录开关与更新时间,不保存任务、目录或输出。
|
|
41
|
+
- **零运行时依赖**:插件本身不需要额外 npm 依赖。
|
|
42
|
+
|
|
43
|
+
## 运行要求
|
|
44
|
+
|
|
45
|
+
| 组件 | 要求 |
|
|
46
|
+
|---|---|
|
|
47
|
+
| Node.js | `>= 20` |
|
|
48
|
+
| DSH | 支持 Cordis bundle patch 与工具注册的版本 |
|
|
49
|
+
| Codex CLI | 支持 `codex exec`、`-C`、`-s`、`--ephemeral` |
|
|
50
|
+
| 操作系统 | macOS 或 Linux;Windows 尚未验证 |
|
|
51
|
+
|
|
52
|
+
已验证组合:
|
|
53
|
+
|
|
54
|
+
- DeepSeek Harness `0.2.1-rc.2`
|
|
55
|
+
- Node.js `22.x`
|
|
56
|
+
- Codex CLI `0.166.0`
|
|
57
|
+
|
|
58
|
+
先确认 Codex CLI 可用:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
codex --version
|
|
62
|
+
codex login status
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
> 如果使用自定义 OpenAI-compatible provider,`codex login status` 显示未登录不一定是错误。请以 Codex CLI 能否实际执行 `codex exec` 为准。
|
|
66
|
+
|
|
67
|
+
## 安装
|
|
68
|
+
|
|
69
|
+
### 通过 DSH 插件市场索引安装
|
|
70
|
+
|
|
71
|
+
在 DSH 的「发现 → 插件市场 → 添加索引源」中添加:
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
https://raw.githubusercontent.com/chaorenzeng/dsh-use-codex/main/market/index.json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
然后搜索 **DSH Use Codex** 并安装。市场索引固定到不可变的 Git 提交,实际安装来源仍是本仓库。
|
|
78
|
+
|
|
79
|
+
### 1. 获取源码
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
git clone git@github.com:chaorenzeng/dsh-use-codex.git "$HOME/Projects/dsh-use-codex"
|
|
83
|
+
cd "$HOME/Projects/dsh-use-codex"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 2. 在 DSH profile 中登记依赖与 bundle
|
|
87
|
+
|
|
88
|
+
编辑目标 DSH profile 的 `package.json`,例如 `~/.dsh/profiles/web/package.json`:
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"dependencies": {
|
|
93
|
+
"dsh-use-codex": "file:/absolute/path/to/dsh-use-codex"
|
|
94
|
+
},
|
|
95
|
+
"dsh": {
|
|
96
|
+
"profile": {
|
|
97
|
+
"bundles": [
|
|
98
|
+
"dsh-use-codex"
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
保留该文件中已有的依赖和 bundle,不要清空其他配置。然后同步 profile 依赖:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
cd ~/.dsh/profiles/web
|
|
109
|
+
pnpm install
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
如果 DSH profile 使用其他包管理器,请使用对应命令安装依赖。
|
|
113
|
+
|
|
114
|
+
### 3. 添加本机配置
|
|
115
|
+
|
|
116
|
+
在目标 DSH profile 的 `cordis.patch.yml` 中覆盖插件配置:
|
|
117
|
+
|
|
118
|
+
```yaml
|
|
119
|
+
- id: use-codex
|
|
120
|
+
name: dsh-use-codex
|
|
121
|
+
config:
|
|
122
|
+
enabled: true
|
|
123
|
+
bin: /absolute/path/to/codex
|
|
124
|
+
defaultCwd: /absolute/path/to/workspace
|
|
125
|
+
allowedRoots:
|
|
126
|
+
- /absolute/path/to/workspace
|
|
127
|
+
allowDangerFullAccess: false
|
|
128
|
+
timeoutSec: 900
|
|
129
|
+
maxOutputChars: 20000
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
> 真实路径、Codex 凭据和 provider 设置属于本机配置,不应提交到开源仓库。
|
|
133
|
+
|
|
134
|
+
### 4. 重启 DSH
|
|
135
|
+
|
|
136
|
+
重启 DSH 宿主,使 profile 首次加载插件和配置。若由 macOS LaunchAgent 管理,可使用:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
launchctl kickstart -k "gui/$(id -u)/<YOUR_DSH_LAUNCHD_LABEL>"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
重启后必须**新建一个 DSH 会话**,旧会话不会自动获得新注册的工具。
|
|
143
|
+
|
|
144
|
+
### 5. 验证
|
|
145
|
+
|
|
146
|
+
在新建会话中发送:
|
|
147
|
+
|
|
148
|
+
```text
|
|
149
|
+
让 Codex 做:只回复 USE_CODEX_OK,不要读取或修改任何文件。
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
如果返回 `USE_CODEX_OK`,说明插件、Codex CLI 和工具调用链均正常。
|
|
153
|
+
|
|
154
|
+
## 配置
|
|
155
|
+
|
|
156
|
+
### 插件配置
|
|
157
|
+
|
|
158
|
+
| 配置项 | 默认值 | 说明 |
|
|
159
|
+
|---|---|---|
|
|
160
|
+
| `enabled` | `false` | 是否在 DSH 启动时注册工具;关闭时不注册任何工具 |
|
|
161
|
+
| `bin` | `codex` | Codex CLI 可执行文件路径;支持 `~` 展开 |
|
|
162
|
+
| `defaultCwd` | DSH 进程工作目录 | 未传 `cwd` 时使用,必须是白名单内的绝对目录 |
|
|
163
|
+
| `allowedRoots` | `[defaultCwd]` | 允许 Codex 工作的真实目录列表 |
|
|
164
|
+
| `allowDangerFullAccess` | `false` | 是否允许单次调用选择 `danger-full-access` |
|
|
165
|
+
| `timeoutSec` | `900` | 单次调用超时上限,范围 `1–3600` 秒 |
|
|
166
|
+
| `maxOutputChars` | `20000` | stdout 和 stderr 各自最多保留的字符数,范围 `1000–200000` |
|
|
167
|
+
|
|
168
|
+
公开仓库中的 [`cordis.patch.yml`](cordis.patch.yml) 使用 `/tmp` 作为安全占位目录,并默认设置 `enabled: false`。部署时应只在个人 profile patch 中覆盖为真实配置。
|
|
169
|
+
|
|
170
|
+
### 环境变量
|
|
171
|
+
|
|
172
|
+
| 环境变量 | 说明 |
|
|
173
|
+
|---|---|
|
|
174
|
+
| `CODEX_BIN` | 未配置 `bin` 时使用的 Codex CLI 路径 |
|
|
175
|
+
| `USE_CODEX_STATE` | 覆盖即时开关状态文件路径 |
|
|
176
|
+
| `DSH_HOME` | DSH 数据目录;状态默认写入其下的 `use-codex.json` |
|
|
177
|
+
|
|
178
|
+
即时开关状态文件默认位于:
|
|
179
|
+
|
|
180
|
+
```text
|
|
181
|
+
${DSH_HOME:-~/.dsh}/use-codex.json
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
文件权限为 `0600`,内容仅包含:
|
|
185
|
+
|
|
186
|
+
```json
|
|
187
|
+
{
|
|
188
|
+
"enabled": true,
|
|
189
|
+
"updatedAt": "2026-01-01T00:00:00.000Z"
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## 使用方式
|
|
194
|
+
|
|
195
|
+
### 自然语言调用
|
|
196
|
+
|
|
197
|
+
```text
|
|
198
|
+
让 Codex 做:检查当前仓库为什么测试失败,定位原因并修复;不要提交 commit。
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
```text
|
|
202
|
+
交给 Codex 执行:分析 src 目录中的重复代码,先给出方案,不要直接修改。
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
DSH 的模型会按需调用 `codex_run`。任务应写清目标、范围、约束和验收标准,以便 Codex 独立完成。
|
|
206
|
+
|
|
207
|
+
### 指定工作目录和沙箱
|
|
208
|
+
|
|
209
|
+
```text
|
|
210
|
+
让 Codex 做:只读取这个仓库并总结架构。工作目录使用 /absolute/path/to/repo,使用 read-only 沙箱。
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### 查看状态
|
|
214
|
+
|
|
215
|
+
```text
|
|
216
|
+
检查 Codex 委派的状态。
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### 即时关闭
|
|
220
|
+
|
|
221
|
+
```text
|
|
222
|
+
关闭 Codex 委派。
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
关闭后 `codex_run` 会立即拒绝新任务;重新打开不需要重启 DSH。
|
|
226
|
+
|
|
227
|
+
### 直接调用工具参数
|
|
228
|
+
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"task": "运行相关测试并修复失败原因,不要提交 commit。",
|
|
232
|
+
"cwd": "/absolute/path/to/repository",
|
|
233
|
+
"sandbox": "workspace-write",
|
|
234
|
+
"timeoutSec": 600
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## 工具参考
|
|
239
|
+
|
|
240
|
+
### `codex_run`
|
|
241
|
+
|
|
242
|
+
在指定工作目录中启动一次非交互式 `codex exec` 任务。
|
|
243
|
+
|
|
244
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
245
|
+
|---|---|---|---|
|
|
246
|
+
| `task` | `string` | 是 | 完整任务说明;最大 `100000` 字符 |
|
|
247
|
+
| `cwd` | `string` | 否 | 绝对工作目录,必须位于 `allowedRoots` 内 |
|
|
248
|
+
| `sandbox` | `string` | 否 | `read-only`、`workspace-write` 或 `danger-full-access` |
|
|
249
|
+
| `timeoutSec` | `number` | 否 | 本次超时,不能超过插件配置的 `timeoutSec` |
|
|
250
|
+
|
|
251
|
+
默认沙箱由两层开关共同决定:
|
|
252
|
+
|
|
253
|
+
1. **宿主配置** `allowDangerFullAccess: true|false`(profile 补丁,重启生效)——这是硬性许可,`false` 时任何方式都无法使用 `danger-full-access`
|
|
254
|
+
2. **运行时开关** `codex_danger`(即时生效,持久化到状态文件)——宿主允许后,用它切换"默认沙箱"是 `danger-full-access` 还是 `workspace-write`
|
|
255
|
+
|
|
256
|
+
省略 `sandbox` 参数时:宿主允许且 `codex_danger` 处于打开状态 → `danger-full-access`;否则 → `workspace-write`。显式传入的 `sandbox` 始终优先于默认值。
|
|
257
|
+
|
|
258
|
+
### `codex_status`
|
|
259
|
+
|
|
260
|
+
只读检查以下信息:
|
|
261
|
+
|
|
262
|
+
- 即时开关状态
|
|
263
|
+
- `codex --version`
|
|
264
|
+
- `codex login status`
|
|
265
|
+
- 有效目录白名单
|
|
266
|
+
- 危险模式是否允许
|
|
267
|
+
- 超时与输出限制
|
|
268
|
+
- 当前 DSH 进程内最近一次调用的结果摘要
|
|
269
|
+
|
|
270
|
+
### `codex_danger`
|
|
271
|
+
|
|
272
|
+
切换 `danger-full-access` 的运行时开关(宿主 `allowDangerFullAccess: true` 时有效)。
|
|
273
|
+
|
|
274
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
275
|
+
|---|---|---|---|
|
|
276
|
+
| `enabled` | `boolean` | 是 | `true` 打开危险模式(默认沙箱变 `danger-full-access`),`false` 关闭(回到 `workspace-write`) |
|
|
277
|
+
|
|
278
|
+
打开后**下一次** `codex_run` 默认以 `danger-full-access` 运行(无沙箱:可读写任意路径、访问网络、执行任意命令)。此开关只影响默认沙箱,不影响显式传入的 `sandbox` 参数。状态持久化,重启 DSH 后保留。
|
|
279
|
+
|
|
280
|
+
### `codex_switch`
|
|
281
|
+
|
|
282
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
283
|
+
|---|---|---|---|
|
|
284
|
+
| `enabled` | `boolean` | 是 | `true` 打开,`false` 关闭 |
|
|
285
|
+
|
|
286
|
+
即时开关持久化到状态文件,不影响 DSH 宿主中的其他插件。
|
|
287
|
+
|
|
288
|
+
## 运行原理
|
|
289
|
+
|
|
290
|
+
```mermaid
|
|
291
|
+
flowchart LR
|
|
292
|
+
U[DSH 用户] --> A[DSH Agent]
|
|
293
|
+
A -->|codex_run| B[dsh-use-codex]
|
|
294
|
+
B --> C{目录与安全校验}
|
|
295
|
+
C -->|通过| D[Codex CLI<br/>codex exec]
|
|
296
|
+
D --> W[授权工作目录]
|
|
297
|
+
D --> B
|
|
298
|
+
B --> A
|
|
299
|
+
A --> U
|
|
300
|
+
C -->|拒绝| A
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
插件最终执行的核心命令等价于:
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
codex exec \
|
|
307
|
+
-C /absolute/path/to/workspace \
|
|
308
|
+
-s workspace-write \
|
|
309
|
+
--skip-git-repo-check \
|
|
310
|
+
--ephemeral \
|
|
311
|
+
--color never \
|
|
312
|
+
-- "任务正文"
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
`--ephemeral` 表示不复用 Codex 会话,不表示只读。若 Codex 获得 `workspace-write`,它仍可能修改允许目录中的文件。
|
|
316
|
+
|
|
317
|
+
## 安全模型
|
|
318
|
+
|
|
319
|
+
本插件允许 DSH 启动本机 Codex,因此应把 DSH 会话视为具备受控本机执行能力。
|
|
320
|
+
|
|
321
|
+
### 已有防护
|
|
322
|
+
|
|
323
|
+
- 工作目录必须存在、为绝对路径,并通过真实路径解析。
|
|
324
|
+
- 工作目录必须位于 `allowedRoots` 内。
|
|
325
|
+
- 解析软链后仍须位于白名单内,阻止软链逃逸。
|
|
326
|
+
- 任务作为单个 argv 参数传入,不经过 shell。
|
|
327
|
+
- 超时或取消时终止 Codex 进程组。
|
|
328
|
+
- stdout/stderr 有长度上限。
|
|
329
|
+
- 插件状态不保存任务正文、工作目录或执行输出。
|
|
330
|
+
- 公共 bundle 默认关闭危险模式。
|
|
331
|
+
|
|
332
|
+
### 部署建议
|
|
333
|
+
|
|
334
|
+
- 只安装在可信的本机 DSH 中,不要把 DSH 暴露给不可信用户。
|
|
335
|
+
- 将 `allowedRoots` 收窄到实际需要的仓库或目录。
|
|
336
|
+
- 除非宿主机已做额外隔离,否则不要开启 `allowDangerFullAccess`。
|
|
337
|
+
- Codex 子进程会继承 DSH 环境变量,其中可能包含凭据;请检查 DSH 运行环境。
|
|
338
|
+
- `workspace-write` 仍允许修改工作区,不应把敏感目录加入白名单。
|
|
339
|
+
- 任务正文虽不写入插件状态,但仍可能出现在 DSH 对话记录、宿主日志或 Codex 自身日志中。
|
|
340
|
+
- 保持 DSH、Codex CLI 和依赖项更新。
|
|
341
|
+
|
|
342
|
+
完整安全说明见 [SECURITY.md](SECURITY.md)。
|
|
343
|
+
|
|
344
|
+
## 开发与测试
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
git clone https://github.com/chaorenzeng/dsh-use-codex.git
|
|
348
|
+
cd dsh-use-codex
|
|
349
|
+
npm test
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
测试使用临时目录和假 Codex 可执行文件,不访问网络、真实模型或私有工作区。当前覆盖:
|
|
353
|
+
|
|
354
|
+
- 插件元数据与三个工具注册
|
|
355
|
+
- 空任务、无效目录和白名单外目录
|
|
356
|
+
- 软链逃逸
|
|
357
|
+
- 危险模式默认拒绝
|
|
358
|
+
- 即时开关
|
|
359
|
+
- `workspace-write` 与 `--ephemeral` 参数
|
|
360
|
+
- 超时进程组终止
|
|
361
|
+
- 状态文件最小化持久化
|
|
362
|
+
|
|
363
|
+
提交前可检查 npm 实际打包内容:
|
|
364
|
+
|
|
365
|
+
```bash
|
|
366
|
+
npm pack --dry-run
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
欢迎提交 Issue 和 Pull Request。请勿在公开 Issue 中提交凭据、私有路径、完整日志或其他敏感信息;安全问题请参考 [SECURITY.md](SECURITY.md) 的私密报告流程。
|
|
370
|
+
|
|
371
|
+
## 常见问题
|
|
372
|
+
|
|
373
|
+
### 为什么新建会话后看不到工具?
|
|
374
|
+
|
|
375
|
+
先确认 `package.json` 的 `dsh.profile.bundles` 包含 `dsh-use-codex`,profile patch 中 `enabled` 为 `true`,然后重启 DSH 并新建会话。
|
|
376
|
+
|
|
377
|
+
### 为什么提示工作目录不在白名单内?
|
|
378
|
+
|
|
379
|
+
`cwd` 必须是绝对路径、真实存在,并在解析软链后位于 `allowedRoots` 内。白名单中的无效目录也会被忽略。
|
|
380
|
+
|
|
381
|
+
### 为什么不传 `cwd` 会失败?
|
|
382
|
+
|
|
383
|
+
`defaultCwd` 必须存在且位于白名单内。推荐在 profile 配置中同时显式设置 `defaultCwd` 和对应的 `allowedRoots`。
|
|
384
|
+
|
|
385
|
+
### 为什么 `codex_status` 显示未登录?
|
|
386
|
+
|
|
387
|
+
使用自定义 OpenAI-compatible provider 时,`codex login status` 可能不反映实际可用性。请直接验证 `codex exec` 是否能完成任务。
|
|
388
|
+
|
|
389
|
+
### 为什么任务执行很久?
|
|
390
|
+
|
|
391
|
+
单次执行默认最多等待 `900` 秒。可以在配置范围内通过 `timeoutSec` 调整,超出上限的值会被限制到插件配置的最大值。
|
|
392
|
+
|
|
393
|
+
### 关闭插件后是否还需要重启?
|
|
394
|
+
|
|
395
|
+
不需要。`codex_switch` 的关闭状态立即生效。若要在启动时不注册工具,则需在 profile 配置中设置 `enabled: false` 并重启 DSH。
|
|
396
|
+
|
|
397
|
+
## 项目状态
|
|
398
|
+
|
|
399
|
+
项目处于 `0.x` 实验阶段,工具参数、配置字段和返回格式可能随 DSH 与 Codex CLI 的演进调整。发布前建议固定已验证的 DSH 和 Codex CLI 版本,并在更新后进行端到端验证。
|
|
400
|
+
|
|
401
|
+
本项目是独立的社区插件,与 DeepSeek 或 OpenAI 无隶属或官方背书关系。DeepSeek Harness、Codex 及相关名称和商标归各自权利人所有。
|
|
402
|
+
|
|
403
|
+
## License
|
|
404
|
+
|
|
405
|
+
[MIT](LICENSE) © 2026 dsh-use-codex contributors
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Threat model
|
|
4
|
+
|
|
5
|
+
`dsh-use-codex` lets a DSH tool call start the local Codex CLI. The person or agent controlling DSH can therefore request local code execution within the configured boundary.
|
|
6
|
+
|
|
7
|
+
Only install this plugin in a trusted local DSH instance. Do not expose DSH or the plugin to untrusted users.
|
|
8
|
+
|
|
9
|
+
## Defaults
|
|
10
|
+
|
|
11
|
+
- `enabled: false` in the public bundle patch
|
|
12
|
+
- `workspace-write` sandbox for normal runs
|
|
13
|
+
- `danger-full-access` disabled unless the host explicitly enables it
|
|
14
|
+
- Required working directory must resolve inside `allowedRoots`
|
|
15
|
+
- Symlink escapes are rejected
|
|
16
|
+
- The task is passed as an argv value without a shell
|
|
17
|
+
- Timeouts terminate the Codex process group
|
|
18
|
+
- Tasks, working directories, and outputs are not persisted by the plugin
|
|
19
|
+
|
|
20
|
+
## Operator responsibilities
|
|
21
|
+
|
|
22
|
+
- Keep `allowedRoots` as narrow as possible
|
|
23
|
+
- Do not set `allowDangerFullAccess: true` unless the host is externally isolated
|
|
24
|
+
- Review Codex configuration and provider endpoints
|
|
25
|
+
- Treat inherited environment variables as available to the Codex child process
|
|
26
|
+
- Keep Codex CLI and DSH updated
|
|
27
|
+
|
|
28
|
+
## Reporting
|
|
29
|
+
|
|
30
|
+
Please report vulnerabilities through the GitHub repository's private security advisory channel rather than a public issue. Include reproduction steps, affected versions, and the expected impact.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Public-safe default bundle patch for dsh-use-codex.
|
|
2
|
+
# Keep machine-specific paths in your DSH profile patch, not in this repository.
|
|
3
|
+
#
|
|
4
|
+
# Security defaults:
|
|
5
|
+
# - enabled: false until the host explicitly opts in
|
|
6
|
+
# - workspace-write sandbox for codex_run
|
|
7
|
+
# - danger-full-access disabled
|
|
8
|
+
- insert:
|
|
9
|
+
- id: use-codex
|
|
10
|
+
name: dsh-use-codex
|
|
11
|
+
config:
|
|
12
|
+
enabled: false
|
|
13
|
+
bin: codex
|
|
14
|
+
defaultCwd: /tmp
|
|
15
|
+
allowedRoots:
|
|
16
|
+
- /tmp
|
|
17
|
+
allowDangerFullAccess: false
|
|
18
|
+
timeoutSec: 900
|
|
19
|
+
maxOutputChars: 20000
|