Proxy Link Verification to avoid network isolation flag#16009
Open
chidozieononiwu wants to merge 1 commit into
Open
Proxy Link Verification to avoid network isolation flag#16009chidozieononiwu wants to merge 1 commit into
chidozieononiwu wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the common link verification tooling to route all outbound HTTP requests through a proxy service authenticated with an Azure app registration access token, aiming to avoid network isolation flags and centralize outbound traffic control.
Changes:
- Added an AzureCLI step to acquire an app registration access token and pass it to the link-checking script via
APP_REGISTRATION_TOKEN. - Introduced
Invoke-ProxiedWebRequestinVerify-Links.ps1and replaced directInvoke-WebRequestcalls with the proxied wrapper across link-processing paths. - Updated link cache/page fetch logic to use the proxied request wrapper as well.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| eng/common/scripts/Verify-Links.ps1 | Adds proxied HTTP request wrapper and routes link-check HTTP calls through the proxy using a bearer token. |
| eng/common/pipelines/templates/steps/verify-links.yml | Adds token acquisition step and passes the token to the PowerShell link verification step via env var. |
Comment on lines
+100
to
+101
| function Invoke-ProxiedWebRequest { | ||
| param( |
|
|
||
| $ProgressPreference = "SilentlyContinue"; # Disable invoke-webrequest progress dialog | ||
|
|
||
| $ProxyBaseUrl = "https://net-iso-proxy-b5b9dgb3h5h4fqf8.westus2-01.azurewebsites.net/api/proxy" |
Comment on lines
+114
to
+116
| if ([string]::IsNullOrWhiteSpace($token)) { | ||
| throw 'APP_REGISTRATION_TOKEN environment variable is not set.' | ||
| } |
Comment on lines
+20
to
+22
| - task: AzureCLI@2 | ||
| displayName: Get app registration access token | ||
| inputs: |
Comment on lines
+118
to
+129
| $proxyUri = [System.Uri]::new("${ProxyBaseUrl}?url=" + [System.Uri]::EscapeDataString($Uri.ToString())) | ||
| $headers = @{ Authorization = "Bearer $token" } | ||
| if ($UserAgent) { | ||
| $headers['User-Agent'] = $UserAgent | ||
| } | ||
|
|
||
| $parameters = @{ | ||
| Uri = $proxyUri | ||
| Method = if ($Method -eq 'HEAD') { 'GET' } else { $Method } | ||
| Headers = $headers | ||
| TimeoutSec = $TimeoutSec | ||
| } |
Contributor
|
The following pipelines have been queued for testing: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances the link verification process by introducing a proxy-based approach for all outgoing web requests in the verification scripts. The changes ensure that all HTTP requests are routed through a secure proxy and authenticated using an Azure app registration access token. This improves security, enables centralized traffic control, and helps avoid rate limiting issues. The most important changes are as follows:
Pipeline and Authentication Updates:
verify-links.ymlto acquire an Azure app registration access token and set it as a secret environment variable (APP_REGISTRATION_TOKEN) for use during link verification. [1] [2]Proxy Integration in Link Verification Script:
Invoke-ProxiedWebRequestfunction inVerify-Links.ps1to wrap all HTTP requests with proxy routing and bearer token authentication using the acquired access token.Invoke-WebRequestin the link processing functions (ProcessRedirectLink,ProcessCratesIoLink,ProcessStandardLink,GetLinks, and cache file retrieval) withInvoke-ProxiedWebRequest, ensuring all requests are proxied and authenticated. [1] [2] [3] [4] [5]Passing run js - template 20260612.15