Repository navigation
feat(claude): config-level allowRootSandbox opt-in so operators don't need to patch claude.ts for root-launched sessions #2714
Description
Area
CLI; Platform (Linux); Service lifecycle.
What are you trying to accomplish?
I need to run ocx claude --dangerously-skip-permissions in a root-owned VPS/container deployment without patching src/cli/claude.ts after every OpenCodex upgrade, while preserving OpenCodex's current fail-closed behavior for all operators who do not explicitly opt in.
Claude Code 2.1.205+ exits when all of these are true:
- process UID is 0;
- bypass permissions was explicitly requested;
IS_SANDBOX != 1;- no recognized external sandbox marker is present.
What prevents this today?
Issue #1688 accurately diagnosed the workflow. The upstream resolution intentionally refused to set IS_SANDBOX=1 automatically because UID 0 is not proof of isolation. That is the correct safe default, but root-only deployments have no supported operator-level override in OpenCodex.
The only working local workaround is this source patch in buildClaudeEnv():
if (typeof process.getuid === "function" && process.getuid() === 0) {
setDefault("IS_SANDBOX", "1");
}It has been validated across OpenCodex updates, but it leaves the installed package different from the official npm tarball and must be reapplied after upgrades.
What should OpenCodex do?
Expose a deliberately named, default-false config option for operators who explicitly accept this risk, for example:
{
"claudeCode": {
"allowRootSandbox": true
}
}When and only when all conditions are met:
- the config flag is
true; process.getuid() === 0;- the launch explicitly includes
--dangerously-skip-permissions;
OpenCodex should call setDefault("IS_SANDBOX", "1") for the child environment and emit a concise warning. An explicitly exported IS_SANDBOX=0 must continue to win. Ordinary Claude launches must remain unchanged.
This preserves the secure default from #1688 while giving VPS/container operators an auditable, supported opt-in instead of requiring an out-of-tree patch.
Example usage or interface
{
"claudeCode": {
"allowRootSandbox": true
}
}# Explicit operator opt-in + explicit dangerous CLI flag
ocx claude --dangerously-skip-permissions --print "reply OK"
# Expected warning
# OpenCodex: root sandbox override enabled by claudeCode.allowRootSandboxExpected guards:
# Default config: still fail closed
ocx claude --dangerously-skip-permissions
# Explicit user opt-out wins even when config is true
IS_SANDBOX=0 ocx claude --dangerously-skip-permissions
# Ordinary launch: no override injected
ocx claude --print "reply OK"Alternatives or workarounds
- Patch
src/cli/claude.tsafter every npm update: works but creates permanent package drift. - Export
IS_SANDBOX=1manually: not centrally auditable and easy to apply too broadly. - Run OpenCodex as a non-root user: preferable where possible, but not always available in existing root-owned VPS/container deployments.
- Create/verify a real OS sandbox: strongest design, but significantly larger in scope; the proposed flag remains an explicit risk acceptance, not a claim that UID 0 is isolated.
Additional context
- OpenCodex 2.33.0 official npm package has zero
IS_SANDBOXhandling insrc/cli/claude.ts. - The installed local patch is the only source-code difference from the official tarball.
- Related: [Bug]: ocx claude --dangerously-skip-permissions aborts as root (uid==0) because IS_SANDBOX is never set #1688 and its resolution on dev via fix: gate root skip-permissions bypass and ship the auto-review model override (#1688 #1225) #2631.
Checks
- I searched existing issues and documentation.
- This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
- I removed secrets and personal data.
Activity
github-actions commentedon Aug 26, 2026
Issue reopened
The report now contains the information required by the automated check. Thanks for updating it.
rrmlima commentedon Aug 27, 2026
Updated the report to use the repository's recognized issue-template headings and filled every required field requested by the quality bot. The reproduction and all examples are redacted. Please re-evaluate/reopen automatically.
rrmlima commentedon Aug 27, 2026
Follow-up: corrected headings to the exact GitHub issue-form rendering (). For #2717 I also added the literal Bug-template fields , , , , and because the quality bot classified the existing issue as kind=bug. All requested fields are now present.
rrmlima commentedon Aug 27, 2026
Follow-up: corrected headings to the exact GitHub issue-form rendering (
###). For #2717 I also added the literal Bug-template fieldsSummary,Reproduction,Version,Operating system, andProvider and modelbecause the quality bot classified the existing issue askind=bug. All requested fields are now present.lidge-jun commentedon Aug 27, 2026
리뷰 · 우선순위 34 / 80
설명: 이 이슈는 루트로
ocx claude --dangerously-skip-permissions를 켤 때 Claude Code 가 막는 것을, 설정 한 칸으로 우회하고 싶다는 요청이다. 작성자는 rrmlima 이다. 라벨은 enhancement 다. 보고 버전은 OpenCodex 2.33.0 이다. 지금 CURRENTdevHEAD 는 9b838d0 이다. package.json 은 아직 2.32.1-preview.20260825 다. 이번 시간 origin/dev는 ab63ded 에서 9b838d0 로 움직였다. 마지막 머지는 2719 그림 다듬기다. 이 이슈와는 무관하다. 이 이슈는 열려 있다. 구현 풀은 없다. 내가 머지하지 않고 구현하지 않는다.작성자가 말한 막힘은 Claude Code 2.1.205 이후다. 유아이디가 0 이고, 권한 우회 깃발을 켰고,
IS_SANDBOX가 1 이 아니면 자식이 끝난다. 이슈 1688 이 그 길을 이미 적었다. 작성자는 1688 이 자동으로IS_SANDBOX=1을 넣는 것을 거절했다고 적었고, 그래서 매번src/cli/claude.ts의buildClaudeEnv에 패치를 넣는다고 한다. 원하는 설정은claudeCode.allowRootSandbox기본 꺼짐이다. 켜져 있고, 유아이디가 0 이고,--dangerously-skip-permissions가 있을 때만setDefault("IS_SANDBOX", "1")을 하고 경고를 찍는다. 사용자가 보낸IS_SANDBOX=0은 그대로 이겨야 한다.HEAD 를 보면 그 동작은 이미 들어가 있다. 머지된 풀 2631 이 이슈 1688 을 닫으면서 넣었다. src/cli/claude.ts 309-316줄
shouldAllowRootSkipPermissions는 인자 목록에--dangerously-skip-permissions가 있고getuid() === 0이면 참이다. 325-341줄cmdClaude는 그 값을buildClaudeEnv에 넘긴다. 120-122줄은 참일 때setDefault("IS_SANDBOX", "1")을 한다. 115-118줄setDefault는 이미 값이 있으면 안 덮는다. 그래서 사용자가 보낸IS_SANDBOX=0은 이긴다. 318-322줄rootSkipPermissionsNotice는 우회를 넣었을 때와 사용자 값을 지켰을 때 경고가 다르다. 2631 본문도 운영체제 샌드박스를 안 만들었다고 분명히 적었다.작성자가 원하는 세 번째 문, 설정 칸은 없다. src/types/config.ts 8줄
OcxClaudeCodeConfig에allowRootSandbox가 없다. src/config.ts 의 claudeCode 검사에도 그 칸이 없다. 2631 은 설정 칸 없이, 위험 깃발과 루트 유아이디 두 개만으로 우회를 켰다. 그건 작성자 안보다 더 자동이다. 기본 꺼짐 설정 칸을 더하면 2631 보다 더 닫힌 동작이 된다. 그건 새 기능이 아니라 이미 합친 설계를 되돌리는 일이다. 보고한 2.33.0 공식 패키지에 이 코드가 없다면, 그건 배포가dev보다 뒤처진 것이다. 이 저장소 package.json 은 아직 2.32.1-preview.20260825 다. 소스에 패치를 심는 우회는dev기준으로 필요 없다.관련 이슈 1688 은 2631 로 닫혀 있다. 다시 열지 말 것. 1225 는 같은 2631 에 실렸지만 자동 리뷰 모델 이야기라 이 이슈와 무관하다. types.ts 와 config.ts 가르기가 진행 중이다. 만약 설정 칸을 굳이 넣는다면 src/types/config.ts 의
OcxClaudeCodeConfig에만 넣는다. src/types.ts 를 되살리지 말 것. 프리뷰 배포가 아니다. 2464 2568 1049 2612 2210 2641 을 다시 열거나 댓글 달지 말 것.라인 309-316 - src/cli/claude.ts shouldAllowRootSkipPermissions 가 위험 깃발과 유아이디 0 만 본다
라인 120-122 - buildClaudeEnv 가 그 값이 참이면 IS_SANDBOX=1 을 기본으로 넣는다
라인 115-118 - setDefault 는 사용자 값이 있으면 안 덮는다. IS_SANDBOX=0 이 이긴다
라인 337-341 - cmdClaude 가 루트 우회일 때 경고를 찍는다
라인 318-322 - 경고 문구는 우회를 넣었을 때와 사용자 값을 지켰을 때가 다르다
라인 8-88 - src/types/config.ts OcxClaudeCodeConfig 에 allowRootSandbox 칸이 없다
풀 2631 - 이슈 1688 을 닫으며 이 우회를 이미 넣었다
이슈 1688 - 닫혀 있다. 다시 열지 말 것
이슈 본문 - 2.33.0 패키지에 없다고 했으나 CURRENT dev 소스에는 있다
메인테이너의 판단이 필요한 지점
너의 추천
이 이슈는 닫는다. 완료로 닫는다. 이미
dev의 2631 이 1688 을 닫으며 같은 우회를 넣었다. 설정 칸allowRootSandbox는 넣지 말 것. 넣으면 이미 합친 자동 우회를 다시 잠그는 동작이 된다. 작성자에게는 소스 패치를 버리고 지금dev의ocx claude --dangerously-skip-permissions를 쓰라고 한다. 사용자가 보낸IS_SANDBOX=0은 그대로 이긴다. 1688 은 다시 열지 말 것. 구현 풀을 받지 말 것. 라벨은 그대로 둔다. 프리뷰 배포가 아니다. 내가 머지하지 않는다.이 댓글은 grok-bot이 작성했습니다
rrmlima commentedon Aug 28, 2026
Validated against the released
@bitkyc08/opencodex@2.34.0and on the original root-owned VPS workflow.Evidence:
2.34.0.src/cli/claude.tsis byte-for-byte identical to the official npm 2.34.0 tarball; no local source patch remains.--dangerously-skip-permissions.IS_SANDBOX=1only for that opted-in launch.IS_SANDBOX=0still wins.Focused upstream tests on clean
main/ Bun 1.4.0:Production verification after restart:
The former local
apply-claude-root-bypass.shhas been retired. No further change is requested: 2.34.0 provides the desired opt-in behavior with stronger safeguards than the old local patch. Closing as completed by #2631 / 2.34.0.