Skip to content

Module Federation: Koajs vulnerable to Cross-Site Scripting (XSS) at ctx.redirect() function #30748

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

Open
1 of 4 tasks
techfg opened this issue Apr 16, 2025 · 0 comments · May be fixed by #30806
Open
1 of 4 tasks

Module Federation: Koajs vulnerable to Cross-Site Scripting (XSS) at ctx.redirect() function #30748

techfg opened this issue Apr 16, 2025 · 0 comments · May be fixed by #30806

Comments

@techfg
Copy link

techfg commented Apr 16, 2025

Current Behavior

npm audit warns of a security vulnerability Koajs vulnerable to Cross-Site Scripting (XSS) at ctx.redirect() function:

koa  <2.16.1
Severity: moderate
Koajs vulnerable to Cross-Site Scripting (XSS) at ctx.redirect() function - https://github.com/advisories/GHSA-x2rg-q646-7m2v
fix available via `npm audit fix --force`
Will install @nx/[email protected], which is a breaking change
node_modules/koa
  @module-federation/dts-plugin  <=0.11.4
  Depends on vulnerable versions of koa
  node_modules/@module-federation/dts-plugin
    @module-federation/enhanced  <=0.0.1-rc.0 || 0.1.2 - 0.11.4
    Depends on vulnerable versions of @module-federation/dts-plugin
    Depends on vulnerable versions of @module-federation/manifest
    Depends on vulnerable versions of @module-federation/rspack
    node_modules/@module-federation/enhanced
      @nx/module-federation  *
      Depends on vulnerable versions of @module-federation/enhanced
      node_modules/@nx/module-federation
        @nx/react  <=0.0.0-pr-30702-1a3e277 || >=20.2.0-beta.0
        Depends on vulnerable versions of @nx/module-federation
        node_modules/@nx/react
    @module-federation/manifest  <=0.0.0-next-20250415111630 || 0.1.3 - 0.11.4
    Depends on vulnerable versions of @module-federation/dts-plugin
    node_modules/@module-federation/manifest
      @module-federation/rspack  <=0.11.4
      Depends on vulnerable versions of @module-federation/dts-plugin
      Depends on vulnerable versions of @module-federation/manifest
      node_modules/@module-federation/rspack

Expected Behavior

@nx/module-federation should not depend on a vulnerable dependency.

GitHub Repo

https://github.com/techfg/nx-koajs-xss-repro.git

Steps to Reproduce

  1. clone repo
  2. npm install
  3. npm audit

Nx Report

NX   Report complete - copy this into the issue template

Node           : 22.14.0
OS             : linux-x64
Native Target  : x86_64-linux
npm            : 10.9.2

nx                     : 20.8.0
@nx/js                 : 20.8.0
@nx/eslint             : 20.8.0
@nx/workspace          : 20.8.0
@nx/devkit             : 20.8.0
@nx/module-federation  : 20.8.0
@nx/react              : 20.8.0
@nx/vite               : 20.8.0
@nx/web                : 20.8.0
typescript             : 5.7.3
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/react/router-plugin
@nx/vite/plugin
---------------------------------------
Cache Usage: 0.00 B / 25.09 GB

Failure Logs

Package Manager Version

npm 10.9.2

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

Seems to be due to @module-federation/enhanced referencing ^0.9.0 which is an outdated and unpatched version.

@module-federation/dts-plugin has been patched and was released in v0.12.0.

Related: #30502

Julien-Marcou added a commit to Julien-Marcou/nx that referenced this issue Apr 22, 2025
Julien-Marcou added a commit to Julien-Marcou/nx that referenced this issue Apr 22, 2025
Julien-Marcou added a commit to Julien-Marcou/nx that referenced this issue Apr 23, 2025
Julien-Marcou added a commit to Julien-Marcou/nx that referenced this issue Apr 23, 2025
Julien-Marcou added a commit to Julien-Marcou/nx that referenced this issue Apr 24, 2025
Julien-Marcou added a commit to Julien-Marcou/nx that referenced this issue Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant