#109768Fix Race Condition in Dashboard Identifier Generation
Description
This patch improves the robustness and security of the Dashboard identifier generation process by eliminating the reliance on `time()` combined with `sha1()` hashing.
### Why was this error-prone?
In `DashboardRepository` and `DashboardAjaxController`, identifiers were previously generated using the following pattern:
`$identifier = sha1($prefix . ‘-’ . time());`
Because `time()` provides only one-second resolution, concurrent API requests or automated scripts generating multiple dashboards or widgets within the exact same second would receive identically generated identifiers. This introduces a race condition that leads to primary key collisions or silent overwriting of widget data.
Additionally, `DashboardRepository::create()` was unnecessarily wrapping the already robust `StringUtility::getUniqueId()` inside a `sha1()` hash:
`sha1(StringUtility::getUniqueId(‘widget_’) . ‘-’ . $defaultWidget[‘identifier’]);`
This is an error-prone design pattern that obfuscates the identifier’s structure.
### How does this patch fix it?
We updated both the `DashboardRepository` and `DashboardAjaxController` to use TYPO3’s native `StringUtility::getUniqueId()` for generating collision-free identifiers natively. The new implementation guarantees robust identifiers without relying on predictable 1-second `time()` intervals or redundant `sha1()` hashing wrappers.
- Swapped `sha1($prefix . time())` constructs for `$identifier = StringUtility::getUniqueId($prefix);`.
- Eliminated the redundant `sha1()` hashing wrapped over `StringUtility::getUniqueId()`.
- Imported `\TYPO3\CMS\Core\Utility\StringUtility` in `DashboardAjaxController` to cleanly utilize the API.
This issue was automatically created from https://github.com/TYPO3/typo3/pull/637
Reviews 1
Related issues 1
History 25
-
Gerrit Code Review pushed patch set 1 for main to change 93974 status
NewUnder Review <span data-processor="relativetime" data-value="2026-05-05T07:38:30+00:00" > 05/05/26, 07:38 </span> -
Gerrit Code Review pushed patch set 2 for main to change 93974 <span data-processor="relativetime" data-value="2026-10-06T15:40:31+00:00" > 10/06/26, 15:40 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 93974 <span data-processor="relativetime" data-value="2026-10-06T15:41:19+00:00" > 10/06/26, 15:41 </span>
-
Georg Ringer changed Related to #110515 <span data-processor="relativetime" data-value="2026-10-09T08:54:59+00:00" > 10/09/26, 08:54 </span>
-
Georg Ringer commented and changed status
Under ReviewClosed <span data-processor="relativetime" data-value="2026-10-09T08:55:08+00:00" > 10/09/26, 08:55 </span>
closing in favor of #110515