Expected behaviour
- It should be possible to load external scripts that are loaded via the rpf.io domain.
- If external scripts are supported, they should load without an unexpected browser CORS failure.
- If external scripts are not supported, the runner should block them intentionally and report that clearly.
Actual behaviour
- The HTML preview allows
https://rpf.io/ as an external source, but when a project includes <script src="https://rpf.io/piratetalk"></script>, the browser blocks it with a CORS error.
- This creates a mismatch between the app’s allowlist and actual runtime behavior.
Steps to reproduce
- Open
http://localhost:3011/web-component.html.
- Load or paste an HTML project containing
<script src="https://rpf.io/piratetalk"></script>. Example
- Click RUN button
- Check the browser console.
- Observe:
Access to script at 'https://rpf.io/piratetalk' from origin 'http://localhost:3011' has been blocked by CORS policy...
Additional context
src/utils/externalLinkHelper.js includes https://rpf.io/ in allowedExternalLinks.
src/components/Editor/Runners/HtmlRunner/HtmlRunner.jsx rewrites src attributes and unconditionally adds crossorigin, including on <script> tags.
- That causes the browser to enforce CORS on external classic scripts that may otherwise have loaded.
Suggested fixes:
- Potential: Only add
crossorigin for media/assets that need it, not <script> tags but this may cause more CORS issue with Google hosted jQuery which is currently hidden.
Risks
- Removing
crossorigin from <script> tags may make third-party scripts execute instead of fail.
- Would increase the security risk of running remote untrusted code.
Screenshots and Videos
Once a fix is in, include a video on how to test it below
We're exploring using videos to demonstrate how to test new features, to improve our testing process.
Expected behaviour
Actual behaviour
https://rpf.io/as an external source, but when a project includes<script src="https://rpf.io/piratetalk"></script>, the browser blocks it with a CORS error.Steps to reproduce
http://localhost:3011/web-component.html.<script src="https://rpf.io/piratetalk"></script>. ExampleAccess to script at 'https://rpf.io/piratetalk' from origin 'http://localhost:3011' has been blocked by CORS policy...Additional context
src/utils/externalLinkHelper.jsincludeshttps://rpf.io/inallowedExternalLinks.src/components/Editor/Runners/HtmlRunner/HtmlRunner.jsxrewritessrcattributes and unconditionally addscrossorigin, including on<script>tags.Suggested fixes:
crossoriginfor media/assets that need it, not<script>tags but this may cause more CORS issue with Google hosted jQuery which is currently hidden.Risks
crossoriginfrom<script>tags may make third-party scripts execute instead of fail.Screenshots and Videos
Once a fix is in, include a video on how to test it below
We're exploring using videos to demonstrate how to test new features, to improve our testing process.