Typo3 workspaces

From dirnbauer/webconsulting-skills · View interactive version

Typo3 workspaces is an AI agent skill from the GitHub repository dirnbauer/webconsulting-skills. Guides TYPO3 Workspaces versioning, staging, publishing, overlays, workspace-aware queries, file limitations, permissions, frontend preview, diagnostics, repair, and tests. Use when the user works with TYPO3 workspaces, draft content, staged publishing, versioning, workspace overlays, review workflo

How to use this skill

Skill file

TYPO3 Workspaces

Source: https://github.com/dirnbauer/webconsulting-skills

Compatibility: TYPO3 v14.x

All code examples in this skill are designed to work on TYPO3 v14.

TYPO3 API First: Always use TYPO3's built-in APIs, core features, and established conventions before creating custom implementations. Do not reinvent what TYPO3 already provides. Always verify that the APIs and methods you use exist and are not deprecated in TYPO3 v14 by checking the official TYPO3 documentation.

Sources

This skill is based on 17 authoritative sources:

  1. TYPO3 Workspaces Extension Docs
  2. Versioning (Workspaces Extension)
  3. Creating a Custom Workspace
  4. Configuration Options (Workspaces)
  5. PSR-14 Events (Workspaces)
  6. Versioning & Workspaces (TYPO3 Explained / Core API)
  7. TCA versioningWS Reference
  8. Restriction Builder (TYPO3 Explained / Doctrine DBAL)
  9. b13 Blog: The Elegant Efficiency of TYPO3 Overlays (Benni Mack)
  10. Scheduler Tasks (Workspaces)
  11. Users Guide (Workspaces)
  12. TYPO3-CORE-SA-2025-022: Information Disclosure in Workspaces Module
  13. Localized Content Guide
  14. File Collections (TYPO3 Explained)
  15. FAL Database Architecture
  16. Forge Bug #60343: sys_file_metadata does not recognize workspace
  17. Forge Feature #97923: Combined folder_identifier field for sys_file_collection

1. Core Concepts

What Are Workspaces?

Workspaces allow editors to prepare content changes without affecting the live website. Changes go through a configurable review process before publication.

There are two types:

How Versioning Works (Database Level)

Offline (workspace) versions live in the same database table as live records. They are identified by:

| Field | Purpose |

|-------|---------|

| t3ver_oid | Points to the live record's uid (0 for live records and workspace-new records) |

| t3ver_wsid | Workspace ID this version belongs to (0 for live) |

| t3ver_state | Special state flags (see below) |

| t3ver_stage | Workflow stage (0=editing, -10=ready to publish) |

| pid | Real page ID (same as the live record's pid) |

Note: Before TYPO3 v10.4, offline versions had pid = -1. Since v10.4 (Important #89555, "Workspace-related database records contain the proper Page ID"), workspace records store their real pid; the separate v11 change (Breaking #92497) removed move placeholders. If you encounter pid = -1 in legacy code or documentation, it is outdated.

t3ver_state values (TYPO3 v14):

| Value | Meaning |

|-------|---------|

| 0 | Default: workspace modification of existing live record |

| 1 | New record created exclusively in workspace (no live counterpart) |

| 2 | Delete placeholder (record marked for deletion upon publish) |

| 4 | Move pointer (record to be moved upon publish, stores new pid/sorting) |

Removed in v11: t3ver_state = -1 (old "new version" pendant), t3ver_state = 3 (old "move placeholder"), and the t3ver_move_id field. If you see these values in legacy code, they are not used on TYPO3 v14.

The Overlay Mechanism

TYPO3 always fetches live records first, then overlays workspace versions on top. For translations with workspaces, the chain is:

  1. Fetch default language, live record (language=0, workspace=0)
  2. Overlay workspace version (search for t3ver_oid=<uid> AND t3ver_wsid=<current_ws>)
  3. Overlay language translation (search for l10n_parent=<uid> in target language)
  4. Overlay workspace version of translation

The uid of the live record is always preserved during overlay -- this keeps all references and links intact.

Publishing Workflow

2. CRITICAL: File/FAL Limitation

Files (FAL) are NOT versioned. This is the single most important limitation of TYPO3 Workspaces.

See also Section 2a below for the additional file collection limitation (folder-based collections).

What This Means

The Predictable Filename Security Problem

Scenario: An editor creates a workspace version of a page replacing geschaeftsbericht2024.pdf with geschaeftsbericht2025.pdf. The workspace is NOT published yet. However:

  1. The new PDF is uploaded to fileadmin/ immediately (files are live!)
  2. An external person guesses the URL by incrementing the year
  3. geschaeftsbericht2025.pdf is accessible before the content element referencing it is published

This is a real security/confidentiality risk.

Workarounds

1. Use non-guessable filenames:

# Instead of:
fileadmin/reports/geschaeftsbericht2025.pdf

# Use hashed/random names:
fileadmin/reports/gb-a8f3e2b1c9d4.pdf

2. Store confidential files outside the web root:

// config/system/settings.php
// Use a private storage that is NOT publicly accessible
// Deliver files programmatically via a controller

3. Use EXT:secure_downloads (leuchtfeuer/secure-downloads):

Files are delivered through a PHP script that checks access permissions. No direct file URL access.

4. Server-level protection for sensitive directories:

# Apache (.htaccess in a subdirectory)
<IfModule mod_authz_core.c>
    Require all denied
</IfModule>
# NGINX
location /fileadmin/confidential/ {
    deny all;
    return 403;
}

5. Use separate file references per workspace version:

Upload the new file with a different name. Do NOT overwrite the existing file. The workspace version of the content element references the new file, the live version keeps the old one. Upon publishing, both files exist but only the new one is referenced.

Rules for Workspace-Safe File Handling

2a. File Collections and Workspaces

File collections (sys_file_collection) are workspace-versioned at the record level, but folder-based collections resolve files from the live filesystem at runtime -- there is no database relation to overlay.

How File Collections Work

sys_file_collection stores three collection types, distinguished by the type field:

| type value | Resolution mechanism | Database relations involved |

|---|---|---|

| static (0) | sys_file_reference rows (tablenames='sys_file_collection', fieldname='files') | One sys_file_reference row per file |

| folder (1) | folder_identifier string (e.g. 1:/user_upload/gallery/) | None -- no join table, no reference rows |

| category (2) | category uid resolved via sys_category_record_mm | MM table (handled via parent record overlay) |

The TCA for sys_file_collection has versioningWS => true. This means the collection record itself gets workspace versions with t3ver_* fields. However, the record-level versioning only versions the fields stored in sys_file_collection -- it does not version the files that the collection resolves.

Workspace Safety per Collection Type

| Collection Type | Record versioned? | File binding versioned? | Physical files versioned? | Workspace-safe? |

|---|---|---|---|---|

| Static | Yes | Yes (sys_file_reference has versioningWS = true) | No | Partially safe |

| Folder-based | Yes (record only) | No -- no DB binding exists | No | Not safe |

| Category-based | Yes | Partially (category MM handled via parent overlay) | No | Partially safe |

Why Folder-Based Collections Break Workspace Isolation

For folder-based collections, the "relation" between the collection and its files is not a database relation. The collection record stores only a folder_identifier string. When FolderBasedFileCollection::loadContents() is called, TYPO3 calls $storage->getFilesInFolder() to list files directly from the live storage driver. There is no overlay-capable database row between the collection and its files.

Consequences:

Static Collections Are Safer

Static collections (type=static) bind files via sys_file_reference rows. Both sys_file_collection and sys_file_reference have versioningWS = true. When you add or remove a file from a static collection inside a workspace, TYPO3 creates workspace versions of the sys_file_reference rows. The binding between collection and file is versioned.

The remaining limitation: physical files (sys_file) are still not versioned (see Section 2). If you overwrite a file, it changes everywhere.

Workarounds for Folder-Based Collections

1. Prefer static collections when workspace isolation matters:

Use type=static instead of type=folder. The file-to-collection binding is a sys_file_reference row, which is workspace-versioned.

2. Use separate folders per workspace version:

For folder-based collections, create a new folder for the workspace change (e.g. gallery-v2/) and change the folder_identifier in the workspace version of the collection record. The live version still points to the original folder.

3. Do NOT modify shared folder contents while workspace drafts reference them:

If a folder-based collection is used in workspace content, avoid adding or removing files from that folder until the workspace is published.

4. Clean up old folders after publishing:

Use AfterRecordPublishedEvent to remove obsolete folders after the workspace version is published:

<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Resource\StorageRepository;
use TYPO3\CMS\Workspaces\Event\AfterRecordPublishedEvent;

#[AsEventListener]
final class CleanupOldCollectionFolderListener
{
    public function __construct(
        private readonly StorageRepository $storageRepository,
    ) {}

    public function __invoke(AfterRecordPublishedEvent $event): void
    {
        if ($event->getTable() !== 'sys_file_collection') {
            return;
        }

        // After publishing a folder-based collection, remove the old folder
        // if it is no longer referenced by any collection.
        // Implementation depends on your naming convention (e.g. gallery-v1/, gallery-v2/).
    }
}

Rules for Workspace-Safe File Collections

3. Installation & Setup Checklist

Installation

# Composer (TYPO3 v14)
composer require typo3/cms-workspaces

# Non-Composer: activate in Admin Tools > Extensions

Complete Setup Checklist

Use this checklist to verify your workspace setup is complete:

Extension & System
Backend User Groups
Backend Users
Workspace Record
Tables (TCA)

Inline / IRRE child tables (Deprecation #106821): If versioningWS is missing on a child table, Core logs a deprecation and may auto-add the flag at TCA build time — it does not throw a hard error. Set the flag explicitly in TCA; it will become a hard requirement in v15.

Scheduler Tasks
TSconfig

Detailed Reference

Read the full guide when the task needs detailed examples, long templates, troubleshooting matrices, appendices, or sections not included above. Keep this file unloaded for narrow tasks so the skill follows progressive disclosure.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.