Skip to content

feat(agent): block uip codedagent run and function run in uipath_cli tool - #1108

Open
mariadhakalUipath wants to merge 1 commit into
mainfrom
feat/uipath-cli-tool-safety-filter
Open

mariadhakalUipath wants to merge 1 commit into
mainfrom
feat/uipath-cli-tool-safety-filter

Conversation

@mariadhakalUipath

@mariadhakalUipath mariadhakalUipath commented Sep 22, 2026

Copy link
Copy Markdown
Contributor
  • The `uipath_cli` tool now refuses `uip codedagent run` and `uip function run`, so an agent cannot execute a coded agent or function locally through it.
  • The check sits in `_parse_uip_command` after the `uip`/`uipath` prefix is stripped, so both `uip codedagent run …` and `codedagent run …` are caught. A refused command returns the usual recoverable `exit_code=-1000` payload and never starts a process.
  • Other `codedagent` and `function` subcommands (`pack`, `init`, `list`, …) are unaffected.

Copilot AI lite review requested due to automatic review settings September 22, 2026 21:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Add tool-level tests covering prefixed and unprefixed commands and confirming no subprocess is invoked.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Low severity

Open (1)
What changed in this PR

This PR prevents uipath_cli from locally executing codedagent run and function run commands.

Changes:

  • Rejects prohibited commands with a recoverable exit_code=-1000 response.
  • Preserves other coded agent and function subcommands.
  • Adds parser tests for blocked commands.
File Summary
tests/​agent/​tools/​internal_tools/​test_uipath_cli_tool.py Tests parser rejection of blocked commands.
src/​uipath_langchain/​agent/​tools/​internal_tools/​uipath_cli_tool.py Rejects prohibited run commands before subprocess execution.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +58 to +61
@pytest.mark.parametrize("command", ["codedagent run", "function run"])
def test_parse_blocks_local_run_commands(command: str) -> None:
with pytest.raises(ValueError, match="blocked"):
_parse_uip_command(command)
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants