fix-dependency-security
Skill2 starsChanged 40 days agoMITView on GitHub
Fixes dependency vulnerabilities and deprecations, hardens the supply chain, and wraps package-manager installs with Socket Firewall (sfw). Use when the user asks for pnpm/npm audit, security fixes, deprecated packages, supply-chain attack prevention, StepSecurity-style dependency hygiene, or sfw.
- Deletes or force-pushes
- Installs packages
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- adversarial-auditSkill
- agentic-reactorSkill
- agent-orchestratorSkill
- ai-optimizationSkill
- architecture-synthesisSkill
- audit-allow-buildsSkill
- audit-ide-dependenciesSkill
- author-workflow-skillSkill
- bdd-strategizerSkill
- chrome-extension-mv3Skill
- concurrent-cli-agentsSkill
- control-feederSkill
- control-graphSkill
- cursor-transcript-harvestSkill
- cv-promote-guardSkill
- devcontainer-hardenedSkill
- dual-copy-skill-publishSkill
- explore-repo-readonlySkill
- finder-reactorSkill
- fusion-sageSkill
- git-worktreesSkill
- grok-host-prepSkill
- gt-flowSkill
- higher-order-decision-architectSkill
- looperSkill
- master-plannerSkill
- mvu-refactor-planSkill
- odysseus-navigatorSkill
- project-editor-profileSkill
- react-client-expertSkill
- semantic-markup-cssSkill
- semantic-nameSkill
- session-unit-orderSkill
- shell-kernel-ontologySkill
- skill-rename-propagationSkill
- split-to-prsSkill
- src-tree-reorganizeSkill
- stellar-roadmapSkill
- stellar-spacemapSkill
- subagent-delegationSkill
- subagent-explore-reportSkill
- supply-chain-hardenSkill
- tauri-agenticSkill
- tauri-ipc-debugSkill
- tidy-commit-pushSkill
- upgrade-packagesSkill
- verification-cockpitSkill
- x-agent-resourcesSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 2 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Re-verify: after every change: install → audit → type-check/lint.
- Very specific: line 59
If multiple advisories affect one package, bump to the highest required patched version (e.g.
- Very specific: line 70
When trustPolicy: no-downgrade blocks install or lockfile verification:
- Very specific: line 72
Read the package name and version from the error (e.g.
- Very specific: line 111
Add or update overrides in pnpm-workspace.yaml:
- Very specific: line 127
Do not stop until pnpm audit reports no known vulnerabilities (or document accepted risk with user approval).
- Very specific: line 185
Prefer settings in pnpm-workspace.yaml (not package.json):
- Distinctive: line 194
Keep existing project overrides (security pins) alongside these keys.
- Very specific: line 196
allowBuilds: only enable lifecycle scripts for packages that truly need native builds (e.g. - Very specific: line 210
Use StepSecurity threat write-ups when investigating npm incidents (typosquats, maintainer hijacks).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Fix dependency security
End-to-end workflow for vulnerabilities, deprecations, and supply-chain install safety in Node/pnpm projects.
Principles
- Prefer real upgrades over silencing warnings (
allowedDeprecatedVersions, ignoring audit). - One source of policy for pnpm:
pnpm-workspace.yaml(overrides,minimumReleaseAge,blockExoticSubdeps) — not scatteredpackage.jsonpnpmblocks. - Wrap risky commands with SFW so malicious packages are blocked before download.
- Re-verify after every change: install → audit → type-check/lint.
Tooling map
| Tool | Role |
| pnpm audit | CVE/advisory report for the lockfile |
pnpm overrides (pnpm-workspace.yaml) | Force patched transitive versions |
SFW (sfw) | Socket Firewall Free — prefix installs; blocks confirmed malware at network layer |
| StepSecurity | CI/runtime supply-chain platform (Harden-Runner, threat intel, cooldown policies). Complements local sfw; does not replace pnpm audit |
| pnpm settings | minimumReleaseAge, blockExoticSubdeps, trustPolicy — delay/block risky resolution (pnpm supply-chain security) |
SFW is the sfw CLI (Socket). StepSecurity is often first to publish npm incident analysis; use their advisories for context, and Harden-Runner in GitHub Actions for CI egress control.
Workflow checklist
Copy and track:
- [ ] 1. Baseline: pnpm audit (and pnpm outdated if useful)
- [ ] 2. If trust downgrade: pnpm why → bump parent or overrides (no trustPolicyExclude)
- [ ] 3. Plan CVE fixes (direct bumps vs overrides vs upstream)
- [ ] 4. Apply fixes (package.json + pnpm-workspace.yaml)
- [ ] 5. Install behind SFW: sfw pnpm install
- [ ] 6. Confirm: pnpm audit → clean
- [ ] 7. Confirm: no deprecated deps (install output / pnpm why)
- [ ] 8. Validate: pnpm type-check && pnpm lintStep 1: Audit
pnpm audit- Note severity, package, patched versions, and paths (which dependency pulls it in).
- If multiple advisories affect one package, bump to the highest required patched version (e.g.
>=16.2.6beats>=16.2.5).
pnpm why <package> # trace transitive source
pnpm outdated # optional: direct upgrade candidatesStep 2: Fix ERR_PNPM_TRUST_DOWNGRADE
When trustPolicy: no-downgrade blocks install or lockfile verification:
- Read the package name and version from the error (e.g.
semver@6.3.1). - Trace the tree:
pnpm why <package>- Fix in this order (do not use
trustPolicyExcludeunless the user explicitly approves an exception):
| Option | When |
| Bump direct dep | pnpm why shows your package.json dependency — raise its range and reinstall |
| Bump transitive parent | A parent you control (e.g. eslint-config-next) has a newer release that drops the bad version — upgrade that parent |
pnpm.overrides | Parent range cannot move yet, but a newer same-major or compatible major exists with stronger trust — pin in pnpm-workspace.yaml, then regenerate the lockfile |
- Regenerate a stale lockfile if overrides changed but verification still fails:
rm -rf node_modules pnpm-lock.yaml
sfw pnpm install --no-frozen-lockfile
pnpm install # confirm lockfile passes supply-chain policies- Re-run
pnpm why <package>to confirm a single trusted version remains.
Example (eslint toolchain): eslint-config-next pulled eslint-import-resolver-typescript@3.10.1 and semver@6.3.1 → overrides to ^4.4.4 and ^7.7.2 after pnpm why showed no newer parent.
Step 3: Fix vulnerabilities
Direct dependencies
Bump in package.json, then install (see Step 5).
Example: Next.js advisories → set next to latest patched in the same major line (e.g. 16.2.6).
Transitive only
Add or update overrides in pnpm-workspace.yaml:
overrides:
"<package>": ^<patched-version>Align related packages (e.g. @next/env with next).
After overrides
sfw pnpm install
pnpm auditDo not stop until pnpm audit reports no known vulnerabilities (or document accepted risk with user approval).
Step 4: Fix deprecations
pnpm install # surface deprecated warnings (prefer sfw — Step 5)
pnpm why <deprecated-package>| Situation | Action |
| Newer non-deprecated version exists | Override or bump parent dependency |
| Entire package deprecated (all versions) | Bump parent chain (e.g. onnxruntime-node@1.26 → global-agent@4 removes deprecated boolean) |
| Only silencing available | Avoid allowedDeprecatedVersions unless user explicitly accepts risk |
Step 5: SFW (Socket Firewall) for installs
Install SFW once per machine
npm i -g sfw
# or: binary from https://github.com/SocketDev/sfw-free/releasesPrefix package-manager commands
sfw pnpm install
sfw pnpm add <pkg>
sfw pnpm update <pkg>
sfw npm ci # if using npm in CILimits: SFW blocks network fetches of confirmed malware. Cached artifacts are not re-checked — after compromise scares, prune cache:
pnpm store pruneCI (GitHub Actions):
- uses: socketdev/action@v1
with:
mode: firewall-free # or firewall for enterprise
- run: sfw pnpm install --frozen-lockfileDocs: https://docs.socket.dev/docs/socket-firewall-free
Step 6: pnpm supply-chain hardening
Prefer settings in pnpm-workspace.yaml (not package.json):
# Example — tune per project; pnpm 11 defaults minimumReleaseAge to 1440 (1 day)
minimumReleaseAge: 1440
blockExoticSubdeps: true
# trustPolicy: no-downgrade # optional, stricter trustKeep existing project overrides (security pins) alongside these keys.
allowBuilds: only enable lifecycle scripts for packages that truly need native builds (e.g. sharp, esbuild). After changes to the whitelist or to locked versions of allowed packages, run audit-allow-builds.
Step 7: CI / StepSecurity (optional)
For GitHub Actions, add Harden-Runner early in the job to detect anomalous egress and tampering:
- uses: step-security/harden-runner@v2
with:
egress-policy: audit # then tighten to block + allowed-endpointsUse StepSecurity threat write-ups when investigating npm incidents (typosquats, maintainer hijacks). Pair with sfw on developer machines and pnpm audit in CI.
Step 8: Validate
pnpm audit
pnpm type-check
pnpm lint
pnpm build # if user expects full verificationSummarize for the user:
- What was vulnerable / deprecated and how it was fixed
- Version bumps and overrides added
- Whether
sfwwas used for install - Remaining risks (e.g. AI-flagged but unconfirmed packages SFW only warns on)
Project-specific notes
See examples/README.md for hardened pnpm workspace examples (e.g. Next.js portfolio).
Anti-patterns
- Pinning vulnerable versions indefinitely without user sign-off
allowedDeprecatedVersions: "*"instead of upgrading- Running
pnpm add/pnpm updatewithoutsfwwhen hardening supply chain - Putting pnpm
overridesinpackage.jsonwhen the repo usespnpm-workspace.yaml - Assuming audit clean means safe without checking deprecations and install-time firewall
trustPolicyExcludeto bypass trust downgrades — usepnpm why, bump, oroverridesinstead
Related skills
- audit-allow-builds — supply-chain review of
allowBuildspackages (lockfile versions, new releases, postinstall scripts) - audit-ide-dependencies — Cursor/VS Code extensions and plugin caches under
~/.cursor(separate from the project lockfile) - upgrade-packages — semver-safe and major framework upgrades; shares trust-downgrade /
pnpm whyworkflow
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

