Issue Task Rejected

#109756Replace unsafe rand() with random_int() in UserSessionManager

TYPO3 GmbH TYPO3com 05/04/26, 15:56 updated 08/06/26, 15:59

Description

This patch proactively improves the security posture of the session management system by eliminating an error-prone design pattern related to randomness.

In `UserSessionManager.php`, the garbage collection probability was calculated using `rand(0, 99)`. The standard `rand()` function is a weak pseudo-random number generator and is considered an unsafe library call in contexts like session management.

This patch replaces it with `random_int(0, 99)`, which generates cryptographically secure, unbiased random integers. While the patch is a simple one-liner, it systematically removes a native PHP function known to be insecure and replaces it with the modern, secure standard.

This issue was automatically created from https://github.com/TYPO3/typo3/pull/634

Reviews 1

History 12

  1. Garvin Hicking commented and changed status Under Review Rejected <span data-processor="relativetime" data-value="2026-08-06T15:59:56+00:00" > 08/06/26, 15:59 </span>

    See review notes