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

Command icon 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

mr.baileys created an issue. See original summary.

mr.baileys’s picture

Status: Needs work » Needs review
nikro’s picture

Assigned: mr.baileys » nikro

Good catch!

Code looks good, I'll wanna do a quick test tmw and then I'll RTBC it.

Thanks!

nikro’s picture

Assigned: nikro » Unassigned
Status: Needs review » Reviewed & tested by the community

This looks good and works well, just tested on a staging instance.

nikro’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.