// Copyright (c) Microsoft. All rights reserved. namespace SampleApp; /// /// Options that control which URLs the is permitted to access. /// /// /// /// By default, no hosts are accessible. You must explicitly opt in to one or more /// of the access modes below. The validation order is: /// /// /// If the host matches an entry in , the request is allowed. /// If the resolved IP is a public address and is , the request is allowed. /// If the resolved IP is a private/loopback/link-local address and is , the request is allowed. /// If is , the request is allowed. /// Otherwise, the request is blocked. /// /// internal sealed class WebBrowsingToolOptions { /// /// Gets or sets a list of host patterns that are always permitted, regardless of other settings. /// Patterns support wildcard prefix matching (e.g., "*.example.com" matches "docs.example.com"). /// Exact host names (e.g., "docs.microsoft.com") are also supported. /// /// This has the highest priority — if a host matches, it is allowed immediately. public IReadOnlyList? AllowedHosts { get; set; } /// /// Gets or sets a value indicating whether public internet hosts (non-private, non-loopback, non-link-local IPs) are permitted. /// Default is . /// public bool AllowPublicNetworks { get; set; } /// /// Gets or sets a value indicating whether private network hosts are permitted. /// This includes RFC 1918 addresses (10.x.x.x, 172.16-31.x.x, 192.168.x.x), /// loopback (127.x.x.x, ::1), link-local (169.254.x.x, fe80::), /// and cloud metadata endpoints (169.254.169.254). /// Default is . /// /// /// Warning: Enabling this allows the agent to make requests to internal services, /// localhost, and cloud metadata endpoints. Only enable this if you understand the SSRF risks. /// public bool AllowPrivateNetworks { get; set; } /// /// Gets or sets a value indicating whether all hosts are permitted without any restriction. /// Default is . /// /// /// ⚠️ UNSAFE: Enabling this disables all network boundary checks and allows the agent /// to access any URL, including internal services, cloud metadata endpoints, and localhost. /// Only use this for trusted, isolated environments where SSRF is not a concern. /// public bool AllowAllHosts { get; set; } }