-
Notifications
You must be signed in to change notification settings - Fork 23.1k
Update index.md of using textures in webgl #42165
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
Conversation
A misleading phrase "Because WebGL now requires textures to be loaded from secure contexts" is removed from the document in this PR. It is true that "Loading of WebGL textures is subject to cross-domain access controls", but to make the context secure the data shall be delivered over an authenticated and encrypted channel, i.e,, requires the use of an HTTPS protocol schema. However, there is no mandatory requirement for webgl applications to load textures from secure context. Cross origin requests are also supported for an HTTP protocol. The documentation should be free from misleading claims. Besides, it is easier to set up a local http server for webgl-example tutorial experiments. I examined the use of an unencrypted http server (Python http.server) with samples of the webgl-examples tutorial and confirm that the samples1-8 work as expected.
if -> when
files/en-us/web/api/webgl_api/tutorial/using_textures_in_webgl/index.md
Outdated
Show resolved
Hide resolved
…/index.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
Preview URLs (comment last updated: 2025-12-01 19:02:53) |
|
@wbamberg Please help me understand github-actions' (bot) correction: it curtails the full link |
files/en-us/web/api/webgl_api/tutorial/using_textures_in_webgl/index.md
Outdated
Show resolved
Hide resolved
Hi @vasilich-tregub ! MDN uses relative links for internal pages. See e.g. all the links in https://raw.githubusercontent.com/mdn/content/refs/heads/main/files/en-us/web/security/attacks/index.md . It's complaining about the redirect because you were unlucky enough to link to the SOP page just before it got moved. It's not related to the bot's update. I added a suggestion that ought to fix it 🤞 . |
|
Hi @wbamberg, thank you for explanation, I've got it. |
You could click "commit this suggestion" but as you note I can do that too, so I did. |
wbamberg
left a comment
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.
Thank you! I think this makes sense. I couldn't find any indication that loading textures requires a secure context.
Note though that the fact that it works using a local HTTP server is not evidence that secure context doesn't apply: browsers treat local HTTP servers as secure contexts, to make development easier.
But your explanation of why file:// URLs don't work is plausible to me - it certainly sounds more like a cross-origin restriction than a secure context restriction.
|
Entirely agreed. Verification of "negative" claims, like 'there are no indications that loading textures requires a secure context' is a very exacting task. In practice, you can accept a "negative" claim as true only when a few (if possible, independent) experts agree. Your note about special treatment of local http servers by user agents is significant for development and testing tasks: I found further details in $ 5.2. localhost. Thank you for your time and effort. |
Remove the phrase
Because WebGL now requires textures to be loaded from secure contextsfrom index.md of Using textures in WebGL and explain the benefit of possibility to use a plain, unencrypted http server for local development and testingIt is true that
Loading of WebGL textures is subject to cross-domain access controls, but there is no mandatory requirement for webgl applications to load textures from secure context sensu stricto. Cross origin requests can be supported with a plain, unencrypted HTTP protocol.Description
I removed the phrase
Because WebGL now requires textures to be loaded from secure contextsand explained that the use of http server is fully legitimate for local development and testingMotivation
First, the educational resource should not include misleading statements. Second, it is easier to set up a local http server for webgl-example tutorial experiments: compare Python's readily available module http.server and the complexity of configuring SSL for https.server. I examined the use of an unencrypted http server (Python http.server) with samples of the webgl-examples tutorial and confirm that the samples1-8 work as expected.
Additional details
If need be, we can include the reference to W3C document on secure context: https://w3c.github.io/webappsec-secure-contexts/#examples-top-level. A very instructive article on WebGL security considerations see in https://blog.pixelfreestudio.com/webgl-security-best-practices-ensuring-safe-3d-web-experiences/. The document never states that secure context is mandatory for WebGL apps to work but stresses the use of secure context for mitigating risks and vulnerability!
For development of WebGL applications, some guides urge designers to always work in secure context. However, depending on task, this requirement can be weakened. When selecting which server flavor to choose, the rule of thumb: use of https is mandatory when deploying to the web; for local testing and development you can use a plain, unencrypted http server, especially when the development task is not concerned specifically with risk mitigation -- use of http server simplifies setting up the design environment.
Related issues and pull requests
This edit is necessary because the phrase
Because WebGL now requires textures to be loaded from secure contextsis replicated in many documents hosted on MDN -- for example, README in the tutorial of webgl-examples, see my closed PR#365 -- and also in broader technical documentation. First, the educational resource should not contain misleading statements; second, the correct understanding of security issues can improve developer's experience when setting up environment for development and testing.