@@ -8,9 +8,6 @@ class ProcessManager
8
8
# Timeout for version check operations to prevent hanging
9
9
VERSION_CHECK_TIMEOUT = 5
10
10
11
- # Process managers in order of preference
12
- PROCESS_MANAGERS = %w[ overmind foreman ] . freeze
13
-
14
11
class << self
15
12
# Check if a process is available and usable in the current execution context
16
13
# This accounts for bundler context where system commands might be intercepted
@@ -39,9 +36,8 @@ def run_with_process_manager(procfile)
39
36
FileManager . cleanup_stale_files
40
37
41
38
# 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 ] )
45
41
46
42
show_process_manager_installation_help
47
43
exit 1
@@ -159,9 +155,11 @@ def show_process_manager_installation_help
159
155
end
160
156
161
157
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 )
165
163
rescue StandardError
166
164
false
167
165
end
0 commit comments