Skip to content

OutboundHostValidator Configuration binding and addition of allow_http_for_loopback option - #655

Open
Rodrigo Brandão (rodrigobr-msft) wants to merge 9 commits into
mainfrom
users/robrandao/allow-loopback-option
Open

Rodrigo Brandão (rodrigobr-msft) wants to merge 9 commits into
mainfrom
users/robrandao/allow-loopback-option

Conversation

@rodrigobr-msft

@rodrigobr-msft Rodrigo Brandão (rodrigobr-msft) commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

This pull request introduces enhancements to the outbound host validation logic, focusing on improved security and configurability for handling HTTP and loopback addresses. The main changes add support for selectively allowing HTTP connections to loopback addresses, improve the validation of service URLs, and expand configuration options for outbound host validation.

Security and validation improvements:

  • Updated service URL validation in _http_adapter_base.py to ensure both the scheme (e.g., HTTP/HTTPS) and port match between claim and activity URLs, reducing the risk of mismatches or protocol downgrade attacks.
  • Modified the _allow_addr function and its usage to allow HTTP for loopback addresses only if explicitly configured, tightening network address rules. [1] [2] [3] [4]
  • Enhanced the _is_allowed method to permit HTTP URLs only when the target is a loopback address and the new configuration flag is enabled, further restricting insecure connections.

Configurability and extensibility:

  • Added a new allow_http_for_loopback parameter and configuration option to OutboundHostValidator, enabling fine-grained control over HTTP access to loopback addresses via code or configuration. [1] [2] [3] [4] [5]
  • Integrated configuration loading methods (_from_scoped_configuration, _from_root_configuration) into OutboundHostValidator to support reading settings from a configuration object, making the validator more extensible and easier to manage. [1] [2]

Dependency and import updates:

  • Added necessary imports for configuration management and type annotations in outbound_host_validator.py to support the new features and maintain code clarity.

@rodrigobr-msft Rodrigo Brandão (rodrigobr-msft) changed the title OutboundHostValidatorConfig definition and addition of allow_http_for_loopback option OutboundHostValidator Configuration binding and addition of allow_http_for_loopback option Nov 17, 2026

Copilot AI left a comment

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.

🟡 Changes recommended

Configuration binding disables outbound host enforcement when Enabled is omitted despite supplied hosts, allowing every URL instead of enforcing the allowlist.

2 open issues
What changed in this PR

This PR adds configuration binding and controlled HTTP loopback access to the SDK’s outbound host validator, while tightening service URL matching.

Changes:

  • Adds configuration loading and an allow_http_for_loopback option.
  • Requires matching schemes and ports between claim and activity service URLs.
  • Updates address-validation tests to allow loopback addresses when private-network access is enabled.
File Description
tests/​hosting_core/​test_outbound_host_validator.py Updates loopback expectations for private-network access.
libraries/​microsoft-agents-hosting-core/​microsoft_agents/​hosting/​core/​security/​outbound_host_validator.py Adds configuration binding and conditional HTTP loopback support.
libraries/​microsoft-agents-hosting-core/​microsoft_agents/​hosting/​core/​_http_adapter_base.py Adds scheme and port checks to service URL validation.

Review effort: Balanced

Copilot AI left a comment

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.

🟢 Approval recommended

The review identifies no outstanding issues with the outbound host validation and service URL matching changes.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

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