about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-03-31 17:27:24 +0200
committerEugen Rochko <eugen@zeonfederated.com>2019-03-31 17:27:24 +0200
commit68c797bece0ed0801cfc8718d77841b455bf4d0d (patch)
treee7e3d656684215c20d9824d013218b3b48f9e289
parent59cce07601cbac40c8e6f5af593ea957a57d209f (diff)
Ensure request.body isn't emptied out before signature verification (#10432)
Fixes #10429
-rw-r--r--app/controllers/activitypub/inboxes_controller.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/controllers/activitypub/inboxes_controller.rb b/app/controllers/activitypub/inboxes_controller.rb
index 1501b914e..a0b7532c2 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