Fix #3835: Related tags update vulnerability.

Also fixes deprecated call to `render :text`.
This commit is contained in:
evazion
2018-08-24 11:50:41 -05:00
parent 8833374294
commit 05ad112831
2 changed files with 8 additions and 7 deletions

View File

@@ -36,13 +36,6 @@ class ApplicationController < ActionController::Base
response.headers["Access-Control-Allow-Origin"] = "*"
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
respond_to do |format|
format.json do

View File

@@ -19,4 +19,12 @@ class RelatedTagsController < ApplicationController
@tag.save
head :ok
end
protected
def require_reportbooru_key
unless Danbooru.config.reportbooru_key.present? && params[:key] == Danbooru.config.reportbooru_key
raise User::PrivilegeError
end
end
end