We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f46a03c commit 2411661Copy full SHA for 2411661
1 file changed
lib/runtime/AutoPublicPathRuntimeModule.js
@@ -50,7 +50,10 @@ class AutoPublicPathRuntimeModule extends RuntimeModule {
50
`var document = ${RuntimeGlobals.global}.document;`,
51
"if (!scriptUrl && document) {",
52
Template.indent([
53
- "if (document.currentScript)",
+ // Technically we could use `document.currentScript instanceof window.HTMLScriptElement`,
54
+ // but an attacker could try to inject `<script>HTMLScriptElement = HTMLImageElement</script>`
55
+ // and use `<img name="currentScript" src="https://attacker.controlled.server/"></img>`
56
+ "if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')",
57
Template.indent("scriptUrl = document.currentScript.src;"),
58
"if (!scriptUrl) {",
59
0 commit comments