Skip to content

feat: pass folderKey in CAS WebSocket handshake for robot access validation#1375

Open
scottcmg wants to merge 5 commits intomainfrom
add-robot-info-cas
Open

feat: pass folderKey in CAS WebSocket handshake for robot access validation#1375
scottcmg wants to merge 5 commits intomainfrom
add-robot-info-cas

Conversation

@scottcmg
Copy link
Copy Markdown

@scottcmg scottcmg commented Feb 25, 2026

Summary

Passes folderKey as a WebSocket query parameter during the CAS handshake so that robots running with runAsMe=false (unattended, external app tokens) can be authorized by CAS via folder-scoped access.

Changes

  • _bridge.py: Build WebSocket URL with folderKey query param sourced from UIPATH_FOLDER_KEY env var (available via IJobInvocation.FolderKey in HDENS)
  • constants.py: Remove ENV_SYNTHETIC_USER_ID (no longer needed — CAS validates folder, not synthetic user identity)
  • test_bridge.py: Update test to verify folderKey is included and syntheticUserId is absent

How it works

When a URT agent runs with runAsMe=false, the robot's user ID won't match the conversation owner. CAS falls back to verifying the robot's folderKey matches conversation.folder_key. This avoids threading the user's synthetic identity through FpsProperties/HDENS/wire.

Companion PR

AgentInterfaces#761 — CAS-side folder-scoped robot authorization

Test Plan

  • python -m pytest tests/cli/chat/test_bridge.py
  • Verify folderKey appears in WebSocket URL when UIPATH_FOLDER_KEY is set
  • Verify syntheticUserId is no longer sent

@github-actions github-actions bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository labels Feb 25, 2026
@scottcmg scottcmg changed the title [WIP] Add keys to chat bridge for agent validation feat: add keys to chat bridge for agent validation Feb 27, 2026
@scottcmg scottcmg force-pushed the add-robot-info-cas branch 2 times, most recently from a31bd4e to 48ab984 Compare February 27, 2026 18:44
assert context.conversation_id is not None, "conversation_id must be set in context"
assert context.exchange_id is not None, "exchange_id must be set in context"

# Extract host from UIPATH_URL
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.

Any specific reason to remove comment? Same with # Construct WebSocket URL for CAS below?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Oh no those shouldn't be removed, added them back and looked through the rest of the commit to make sure nothing else was removed that shouldn't have been.

@scottcmg scottcmg force-pushed the add-robot-info-cas branch from a039733 to 08a5fe2 Compare March 10, 2026 23:34
scottcmg and others added 2 commits March 25, 2026 19:52
CAS now validates robot access via org + folderKey match instead of
syntheticUserId. Send folderKey (from UIPATH_FOLDER_KEY env var) as
a query param and remove syntheticUserId plumbing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@scottcmg scottcmg changed the title feat: add keys to chat bridge for agent validation feat: pass folderKey in CAS WebSocket handshake for robot access validation Mar 26, 2026
@maxduu maxduu self-requested a review March 26, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants