Skip to content
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

Support webpack-dev-server v5 in @cypress/webpack-dev-server #29305

Closed
AtofStryker opened this issue Apr 11, 2024 · 6 comments · Fixed by #29306
Closed

Support webpack-dev-server v5 in @cypress/webpack-dev-server #29305

AtofStryker opened this issue Apr 11, 2024 · 6 comments · Fixed by #29306
Assignees
Labels
npm: @cypress/webpack-dev-server @cypress/webpack-dev-server package issues type: feature New feature that does not currently exist

Comments

@AtofStryker
Copy link
Contributor

What would you like?

I would like to @cypress/webpack-dev-server to support webpack-dev-server v5

Why is this needed?

new version of webpack-dev-server is available, which projects like angular v18 are using and others likely will use as well

Other

To make this not a breaking change to cypress nad @cypress/webpack-dev-server, webpack-dev-server version 4 still needs to be the default/shipped version, but webpack-dev-server 5 should be able to be sourced without error

@AtofStryker AtofStryker self-assigned this Apr 11, 2024
@AtofStryker
Copy link
Contributor Author

see #28926 for default wds 4 to 5 bump, which is a breaking change

@robcmills
Copy link

@AtofStryker The logic in npm/webpack-dev-server/src/helpers/sourceRelativeWebpackModules.ts according to its own comment:

// Source the webpack-dev-server module from the provided framework or projectRoot.
// If none is found, we fallback to the version bundled with this package.

Currently, when it finds that the parent project is using wds v5, it throws. Would it be possible to instead of throwing, fallback to the bundled version? Or is it necessary to fail because wds v5 running in the parent is going to cause issues with running a different version in component tests?

@robcmills
Copy link

Also, for "Why is this needed?" there is a high severity security vulnerability in wds <5.3.4 which puts contractual obligations on many companies to upgrade in order to conform with SOC2 compliance and other security audits.

┌───────────────┬──────────────────────────────────────────────────────────────┐
│ high          │ Path traversal in webpack-dev-middleware                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ webpack-dev-middleware                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=5.3.4                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ webpack-dev-server                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ webpack-dev-server > webpack-dev-middleware                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://www.npmjs.com/advisories/1096729                     │
└───────────────┴──────────────────────────────────────────────────────────────┘

@AtofStryker
Copy link
Contributor Author

@AtofStryker The logic in npm/webpack-dev-server/src/helpers/sourceRelativeWebpackModules.ts according to its own comment:

// Source the webpack-dev-server module from the provided framework or projectRoot.
// If none is found, we fallback to the version bundled with this package.

Currently, when it finds that the parent project is using wds v5, it throws. Would it be possible to instead of throwing, fallback to the bundled version? Or is it necessary to fail because wds v5 running in the parent is going to cause issues with running a different version in component tests?

We would want to fail since we are sourcing whatever is installed in your project and is going to give you behavior you would otherwise expect. The bundled version could be incompatible with your configuration / set up

@AtofStryker
Copy link
Contributor Author

Also, for "Why is this needed?" there is a high severity security vulnerability in wds <5.3.4 which puts contractual obligations on many companies to upgrade in order to conform with SOC2 compliance and other security audits.

┌───────────────┬──────────────────────────────────────────────────────────────┐
│ high          │ Path traversal in webpack-dev-middleware                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ webpack-dev-middleware                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=5.3.4                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ webpack-dev-server                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ webpack-dev-server > webpack-dev-middleware                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://www.npmjs.com/advisories/1096729                     │
└───────────────┴──────────────────────────────────────────────────────────────┘

when #29306 drops webpack-dev-server 4 will still be installed, so your dependency/vulnerability tool will likely still pick up this vulnerability, but the dependency will not be run since you have wds v5 installed (also another reason not to fall back to unexpected behavior 🙂 )

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 18, 2024

Released in 13.8.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v13.8.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
npm: @cypress/webpack-dev-server @cypress/webpack-dev-server package issues type: feature New feature that does not currently exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants