Repository navigation
Never send Entra sign-in tokens to the marketplace - #343689
Karthik Nadig (karthiknadig) merged 5 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The focused changes remove unsafe token fallbacks with targeted regression coverage and no unresolved findings.
No open issues 🎉
What changed in this PR
This security follow-up keeps Microsoft sign-in tokens local to marketplace eligibility checks and permits only resource-scoped tokens to be sent to the marketplace.
Changes:
- Removes sign-in-token fallbacks when metadata or resource sessions are unavailable.
- Skips silent resource-session lookup and interactive resource consent when no resource scopes are advertised.
- Expands regression coverage for outgoing authorization headers and shared-process/remote manifest arguments across open and gated marketplaces.
| File | Description |
|---|---|
| src/vs/workbench/services/extensionManagement/test/electron-browser/extensionGalleryManifestService.test.ts | Verifies anonymous fallback, resource-token use, and cross-process token propagation. |
| src/vs/workbench/services/extensionManagement/electron-browser/extensionGalleryAccountService.ts | Removes credential fallbacks and guards resource authentication against empty scopes. |
Review effort: Balanced
|
TylerLeonhardt, could you provide explicit security sign-off on the private Marketplace credential boundary before wider rollout? The proposed boundary in this PR is intentional delegation: the renderer obtains a marketplace resource-scoped Entra access token and publishes the raw bearer plus service-index URL over the existing manifest IPC channel to the shared process and any connected remote agent (SSH, WSL, tunnels, or Codespaces). A host controlling that remote process can read the credential. The HTTPS/origin check restricts cooperative request attachment; it does not isolate the token from that host. This PR removes the fallback sign-in credential and identity-scope substitution. No refresh grant is sent to those replicas. Separate focused follow-ups address redirect credential stripping in Node and Electron (#343690), token renewal (#343688), and 403 status handling (#343686). They are open PRs, not protection already landed on main. The existing GitHub exchange feature, #325815, remains in review separately. Please explicitly review whether the remote delegation and resource/scope/origin restrictions are acceptable. Source-level checks and passing regressions are not a substitute for that approval. Drafted with GitHub Copilot. |
CI failure investigationThe two underlying failures in Code OSS run https://github.com/microsoft/vscode/actions/runs/39897075541 are unrelated to the two files changed by this PR:
The I attempted Drafted with GitHub Copilot. Update: resolved after rebasing on current mainThe user requested an actual base refresh, not an empty CI-trigger commit. This PR was rebased without conflicts onto main Fresh Code OSS run https://github.com/microsoft/vscode/actions/runs/40379461103 completed successfully. There are now no failing checks on this head. The remaining |
ea93305 to
deb73fa
Compare
|
Karthik Nadig (@karthiknadig) this is ready for your review 🙏 |
Karthik Nadig (karthiknadig)
left a comment
There was a problem hiding this comment.
LGTM. The sign-in token no longer leaves the provider, and the sign-in scopes are no longer substituted for the marketplace's. One question inline.
The remote-delegation sign-off you asked Tyler for is about behavior that already shipped in #325804. This PR only narrows what is sent, so I don't think it needs to wait on that.
Review assisted by Copilot.
Keep sign-in credentials local when resource metadata or marketplace-scoped sessions are unavailable. Skip resource requests without advertised scopes and cover outgoing HTTP headers and shared/remote manifest IPC payloads. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 501856fc-20e7-4945-be4d-520737498b91
Show an administrator configuration explanation only for gated 401 responses with unusable advertised resource scopes. Preserve metadata fidelity and enforce resource-scope safety at token acquisition and consent, with HTTP, shared/remote payload, UI, and reload-compatible regression coverage. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 501856fc-20e7-4945-be4d-520737498b91
3d05bc9 to
bfae5fb
Compare
|
Karthik Nadig (@karthiknadig) your comments says LG, but it’s not approved. We are also running into build issues if you can provide any insights |
Karthik Nadig (karthiknadig)
left a comment
There was a problem hiding this comment.
The token change I approved is unchanged and still looks good. Rejecting VSCODE_-prefixed and OIDC-only scopes is a good addition: scopes supplied by the marketplace shouldn't be able to steer the Microsoft provider's client ID or tenant.
The new commit also adds a public ExtensionGalleryManifestStatus.RequiresConfiguration value, with its own welcome message, badge and sign-in precondition (inline). I'd like to keep that out of this PR; I'll approve once that's settled.
On the CI failure: macOS / Electron-Unit failed while downloading Electron's SHASUMS256.txt from GitHub releases (HTTP 500, three times), so it's unrelated to this change. Rerunning the failed jobs should clear it.
Review assisted by Copilot.
Karthik Nadig (karthiknadig)
left a comment
There was a problem hiding this comment.
LGTM. The RequiresConfiguration status point from my earlier comment is non-blocking; fine to address in a follow-up with Sandeep.
Review assisted by Copilot.
Integrate pinned main 64c455b without rewriting reviewed history. Preserve metadata caching, validation and stale-consent protections together with resource-only tokens and the 401-only scope configuration diagnostic. Keep main's 403 denial and synchronized sign-out/consent regressions. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 501856fc-20e7-4945-be4d-520737498b91
Head branch was pushed to by a user without write access
Keep the existing RequiresSignIn status and UI while logging unusable marketplace scope metadata after a gated 401. Preserve resource-only token acquisition, scope guards and HTTP/shared/remote regression coverage. Save the separate status, welcome, badge and sign-in gating changes for owner-reviewed follow-up work. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 501856fc-20e7-4945-be4d-520737498b91
Karthik Nadig (karthiknadig)
left a comment
There was a problem hiding this comment.
Approval stands; one non-blocking suggestion inline. Happy to re-approve if you change it.
Review assisted by Copilot.
Warn during protected-resource discovery when advertised scopes cannot support marketplace authentication. Return no credential for unusable scopes without extending the shared account contract or the manifest service. Preserve metadata caching, fidelity and resource-only token/consent guards, with warning/cache and outgoing HTTP/IPC regression coverage. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 501856fc-20e7-4945-be4d-520737498b91
Head branch was pushed to by a user without write access
|
Karthik Nadig (@karthiknadig) we need your re-approval here and 2 more to merge. Thank you so much for the help with all of these 🙏 |
Karthik Nadig (karthiknadig)
left a comment
There was a problem hiding this comment.
Thanks, that addresses my comment. The diagnostic now lives in the provider, the shared account contract and manifest service are unchanged, and the warning is covered once per discovery without credentials or resource consent. LGTM.
Review assisted by Copilot.
865fc10
into
microsoft:main
Related to microsoft/vscode#325412.
Summary
Keep the Microsoft sign-in token local to account selection and tenant eligibility. Marketplace authentication uses only a session requested for the advertised marketplace scopes and authorization server, bound to the selected account.
Behavior
RequiresSignInstatus; 403 remainsAccessDenied.VSCODE_options cannot cause resource-token acquisition or consent. Syntax-valid discovery metadata remains intact for the existing cache.scopes_supported. Cached reads and coalesced lookups do not repeat the warning. Existing malformed-metadata warnings and retry behavior remain unchanged.An explicitly advertised
api://{client-id}/access_as_userorapi://{client-id}/.defaultscope names the app registration. The canonical HTTPS marketplace URL in PRMresourceis not used to invent an Entra{resource}/.defaultfallback.This PR does not change marketplace statuses or UI. Configuration-status UX is deferred to separately reviewed follow-up work. The account contract remains limited to the credential; no diagnostic field or manifest-service logging is added.
This change does not add a redirect policy, renewal scheduler, or metadata-cache lifetime.
Validation
Commands were run with the repository-required Node 24.22.1 and pinned pnpm 12.16.0, using
corepack.cmd pnpm.corepack.cmd pnpm run typecheck-clientcorepack.cmd pnpm run build-fast --client-only.\scripts\test.bat --run src\vs\workbench\services\extensionManagement\test\electron-browser\extensionGalleryAccountService.test.ts --run src\vs\workbench\services\extensionManagement\test\electron-browser\extensionGalleryManifestService.test.ts --timeout 20000 --reporter dotcorepack.cmd pnpm run precommit src\vs\workbench\services\extensionManagement\common\extensionGalleryAccount.ts src\vs\workbench\services\extensionManagement\electron-browser\extensionGalleryAccountService.ts src\vs\workbench\services\extensionManagement\electron-browser\extensionGalleryManifestService.ts src\vs\workbench\services\extensionManagement\test\electron-browser\extensionGalleryAccountService.test.ts src\vs\workbench\services\extensionManagement\test\electron-browser\extensionGalleryManifestService.test.tsRegression assertions inspect actual outgoing Authorization headers and complete shared/remote manifest payloads, anonymous open indexes, absent/malformed metadata, missing/empty/identity-only/internal scopes, failed resource lookup, successful resource acquisition, interactive consent, reload recovery, sign-out races, and provider-side conditional warnings. Additional warning regressions cover coalesced lookups, cache reuse, expiry/rediscovery, and avoiding resource acquisition or consent for unusable scopes.
Live Entra-gated and interactive identity-provider flows were not exercised.
Drafted with GitHub Copilot.