mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 07:37:55 +08:00
SECURITY: 413 for GET, HEAD or DELETE requests with payload.
This commit is contained in:
@ -307,7 +307,15 @@ module Middleware
|
||||
@app = app
|
||||
end
|
||||
|
||||
PAYLOAD_INVALID_REQUEST_METHODS = ["GET", "DELETE", "HEAD"]
|
||||
|
||||
def call(env)
|
||||
if PAYLOAD_INVALID_REQUEST_METHODS.include?(env[Rack::REQUEST_METHOD]) &&
|
||||
env[Rack::RACK_INPUT].size > 0
|
||||
|
||||
return [413, {}, []]
|
||||
end
|
||||
|
||||
helper = Helper.new(env)
|
||||
force_anon = false
|
||||
|
||||
|
Reference in New Issue
Block a user