Skip to content

Catch errors when getting from browser storage#7001

Merged
JamesNK merged 3 commits intomainfrom
jamesnk/browser-storage-error-handling
Jan 10, 2025
Merged

Catch errors when getting from browser storage#7001
JamesNK merged 3 commits intomainfrom
jamesnk/browser-storage-error-handling

Conversation

@JamesNK
Copy link
Copy Markdown
Member

@JamesNK JamesNK commented Dec 30, 2024

Description

Getting values from session storage can fail if the user upgrades Aspire version, or starts and stops the standalone container, while leaving the browser open. The problem is that session state is preserved (the browser is still open) but the underlying encryption keys have changed. The data's now invalid.

Fix is to ignore errors when getting from session/local storage. In this case the session state is lost, but nothing important is saved there.

Fixes #6961

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?
Microsoft Reviewers: Open in CodeFlow

Copy link
Copy Markdown
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.

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

Files not reviewed (1)
  • src/Aspire.Dashboard/Model/BrowserStorage/LocalBrowserStorage.cs: Evaluated as low risk

private readonly ProtectedBrowserStorage _protectedBrowserStorage;

protected BrowserStorageBase(ProtectedBrowserStorage protectedBrowserStorage)
protected BrowserStorageBase(ProtectedBrowserStorage protectedBrowserStorage, ILogger<T> logger)
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.

Does this need to be ILogger<T>? If it was just ILogger, then we wouldn't need to use the TSelf inheritance pattern and BrowserStorageBase could remain non-generic.

@JamesNK JamesNK enabled auto-merge (squash) January 9, 2025 23:04
@JamesNK JamesNK merged commit 5f3fc13 into main Jan 10, 2025
@JamesNK JamesNK deleted the jamesnk/browser-storage-error-handling branch January 10, 2025 00:20
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

intermittent CryptographicException while running standalone aspire dashboard makes dashboard unusable

4 participants