Closed (fixed)
Project:
Profile 2
Version:
7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Anonymous (not verified)
Created:
4 Feb 2011 at 21:16 UTC
Updated:
15 Apr 2018 at 20:56 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
ericbroder commentedThere appears to be a significant risk of exposing sensitive data. I tested on a standard D7 install. Even with both of these permissions turned off:
- Profile Name: View own profile
- Profile Name: View any profile
...users can still view their own Profile Name profile. This potentially exposes sensitive data and appears to be a "Less Critical" Security Risk: http://drupal.org/security-team/risk-levels
Drupal version or module version:
- Drupal core 7.0
- Profile 2 7.x-1.x
- Entity 7.x-1.x
Steps to reproduce:
- Install Drupal with a Standard Install Profile.
- Install and Enable Profile 2 and Entity modules.
- Create a new profile and turn off "View own" and "View any" permissions.
- Test if a user can view their own profile data.
- Expected result based on permissions is that user can not view their own profile data.
I contacted the Drupal Security Team, and they said:
Comment #2
gregglesSubscribe.
Comment #3
rwohlebMy issue is that I'm trying to pull in profile2 fields into views. It works great... as long as you are admin.
It looks like the issue (my part of it at least) is coming from two directions. First, profile2_field_access() isn't checking much of the available state. It's relying on the full entity being passed, which is really an optional argument to hook_field_access. This would be fine, except it's returning FALSE any time the entity is missing, even when the target field is not set as private and doesn't need to check the UID attached to the entity.
The other side of the issue appears to be coming from views. The access() method of views_handler_field_field is calling field_access(), but is just passing the field name instead of a full field array. All the docs I've found, including field.api.php, gives an example with $field being an array.
Am I on crack?
Comment #4
matt2000 commentedsubscribe
Comment #5
joachim commentedConfirming.
At /user/X I can see a heading and field output for a profile type where *nobody* has any permissions. This happens both for the user viewing their own profile, and for anons (where they can see the user profile in general).
Comment #6
ericbroder commentedI assume the security check is supposed to happen here:
ref: http://drupalcode.org/project/profile2.git/blob/refs/heads/7.x-1.x:/prof...
However when I check this in my debugger, it looks like this function is not actually being called when a user views their own profile.
The main place I see profile2_access called is in hook_entity_info:
ref: http://drupalcode.org/project/profile2.git/blob/refs/heads/7.x-1.x:/prof...
UPDATE: Sorry, this was incorrect: ...it looks like this function is not actually being called when a user views their own profile. I think I was having a problem with my debugger. The real problem seems to be that the function is not called with $op = view, so it doesn't really check the View own and View any permissions.
Comment #7
joachim commentedThanks for the digging work :)
Looks like this will be a nice and simple patch... can anyone test it?
Comment #8
joachim commentedHmm. That call should not pass in $account.
But it's getting pretty late here... perhaps someone else can reroll? :)
Comment #9
ericbroder commentedRerolled patch based on #1051550-8: users always see their own profiles. Seems to work, though I'm not much of a hook_user_view expert: http://api.drupal.org/api/drupal/modules--user--user.api.php/function/ho...
Comment #10
ericbroder commentedSee also: #1153950: View profile permissions
Comment #11
roam2345 commentedclosed duplicate #1149808: Field permission issues when using relationships. to track on this thread.
Application of patch #7 and #9 did not resolve the issue for me so far.
My issue is from a different angle but essentially the same thing.
I have a view that does the following (using a block).
- I get the UID off the url (contextual filter)
- I add the relationship with the profile for the user.
- I try and show any field off the profile (using the relationship).
- Set the view access permissions to (None) or (permission | View published content) has same effect.
- BOOM! I can view the block as an admin, but anon that has permission to view the profile gets a funky error (see link at top).
Comment #12
joachim commentedThis issue is about the core display of profile categories at /user/UID.
Showing stuff in a View is another matter entirely -- I suggest you reopen that other issue and change its tile so it's clearly stated it concerns fields shown in Views.
Comment #13
roam2345 commented@joachim kk thanks. From my understanding of views access permissions the error is propagating from this issue, but ill leave that for comment on the other thread.
Comment #14
karilu_ec commentedPatch didn't work for me either. I have a view that displays the profile of the a person in a role 'staff', I created the view for a personnel page.
I can see the page as an admin but I cannot see the page as anonymous user or even the own person of the staff that is seeing that page (view). Similar issue as post #11 in the closed duplicate issue.
Comment #15
fagoouch.
Patch solve the issue, however we should better not create the render-array at all if it cannot be viewed anyway. Also, we should add tests to this so it cannot happen again.
Comment #16
fagoComment #17
fagoI've committed that patch + added some improvements to profile2_access() so modules may alter access. Please test carefully and report any problems.
Comment #18
fagoAny feedback? Does no one care?
Comment #19
ericbroder commentedThanks fago, this issue appears to be fixed now: #1051550-1: users always see their own profiles
Tested on:
- Drupal core: 7.2
- Profile 2: 7.x-1.x
- Entity: 7.x-1.x
Comment #20
fagothanks, I published a new release containing the fix: http://drupal.org/node/1181018