Issue Bug Closed

#66064Use configurationBuilder for generating propertyMappingConfiguration in controller arguments

Bernhard Kraft 03/26/15, 18:42 updated 10/06/26, 18:02

Description

Currently the propertyMappingConfiguration in “TYPO3\CMS\Extbase\Mvc\Controller\Argument” gets injected and thus will be empty.

I guess it would make sense to use “TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationBuilder” to generate a new propertyMappingConfiguration having sane defaults. Or is the ConfigurationBuilder just intended for property mapping internally in a domain object and not for domain models being passed as controller arguments?

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 3

  1. Bernhard Kraft commented <span data-processor="relativetime" data-value="2015-03-26T18:45:16+00:00" > 03/26/15, 18:45 </span>

    At least the the configurationBuilder is used in “TYPO3\CMS\Extbase\Property\PropertyMapper” when calling ->convert() with a NULL value for property configuration.

    The “TYPO3\CMS\Extbase\Mvc\Controller\Argument” class creates an propertyMappingConfiguration by injection and thus will pass a non-null value which is not enriched with the default settings. So my assumption was that Mvc\Controller\Argument should use the propertyMappingConfigurationBuilder.

  2. Georg Ringer commented and changed status New Closed <span data-processor="relativetime" data-value="2026-10-06T18:02:11+00:00" > 10/06/26, 18:02 </span>

    Thanks for the report. This is intended behaviour, so I am closing the issue.

    The defaults of PropertyMappingConfigurationBuilder are meant for code that calls PropertyMapper::convert() itself with data it trusts:

    • allowAllProperties()
    • PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED => true
    • PersistentObjectConverter::CONFIGURATION_MODIFICATION_ALLOWED => true

    Controller arguments are mapped from request data. With these defaults every request could set any property of a domain object and create or modify persisted objects (mass assignment). That is why Argument starts with an empty MvcPropertyMappingConfiguration: Extbase is secure by default and only allows what was explicitly permitted.

    Permissions are granted in two ways:

    1. Forms rendered with <f:form> include an HMAC-signed __trustedProperties field. MvcPropertyMappingConfigurationService::initializePropertyMappingConfigurationFromRequest() allows exactly the properties the form rendered, and allows modification when __identity is present, creation otherwise.
    2. Without a form, the controller opts in explicitly, e.g. in initializeCreateAction():
    $this->arguments->getArgument('blog')
        ->getPropertyMappingConfiguration()
        ->allowProperties('title', 'description')
        ->setTypeConverterOption(
            PersistentObjectConverter::class,
            PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED,
            true
        );

    Flow, where the Extbase property mapper comes from, follows the same principle.