-
Notifications
You must be signed in to change notification settings - Fork 474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store non-sensitive UI state without protection #5434
Conversation
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.
Approved, assuming the security review is completed before merge.
private ValueTask SetJsonAsync(string key, string json) | ||
=> _jsRuntime.InvokeVoidAsync("localStorage.setItem", key, json); | ||
|
||
private ValueTask<string?> GetJsonAsync(string key) | ||
=> _jsRuntime.InvokeAsync<string?>("localStorage.getItem", key); |
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.
These two methods return ValueTask
. I'm not sure how often these would return completed tasks, but perhaps we also use value tasks on the new methods on ILocalStorage
.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Done over email |
Description
Some UI state is stored in protected browser storage: details orientation and size.
Unfortunately protected storage becomes unusable if the dashboard's data protection keys change. This can happen if the dashboard is launched from a docker container (each run has new keys). I've also seen it when updating Aspire version - perhaps the dashboard being located in a different place or a different file name causes new keys? IDK.
The fix is to store long term (localStorage) non-sensitive state without protected. Values will be remembered between runs, and there won't be errors silently thrown in the background when attempting to unencrpyt and failing.
Short term storage (sessionStorage) that is used to store potentially sensitive page data still only allows storage with protection.
I'll double check this is safe with Blazor and security folks.
Fixes #4949
Checklist
<remarks />
and<code />
elements on your triple slash comments?Microsoft Reviewers: Open in CodeFlow