Needs review
Project:
Paragraphs
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
11 Apr 2026 at 16:18 UTC
Updated:
20 Apr 2026 at 08:38 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
matt-whelan commentedConfirmed on Drupal 11.3.7 / Paragraphs 1.20: the
_permissionrequirement bypasseshook_entity_create_access().Direct precedent in core (config entity type, no parent bundle):
entity.menu.add_formuses_entity_create_access: 'menu'filter.format_adduses_entity_create_access: 'filter_format'Fits as a child of #3561626's split-per-entity-type approach. No regression for default installs -
EntityAccessControlHandler::createAccessstill grants on the entity'sadmin_permissionbefore consulting hooks.Proposed fix:
Wrote a kernel test with two cases, driven by a tiny test module that toggles its hook verdict via state:
testForbiddenHookDeniesRouteAccess- pre-fix FAILS, post-fix PASSES.testNeutralHookAllowsRouteAccess- passes both, proves the admin permission path is not regressed.Happy to open an MR if you'd like? Cheers.
Comment #3
aayushpathak commentedworking..
Comment #4
mukhtarm commentedI know some are working on this issue. But here is my take.
What was fixed
The paragraphs.type_add route at /admin/structure/paragraphs_type/add was using _permission: 'administer paragraphs types' which bypasses hook_entity_create_access(). The patch replaces it with _entity_create_access: 'paragraphs_type', consistent with how Drupal core handles similar config entity routes (menus, text formats, etc.).
What changed
web/modules/contrib/paragraphs/paragraphs.routing.yml
_permission→_entity_create_accesson thetype_addrouteTest results
* With paragraphs_access_test module (implements hook_entity_create_access() returning forbidden): access is DENIED — the hook is now respected ✓
* Without the test module, user 1 (superadmin): access is ALLOWED — no regression ✓
* Route requirements dump: confirms _entity_create_access: 'paragraphs_type' is active in the running Drupal router ✓
I created a custom module (paragraphs_access_test) to test the functionality.
Comment #6
aayushpathak commented