Issue Bug Closed

#109528EXT:form > Database storage forms > Access denied: You do not have permission to access forms on page "0".

Stefan Bürk 04/09/26, 09:19 updated 04/21/26, 11:30

Description

Description:

Database storage forms used in the frontend without a valid
TYPO3 Backend User login (for that domain) leads to following
exception with page.config.contentObjectExceptionHandler = 0
active and context set to debug mode (not production):

(1/1) #1529710560 TYPO3\CMS\Form\Domain\Exception\RenderingException
Access denied: You do not have permission to access forms on page "0".
in core-main/typo3/sysext/form/Classes/Domain/Factory/ArrayFormFactory.php
line 70

It seems that this related either to the original change #108653 introducing
the database storage directly or got engaged with the followup #109346 adding
permission checks to ensure that form are not loaded in the backend editor in
case the user has no read permissions.

For the frontend the database storage is used and thus the permission checks,
but does not deal with the fact that frontend page without any login, neither
FE nor BE user login should still be able to render the form, otherwise EXT:form
is unusable and does not make any sense anymore.

A first hack could be to check for the (global) request object and the application
type if it is a frontend request and simply allow read permissions, but feels not
right overall.

The whole permission handling should be revisited and a full concept postulated
and checked. For now we need a first bugfix to mitigate the regression already
released with TYPO3 v14.2.

To reproduce this following steps are needed:

  • Create a new form using database storage in the backend with a user having the permission for it. Add for example a email field.
  • Add a form plugin visible on a visible page and select the created database storage form
  • Logout from the backend or use a different browser to avoid any backend user session and open the page (frontend) with the form plugin and database form selected.

Expected:

Form renders normally and a website visitor can fill it out and send it.

Actual:

> Oops, an error occurred.

is displayed until TypoScript option set to debug this combined with Debug mode (FE) enabled,
than the exception is displayed with a stack trace.

Workaround used in project based on TYPO3 v14.2 for now as composer patch:

diff --git a/Classes/Storage/Permission/DatabasePermissionChecker.php b/Classes/Storage/Permission/DatabasePermissionChecker.php
index 6680c1e400a..d74c545abee 100644
--- a/typo3/sysext/form/Classes/Storage/Permission/DatabasePermissionChecker.php
+++ b/typo3/sysext/form/Classes/Storage/Permission/DatabasePermissionChecker.php
@@ -19,6 +19,7 @@ namespace TYPO3\CMS\Form\Storage\Permission;

 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
+use TYPO3\CMS\Core\Http\ApplicationType;
 use TYPO3\CMS\Core\Schema\TcaSchemaFactory;
 use TYPO3\CMS\Core\Type\Bitmask\Permission;
 use TYPO3\CMS\Form\Domain\Repository\FormDefinitionRepository;
@@ -45,6 +46,10 @@ final readonly class DatabasePermissionChecker
      */
     public function hasReadPermission(int $pageId): bool
     {
+        $request = $GLOBALS['TYPO3_REQUEST'] ?? null;
+        if ($request !== null && ApplicationType::fromRequest($request)->isFrontend()) {
+            return true;
+        }
         if (!$this->hasBackendUser()) {
             return false;
         }

Reviews 2