Activity access check not called when viewed in a stream

Created on 6 March 2024, 9 months ago
Updated 18 April 2024, 7 months ago

Problem/Motivation

When a user submits a post to a closed group an activity is shown in the stream for anonymous users.
It looks like the access check is not being called, debugging shows the ActivityAccessController::checkAccess is not being called within the stream.

Steps to reproduce

Create a closed group
Post something to the group as a member of that group
Log out or open a window where you're logged out
View the homepage stream
There is an activity for this post shown (however not in full detail)

For further debugging purposes we've loaded the post by ID in a sandbox environment.
Which basically looked like this:

$post     = Post::load($pid);
$activity = Activity::load($aid);
$user     = User::load(0);
$post_result = $post->access('view', $user);
$activity_result = $activity->access('view', $user);

Both post_result as activity_result returned false, but the activity was still being shown. So it looks like the access checks are at least ignored, or not ran at all?

In my opinion this is "leaking" data that you might not want anonymous users to know.
Is this something that is configurable, and I have missed in the settings?
Or is indeed the ActivityAccessController not being called?

🐛 Bug report
Status

Active

Version

12.1

Component

Activity/Notifications

Created by

🇳🇱Netherlands RicardoPeters

Live updates comments and jobs are added and updated live.
  • Security improvements

    It makes Drupal less vulnerable to abuse or misuse. Note, this is the preferred tag, though the Security tag has a large body of issues tagged to it. Do NOT publicly disclose security vulnerabilities; contact the security team instead. Anyone (whether security team or not) can apply this tag to security improvements that do not directly present a vulnerability e.g. hardening an API to add filtering to reduce a common mistake in contributed modules.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024