Skip to content

Commit 835e83a

Browse files
authored
Harden CodexClaw default runtime permissions (#7)
Default the Codex SDK runtime to least-privilege settings and format README for CI.
1 parent 2669b5c commit 835e83a

4 files changed

Lines changed: 19 additions & 27 deletions

File tree

.env.example

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ WORKSPACE_ROOT=.
1414
CODEX_WORKDIR=.
1515
CODEX_SDK_CONFIG={}
1616
CODEX_SDK_SKIP_GIT_REPO_CHECK=true
17-
CODEX_SDK_SANDBOX_MODE=danger-full-access
18-
CODEX_SDK_APPROVAL_POLICY=never
17+
CODEX_SDK_SANDBOX_MODE=workspace-write
18+
CODEX_SDK_APPROVAL_POLICY=on-request
1919
CODEX_SDK_REASONING_EFFORT=
20-
CODEX_SDK_NETWORK_ACCESS_ENABLED=
20+
CODEX_SDK_NETWORK_ACCESS_ENABLED=false
2121
CODEX_SDK_WEB_SEARCH_MODE=
2222
CODEX_SDK_ADDITIONAL_DIRECTORIES=[]
2323
SHELL_ENABLED=false
@@ -35,7 +35,7 @@ CRON_TIMEZONE=Asia/Shanghai
3535

3636
MCP_SERVERS=[]
3737

38-
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx
38+
GITHUB_TOKEN=github-token-with-minimal-scope
3939
GITHUB_DEFAULT_WORKDIR=.
4040
GITHUB_DEFAULT_BRANCH=main
4141
E2E_TEST_COMMAND=npx playwright test --reporter=line

README.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
A Telegram bot that gives you remote access to `@openai/codex` through a Node.js runtime with two Codex backends: the Codex SDK and the legacy CLI/PTy path.
77
It is strictly inspired by `RichardAtCT/claude-code-telegram`, but this project is implemented for CodeX SDK/CLI + MCP + Subagent routing.
88

9-
109
## What Is This?
1110

1211
This bot connects Telegram to Codex and routes tasks to the right execution surface:
@@ -22,7 +21,6 @@ Key design goals:
2221
- Avoid duplicate MCP calls by separating Codex MCP vs Bot MCP responsibilities
2322
- Prefer the SDK backend for new installs, while keeping the CLI backend as a fallback
2423

25-
2624
## Use This Like A Skill
2725

2826
### What It Does
@@ -70,7 +68,6 @@ npm run start
7068

7169
For agent-oriented setup, see [SKILL.md](/Users/ding/Documents/Code/Github/CodexClaw/SKILL.md).
7270

73-
7471
## Quick Start
7572

7673
### Prerequisites
@@ -79,7 +76,6 @@ For agent-oriented setup, see [SKILL.md](/Users/ding/Documents/Code/Github/Codex
7976
- Codex CLI -- https://github.com/openai/codex
8077
- Telegram Bot Token -- from `@BotFather`
8178

82-
8379
## Development Commands
8480

8581
- `npm run start` - start the bot
@@ -492,18 +488,17 @@ Telegram can manage runtime usage of Bot-side MCP and skills, but not install ar
492488
- Codex SDK reference: https://github.com/coleam00/codex-telegram-coding-assistant
493489
- This implementation: Codex-first Node.js stack (`@openai/codex-sdk`, `telegraf`, `node-pty`, `node-cron`, MCP SDK)
494490

495-
496491
---
497492

498-
## 🦞 OPC Ecosystem
493+
## ?? OPC Ecosystem
499494

500-
> Built by [@MackDing](https://github.com/MackDing) One-Person Company infrastructure powered by AI agents.
495+
> Built by [@MackDing](https://github.com/MackDing) ? One-Person Company infrastructure powered by AI agents.
501496
502-
| Project | What it does |
503-
|---------|-------------|
504-
| [**opc.ren**](https://opc.ren) | OPC founder hub tools, signals, community |
505-
| [**CodexClaw**](https://github.com/MackDing/CodexClaw) | Telegram bot for remote Codex access with MCP + subagent routing |
506-
| [**awesome-ai-api**](https://github.com/MackDing/awesome-ai-api) | Leaderboard of 200+ AI API gateways & relays |
507-
| [**claude-context-health**](https://github.com/MackDing/claude-context-health) | Diagnose & fix Claude Code session degradation |
508-
| [**opc-daily-signal**](https://github.com/MackDing/opc-daily-signal) | AI-powered daily decision intelligence for OPC founders |
509-
| [**doc-preprocess-hub**](https://github.com/MackDing/doc-preprocess-hub) | Enterprise document preprocessing MinerU + docling |
497+
| Project | What it does |
498+
| ------------------------------------------------------------------------------ | ---------------------------------------------------------------- |
499+
| [**opc.ren**](https://opc.ren) | OPC founder hub ? tools, signals, community |
500+
| [**CodexClaw**](https://github.com/MackDing/CodexClaw) | Telegram bot for remote Codex access with MCP + subagent routing |
501+
| [**awesome-ai-api**](https://github.com/MackDing/awesome-ai-api) | Leaderboard of 200+ AI API gateways & relays |
502+
| [**claude-context-health**](https://github.com/MackDing/claude-context-health) | Diagnose & fix Claude Code session degradation |
503+
| [**opc-daily-signal**](https://github.com/MackDing/opc-daily-signal) | AI-powered daily decision intelligence for OPC founders |
504+
| [**doc-preprocess-hub**](https://github.com/MackDing/doc-preprocess-hub) | Enterprise document preprocessing ? MinerU + docling |

src/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,14 +339,14 @@ export function loadConfig(): AppConfig {
339339
"read-only",
340340
"workspace-write",
341341
"danger-full-access"
342-
]) || (runnerBackend === "sdk" ? "danger-full-access" : undefined),
342+
]) || (runnerBackend === "sdk" ? "workspace-write" : undefined),
343343
approvalPolicy:
344344
parseEnum<CodexApprovalPolicy>(process.env.CODEX_SDK_APPROVAL_POLICY, [
345345
"never",
346346
"on-request",
347347
"on-failure",
348348
"untrusted"
349-
]) || (runnerBackend === "sdk" ? "never" : undefined),
349+
]) || (runnerBackend === "sdk" ? "on-request" : undefined),
350350
modelReasoningEffort: parseEnum<CodexReasoningEffort>(
351351
process.env.CODEX_SDK_REASONING_EFFORT,
352352
["minimal", "low", "medium", "high", "xhigh"]

tests/config.test.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ test("loadConfig falls back to the current working directory when configured pat
227227
assert.equal(config.mcp.servers[0].cwd, cwd);
228228
});
229229

230-
test("loadConfig defaults the sdk runtime to full access when unset", () => {
230+
test("loadConfig defaults the sdk runtime to least-privilege settings when unset", () => {
231231
const config = withEnv(
232232
{
233233
BOT_TOKEN: "telegram-token",
@@ -238,11 +238,8 @@ test("loadConfig defaults the sdk runtime to full access when unset", () => {
238238
);
239239

240240
assert.equal(config.runner.backend, "sdk");
241-
assert.equal(
242-
config.runner.sdkThreadOptions.sandboxMode,
243-
"danger-full-access"
244-
);
245-
assert.equal(config.runner.sdkThreadOptions.approvalPolicy, "never");
241+
assert.equal(config.runner.sdkThreadOptions.sandboxMode, "workspace-write");
242+
assert.equal(config.runner.sdkThreadOptions.approvalPolicy, "on-request");
246243
});
247244

248245
test("loadConfig requires shell allowlist when safe shell is enabled", () => {

0 commit comments

Comments
 (0)