SECURITY: Remove runaway cpu/memory tests.
These should not be in the public plugin accessible via a GET. At the very least they should require an environment variable and CSRF protection. I'm removing them because they don't seem commonly used.
This commit is contained in:
parent
8f6be9c592
commit
ed4b88166e
|
|
@ -64,7 +64,7 @@ module DockerManager
|
||||||
repo = DockerManager::GitRepo.find(params[:path])
|
repo = DockerManager::GitRepo.find(params[:path])
|
||||||
raise Discourse::NotFound unless repo.present?
|
raise Discourse::NotFound unless repo.present?
|
||||||
|
|
||||||
repo.update! if Rails.env == 'production'
|
repo.update_remote! if Rails.env == 'production'
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
latest: {
|
latest: {
|
||||||
|
|
@ -103,27 +103,5 @@ module DockerManager
|
||||||
end
|
end
|
||||||
render plain: ps_output
|
render plain: ps_output
|
||||||
end
|
end
|
||||||
|
|
||||||
def runaway_cpu
|
|
||||||
Thread.new do
|
|
||||||
a = 1
|
|
||||||
while true
|
|
||||||
a += 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
render plain: "Killing CPU on #{Process.pid}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def runaway_mem
|
|
||||||
Thread.new do
|
|
||||||
a = []
|
|
||||||
while true
|
|
||||||
a << Array.new(50_000_000 / 8)
|
|
||||||
sleep 30
|
|
||||||
end
|
|
||||||
end
|
|
||||||
render plain: "Leaking memory on #{Process.pid}"
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,5 @@ DockerManager::Engine.routes.draw do
|
||||||
get "admin/docker/ps" => "admin#ps", constraints: AdminConstraint.new
|
get "admin/docker/ps" => "admin#ps", constraints: AdminConstraint.new
|
||||||
post "admin/docker/upgrade" => "admin#upgrade", constraints: AdminConstraint.new
|
post "admin/docker/upgrade" => "admin#upgrade", constraints: AdminConstraint.new
|
||||||
delete "admin/docker/upgrade" => "admin#reset_upgrade", constraints: AdminConstraint.new
|
delete "admin/docker/upgrade" => "admin#reset_upgrade", constraints: AdminConstraint.new
|
||||||
get "admin/docker/runaway_cpu" => "admin#runaway_cpu", constraints: AdminConstraint.new
|
|
||||||
get "admin/docker/runaway_mem" => "admin#runaway_mem", constraints: AdminConstraint.new
|
|
||||||
get 'admin/docker/csrf' => 'admin#csrf', constraints: AdminConstraint.new
|
get 'admin/docker/csrf' => 'admin#csrf', constraints: AdminConstraint.new
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ class DockerManager::GitRepo
|
||||||
url
|
url
|
||||||
end
|
end
|
||||||
|
|
||||||
def update!
|
def update_remote!
|
||||||
`cd #{path} && git remote update`
|
`cd #{path} && git remote update`
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue