Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@crbroughton/msw-builder
Advanced tools
A small set of helper functions for Mock Service Worker (MSW)
msw-builder is a helper library that exposes small functions when
working with Mock Service Worker (MSW) & Zod. These helper functions
utilise ts-deepmerge
. The supplied schema is used as a base,
then merged with whatever overrides you wish to supply.
The goal of this library is to simplfy MSW mocking patterns, especially copy-pasta mocking of JSON responses.
To use, simply define your zod schema (ensure you parse at the end):
const singleObjSchema = z.object({
id: z.number().default(1),
}).parse({})
Once defined, you can use any of the following functions:
// creates a single object from the schema
const { create } = mswBuilder(singleObjSchema)
const result = create({ id: 1 }) // is a single object
// creates an array
const { createArray } = mswBuilder(singleObjSchema)
const result = createArray(2, { id: 2 }) // is an array of 2 results
// creates an unique array (probably the most helpful for mocking)
const { createUniArray } = mswBuilder(singleObjSchema)
const result = createUniArray([
{
id: 2,
},
{
id: 3,
},
])
To install dependencies:
bun install
This project was created using bun init
in bun v1.0.0. Bun is a fast all-in-one JavaScript runtime.
FAQs
A small set of helper functions for Mock Service Worker (MSW)
The npm package @crbroughton/msw-builder receives a total of 0 weekly downloads. As such, @crbroughton/msw-builder popularity was classified as not popular.
We found that @crbroughton/msw-builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.