Cross-request flag-state leakage in @flags-sdk/flagsmith
Description
Impact
A cross-request flag-state leak affects server-side applications using @flags-sdk/flagsmith versions 1.0.0 and 1.0.1 to evaluate user-specific flags.
The adapter shares a mutable Flagsmith SDK client across requests. After evaluating flags for an identified user, subsequent anonymous requests can receive that user’s flag values. Concurrent requests for different users can also interfere with one another.
This can expose user-specific flag values or configuration and cause applications to serve features or behavior intended for another user. The impact depends on how the application uses those values. Applications that exclusively evaluate environment-level flags without user identification are not affected by this cross-user scenario.
Patches
This issue is fixed in @flags-sdk/flagsmith@2.0.0.
Versions 1.0.0 and 1.0.1 reused the flagsmith package’s mutable singleton across server requests. Version 2.0.0 replaces that integration with @flagsmith/nodejs, which accepts identity and traits per evaluation rather than storing a shared current user.
Upgrade to version 2.0.0 and follow the migration instructions in the release notes. This is a major release with breaking configuration changes.
Workarounds
Creating another createFlagsmithAdapter() instance alone does not isolate the underlying singleton. Returning an empty identity or calling logout() on the shared client is also insufficient to protect against concurrent requests.