about summary refs log tree commit diff
path: root/app/lib/activitypub
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-07-11 20:11:09 +0200
committerGitHub <noreply@github.com>2019-07-11 20:11:09 +0200
commit5bf67ca91350e40e6f329271d3ca2bdcba87ab64 (patch)
treee6a124c0c3913900a6d55c163b0ef308bfae64c7 /app/lib/activitypub
parent4e1260feaa09bfa7305887e34cb129b37bee6c52 (diff)
Add ActivityPub secure mode (#11269)
* Add HTTP signature requirement for served ActivityPub resources

* Change `SECURE_MODE` to `AUTHORIZED_FETCH`

* Add 'Signature' to 'Vary' header and improve code style

* Improve code style by adding `public_fetch_mode?` method
Diffstat (limited to 'app/lib/activitypub')
-rw-r--r--app/lib/activitypub/adapter.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/lib/activitypub/adapter.rb b/app/lib/activitypub/adapter.rb
index c259c96f4..a1d84de2f 100644
--- a/app/lib/activitypub/adapter.rb
+++ b/app/lib/activitypub/adapter.rb
@@ -33,6 +33,7 @@ class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base
   def serializable_hash(options = nil)
     options         = serialization_options(options)
     serialized_hash = serializer.serializable_hash(options)
+    serialized_hash = serialized_hash.select { |k, _| options[:fields].include?(k) } if options[:fields]
     serialized_hash = self.class.transform_key_casing!(serialized_hash, instance_options)
 
     { '@context' => serialized_context }.merge(serialized_hash)