Problem / motivation
The core tracker module is a really useful module that enables tracking of recent content for users.
The main problem is that the most of times we want to enable and allow just admins or content editors to access this interface, but the module is currently using the default _permission: 'access content' for "/activity" url (see tracker.routing.yml). The most of times you might not want to have content types or users names disclosed to the anonymous users.
Steps to reproduce
1) Enable Activity Tracker module
2) As anonymous user, try to access http://yoursitedomain.com/activity
You might see all the information about the users activity, including "Page type", "Page Title", "Author", "Comments" and "Last Updated Date". There is no way to control who can see this information.
Proposed solution
Create a new "access users activity" permission and use it instead of the default "access content". It is possible to have better control of who should see the page by having this new permission type.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | tracker_prevent_anonymous-2978468-3.patch | 3.72 KB | bertonha |
| #2 | tracker_prevent_anonymous-2978468-2.patch | 816 bytes | bertonha |
Comments
Comment #2
bertonha commentedPatch tracker_prevent_anonymous-2978468-2.patch attached
Comment #4
bertonha commentedtracker_prevent_anonymous-2978468-3.patch
Comment #8
PeterE commentedIn case someone else lands here, I had a similar situation whereby I only want the administrator to view user activity.
Add the following to your custom module's mymodule.services.yml (where mymodule is our custom module's name)
Then create a route in your module's src\Routing\RouteSubscriber.php as follows:
Comment #10
hazit commentedIt would be useful to simply add Activity Tracker to the permissions list so that access can be set per User Role (i.e. not just anonymous vs authenticated).
Comment #12
jasonluttrell+1 for adding this feature to Drupal 8/9, implemented as hazit described above. Thanks.
Comment #13
tjtj commentedThis is a security issue. Anyone can see all activities including admin ones. Must be fixed in core ASAP! Still exists in 9.1.4
Comment #14
bessonweb commentedI think also it's a security and SEO issue. That expose all usernames and potentially not published contents. It's not very critical but personnally, I have disabled this module for these reasons.
Comment #15
tjtj commentedAnd people who enable this module do not know that it exposes user names and activities with NO access control permissions. I think it is quite critical. I found this by looking at my logs, and a hacker was accessing this page.
Comment #16
pwolanin commentedThis seems more that it is a documentation issue and feature request, not a security issue?
There *is* access control via permission - if you have a closed site then anonymous users should not have the access content permission.
Comment #17
larowlanIf the list includes unpublished node titles then it's access bypass
Comment #19
csc4 commented+1 for considering this as a security issue in that there is no warning that enabling this module exposes title information with no access checks which is very 'unDrupal' - and undermines module level protections such as Groups
The suggestion from 6 Apr 2010 #762962-45: Add permissions for the tracker pages for three permissions seems
From that issue: Proposed resolution
The patch in #45 adds these three permissions:
access global tracker
access other user's tracker
access own tracker
Seems a really good solution even 11 years on...
Comment #23
quietone commentedThis extension is deprecated and scheduled for removal in Drupal 11.
This is now Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
It will be moved to the contributed extension once the Drupal 11 branch is open.
Comment #25
andypostnow in contrib
Comment #26
xmacinfoUsing the contrib module on D11.
I am surprised to see that anonymous users can see the list of Recent content even if I set the view block permission to:
Role: Administrator
I wonder what is overriding the permission I set in the view.
/admin/structure/views/view/content_recentCreating a custom module with a custom
permissions.ymlandrouting.ymlis one solution. But I would expect the module itself to handle permissions.If we plan to add missing permissions to this module, let's change the issue to task and change the issue title to:
Add a new “access users activity” permission.
Pseudo code:
Comment #27
batigolixThis can be resolved together with the conversion to Views: #1941830: Convert tracker listings to a view