]> git.mxchange.org Git - friendica.git/commitdiff
Issue 14879: Fix activity trust check
authorMichael <heluecht@pirati.ca>
Sun, 1 Jun 2025 17:49:21 +0000 (17:49 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 12 Jun 2025 02:23:44 +0000 (02:23 +0000)
src/Protocol/ActivityPub/Receiver.php
src/Util/JsonLD.php

index c217d491ca94848ef5b3416ff58956386ba35e52..1cb1cb0649b0e49ee8606722d816e1a0d1f18f7e 100644 (file)
@@ -644,16 +644,19 @@ class Receiver
                                return true;
                        }
                } else {
-                       $attributed_to = '';
+                       $attributed_to = null;
                }
 
                // Test the provided signatures against the actor and "attributedTo"
                if ($trust_source) {
-                       if ($attributed_to !== false && $attributed_to !== '') {
+                       if (!is_null($attributed_to)) {
                                $trust_source = (in_array($actor, $signer) && in_array($attributed_to, $signer));
                        } else {
                                $trust_source = in_array($actor, $signer);
                        }
+                       if (!$trust_source) {
+                               DI::logger()->info('Actor missmatch. Activity trust could not be achieved.', ['type' => $type, 'signer' => $signer, 'actor' => $actor, 'attributedTo' => $attributed_to]);
+                       }
                }
 
                // Lemmy announces activities.
index afca8d79ba164e91d663284a5c8f995c35ed609b..676c944381c53304e85243681a5720a6de29b6ad 100644 (file)
@@ -286,7 +286,7 @@ class JsonLD
         * @param $type
         * @param $type_value
         *
-        * @return string|null fetched element
+        * @return mixed|null fetched element. If the element is not found, null is returned.
         */
        public static function fetchElement($array, $element, $key = '@id', $type = null, $type_value = null)
        {