Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions gateway/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,14 @@ def build_session_context_prompt(
f"**Session type:** {session_label} β€” messages are prefixed "
"with [sender name]. Multiple users may participate."
)
elif context.source.user_name:
lines.append(f"**User:** {context.source.user_name}")
elif context.source.user_id:
uid = context.source.user_id
if redact_pii:
uid = _hash_sender_id(uid)
lines.append(f"**User ID:** {uid}")
else:
if context.source.user_name:
lines.append(f"**User:** {context.source.user_name}")
if context.source.user_id:
uid = context.source.user_id
if redact_pii:
uid = _hash_sender_id(uid)
lines.append(f"**User ID:** {uid}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please retain current main's _format_untrusted_prompt_value(uid) here rather than interpolating the raw ID. Commit 09666ceb76c0c3388c03c82c5d2dc2ecd2e57b60 hardened all user-controlled session metadata in this prompt; the corresponding name path must retain that protection too.


# Platform-specific behavioral notes
if context.source.platform == Platform.SLACK:
Expand Down