Skip to content

Improve IP restriction handling - #2962

Open
robgruen wants to merge 2 commits into
mainfrom
dev/robgruen/builtinTask_fix
Open

Improve IP restriction handling#2962
robgruen wants to merge 2 commits into
mainfrom
dev/robgruen/builtinTask_fix

Conversation

@robgruen

@robgruen robgruen commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces significant improvements to network security and HTTP request handling across the workflow engine and copilot plugin packages. The main focus is on centralizing and strengthening the detection and blocking of private or reserved network targets, refactoring HTTP GET logic for better security and maintainability, and updating dependencies to use shared utilities. It also enhances test coverage to ensure correct handling of edge-case IP addresses and network scenarios.

Network security and HTTP request handling:

  • Refactored the http.get task in builtinTasks.ts to use new shared utilities for resolving and validating public IP addresses, improving detection of private/reserved addresses (including edge cases like decimal, octal, and hexadecimal IPv4, IPv4-mapped IPv6, Teredo, 6to4, NAT64, and unique-local IPv6). It now blocks credentialed URLs and enforces allowed/blocked host constraints more robustly. (ts/examples/workflow/engine/src/builtinTasks.ts)
  • Replaced custom IP parsing and public/private network detection logic in workspaceServer.ts with centralized helpers from @typeagent/common-utils/network, ensuring consistent enforcement of network security across packages. (ts/packages/copilot-plugin/src/mcp/workspaceServer.ts) [1] [2] [3]

Dependency and codebase updates:

  • Added @typeagent/common-utils as a dependency in both the workflow engine and copilot plugin packages to share network security logic. (ts/examples/workflow/engine/package.json, ts/packages/copilot-plugin/package.json, ts/packages/utils/commonUtils/package.json) [1] [2] [3]

Testing improvements:

  • Expanded test cases in both the workflow engine and copilot plugin to cover a wide range of private/reserved network targets, including unusual address formats, ensuring that these are correctly blocked. (ts/examples/workflow/engine/test/engine.spec.ts, ts/packages/copilot-plugin/test/workspaceServer.spec.ts) [1] [2]
  • Updated tests to reflect new error messages and validation logic, such as blocking credentialed HTTP/HTTPS URLs. (ts/examples/workflow/engine/test/engine.spec.ts)

Internal utility improvements:

  • Exported the readHttpResponseBody helper for direct testing and use in other modules, facilitating better testability and code reuse. (ts/examples/workflow/engine/src/builtinTasks.ts, ts/examples/workflow/engine/test/engine.spec.ts)

These changes collectively harden the system against SSRF and similar attacks, ensure consistent network policy enforcement, and improve maintainability by consolidating network utilities.

@robgruen
robgruen marked this pull request as ready for review September 2, 2026 16:06
Comment thread ts/examples/workflow/engine/src/builtinTasks.ts
Co-authored-by: robgruen <25374553+robgruen@users.noreply.github.com>
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.

3 participants