Fix #3835: Related tags update vulnerability.
Also fixes deprecated call to `render :text`.
This commit is contained in:
@@ -36,13 +36,6 @@ class ApplicationController < ActionController::Base
|
|||||||
response.headers["Access-Control-Allow-Origin"] = "*"
|
response.headers["Access-Control-Allow-Origin"] = "*"
|
||||||
end
|
end
|
||||||
|
|
||||||
def require_reportbooru_key
|
|
||||||
unless params[:key] == Danbooru.config.reportbooru_key
|
|
||||||
render(text: "forbidden", status: 403)
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def bad_db_connection
|
def bad_db_connection
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json do
|
format.json do
|
||||||
|
|||||||
@@ -19,4 +19,12 @@ class RelatedTagsController < ApplicationController
|
|||||||
@tag.save
|
@tag.save
|
||||||
head :ok
|
head :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def require_reportbooru_key
|
||||||
|
unless Danbooru.config.reportbooru_key.present? && params[:key] == Danbooru.config.reportbooru_key
|
||||||
|
raise User::PrivilegeError
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user