Background information

This was originally reported as a private security issue, but has been approved for handling in the public queue by the Drupal Security Team.

Problem/Motivation

While trying to restrict the creation of content types I noticed that hook_entity_create_access works for some config entities and not for others.

Some add form routes only check for a specific permission and don't trigger this hook.

Steps to reproduce

1. Add this hook:

/**
 * Implements hook_entity_create_access().
 */
function test_entity_create_access() {
  return AccessResult::forbidden();
}

In theory this means we can't create any entity.
2. In practice, I can still create contact forms or node types for example, but I can't create menus or text formats.

Proposed resolution

All entity create form routes should probably use the _entity_create_access requirement.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

prudloff created an issue. See original summary.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

prudloff’s picture

This should probably be split into child issues for each entity type.