CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • balancing security with functionality
Pages: [1]

Author Topic: balancing security with functionality  (Read 1032 times)

jamie

  • I post occasionally
  • **
  • Posts: 95
  • Karma: 6
balancing security with functionality
November 20, 2012, 08:00:53 am
Profiles are remarkably flexible and in this case I'm getting a bit lost in the flexibility, which suggests that I may be missing something.

On our Powerbase sites, we do not grant anonymous users access to the "CiviCRM: profile listings and forms" permission. As a result, the useful contact checksum feature doesn't work (this feature allows you to send an email to your contacts inviting them to update their own record). This outcome is quite understandable - the checksum feature depends on anonymous users accessing a pre-filled profile and being able to submit it. That logically falls in the "profile listing and forms" permission.

So, that led us to re-consider why we disable this permission for anonymous users.

We systematically disabled the permission when we discovered that several of our sites were inadvertently exposing data to anonymous users via profiles.

It can happen quite easily and goes something like this:

  • Create a profile  that is just used for "Standalone Form or Directory" and call it "data entry profile"
  • Create fields and carefully ensure that the fields are only visible for "User and User admin only" (say you want to use it for quick data entry)

Now, let many months pass of successfully using a secure form to help you do you work.

Next, discover the super useful feature of using a profile to display search results. Rather than re-creating a new profile, you find that the "data entry" profile would do the trick just perfectly. So you check off the "Search Values" check box and it now is available in advanced search!

Everything is still working fine - no problems and no security issues. However, if you decide you want to edit one of the fields in this profile, the visibility drop down menu will no longer provide "User and User admin only". Instead, the only option is "Public Pages and Listings". It's easy to not notice and simply hit save. If you do that, you have just exposed that field for potentially every record in your database to the world.

Is there a reason why a profile used for search results cannot have fields set to visibility: "User and user admin only"?

The code seems clear in it's intention (CRM/UF/Form/Field.php):

Code: [Select]
if (in_array('Search Profile', $otherModules)) {
      $visibleValues['Public Pages and Listings'] = 'Public Pages and Listings';
    }
    else {
      $visibleValues = CRM_Core_SelectValues::ufVisibility();
    }

If this could be changed, then I think the problem is solved.

On the other hand, given the complexity of profiles, perhaps there is a reason for it and we need to figure out another solution to this problem.

Any thoughts?

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: balancing security with functionality
November 20, 2012, 03:05:14 pm
Jamie - I don't know the answer to your "main" question. It may be related to the "history" of profile-driven search listings - which initially where limited to front-end profile search forms and result tables. Hence - the back-end Advanced Search usage MIGHT share a function which uses visibility to determine whether a field was eligible to be included in the search result columns. Unless Lobo or someone else has a different take on this, I think your next step would be to comment out that condition in a test environment and see if the "Search Views" mode still works if visibility is 'User and User Admin'.

Separately, we don't recommend using Profile Forms and Listings permissions at this point for most sites. Profile permissions have been broken down to separate 'create', 'edit', and 'view'. Pretty sure you can assign profile 'edit' and use the checksum method w/o exposing other people's data - since it means 'edit your own record'.

We are wrapping up some further 'clean-up' (http://issues.civicrm.org/jira/browse/CRM-10853) to ensure that both profile create and profile edit can be assigned WITHOUT requiring 'profile view' at all AND with the redirect to view the created or updated record working properly. This should tighten things up further -  since 'profile view' allows folks to view other contacts 'Public' fields data and that may not be desirable.
Protect your investment in CiviCRM by  becoming a Member!

jamie

  • I post occasionally
  • **
  • Posts: 95
  • Karma: 6
Re: balancing security with functionality
November 21, 2012, 08:31:02 am
Thanks Dave for the link to http://issues.civicrm.org/jira/browse/CRM-10853 - that's great news.

I'll do some testing with removing that condition that prevents search views from using admin only fields and if it seems to work fine, i'll post an issue.

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: balancing security with functionality
November 22, 2012, 01:51:42 am
hey there,

Quote
Separately, we don't recommend using Profile Forms and Listings permissions at this point for most sites.

where don't we recommend that you do that?! any chance we can add a deprecated warning to those permissions in drupal / deprecate them at some point?  do you have any background for this - i'd be happy to make sure that the docs etc. get updated with this info.

Michael
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: balancing security with functionality
November 22, 2012, 01:36:47 pm
We = me, not sure if it's covered in the doc, but should be since that permission is a bit too wide open for most sites. Pretty sure we no longer make that a default permission. I don't think there's a way to mark it 'deprecated' with changing a bunch of code since we match on the actual permission title string - but might be worth looking at - or maybe just removing it. Lobo might have a better opinion on this.
Protect your investment in CiviCRM by  becoming a Member!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: balancing security with functionality
November 22, 2012, 08:05:06 pm
OK,

So I'm trying to get some clarity on this from this thread & the ticket.

Permission4.24.3
CiviCRM: profile listings and formsDo all of below?na?
CiviCRM: profile listingsView search profiles - view profile fields for any contact as long as it's within the profile's group limitsView search profiles - view profile fields for any contact as long as it's within the profile's group limits
CiviCRM: profile createFill in an empty profile - this is required for Standalone, events & contributions. Note that giving this to anonymous combined with a standalone profile can promote spam. 'profile view' is required for the create/ edit workflow UNLESS you specify an alternate redirect URL in the profile settings (because default behavior is to redirect to profile/view after saving)Fill in an empty profile - this is required for Standalone, events & contributions. Note that giving this to anonymous combined with a standalone profile can promote spam. There is an implicit 'view own profile' on this so view profile permission is no longer needed
CiviCRM: profile editAllow person to edit own profile in conjunction with being logged in or a checksum. 'profile view' is required for the create/ edit workflow UNLESS you specify an alternate redirect URL in the profile settings (because default behavior is to redirect to profile/view after saving)Allow person to edit own profile in conjunction with being logged in or a checksum. There is an implicit 'view own profile' on this so view profile permission is no longer needed
CiviCRM: profile view? view ? profile?  (anyones??) In 4.2 you need this to see the thank you page after filling in a profileview ? profile
« Last Edit: November 23, 2012, 01:52:04 pm by Eileen »
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Katy J

  • I post occasionally
  • **
  • Posts: 50
  • Karma: 4
    • Third Sector Design
Re: balancing security with functionality
November 23, 2012, 05:44:52 am
4.2   CiviCRM: profile view   ? view just submitted profile?

Seems you also need 'profile view' to see the thank you page on submission of any profile. So essentially, you create is useless without view in most (all?) cases. I think it would make more sense for the thank you screen to exist within the create, or be a redirect to a different kind of page.
Do what you love, it's your gift to the universe

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: balancing security with functionality
November 23, 2012, 08:45:08 am

The plan for 4.3 is folks with "profile create" have an implicit "view my profile details only" permission. Hence after creating it gets redirected to viewing your profile only

this is separate from the generic profile view permission

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: balancing security with functionality
November 23, 2012, 11:20:44 am
.. and the same will be true for profile edit permission in 4.3. The objective is that you can grant ONLY profile create to anonymous and ONLY profile edit to authenticated if you only want the ability for users to create their own record and edit their own record. 'Profile view' would then only be assigned if you are using profiles to create a searchable directory and you want folks who do NOT have 'view all contacts' to be able to view fields exposed by a specific profile for other contacts than their own.

Katy J is correct that in 4.2 'profile view' is required for the create workflow UNLESS you specify an alternate redirect URL in the profile settings (because default behavior is to redirect to profile/view after saving).
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • balancing security with functionality

This forum was archived on 2017-11-26.