Problem/Motivation
The module sends the raw PHP session identifier to LangFuse as the trace
sessionId. It is set in
LangFuseTraceManager::resolveTraceIdentity() (used by
ensureTrace()).
session_id() returns the live session token, the same
secret stored in the user's session cookie. Forwarding it to a third-party
observability backend (especially LangFuse Cloud) leaks a credential: anyone
who can read traces could replay that value to hijack the user's session.
Proposed resolution
Hash the session ID before it leaves Drupal, so traces still group requests
from the same session but the value can no longer be replayed as a token.
Remaining tasks
- Review / RTBC.
API changes
None. Method signatures are unchanged.
Data model changes
None.
Issue fork langfuse-3594076
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mr.baileysComment #4
nikro commentedGood catch!
Code looks good, I'll wanna do a quick test tmw and then I'll RTBC it.
Thanks!
Comment #5
nikro commentedThis looks good and works well, just tested on a staging instance.
Comment #7
nikro commented