API key leaked to child processes via os.Environ() #3

Open
opened 2026-05-18 02:18:36 +00:00 by renekv · 0 comments
Contributor

Severity: High

When launching claude or codex:

c.Env = append(os.Environ(), "ANTHROPIC_BASE_URL="+base, ...)

os.Environ() passes all parent env vars to the child, including OCGO_API_KEY. Any subprocess run by claude/codex can read the API key from /proc/<pid>/environ or environment inspection.

File: cmd/ocgo/main.go:234-237, cmd/ocgo/main.go:276

Fix: Filter OCGO_API_KEY out of the environment before passing to children, or build a clean env without it.

**Severity: High** When launching claude or codex: ```go c.Env = append(os.Environ(), "ANTHROPIC_BASE_URL="+base, ...) ``` `os.Environ()` passes **all** parent env vars to the child, including `OCGO_API_KEY`. Any subprocess run by claude/codex can read the API key from `/proc/<pid>/environ` or environment inspection. **File:** `cmd/ocgo/main.go:234-237`, `cmd/ocgo/main.go:276` **Fix:** Filter `OCGO_API_KEY` out of the environment before passing to children, or build a clean env without it.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: opencode/ocgo#3
No description provided.