Overview
On /admin/people/permissions, each "Use the X text format" permission title is a link to that text format's configuration page (route entity.filter_format.edit_form). That page requires the administer filters permission.
A user who can manage permissions (administer permissions) but does not have administer filters sees these links and gets a 403 Access Denied when following one. The link is rendered unconditionally, without checking whether the current user can reach its target.
Steps to reproduce
- Create a role with at least these permissions (explicitly no
administer filters):access administration pagesaccess navigationview the administration themeadminister permissionsadminister users
- Assign the role to a user and log in as that user.
- Go to
/admin/people/permissions. - Follow a "Use the Restricted HTML text format" permission link.
- Result: 403 Access Denied. Expected: no link, or a link the user can follow.
Proposed resolution
In FilterPermissions::permissions(), only wrap the format label in a link when the current user has access to the format's edit form; otherwise show the plain label.
The access check's cacheability to the permission can be ignored, this is in a form forced with max-age 0
User interface changes
For users without administer filters, text format permission titles show as plain text instead of a 403 link.
Disclaimer: Used Claude Code + claude-opus-4-8 to search for potential dupes and write concrete STR.
Issue fork drupal-3616458
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
penyaskitoComment #3
penyaskitoComment #5
penyaskitoWim Leers flagged this on an internal project, so if possible should get credit too.
Comment #6
csakiistvanComment #7
csakiistvan✅ Tested and works — MR !16686.
Environment
Prerequisites
access administration pages,access navigation,view the administration theme,administer permissions,administer users— explicitly withoutadminister filters, assigned to a test user (per the issue summary).vendor/bin/phpunit core/modules/filter/tests/src/Kernel/FilterPermissionsTest.phpSteps
FilterPermissions::permissions()only links the format label when$format->access('update')is TRUE, plus the newFilterPermissionsTest.ddev drush cr/admin/people/permissionsand check the Filter section.Expected results
administer filters: the text format permission titles are plain text, no link that would 403.administer filters: the titles stay linked and the links work.Actual results
Before the fix the test user saw "Use the Restricted HTML text format" as a link and following it returned 403 on
/admin/config/content/formats/manage/restricted_html. After the fix the same user sees the plain label with no link, while user 1 still gets a working link.FilterPermissionsTestpasses (13 assertions).Notes
$format->access('update')and the route access forentity.filter_format.edit_formreturn FALSE.FilterPermissions::permissions().FilterDefaultConfigTestonly mentions the class in a setUp comment and is about default config installation, so a separateFilterPermissionsTestlooks like the right home.EntityLinksTest(Class "ColinODell\PsrTestLogger\TestLogger" not found) — a missing dev dependency in this environment, unrelated to the change.Testing produced with the assistance of an LLM.
Comment #8
csakiistvanComment #9
smustgrave commentedLeft some comments but tests appear to be failing too.