Skip to content

Conversation

@vasilich-tregub
Copy link
Contributor

@vasilich-tregub vasilich-tregub commented Nov 29, 2025

Remove the phrase Because WebGL now requires textures to be loaded from secure contexts from index.md of Using textures in WebGL and explain the benefit of possibility to use a plain, unencrypted http server for local development and testing

It 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 contexts and explained that the use of http server is fully legitimate for local development and testing

Motivation

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 contexts is 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.

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.
@vasilich-tregub vasilich-tregub requested a review from a team as a code owner November 29, 2025 10:51
@vasilich-tregub vasilich-tregub requested review from wbamberg and removed request for a team November 29, 2025 10:51
@github-actions github-actions bot added Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed labels Nov 29, 2025
if -> when
vasilich-tregub and others added 2 commits November 30, 2025 13:34
…/index.md

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Nov 30, 2025

Preview URLs

(comment last updated: 2025-12-01 19:02:53)

@vasilich-tregub
Copy link
Contributor Author

@wbamberg Please help me understand github-actions' (bot) correction: it curtails the full link developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL to just /en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL and then complains that this corrected link is broken: /en-US/docs/Web/Security/Same-origin_policy#file_origins is a redirect, flaw count is 1. What should I do with this edit, if ever?

@wbamberg
Copy link
Collaborator

@wbamberg Please help me understand github-actions' (bot) correction: it curtails the full link developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL to just /en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL and then complains that this corrected link is broken: /en-US/docs/Web/Security/Same-origin_policy#file_origins is a redirect, flaw count is 1. What should I do with this edit, if ever?

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 🤞 .

@vasilich-tregub
Copy link
Contributor Author

Hi @wbamberg, thank you for explanation, I've got it.
I accept your edit. Should I perform some user action (if any) in the workflow to confirm your edit of links in my PR? I believe I need not do anything as I checked the "Allow edits by maintainers" mark when posting my PR.

@wbamberg
Copy link
Collaborator

wbamberg commented Dec 1, 2025

Should I perform some user action (if any) in the workflow to confirm your edit of links in my PR? I believe I need not do anything as I checked the "Allow edits by maintainers" mark when posting my PR.

You could click "commit this suggestion" but as you note I can do that too, so I did.

Copy link
Collaborator

@wbamberg wbamberg left a 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.

@wbamberg wbamberg merged commit be462cc into mdn:main Dec 1, 2025
8 checks passed
@vasilich-tregub vasilich-tregub deleted the patch-1 branch December 2, 2025 08:34
@vasilich-tregub
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants