-
Notifications
You must be signed in to change notification settings - Fork 0
[Snyk] Upgrade msw from 0.24.4 to 0.49.3 #40
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
base: main
Are you sure you want to change the base?
Conversation
Snyk has created this PR to upgrade msw from 0.24.4 to 0.49.3. See this package in npm: msw See this project in Snyk: https://app.snyk.io/org/newtonombese1/project/5b236417-c0d3-45d3-8b86-e26b7bb42c69?utm_source=github&utm_medium=referral&page=upgrade-pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @nejidevelops, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request, automatically generated by Snyk, upgrades the msw (Mock Service Worker) package from version 0.24.4 to 0.49.3. The primary motivation for this significant upgrade is to address a medium-severity "Information Exposure" vulnerability (SNYK-JS-NODEFETCH-2342118) and ensure the project's dependencies are up-to-date.
Highlights
- Dependency Upgrade: Updates the msw package from version 0.24.4 to 0.49.3.
- Security Fix: Addresses a medium-severity "Information Exposure" vulnerability (SNYK-JS-NODEFETCH-2342118).
- Automated Maintenance: This pull request was automatically generated by Snyk to keep dependencies secure and current.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request upgrades msw
from ^0.24.2
to ^0.49.3
. While this update addresses a security vulnerability, it also introduces breaking changes that will cause your test suite to fail. The API for accessing the request body in msw
has changed, and your mock handlers in src/__test__/mocks/handlers.js
need to be updated accordingly. I have left a detailed comment on the package.json
change explaining the necessary modifications.
"@testing-library/user-event": "^12.1.10", | ||
"mocha": "^8.2.1", | ||
"msw": "^0.24.2" | ||
"msw": "^0.49.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgrading msw
to this version introduces a critical breaking change. As of msw
v0.28.0, req.body
is no longer a plain object. To access the request body, you must now use the asynchronous req.json()
method.
Your handlers in src/__test__/mocks/handlers.js
for POST
and PATCH
requests currently use req.body
directly and will break. You need to update them to be async
and use await req.json()
.
For example, the POST
handler should be updated as follows:
Before:
rest.post("http://localhost:4000/items", (req, res, ctx) => {
id++;
const item = { id, ...req.body };
items.push(item);
return res(ctx.json(item));
})
After:
rest.post("http://localhost:4000/items", async (req, res, ctx) => {
id++;
const body = await req.json();
const item = { id, ...body };
items.push(item);
return res(ctx.json(item));
})
A similar change is required for the PATCH
handler. Without these changes, your tests will fail.
Snyk has created this PR to upgrade msw from 0.24.4 to 0.49.3.
ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.
The recommended version is 70 versions ahead of your current version.
The recommended version was released 3 years ago.
Issues fixed by the recommended upgrade:
SNYK-JS-NODEFETCH-2342118
Release notes
Package name: msw
v0.49.3 (2023-01-19)
Bug Fixes
v0.49.2 (2022-12-13)
Bug Fixes
globalThis.fetch
inctx.fetch
utility (#1490) (42cdbc7) @ Toxiapo @ kettanaitov0.49.1 (2022-11-28)
Bug Fixes
v0.49.0 (2022-11-19)
Features
v0.48.3 (2022-11-15)
Bug Fixes
statuses
dependency during the build (#1458) (99d49f9) @ mattcosta7 @ kettanaitov0.48.2 (2022-11-13)
Bug Fixes
v0.48.1 (2022-11-10)
Bug Fixes
Important
Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.
For more information: