Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove stale secrets after decryption failure - #324014

Merged
TylerLeonhardt merged 2 commits into
microsoft:mainfrom
KevinWang-wpq:codex/secrets-remove-stale-decrypt-failures
Jul 29, 2026
Merged

Remove stale secrets after decryption failure#324014
TylerLeonhardt merged 2 commits into
microsoft:mainfrom
KevinWang-wpq:codex/secrets-remove-stale-decrypt-failures

Conversation

@KevinWang-wpq

Copy link
Copy Markdown
Contributor

When persisted secret decryption fails, BaseSecretStorageService currently queues delete(key) without awaiting it before get() resolves. Because get() and delete() share the same per-key sequencer, callers can observe get() completing before the stale encrypted value has been removed.

This changes the failure path to remove the stored value directly within the current sequencer task, using the same storage-scope selection as delete(). The existing delete() path now shares that helper.

A regression test verifies that after a decryption failure the stale value is removed before get() resolves, and a subsequent get() no longer calls decrypt.

Validation:

  • git diff --check

Copilot AI review requested due to automatic review settings July 2, 2026 08:36
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

TylerLeonhardt

Matched files:

  • src/vs/platform/secrets/common/secrets.ts
  • src/vs/platform/secrets/test/common/secrets.test.ts

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

Fixes an ordering issue in BaseSecretStorageService.get() where a decryption failure could leave a stale encrypted value in storage until a later sequenced delete() task ran, allowing callers to observe get() completing before the cleanup finished.

Changes:

  • On decryption failure, removes the persisted value synchronously within the same per-key sequencer task (instead of queueing an un-awaited delete()).
  • Refactors deletion logic to share a removeValueFromStorage(...) helper so the failure path and delete() use the same scope selection.
  • Adds a regression test ensuring stale persisted secrets are removed before get() resolves and that subsequent get() calls do not attempt decrypt again.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/vs/platform/secrets/common/secrets.ts Performs immediate in-sequencer storage removal on decryption failure and refactors delete removal via a helper.
src/vs/platform/secrets/test/common/secrets.test.ts Adds a regression test verifying stale persisted secrets are removed before get() resolves after decryption failure.

@KevinWang-wpq

Copy link
Copy Markdown
Contributor Author

KevinWang-wpq please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@KevinWang-wpq

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@KevinWang-wpq

Copy link
Copy Markdown
Contributor Author

CLA signed. Could someone from the VS Code team please approve the workflows and review this PR when available?

@TylerLeonhardt
TylerLeonhardt enabled auto-merge (squash) July 8, 2026 23:50
@TylerLeonhardt

Copy link
Copy Markdown
Member

Thanks!

@TylerLeonhardt
TylerLeonhardt force-pushed the codex/secrets-remove-stale-decrypt-failures branch from 71ae1f4 to 8dd3e6b Compare July 9, 2026 01:23
@KevinWang-wpq

Copy link
Copy Markdown
Contributor Author

Hi TylerLeonhardt, thank you again for reviewing this PR and enabling auto-merge! It looks like the workflows are still waiting for maintainer approval after the latest update. When you have a chance, could you please approve them to run? Thanks so much for your help!

@TylerLeonhardt
TylerLeonhardt merged commit b7c1490 into microsoft:main Jul 29, 2026
50 of 55 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.132.0 milestone Jul 29, 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.

7 participants