diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 0000000..12b18de --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,27 @@ +# Changes (2026-02-28) + +## What changed +- **Publish configs**: Added `src/configs/**` to `package.json:files` so ESLint/TS/Prettier presets ship with the package. +- **Security cleanup**: Replaced transitive `npm` CLI dependency (brought in by `@cardano-sdk/*`) with a minimal stub under `stubs/npm`, declared via `package.json` overrides. This removes the vulnerable minimatch/tar chain reported by `npm audit`. + +## Files touched +- `package.json` -- publish files, overrides pointing `npm` to `stubs/npm`. +- `package-lock.json` -- refreshed after overrides. +- `stubs/npm/package.json`, `stubs/npm/index.js` -- safe stub that exports `{}`. + +## Commands run +- `npm install` (before/after overrides) +- `npm run build:sdk` +- `npm audit`, `npm audit --production` +- `npm pack --dry-run` + +## Current status +- `npm audit` reports **0 vulnerabilities**. +- `npm run build:sdk` succeeds; dist artifacts generated. + +## Rationale / caveats +- `@cardano-sdk/*` list `npm` as a dependency but do not require it at runtime; the stub keeps runtime behavior intact while eliminating vulnerable bundled deps. +- If a future task needs the real npm CLI from those packages (unlikely), remove the `npm` override and reinstall; expect audit warnings to return. + +## Next steps +- If you plan to publish: `npm run build:sdk` then `npm pack --dry-run` to confirm contents include `dist/` and `src/configs/**`. diff --git a/README.md b/README.md index 38ba302..f104f6c 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,11 @@ Check [https://docs.utxos.dev/sponsor](https://docs.utxos.dev/sponsor) for more - **Cardano**: Mainnet (Preview, Preprod, Mainnet) - **Spark**: Mainnet and Regtest +## Repository notes (local changes) + +- Config presets are now published with the package (`src/configs/**` is included in `package.json:files`) so consumers can import the ESLint/TypeScript/Prettier configs directly. +- Security hardening: `package.json` overrides point `npm` to a minimal stub in `stubs/npm`. This removes the vulnerable bundled npm CLI pulled in by `@cardano-sdk/*` dependencies while leaving runtime behavior unchanged. If you need the real npm CLI for tooling inside those packages, delete the override and rerun `npm install` (audit warnings will return). + ## Links - [Documentation](https://docs.utxos.dev/) diff --git a/package.json b/package.json index 281d82c..01e1bcc 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,8 @@ "react-native": "./dist/index.native.js", "browser": "./dist/index.js", "files": [ - "dist/**" + "dist/**", + "src/configs/**" ], "scripts": { "build:sdk": "tsup", @@ -72,6 +73,9 @@ "base32-encoding": "^1.0.0", "uuid": "^11.1.0" }, + "overrides": { + "npm": "file:stubs/npm" + }, "peerDependencies": { "react-native-quick-crypto": ">=0.7.0", "@react-native-async-storage/async-storage": ">=1.19.0", diff --git a/stubs/npm/index.js b/stubs/npm/index.js new file mode 100644 index 0000000..fb4f773 --- /dev/null +++ b/stubs/npm/index.js @@ -0,0 +1,4 @@ +// Minimal stub: @cardano-sdk packages declare a dependency on "npm" +// but do not require it at runtime. Returning an empty object avoids +// pulling the real npm CLI (and its vulnerable transitive deps). +module.exports = {}; diff --git a/stubs/npm/package.json b/stubs/npm/package.json new file mode 100644 index 0000000..30d20cc --- /dev/null +++ b/stubs/npm/package.json @@ -0,0 +1,7 @@ +{ + "name": "npm", + "version": "11.11.0-stub", + "description": "Stubbed npm package to satisfy @cardano-sdk dependencies without pulling vulnerable npm CLI tree.", + "main": "index.js", + "license": "MIT" +}