Skip to content

Fix marketplace 403 responses prompting repeated sign-in - #343686

Merged
Karthik Nadig (karthiknadig) merged 2 commits into
microsoft:mainfrom
mcumming:dev/mcumming/marketplace-forbidden-status
Nov 4, 2026
Merged

Karthik Nadig (karthiknadig) merged 2 commits into
microsoft:mainfrom
mcumming:dev/mcumming/marketplace-forbidden-status

Conversation

@mcumming

@mcumming Michael Cummings (MSFT) (mcumming) commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Related to microsoft/vscode#325412.

Behavior

A custom marketplace service-index 401 maps to RequiresSignIn; a 403 follows the existing AccessDenied path. The mapping is independent of the configured account provider and whether the request carries a bearer.

Denied responses do not retain marketplace authorization. Existing status UI, localized labels, and actions are reused; token selection, acquisition, renewal, and metadata caching are unchanged.

Validation

Command Result
npm run typecheck-client Passed for the reviewed implementation.
node build\next\build-fast.ts --client-only Passed for the reviewed implementation.
$env:VSCODE_SKIP_PRELAUNCH = '1'; .\scripts\test.bat --run src\vs\workbench\services\extensionManagement\test\electron-browser\extensionGalleryManifestService.test.ts --reporter dot Passed: 74 tests.

The status matrix covers default, GitHub, and Microsoft account configurations, anonymous and bearer requests, and both HTTP statuses. Consent recovery verifies RequiresSignIn to Available; sign-out coverage includes a late 403.

No live private-marketplace or interactive identity-provider flow was exercised.

Drafted with GitHub Copilot.

Copilot AI balanced review requested due to automatic review settings October 23, 2026 03:44

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.

🟢 Approval recommended

The narrowly scoped correction preserves existing error handling and has focused regression coverage with no unresolved issues.

No open issues 🎉

What changed in this PR

Fixes repeated marketplace sign-in prompts by preserving the distinction between authentication failure (401) and access denial (403), consistent with the linked issue’s HTTP contract.

Changes:

  • Routes service-index 403 responses through the existing AccessDenied path while retaining RequiresSignIn for 401.
  • Adds provider/token/status regression coverage, includes late 403 responses in sign-out race tests, and verifies recovery after interactive Entra consent.
File Description
src/​vs/​workbench/​services/​extensionManagement/​test/​electron-browser/​extensionGalleryManifestService.test.ts Extends status, sign-out race, and consent recovery coverage.
src/​vs/​workbench/​services/​extensionManagement/​electron-browser/​extensionGalleryManifestService.ts Limits the authentication-required error to 401 responses.

Review effort: Balanced

@mariaghiondea

Copy link
Copy Markdown

Karthik Nadig (@karthiknadig) this is ready for your review. Thank you.

@mcumming
Michael Cummings (MSFT) (mcumming) force-pushed the dev/mcumming/marketplace-forbidden-status branch from f4ff917 to 0b9b05f Compare October 26, 2026 18:38
@mariaghiondea

Copy link
Copy Markdown

Karthik Nadig (@karthiknadig) this is ready for your review 🙏

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. A 401 still asks for sign-in, and a 403 now reaches the existing AccessDenied path, which fixes the sign-in loop for GitHub users the marketplace denies.

One ordering note: please merge this after #343689. While main still falls back to sending the Entra sign-in token, a marketplace that answers that token with a 403 would show "contact your administrator" instead of offering sign-in.


Review assisted by Copilot.

@mcumming

Copy link
Copy Markdown
Contributor Author

Replying to Karthik's landing-order note:

Agreed. I'll keep this behind #343689 and rebase after that lands, so 403 handling does not change while the sign-in-token fallback is still present. No need to broaden this PR beyond the 401/403 correction.

Drafted with GitHub Copilot.

Treat service-index 401 responses as authentication challenges and preserve 403 as access denied regardless of provider or bearer presence. Cover the provider/status matrix, Entra consent recovery, and sign-out races.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 7e5dd4b9-d381-460c-911e-9bb109420931
@mcumming
Michael Cummings (MSFT) (mcumming) force-pushed the dev/mcumming/marketplace-forbidden-status branch from 0b9b05f to 3cf842b Compare November 2, 2026 19:57
@mariaghiondea

Copy link
Copy Markdown

Karthik Nadig (@karthiknadig) this needs more reviewers. Are you able to help us with that?

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.

🟡 Changes recommended

The new 403 test delays the metadata probe instead of only the service-index request, causing sign-out to cancel account resolution before the manifest fetch and leaving late manifest responses untested.

1 open issue

Review effort: Max

Complete protected-resource metadata discovery before holding the actual service-index GET. Prove the blocked request uses the resource bearer, await the sign-out status before releasing each late response, and verify the manifest and token remain cleared.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 7e5dd4b9-d381-460c-911e-9bb109420931

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. The new commit only tightens the sign-out race test so the late response reaches the service-index request, and the production change is the same one I approved before.

This now conflicts with #343689, so whichever of the two lands second will need a rebase.


Review assisted by Copilot.

@karthiknadig
Karthik Nadig (karthiknadig) merged commit 289eaeb into microsoft:main Nov 4, 2026
59 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.146.0 milestone Nov 4, 2026
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.

9 participants