Skip to content

fix(runtime): verify process ownership and path identity before terminating stored PIDs (#103) - #147

Merged
BerryUIKI merged 1 commit into
devfrom
bugfix/103-verify-engine-process-ownership
Oct 4, 2026
Merged

BerryUIKI merged 1 commit into
devfrom
bugfix/103-verify-engine-process-ownership

Conversation

@BerryUIKI

Copy link
Copy Markdown
Owner

Summary

Resolves #103 (F03).

  • Strict Executable Ownership: Updated \ComfySupervisor, \WebUISupervisor, and \LlamaServerSupervisor\ to verify that a running process executable image strictly matches the sandboxed virtualenv Python binary (\get_python_bin()) or resides inside the engine's dedicated runtime/installation directory.
  • Reject Unrelated & Recycled PIDs: Stale or recycled PIDs referencing unrelated host Python processes or system processes are identified as unowned and safely ignored without sending termination signals.
  • Safe Stop & PID Cleanup: Calling \stop()\ or \get_pid()\ on an unowned or recycled PID safely unlinks the stale PID file without executing \ askkill\ or \os.kill\ on the foreign process.
  • Regression Tests: Added \�ackend/tests/test_process_ownership_security.py\ testing that unrelated Python processes are rejected, stale PID files are safely cleaned, and owned runtime paths match.

Verification

  • \�ackend/tests/test_process_ownership_security.py: 5/5 passed.
  • Full backend pytest suite: 176/176 passed.

@BerryUIKI
BerryUIKI merged commit 33943f7 into dev Oct 4, 2026
3 checks passed
@BerryUIKI
BerryUIKI deleted the bugfix/103-verify-engine-process-ownership branch October 4, 2026 21:37
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.

1 participant