Breaking: #111498 - Backend user checks delegate to security voters
See forge#111498
Description
The permission checks of
\TYPO3\ ask the
security voters, see Feature: #111237 - Security voters for tables, fields and languages, for every permission
a voter decides on:
checkfor() tables_andselect tables_of tables with TCA,modify non_of fields in the TCA,exclude_ fields explicit_,allowdeny allowed_,languages pagetypes_,select mfa_andproviders custom_options checkAuth Mode () checkLanguage Access ()
The legacy checks and
is thus give the same answer, as long
as
$backend is not changed at runtime, and a voter of
an extension restricts both.
check takes such changes into account,
while the principal of the request
is decides for keeps the
group data registered at login.
check is unchanged for
questions without a subject the voters decide on: tables without TCA,
fields unknown to the TCA, such as exclude fields of FlexForms, and
modules and available_, as the voters decide on modules and
widgets by their objects only. It is unchanged for any other permission as
well, such as webmounts or file_.
The permissions the voters decide on are denied without the security voters, e.g. in the install tool with the failsafe container or in unit tests without a container, and for a backend user object without a principal, e.g. without a user record or with an original user of a switch user session that cannot be resolved. This holds for administrators as well.
The
Data asks
check whether a table may be changed
and whether a page type may be set, so that a voter of an extension restricts
these as well. It grants both to administrators before asking, so that a
voter does not restrict administrators there. The following code still reads
$backend
directly, so that a voter of an extension does not restrict it yet:
Data, the list of tables copied or deleted with a page (Handler tables_)modify \TYPO3\, the page types offered (CMS\ Backend\ Form\ Form Data Provider\ Abstract Item Provider pagetypes_)select \TYPO3\, the exclude fields of FlexForms (CMS\ Backend\ Form\ Form Data Provider\ Tca Flex Process non_)exclude_ fields \TYPO3\(CMS\ Backend\ Controller\ Content Element\ Element Information Controller tables_)select \TYPO3\andCMS\ Backend\ Tree\ Repository\ Page Tree Filter \TYPO3\(CMS\ Linkvalidator\ Query Restrictions\ Editable Restriction allowed_)languages \TYPO3\(CMS\ Workspaces\ Service\ Grid Data Service non_)exclude_ fields - the recycler (
tables_) and the user information of the backend users modulemodify
Impact
For users who are no administrators, the checks answer as follows where they answered differently before:
checkand('tables_ select', $table) checkdeny tables marked('tables_ modify', $table) admin, even if a backend group grants them, including a group added through theOnly After.Groups Resolved Event checkgrants fields that are no exclude fields.('non_ exclude_ fields', 'table: field') checkgrants every language if no language is granted, and "all languages" (('allowed_ languages', $language Id) -1) always, ascheckdoes.Language Access () - An empty value, a value listing several items, a value of
allowed_orlanguages pagetypes_that is no integer and a value ofselect non_orexclude_ fields explicit_without all of its parts never match a grant.allowdeny checkdenies a value without table or field, or of a table of a sub-schema such asAuth Mode () tt_, also for administrators.content. textmedia - A security voter, or an implementation of
Admin, that callsOnly Table Grant Interface check,() checkorAuth Mode () checkof the backend user object for a permission the voters decide on, while the voters decide on such a permission of the same object, throws aLanguage Access () \Logicinstead of recursing without end.Exception
For all users, administrators included, the permissions the voters decide
on are denied for a backend user object without a user record and without
the security voters. The
Data then drops the values of exclude
fields and of the language field without an error.
Changes to
$backend at runtime are still taken into
account by
check.
Affected installations
Installations with extensions that rely on any of the answers listed above,
or that grant tables marked admin to users who are no administrators
through
be_ or
be_.
Migration
Check single values only. To grant a table marked admin to users who
are no administrators, implement
\TYPO3\,
see Feature: #111237 - Security voters for tables, fields and languages, or remove admin from the ctrl
section of the TCA of the table. The
Data keeps writing such
tables for administrators only.
Code that builds a backend user object by hand, e.g. in a command or a test,
authenticates a user with a record instead, e.g. through
Bootstrap:: in a command, or
set in a functional test. Unit tests that call the
checks on a real backend user object mock them instead.
A security voter decides on the principal it is given and does not call
check,
check or
check of the
backend user object for a permission the voters decide on.
New code asks the authorization checker instead of the backend user object, see Feature: #111237 - Security voters for tables, fields and languages.