@@ -8,9 +8,6 @@ class ProcessManager
88 # Timeout for version check operations to prevent hanging
99 VERSION_CHECK_TIMEOUT = 5
1010
11- # Process managers in order of preference
12- PROCESS_MANAGERS = %w[ overmind foreman ] . freeze
13-
1411 class << self
1512 # Check if a process is available and usable in the current execution context
1613 # This accounts for bundler context where system commands might be intercepted
@@ -39,9 +36,8 @@ def run_with_process_manager(procfile)
3936 FileManager . cleanup_stale_files
4037
4138 # Try process managers in order of preference
42- PROCESS_MANAGERS . each do |pm |
43- return if run_process_if_available ( pm , [ "start" , "-f" , procfile ] )
44- end
39+ return if run_process_if_available ( "overmind" , [ "start" , "-f" , procfile ] )
40+ return if run_process_if_available ( "foreman" , [ "start" , "-f" , procfile ] )
4541
4642 show_process_manager_installation_help
4743 exit 1
@@ -159,9 +155,11 @@ def show_process_manager_installation_help
159155 end
160156
161157 def valid_procfile_path? ( procfile )
162- # system is invoked with args (no shell), so shell metacharacters are safe.
163- # Ensure it's a readable regular file.
164- File . file? ( procfile ) && File . readable? ( procfile )
158+ # Reject paths with shell metacharacters
159+ return false if procfile . match? ( /[;&|`$(){}\[ \] <>]/ )
160+
161+ # Ensure it's a readable file
162+ File . readable? ( procfile )
165163 rescue StandardError
166164 false
167165 end
0 commit comments