Despite the obvious security implications, there are many Drupal sites out in the wild that have the PHP evaluator filter enabled for Anonymous users.

It has been proposed that php.module be removed from core. See #1203886: Remove the PHP module from Drupal core

A less drastic alternative would be to protect novice administrators from shooting themselves in the foot by denying use of the PHP evaluator filter to the Anonymous or Authenticated roles.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pillarsdotnet’s picture

Status: Active » Needs review
FileSize
2.49 KB

This patch implements hook_form_FORM_ID_alter() to remove dangerous checkboxes from the user_admin_permissions form.

pillarsdotnet’s picture

Issue tags: +Security
pillarsdotnet’s picture

FileSize
2.67 KB

Improved code logic.

pillarsdotnet’s picture

Removed the stray chunk from _php_filter_tips().

pillarsdotnet’s picture

Issue tags: +Needs backport to D7
catch’s picture

I think this is somewhat a duplicate of #594412: Correctly label all site-owning super-admin permissions. There are similar risks to giving anonymous users full HTML or administer users permissions too.

David_Rothstein’s picture

The idea of disabling these checkboxes on the permission page was previously proposed at #248598: Label permissions which are warned about in the user interface and rejected, so it's worth reading up on the reasoning there - I don't think that has changed.

What that issue eventually did instead was label them in hook_permission() with 'restrict access' => TRUE, so that at least a contributed module could use that information to disable or remove the checkboxes or whatever else.

Filter permissions are trickier, though, since you can't usually tell whether or not a text format is configured dangerously, so we never label them with 'restrict access' => TRUE currently. The issue to deal with that properly is #275811: Warn about potentially insecure filter configurations, but that's also complicated. I wonder if the php_list_permissions() function introduced in the above patches could be a good first step towards at least labeling text formats with the PHP filter as dangerous? Among text formats, there are many ways they can be configured to be a security risk, but the PHP filter kind of does stand in a class of its own.

pillarsdotnet’s picture

Status: Needs review » Closed (duplicate)