Skip to content
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

[WASM] Use crossorigin="anonymous" if web image fails to load #10645

Open
MartinZikmund opened this issue Dec 5, 2022 · 2 comments
Open

[WASM] Use crossorigin="anonymous" if web image fails to load #10645

MartinZikmund opened this issue Dec 5, 2022 · 2 comments
Labels
difficulty/starter 🚀 Categorizes an issue for which the difficulty level is reachable by newcomers good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/bug Something isn't working platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform project/media 📺 Categorizes an issue or PR as relevant to media (MediaPlayer, WebView, PDF, Image, …)

Comments

@MartinZikmund
Copy link
Member

MartinZikmund commented Dec 5, 2022

Current behavior

Currently when Image source is a HTTPS URL, it will fail to load in case crossorigin attribute is not set to anonymous due to Cross-Origin-Embedder-Policy header.

<StackPanel Padding="40">
        <Image Width="50" Height="50" Source="https://i.postimg.cc/rpRG3S21/screenshot-195.png"></Image>
        <BitmapIcon Height="50" Width="50" UriSource="https://img.icons8.com/material/96/000000/positive-dynamic--v1.png"/>
</StackPanel>

Expected behavior

If the image fails to load due to CORS, we should retry with crossorigin = anonymous added. This is now needed since the Cross-Origin-Embedder-Policy header is used to enable threading

How to reproduce it (as minimally and precisely as possible)

No response

Workaround

No response

Works on UWP/WinUI

Yes

Environment

No response

NuGet package version(s)

No response

Affected platforms

No response

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

@MartinZikmund MartinZikmund added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Dec 5, 2022
@jeromelaban
Copy link
Member

Cross-origin settings are required when using threading, but also were incorrectly set when using an earlier version of the bootstrapper (fixed in unoplatform/Uno.Wasm.Bootstrap#602).

That being said, that particular attribute could be set on images when threading is enabled, yet it may be a security risk as it disables what the secure mode is enabling. We may need to have a feature flag for this.

@jeromelaban jeromelaban added platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform and removed triage/untriaged Indicates an issue requires triaging or verification labels Dec 5, 2022
@MartinZikmund MartinZikmund added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. project/media 📺 Categorizes an issue or PR as relevant to media (MediaPlayer, WebView, PDF, Image, …) difficulty/starter 🚀 Categorizes an issue for which the difficulty level is reachable by newcomers and removed difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Aug 23, 2023
@nickodei
Copy link
Contributor

That being said, that particular attribute could be set on images when threading is enabled, yet it may be a security risk as it disables what the secure mode is enabling. We may need to have a feature flag for this.

So what is the best way to approach this issue? Should it be enabled if threading is enabled, or completely disabled because of the security risk or does it need to be behind a feature flag? I could look at this issue but this needs to be clarified prior to someone working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/starter 🚀 Categorizes an issue for which the difficulty level is reachable by newcomers good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/bug Something isn't working platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform project/media 📺 Categorizes an issue or PR as relevant to media (MediaPlayer, WebView, PDF, Image, …)
Projects
Status: No status
Development

No branches or pull requests

3 participants