Skip to content

Proxy Link Verification to avoid network isolation flag#16009

Open
chidozieononiwu wants to merge 1 commit into
Azure:mainfrom
chidozieononiwu:proxy-link-verification
Open

Proxy Link Verification to avoid network isolation flag#16009
chidozieononiwu wants to merge 1 commit into
Azure:mainfrom
chidozieononiwu:proxy-link-verification

Conversation

@chidozieononiwu

Copy link
Copy Markdown
Member

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:

  • Added a new pipeline step in verify-links.yml to 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:

  • Introduced the Invoke-ProxiedWebRequest function in Verify-Links.ps1 to wrap all HTTP requests with proxy routing and bearer token authentication using the acquired access token.
  • Replaced all direct calls to Invoke-WebRequest in the link processing functions (ProcessRedirectLink, ProcessCratesIoLink, ProcessStandardLink, GetLinks, and cache file retrieval) with Invoke-ProxiedWebRequest, ensuring all requests are proxied and authenticated. [1] [2] [3] [4] [5]

Passing run js - template 20260612.15

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.

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-ProxiedWebRequest in Verify-Links.ps1 and replaced direct Invoke-WebRequest calls 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
}
@azure-sdk-automation

Copy link
Copy Markdown
Contributor

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

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

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants