You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: session ID entropy + auth tokens; restrict send_message callbacks
Finding #9 — Predictable session IDs:
- Generate 128-bit random session IDs (YYYYMMDD-<32 hex chars>).
- Add a 256-bit session-scoped AuthToken stored in the session JSON.
- Require the token via X-Session-Token header, session_token cookie, or
auth_token WebSocket field for GET/DELETE/POST /api/sessions/<id> and
WebSocket session resume.
- Add per-IP rate limiting (60/min) on session detail lookups.
- Redact AuthToken from the /api/sessions list endpoint.
- Update the Web UI to store and send tokens.
Finding #10 — send_message callback injection:
- Reject callback_data values that start with reserved internal prefixes
(apr:, den:, trs:, clarify:, skill_save:, skill_skip:) in the
send_message tool.
- Add defense-in-depth validation in the Telegram sender closure.
- Only user-facing cb: callbacks are allowed.
Tests and docs updated.
-**Schedule atomic-write hardening** (`internal/schedule/store.go` + `internal/fsatomic`) — schedule file writes now use `fsatomic.WriteFile`, which creates a random temp file with `O_EXCL`, fsyncs data and directory, and renames over the target. A swapped-in symlink is replaced rather than followed, closing the symlink-override attack on `schedules.json` / `schedule-state.json`.
138
138
-**Telegram singleton flock lock** (`cmd/odek/telegram.go` + `internal/flock`) — the Telegram bot now uses an advisory `flock` on `~/.odek/telegram.lock` instead of a PID file probed with signals. This removes the non-Linux path where a planted PID could cause odek to kill an arbitrary process.
139
139
-**Telegram photo caption wrapping** (`cmd/odek/telegram.go`) — photo captions cross the Telegram trust boundary, so they are wrapped as untrusted content both when passed to the local vision model and when injected into the main agent's user message.
140
+
-**`send_message` callback prefix restriction** (`internal/tool/send_message.go` + `cmd/odek/telegram.go`) — the `send_message` tool rejects any button whose `callback_data` starts with a reserved internal prefix (`apr:`, `den:`, `trs:`, `clarify:`, `skill_save:`, `skill_skip:`); only user-facing `cb:` callbacks are allowed. The Telegram sender closure validates again as defense-in-depth, preventing a forged approval or skill button.
141
+
-**Session ID entropy + session-scoped auth tokens** (`internal/session/session.go`, `cmd/odek/serve.go`) — session IDs now carry 128 bits of randomness (16 bytes / 32 hex chars); each session stores a 256-bit `AuthToken` required by `GET/DELETE/POST /api/sessions/<id>` and WebSocket session-resume messages via `X-Session-Token` header, `session_token` cookie, or `auth_token` WS field. Per-IP rate limiting (60/min) on session lookups adds a brute-force backstop.
140
142
-**Secret redaction** (`internal/redact/redact.go`) — 20+ patterns: OpenAI, Anthropic, GitHub PAT, AWS, PEM, JWT, Vault, Google OAuth, SendGrid, Discord, DB URLs, etc.
0 commit comments