Fix invalid Windows AppxManifest from wildcard scope_extensions (#6104)#6111
Open
JudahGabriel wants to merge 2 commits into
Open
Fix invalid Windows AppxManifest from wildcard scope_extensions (#6104)#6111JudahGabriel wants to merge 2 commits into
JudahGabriel wants to merge 2 commits into
Conversation
Wildcard scope_extensions origins (e.g. https://*.example.com) caused pwa_builder.exe to emit an invalid <uap3:Host Name> in the AppxManifest, failing package creation with error 0x80080204. - Add WebManifestSanitizer that collapses wildcard scope_extensions origins to their parent domain, drops unrepresentable origins, and dedupes before the manifest is written to the file passed to pwa_builder.exe. - On pwa_builder.exe failures, capture the generated AppxManifest and the source web manifest in the logged exception (App Insights) to aid future diagnosis. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
|
Thanks @JudahGabriel for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌 |
Contributor
Author
|
It appears this is still broken when deploying to staging. More testing needed. |
|
Now Package for Android is working properly but package for microsoft store is still showing an error please help me with this |
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.
Problem
Fixes #6104. Packaging for the Microsoft Store / Windows platform fails for PWAs whose web manifest declares a wildcard
scope_extensionsorigin (e.g.https://*.globelink.com).pwa_builder.exefails with:Root cause
The failure happens inside Edge's
pwa_builder.exe, not in our own package assembly. PWABuilder always passes"extensions": "appurihandler", sopwa_builder.exeturns eachscope_extensionsorigin into a<uap3:Host Name="...">entry underwindows.appUriHandler. Per the schema,Host Namemust be a fully-qualified domain name — wildcards like*.globelink.comare rejected, so the generated AppxManifest violates the schema andClose()fails with0x80080204(APPX_E_INVALID_MANIFEST).Changes
WebManifestSanitizer(new): sanitizes the web manifest before it's written to the temp file handed topwa_builder.exe. Forscope_extensionsit:https://*.globelink.com→https://globelink.com),https://*),pwa_builder.exeis affected;options.Manifest(used for images, start URL, etc.) is left untouched to keep the blast radius minimal.WebManifestFinder.GenerateManifestFile: routes the manifest through the sanitizer.PwaBuilderWrapper.CreatePwaBuilderCliError: on anypwa_builder.exefailure, capture the generated AppxManifest (read from the output directory, since it's written before the packagingClose) and the source web manifest in the logged exception — both asexception.Dataentries and as structuredILoggerproperties, so App Insights captures them for diagnosing any future invalid-manifest case.Testing
dotnet buildsucceeds (only pre-existing nullable warnings).WebManifestSanitizer.Sanitizeagainst the exactscope_extensionsfrom the issue; output contained only valid, wildcard-free, de-duplicated origins.Notes / limitations
When
enableWebAppWidgetsistrue,pwa_builder.exefetches the manifest live instead of using our file, so a wildcard origin there still can't be sanitized. That's a narrow edge case outside the reported scenario; the improved error logging will surface it if it occurs.