
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
zod-package-json
Advanced tools
Zod 4 schema for the package.json
file format.
This package exports a Zod and a Zod mini schema (and the inferred TypeScript type) named PackageJson
that can parse most well-formed package.json
files.
The schema includes all currently supported properties listed in the npm docs as well as additional well-known properties specific to TypeScript and Node.js.
The schema also preserves unknown properties, which can be accessed by indexing the parsed data with the desired string keys.
The schema only validates the known properties against their expected type
but does not do any additional normalization such as merging similar properties.
If necessary, that can be done by extending the schema with Zod methods such as
.transform()
or .refine()
.
[!NOTE]
Make sure you have Zod v4 installed in your application to use this package.
Using npm
:
npm add zod zod-package-json
Using yarn
:
yarn add zod zod-package-json
Using pnpm
:
pnpm add zod zod-package-json
Using bun
:
bun add zod zod-package-json
To use the classic Zod schema:
import { PackageJson } from "zod-package-json";
// Parse data from a `package.json` file.
const packageJson = PackageJson.parse({
name: "foo",
version: "1.0.0",
unknownProp: "who knows",
});
// Access a known property.
packageJson.name; // "foo"
// Access an unknown property.
packageJson["unknownProp"]; // "who knows"
To use the Zod mini schema:
import { PackageJson } from "zod-package-json/mini";
// Parse data from a `package.json` file.
const packageJson = PackageJson.parse({
name: "foo",
version: "1.0.0",
unknownProp: "who knows",
});
// Access a known property.
packageJson.name; // "foo"
// Access an unknown property.
packageJson["unknownProp"]; // "who knows"
MIT
Copyright (c) 2025 Edoardo Scibona
See LICENSE file.
FAQs
Zod schema for the package.json file format
The npm package zod-package-json receives a total of 43,666 weekly downloads. As such, zod-package-json popularity was classified as popular.
We found that zod-package-json demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.