Repository navigation
fix(storage): selectable browser store, truthful IsEncrypted, DPAPI persistence, ISettings registration - #3153
Merged
Merged
Conversation
Contributor
|
|
kazo0
enabled auto-merge
August 24, 2026 16:41
rajamatt
approved these changes
Aug 24, 2026
|
Tick the box to add this pull request to the merge queue (same as
|
…ersistence, ISettings registration The storage layer of #3139's split. - KeyValueStorageConfiguration:BrowserCacheLocation selects the WebAssembly store: LocalStorage (the default - what the browser already used, so upgrading never relocates data), SessionStorage (new SessionStorageKeyValueStorage over direct JS interop; there is no WinRT surface for sessionStorage) or MemoryStorage. Member names mirror msal-browser's cacheLocation. Only the browser acts on it - Skia desktop shares the same #else branch and must keep ApplicationData - but the value is validated on every platform so a typo in a shared appsettings.json fails the desktop run a developer actually does - IsEncrypted reports true for EncryptedApplicationDataKeyValueStorage (DPAPI) and PasswordVaultKeyValueStorage (Credential Locker). It is the flag on the public surface a consumer branches on to decide whether a store is safe for tokens, and both said false - DPAPI-protected values now persist on unpackaged Windows. The unpackaged path goes through the string-only ISettings, and the base store persisted value?.ToString() - the literal "System.Byte[]" - while the keys persisted, so HasTokenAsync reported a signed-in user with nothing to recover. The base store base64-encodes byte[] on that path; the encrypted store returns raw bytes on both and accepts either shape on read, so packaged caches are not orphaned - AddKeyedStorage registers the ISettings its stores need (TryAdd; an app's own wins), so UseStorage works on any host rather than only after UseThemeSwitching. Storage.WinUI therefore references Core.WinUI, as Hosting.WinUI and Navigation.WinUI already do New Uno.Extensions.Storage.WinUI.Tests, wired into the runtime-test head: store selection per BrowserCacheLocation value on the browser and the "ignored elsewhere" guard everywhere else, strict validation (unknown and numeric values throw naming the setting, casing accepted), and a round trip through the resolved default. Docs: StorageOverview.md gains the per-platform default-store table, the BrowserCacheLocation section, and a note that Android/iOS heads built with the Skia renderer get plain ApplicationData (the SDK loads this package's netX.0 build there, and the KeyStore/Keychain stores only exist in the platform builds); UpdatingExtensions.md records the IsEncrypted and ISettings changes. Verified: Storage.WinUI.Tests 8/8 on the desktop runtime-test head; Uno.Extensions-packageonly.slnf Release 0 errors; markdownlint and cspell clean. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EqfQh5ovrPEvFGcERLiLhH
The docs-validation stage only runs for PRs that touch a .md file, and the first one to do so since these crept in fails on files it did not change: - MD040 (fenced code block without a language) in specs/004 and specs/006 - cspell: "nuspecs" and "unmaterialized" (technical terms, added to the dictionary) and "recognise" in specs/lessons.md (spelled the way the rest of the docs do) - MD059 / MD060 are new rules in current markdownlint-cli that flag existing tables and link text across doc/; disabled in the config, as #3139 did, so the lane checks what it checked before rather than the whole tree at once Verified with the CI commands: markdownlint clean, cspell 226 files / 0 issues. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EqfQh5ovrPEvFGcERLiLhH
kazo0
force-pushed
the
dev/sb/storage-fixes
branch
from
August 24, 2026 17:10
93ebe00 to
ec84019
Compare
This was referenced Aug 24, 2026
agneszitte
pushed a commit
that referenced
this pull request
Nov 3, 2026
- The docs validation only runs for PRs that touch a .md file. This PR does (HowTo-DefineRoutes.md, from #3254), so it fails on 7.3 files it didn't change - Same fix as main's ec84019 (from #3153): MD040 in specs/004 and specs/006, "nuspecs" and "unmaterialized" in the dictionary, "recognize" in specs/lessons.md, MD059/MD060 off - Also adds "rehook" (specs/009), which main got with #3154 (cherry picked from commit ec84019) Co-Authored-By: Claude Opus 5.5 <[email protected]>
4 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub Issue (If applicable): split out of #3139 (relates to #3025, #2346)
PR Type
What is the current behavior?
IKeyValueStorageisApplicationData(which Uno maps tolocalStorage) with no way to choosesessionStorageor memory-only, so anything built on storage - the authentication token cache above all - has exactly one lifetime in the browser.IsEncryptedis wrong on the stores that do encrypt.EncryptedApplicationDataKeyValueStorage(DPAPI) andPasswordVaultKeyValueStorage(Credential Locker) both reportfalse. That flag is on the publicIKeyValueStoragesurface and is exactly what a consumer branches on to decide whether a store is safe for tokens, so under-reporting pushes callers away from the Windows stores that protect them.ISettings, and the base store persistsvalue?.ToString()- so every protectedbyte[]was written as the literal"System.Byte[]"and read back as nothing. The keys persisted regardless, soTokenCache.HasTokenAsyncreported the user signed in with nothing to recover.UseStoragedoes not register theISettingsits own stores need. It was registered byUseThemeSwitching(and later byUnoHost.CreateDefaultBuilder), so a host built any other way fails to resolve the default store.What is the new behavior?
KeyValueStorageConfiguration:BrowserCacheLocationselects the browser store -LocalStorage(the default, so upgrading never relocates existing data),SessionStorage(newSessionStorageKeyValueStorageover direct JS interop; there is no WinRT surface forsessionStorage), orMemoryStorage. The member names mirror msal-browser'scacheLocation. Only the browser acts on it - Skia desktop shares the same#elsebranch and must keepApplicationData- but it is validated on every platform, so a typo in a sharedappsettings.jsonfails the desktop run a developer actually does rather than only the one head that reads it.IsEncryptedistruefor the DPAPI and Credential Locker stores.ISettingspath; the encrypted store returns the raw DPAPI bytes on both paths and still accepts either shape on read, so existing packaged caches are not orphaned.AddKeyedStorageregistersISettingsitself (TryAdd- an app's own wins). That needs the implementation, which lives inUno.Extensions.Core.UI, soUno.Extensions.Storage.WinUInow referencesUno.Extensions.Core.WinUI(asHosting.WinUIandNavigation.WinUIalready do).UseThemeSwitchingkeeps its ownTryAdd.Uno.Extensions.Storage.WinUI.Tests(runtime UI tests): store selection for eachBrowserCacheLocationvalue on the browser and the "ignored elsewhere" guard on every other head, the strict validation (unknown and numeric values throw naming the setting; casing is accepted), and a write/read round trip through whatever the default resolved to.StorageOverview.mdgains the per-platform default-store table and theBrowserCacheLocationsection, plus a note that Android/iOS heads built with the Skia renderer get plainApplicationData(the SDK swaps in this package'snetX.0build there, and the KeyStore/Keychain stores only exist in the platform builds);UpdatingExtensions.mdrecords theIsEncryptedandISettingschanges.PR Checklist
BrowserCacheLocationis additive with a preserving default;IsEncryptedchanges value on two stores, which is the flag reporting the truthOther information
Verified locally: the new test class 8/8 on the desktop runtime-test head;
Uno.Extensions-packageonly.slnfRelease build 0 errors. The browser-side cases (sessionStorageinterop, the localStorage/session/memory mapping) run on the WebAssembly runtime-test lane that #3139's CI layer adds; until that lands they are covered by the desktop run's "ignored off the browser" assertions and by #3139's own WebAssembly lane, where this class is 8/8.Reviewer note: this is the storage layer of #3139's split. The MSAL provider's WebAssembly token-cache persistence, which is what motivated
BrowserCacheLocation, comes in a later PR; nothing here depends on it.Also carries a small
docs:commit fixing pre-existing markdownlint/cspell failures elsewhere in the tree (specs/004, specs/006, specs/lessons.md, two dictionary words, MD059/MD060 disabled): the docs-validation stage only runs for PRs that touch.md, and this is the first such PR since they crept in. Same fixes as #3139.🤖 Generated with Claude Code
https://claude.ai/code/session_01EqfQh5ovrPEvFGcERLiLhH