Codex TOML config can be corrupted by naive string parsing #9

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

Severity: Medium

writeCodexProfile at cmd/ocgo/main.go:1484-1519 edits TOML config using strings.Index on section headers and manual offset arithmetic (no real TOML parser). This will corrupt files containing nested sections like [profiles.ocgo-launch.subsection] or comments with matching section header text.

Fix: Use a proper TOML parser (e.g. BurntSushi/toml) for editing the config file.

**Severity: Medium** `writeCodexProfile` at `cmd/ocgo/main.go:1484-1519` edits TOML config using `strings.Index` on section headers and manual offset arithmetic (no real TOML parser). This will corrupt files containing nested sections like `[profiles.ocgo-launch.subsection]` or comments with matching section header text. **Fix:** Use a proper TOML parser (e.g. `BurntSushi/toml`) for editing the config file.
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#9
No description provided.