.. / astro
Star Fork

Astro is a website build tool for the modern web — powerful developer experience meets lightweight output.

astro
withastro
...

≥3.0.0 & ≤4.16.0 | CVE-2024-47885

<doc-tags> @name 🛡️ strict-dynamic ⏱️ before-load
More information

Root Cause

Source: https://github.com/withastro/astro/blob/7814a6cad15f06931f963580176d9b38aa7819f2/packages/astro/src/transitions/router.ts#L135-L156

function runScripts() {
  for (const script of Array.from(document.scripts)) {
    if (script.dataset.astroExec === '') continue;
    const type = script.getAttribute('type');
    if (type && type !== 'module' && type !== 'text/javascript') continue;
    const newScript = document.createElement('script');
    newScript.innerHTML = script.innerHTML;
    for (const attr of script.attributes) {
      newScript.setAttribute(attr.name, attr.value);
    }
    newScript.dataset.astroExec = '';
    script.replaceWith(newScript);
  }
}

runScripts();

Related links:

Found by jackfromeast, ishmeals.


Source | History