Summary
With our setup users can see teasers for content that they do not have permission to access in search results. Although clicking the titles in the search page results in 'Access denied', the titles may contain sensitive information.
Recreate setup
This was the method on a fresh OA installation:
Create a Space, set to private. Create a subspace of this, set to private. Add a section, and add a piece of content to it.
Now create two Groups, 'Group 1' and 'Group 2'.
Create two normal users, User 1 and User 2. Assign User 1 to Group 1 and User 2 to Group 2.
Add Group 1 to the Space and Subspace (through Members > Inherited).
Edit the Section and change the visibility options to be just Group 2.
ie:
Space < Group 1 assigned
- Subspace < Group 1 assigned
- - Section < Group 2 assigned
- - - Piece of content
Group 1 < User 1 is member
Group 2 < User 2 is memberRecreate error
Log in as User 1. Search for the title of the piece of content. The teaser for the content appears, even though the user should not have access to it. Clicking on the title of the piece of content results in 'Access denied'.
Expected behaviour
The piece of content does not appear in the search list, since the user does not have access to see it
Notes / a further example
Although our setup uses Groups, the issue also appears if just using normal group members.
Create another user, User 3. Assign them to the Space and Subspace as direct members. Leave the visibility of the Section set to just Group, ie:
Space < User 3 is direct member, Group 1 assigned
- Subspace < User 3 is direct member, Group 1 assigned
- - Section < Group 2 assigned
- - - Piece of contentNow if you log in as User 3 and search for the content, the teaser DOES still appear, even though it shouldn't.
Solution
You should set up your access on Sections *first* before you create any potentially sensitive private content.
Comments
Comment #1
mpotter commentedI'll look into trying to reproduce this.
For search, are you using the normal Drupal search, or are you using SOLR search server?
It's possible the View used by the search is somehow bypassing the normal Drupal node access checks. We are inheriting the search functionality that comes with Panopoly so Open Atrium doesn't do much except add some fields and facets.
While I'd be surprised if they are bypassing Drupal node-access, it wouldn't be the first time I was surprised ;)
The fact that clicking on the nodes gives you "access denied" confirms that the OA2 node access is working correctly. So it's just a matter of getting the search results view to respect that.
Comment #2
jkingsnorth commentedUsing the normal database search.
I think I may have got to the bottom of this. My hypothesis is simply that the search index needs to be rebuilt! Testing now.
Comment #3
jkingsnorth commentedYes this seems to be the issue!
By default the search index (in Search API) is set to 'Index items immediately'. So:
If I create a section without any access restrictions then it gets added to the index.
I then add a piece of content to the section, that gets added to the index as well.
I then change the visibility settings of the section, the index is updated but only for that section - not for all the content inside it.
So until the next cron run, or the index is otherwise rebuilt, the content inside that section is potentially visible to users who cannot access it.
--
One solution would therefore be to disable 'Index items immediately' by default. A slightly more complicated (maybe unfeasible) solution would be to get the Search API to update the index for pieces of content within a section when the section is updated.
Comment #4
mpotter commentedAh ha! Yes, thanks very much for looking into this, that's exactly what is happening.
I'll have to consider this and what the default should be. I'd lean more towards your "slightly more complicated" approach of leaving this default turned on, since most users want their content to appear in search results right away and not wait for cron, and then have changes to access trigger a re-index of some kind.
On production sites where cron runs frequently, changing the default makes sense. But many people install Open Atrium on local systems for testing and evaluation and if the "index immediately" option wasn't enabled we'd just get a ton of support requests claiming that search wasn't working.
These kind of issues can also happen on production sites where you have other caching layers, such as Varnish, which also won't be updated right away.
I think the real lesson here is to document this issue and make people aware that you should really set up your access on Sections *first* before you create any potentially sensitive private content.
Comment #5
Argus commentedUpdated the issue summary with the solution.
Comment #6
jkingsnorth commentedThanks mpotter, Argus. I expect that in the most part the permissions on the sections will be correct before sensitive content is added anyway.