From 68c797bece0ed0801cfc8718d77841b455bf4d0d Mon Sep 17 00:00:00 2001 From: ThibG Date: Sun, 31 Mar 2019 17:27:24 +0200 Subject: [PATCH] Ensure request.body isn't emptied out before signature verification (#10432) Fixes #10429 --- app/controllers/activitypub/inboxes_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/activitypub/inboxes_controller.rb b/app/controllers/activitypub/inboxes_controller.rb index 1501b914ec..a0b7532c2e 100644 --- a/app/controllers/activitypub/inboxes_controller.rb +++ b/app/controllers/activitypub/inboxes_controller.rb @@ -32,7 +32,10 @@ class ActivityPub::InboxesController < Api::BaseController end def body - @body ||= request.body.read.force_encoding('UTF-8') + return @body if defined?(@body) + @body = request.body.read.force_encoding('UTF-8') + request.body.rewind if request.body.respond_to?(:rewind) + @body end def upgrade_account