Skip to content

security: re-audit tail — traversal guard, step-budget parity, jsonstore Phase 1#155

Merged
AVADSA25 merged 2 commits into
mainfrom
reaudit-tail
May 29, 2026
Merged

security: re-audit tail — traversal guard, step-budget parity, jsonstore Phase 1#155
AVADSA25 merged 2 commits into
mainfrom
reaudit-tail

Conversation

@AVADSA25
Copy link
Copy Markdown
Owner

@AVADSA25 AVADSA25 commented May 29, 2026

Post-#154 cleanup. Three concerns, all TDD'd / verified, ruff clean, manifest current.

Item What
agent_id traversal (Medium) _agent_dir rejects /,\,..,leading ./~; loaders degrade to empty → 404 not 500.
non-stream [SKILL:] step-budget (Medium) non-streaming post-LLM tag path now consumes the budget the streaming path enforces.
jsonstore Phase 1 (C8) atomic-write migration of 6 ad-hoc state writers: alerts, marketplace (meta+registry), memory_upgrade (entity_map), imessage, scheduler (schedules), pomodoro. Manifest regenerated for pomodoro.

Deferred (documented): #9 Phase 2 (notifications-RMW writers in heartbeat/scheduler → file_lock), Phase 3 (converge codec_proactive/agent_messaging own atomic helpers), Phase 4 (don't-touch config/token files); the #8 routes/chat.py split (hot-path move, complexity value already shipped in #154); codec_voice marker (working pipeline).

🤖 Generated with Claude Code

Mikarina13 and others added 2 commits May 29, 2026 13:48
…parity (re-audit tail)

- agent_id traversal (Medium): _agent_dir now rejects '/', '\\', '..', leading
  '.'/'~' (path-param endpoints pass agent_id raw; create_agent slugs are safe).
  load_plan/state/manifest/grants catch the ValueError → degrade to empty so the
  endpoints return 404, not 500, on a hostile id.
- step-budget parity (Medium): the non-streaming post-LLM [SKILL:] resolution
  skipped _budget.consume('post_llm_skill_tag') that the streaming path enforces,
  so stream:false could run skills past the per-turn cap. Now consumes + drops
  the tag when exhausted, mirroring the stream path.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ase 1)

Route the simple full-overwrite ~/.codec state writers through
codec_jsonstore.atomic_write_json (tmp+fsync+atomic-replace+0600) instead of
truncate-then-write, so a crash mid-write can't truncate state and a concurrent
reader can't catch a half-written file:
- codec_alerts (_save_state), codec_marketplace (meta + registry cache),
  codec_memory_upgrade (entity_map, sort_keys preserved), codec_imessage
  (save_state), codec_scheduler (save_schedules), skills/pomodoro (_write_state).

Regenerated skills/.manifest.json (pomodoro.py changed — keeps its hash pin
current so the load-time gate doesn't AST-refuse it; CI --check clean).

Deferred to Phase 2/3: the notifications RMW writers (heartbeat/scheduler — need
file_lock, not just atomic write) + the modules with their own atomic helpers
(codec_proactive, codec_agent_messaging — Phase 3 convergence). codec_voice's
marker left untouched (working voice pipeline).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@AVADSA25 AVADSA25 changed the title security: re-audit tail — agent_id traversal guard + step-budget parity security: re-audit tail — traversal guard, step-budget parity, jsonstore Phase 1 May 29, 2026
@AVADSA25 AVADSA25 merged commit 0981408 into main May 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants