GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Clear session authorization headers on redirect retries by jshigetomi · Pull Request #28398 · PowerShell/PowerShell

Conversation

@jshigetomi

@jshigetomi Justin Chung (jshigetomi) commented Nov 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

PR Summary

PR Context

PR Checklist

  • PR has a meaningful title
  • Summarized changes
  • Existing files retain their copyright headers
  • This PR is ready to merge
  • Breaking changes
    • None
  • User-facing changes
    • Not Applicable
  • Testing - New and feature
    • N/A or can only be tested interactively

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Patrick Meinecke Justin Chung
Fix auth preservation on a retry after a redirect (PowerShell#239)
39a33e6
@jshigetomi
Justin Chung (jshigetomi) requested a review from a team as a code owner November 11, 2026 19:12
Copilot AI balanced review requested due to automatic review settings November 11, 2026 19:12
@azure-pipelines

azure-pipelines Bot commented Nov 11, 2026

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot started reviewing on behalf of Justin Chung (jshigetomi) November 11, 2026 19:16
View session
@jshigetomi Justin Chung (jshigetomi) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Nov 11, 2026
Copilot AI reviewed Nov 11, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

Redirect handling permanently removes Authorization from a caller-supplied web session, breaking later requests that reuse it, and regression coverage for redirected retries is missing.

2 open issues
  • High severity Avoid permanently removing Authorization from the caller's WebSession · New
  • Low severity Add retry tests for redirected requests with session Authorization headers · New
What changed in this PR

This PR hardens redirect retries in the shared web cmdlet implementation by preventing reuse of session-level authorization unless explicitly preserved.

Changes:

  • Removes Authorization from both session headers and redirected requests when -PreserveAuthorizationOnRedirect is disabled.
  • Runs this cleanup even when the redirected request already lacks the header.
File Description
src/​Microsoft.PowerShell.Commands.Utility/​commands/​utility/​WebCmdlet/​Common/​WebRequestPSCmdlet.Common.cs Extends redirect authorization cleanup to session headers used when rebuilding requests for retries.

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
if (isRedirect && !PreserveAuthorizationOnRedirect && request.Headers.Contains(HttpKnownHeaderNames.Authorization))
if (isRedirect && !PreserveAuthorizationOnRedirect)
{
WebSession?.Headers?.Remove(HttpKnownHeaderNames.Authorization);
Comment thread ...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
if (isRedirect && !PreserveAuthorizationOnRedirect && request.Headers.Contains(HttpKnownHeaderNames.Authorization))
if (isRedirect && !PreserveAuthorizationOnRedirect)
{
WebSession?.Headers?.Remove(HttpKnownHeaderNames.Authorization);
@jshigetomi Justin Chung (jshigetomi) changed the title Protect redirected requests by clearing session authorization headers Clear session authorization headers on redirect retries Nov 11, 2026
anamnavi
Anam Navied (anamnavi) approved these changes Nov 11, 2026
View reviewed changes
@jshigetomi
Merge branch 'master' into 239bp
21ae9d8
@daxian-dbw

Dongbo Wang (daxian-dbw) commented Nov 12, 2026

Copy link
Copy Markdown
Member

Patrick Meinecke (@SeeminglyScience) can you please take a look at the Copilot comments?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
+1 more reviewer
@anamnavi Anam Navied (anamnavi) anamnavi approved these changes
Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@jshigetomi @daxian-dbw @anamnavi
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.