Skip to content

fix: add -UseBasicParsing to Invoke-WebRequest in get-aspire-cli.ps1#15609

Merged
radical merged 2 commits intomainfrom
copilot/fix-invoke-webrequest-security-warning
Mar 26, 2026
Merged

fix: add -UseBasicParsing to Invoke-WebRequest in get-aspire-cli.ps1#15609
radical merged 2 commits intomainfrom
copilot/fix-invoke-webrequest-security-warning

Conversation

Copy link
Contributor

Copilot AI commented Mar 26, 2026

Windows PowerShell 5.1 defaults to the IE parsing engine for Invoke-WebRequest, triggering a "Security Warning: Script Execution Risk" prompt in interactive sessions. PowerShell 7+ already defaults to basic parsing, so this only affects legacy powershell.exe users.

get-aspire-cli-pr.ps1 was also reviewed and confirmed to require no changes — it uses the gh CLI for all artifact downloads and contains no Invoke-WebRequest calls.

Changes

  • eng/scripts/get-aspire-cli.ps1: Added UseBasicParsing = $true to the $requestParams hashtable passed to Invoke-WebRequest, bypassing the IE engine on PS 5.1. This parameter is a no-op on PS 7+.

Fixes #15608

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI changed the title [WIP] Fix security warning in get-aspire-cli.ps1 for Invoke-WebRequest fix: add -UseBasicParsing to Invoke-WebRequest in get-aspire-cli.ps1 Mar 26, 2026
Copilot AI requested a review from radical March 26, 2026 06:43
@radical radical marked this pull request as ready for review March 26, 2026 06:58
Copilot AI review requested due to automatic review settings March 26, 2026 06:58
@github-actions
Copy link
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15609

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15609"

@radical
Copy link
Member

radical commented Mar 26, 2026

@copilot make sure get-aspire-cli-pr.ps1 also has the fix if needed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Aspire CLI download script to avoid Invoke-WebRequest’s legacy IE-based parsing behavior on Windows PowerShell 5.1, preventing interactive security prompts while keeping behavior unchanged on newer PowerShell editions.

Changes:

  • Add UseBasicParsing = $true to the Invoke-WebRequest splat parameters in Invoke-SecureWebRequest.

Copy link
Contributor Author

Copilot AI commented Mar 26, 2026

@copilot make sure get-aspire-cli-pr.ps1 also has the fix if needed.

get-aspire-cli-pr.ps1 doesn't call Invoke-WebRequest at all — it relies on the gh CLI for all artifact downloads — so no fix is needed there.

@radical radical enabled auto-merge (squash) March 26, 2026 08:07
@radical radical merged commit 6a71c60 into main Mar 26, 2026
258 checks passed
@radical radical deleted the copilot/fix-invoke-webrequest-security-warning branch March 26, 2026 08:46
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.

get-aspire-cli.ps1: Invoke-WebRequest triggers security warning in Windows PowerShell 5.1

4 participants