github Ruya-AI/cozempic v1.8.9

latest releases: v1.8.39, v1.8.38, v1.8.37...
6 months ago

PID-identity hardening (PR #86, @ynaamane)

17-bug audit of guard.py's PID management. 5 confused-deputy attack vectors where recycled PIDs caused SIGTERM of unrelated processes (Slack, VS Code, browser). All signal-sending paths now gated on identity verification.

Key fixes:

  • _is_claude_process() + _is_cozempic_guard_process() + _is_cozempic_watcher_process() — argv-based identity checks before every os.kill()
  • Atomic pidfile via O_CREAT|O_EXCL — prevents TOCTOU race on daemon start
  • _detect_claude_flags — psutil-based with metachar filtering (blocks $(rm -rf /) in process argv)
  • Windows cmd metachar escaping for resume commands
  • Main watchdog loop verifies Claude PID identity on every cycle (catches mid-session PID recycling)

Follow-up fixes:

  • os.open fd leak on os.write failure — now try/finally
  • spawn_lock leak on subprocess.Popen failure — previously blocked all future spawns permanently

Review: 4 independent agents (security/backdoor, logic/correctness, dry-run emulation of 8 scenarios, test coverage). No backdoors. No injection vectors.

637 tests passing.

Don't miss a new cozempic release

NewReleases is sending notifications on new releases.