Terminal
Terminal/Skill
Fixes dependency security issues in a project, either by scanning and repairing everything or by targeting one named package.
By Socket
Works with
npx skills add socketdev/sauce --skill socket-fixFix dependency security issues in your project. This skill operates in two modes:
This skill is an orchestrator. It delegates concrete actions to the subskills: /socket-dep-cleanup, /socket-dep-replace, /socket-dep-patch, and /socket-dep-upgrade.
Determine which mode to use from the user's prompt:
If ambiguous, ask: "Do you want to fix all dependencies or a specific package?"
Scan the project with /socket-scan, then systematically resolve findings using subskills. Choose from three aggressiveness levels to control how far the repair goes.
/socket-scan must be working. Fix All mode requires a full scan to know what to fix.
Use pnpm dlx socket to run the Socket CLI - this always fetches the latest version and requires no global install. Verify it works:
pnpm dlx socket --version
All commands in this skill use the pnpm dlx socket prefix (e.g., pnpm dlx socket scan create ...).
Optional global install: If you prefer a global socket command, install with npm install -g socket@latest (must be version 1.0.0 or higher).
For users without a Socket account: Configure the public demo token directly:
pnpm dlx socket config set apiToken sktsec_t_--RAN5U4ivauy4w37-6aoKyYPDt5ZbaT5JBVMqiwKo_api --no-banner --no-spinner
pnpm dlx socket config set defaultOrg SocketDemo --no-banner --no-spinner
This provides limited access to CLI features like pnpm dlx socket fix, pnpm dlx socket package score, sfw, and socket-patch with rate limits. No account creation is needed for basic usage. Note: The public demo token cannot create scans (pnpm dlx socket scan create requires the full-scans:create permission). For scanning and full-rate access, create a free account at https://socket.dev.
For users with an account: Authenticate with one of:
pnpm dlx socket login (stores credentials in ~/.socket/)SOCKET_CLI_API_TOKEN in your shell profile or CI environmentVerify account authentication:
pnpm dlx socket organization list
If authentication fails or the CLI is not installed, use the /socket-setup skill for detailed guidance including Node.js installation, PATH troubleshooting, and CI/CD token configuration.
Do not proceed with Fix All mode until scanning works. If the user cannot or will not set up Socket, offer Fix Package mode instead (which has lower requirements per subskill).
Run /socket-scan to get a full picture of the project's dependency health. Use --tmp for a temporary read-only scan - the default, which does not persist to the dashboard:
pnpm dlx socket scan create . --tmp --json
Parse the scan results to build a prioritized list of issues:
Report the scan summary to the user:
Scan Results:
Total packages: 150
Critical: 2, High: 5, Medium: 12, Low: 25
Malware: 0
Low-score packages: 3
Before any repair work, identify the project's ecosystem and dependency landscape.
package.json, requirements.txt, go.mod, Cargo.toml, etc.) to determine which package managers are in use.github/workflows/, .gitlab-ci.yml, bitbucket-pipelines.yml, etc.) to understand the project's build and test infrastructurenode_modules/, vendor/, etc.). If dependencies are not installed, run the project's install command using the detected package manager (e.g. npm install, pnpm install, bun install). This is required for both patching and accurate unused dependency detection.Report a brief summary:
Environment detected:
Ecosystem: npm (package-lock.json)
Dependencies: 42 production, 18 dev
CI: GitHub Actions (Node 18/20 matrix)
Build command: npm run build
Test command: npm test
Dependencies installed: yes (node_modules/ present)
Ask the user which level they want, or auto-detect from their prompt:
| Level | Name | What It Does |
|---|---|---|
| 1 | Conservative | Only non-breaking changes: remove trivially unused deps + apply binary patches |
| 2 | Cautious | Everything in Level 1, plus propose ONE risky change for user approval |
| 3 | Full | Safe upgrades, aggressive cleanup, patching, and risky major upgrades - skip and continue on failure |
If the user says "fix everything", "full repair", or "aggressive" → Level 3. If the user says "safe", "conservative", or "don't break anything" → Level 1. If the user says "careful", "cautious", or "one step at a time" → Level 2. If unclear, default to Level 1 and offer to escalate.
Only non-breaking changes. Nothing here should break the build.
For each dependency in the project:
@types/* packages (may support type-checking for indirect usage)package.json scripts/socket-dep-cleanup skill workflowExecute the /socket-dep-patch workflow:
pnpm dlx @socketsecurity/socket-patch scan to discover available patchespnpm dlx @socketsecurity/socket-patch apply.socket/manifest.json)Run the full Level 1 workflow first, then propose one risky change.
Execute Phase 1a (unused dep removal) and Phase 1b (binary patches) as described above.
After Level 1 completes, use the scan results from Step 1 to identify the single highest-value change that carries some risk. Prioritize in this order:
/socket-dep-replace)@types/* package whose base package is not used, or a build plugin that may no longer be needed)Present the proposed change to the user with full context:
Proposed risky change (Level 2):
Package: lodash (4.17.20 → 4.17.21)
Reason: Fixes GHSA-xxxx-xxxx-xxxx (high severity prototype pollution)
Risk: Minor version bump — low risk of breaking changes
Affected files: src/utils/helper.ts, src/api/handler.ts (2 import locations)
Approve this change? [yes/no]
/socket-dep-upgrade (for version bumps) or /socket-dep-cleanup (for removals)Aggressive repair. Apply everything possible, skip and continue on individual failures.
pnpm dlx socket fix --all --no-apply-fixes --json to discover all fixable vulnerabilities--no-major-updates)/socket-dep-upgrade to apply the fix/socket-dep-upgrade's default "bail on failure" behavior - intentional for Level 3's aggressive posture/socket-dep-cleanup for both clearly unused AND ambiguous packages/socket-dep-replace to find and execute a replacementpnpm dlx @socketsecurity/socket-patch scan to discover patches for remaining dependenciespnpm dlx @socketsecurity/socket-patch apply to apply all discovered patchespnpm dlx socket fix --all --no-apply-fixes --json to find remaining vulnerabilities/socket-dep-upgrade with code migrationAfter all phases complete (regardless of level):
/socket-scan again to get a fresh security scanRepair Complete (Level 2 — Cautious)
Removed: 3 unused dependencies (is-odd, left-pad, unused-util)
Patched: 5 packages via socket-patch
Upgraded: 1 package (lodash 4.17.20 → 4.17.21)
Skipped: 0 failures
Security delta:
Before: 4 critical, 8 high, 12 medium
After: 1 critical, 3 high, 10 medium
Remaining issues:
- express@4.17.1: GHSA-yyyy-yyyy-yyyy (critical) — requires major bump to v5, not attempted at Level 2
Target a single named package and resolve its issues. Does not require a full scan - just operates on the specified package.
The user may specify a package by:
lodash, expresslodash@4.17.20pkg:npm/lodash@4.17.20GHSA-xxxx-xxxx-xxxx, CVE-2024-12345If the user provides an advisory ID, resolve it to the affected package(s) using pnpm dlx socket fix --id <ID> --no-apply-fixes --json.
Investigate what's wrong with the target package:
pnpm dlx socket fix --id pkg:<ecosystem>/<name>@<version> --no-apply-fixes --json (requires Socket account) or check if the user provided a specific advisorypnpm dlx @socketsecurity/socket-patch scan and check if patches are available for this packageReport findings:
Package: lodash@4.17.20
Vulnerabilities:
- GHSA-xxxx-xxxx-xxxx (high) — prototype pollution, fixed in 4.17.21
Usage: 6 imports across 3 files
- src/utils/helper.ts (merge, cloneDeep)
- src/api/handler.ts (get, set)
- src/components/Table.tsx (sortBy, groupBy)
Socket patches available: yes (1 patch)
Possible actions:
1. Patch — apply binary patch without version change (/socket-dep-patch)
2. Upgrade — bump to 4.17.21 to fix the CVE (/socket-dep-upgrade)
3. Replace — swap for an alternative package (/socket-dep-replace)
4. Remove — remove if unused (/socket-dep-cleanup)
Based on the diagnosis, recommend the best action. If multiple actions apply, prioritize in this order:
Present the recommendation and ask for approval. Then delegate to the appropriate subskill:
/socket-dep-upgrade/socket-dep-patch/socket-dep-replace/socket-dep-cleanupIf the user has a preference ("just patch it", "upgrade it", "replace it with dayjs"), skip the recommendation and go directly to the requested subskill.
After the subskill completes:
/socket-scan not working (Fix All mode): Do not proceed with Fix All. Offer to run /socket-setup first, or suggest Fix Package mode as an alternative./socket-setup to install and authenticate. For users without an account, /socket-setup will configure the public demo token, which provides limited access to CLI features like pnpm dlx socket fix and pnpm dlx socket package score (but not pnpm dlx socket scan create).socket fix and socket-patch require network access. Check connectivity and retry once before skipping./socket-setup to ensure the Socket CLI is properly configured before starting