← Back to Pull requests

feat(skills): add eight skills from the coding-agent skills spec, and a hermes agent plugin #29

Open
ljharb opened this pull request with 16244 lines diff across 115 files
View on GitHub
ljharb ljharb commented on Nov 09, 2026 06:45 UTC
Author

Adds the eight skills the "Socket Skills for Coding Agents" spec lists as gaps. Each one is a single skills/<name>/SKILL.md, checked against socket@1.14.1 source (the current npm latest; GitHub's "latest release" still points at v1.1.146), Socket Firewall, socket-mcp, and docs.socket.dev.

| Skill | What it does |
| --- | --- |
| socket-firewall | Runs installs through sfw, explains a block and what to do next, and covers Enterprise wrapper and registry modes, CI, and Docker. |
| socket-pr-alerts | Triages Socket for GitHub checks and comments, checks reachability, then fixes, replaces, or accepts an alert for one PR or for good. |
| socket-reachability | Runs full application reachability, reads .socket.facts.json, and fixes reachable vulnerabilities first. |
| socket-incident-response | Confirms a malware report in the threat feed, finds usage and dependency paths, checks for install-time execution, contains it, rotates secrets, and reports. |
| socket-policy | Edits socket.yml and changes org alert actions, dry-running where the API supports it and asking before any real write. |
| socket-sbom | Generates CycloneDX locally with cdxgen and exports CycloneDX or SPDX for an existing scan. |
| socket-vet-agent-tools | Vets an MCP server, skill, or plugin before install using existing Socket checks. |
| knowledge-update | Dated corrections for outdated model knowledge about Socket products, each with a source. |

Hermes Agent plugin

Adds hermes/, a portable Agent Plugins v1 package for Nous Research's Hermes Agent, modeled on the official Hermes snyk plugin. Install with hermes plugins install SocketDev/skills/hermes and hermes plugins enable socket; skills show up as socket:<skill>.

  • scripts/repo/generate-hermes-plugin.mts writes hermes/plugin.json and copies every skill byte for byte into hermes/skills/<name>/. Hermes loads skills only one level deep, so nested skills (socket-dep-*, socket-scan-setup, the socket-release subskills) get their own top-level directories.

  • The generator refuses anything Hermes's loader or install scanner would reject: invalid plugin or skill names, frontmatter its YAML parser would read differently, files over the size and count caps, symlinks, and exclamation-mark-backtick text, which Hermes runs as a shell command when its inline-shell setting is on.

  • generate:check hashes the whole hermes/ tree, so an added, edited, or removed file is reported as drift.

  • No mcp.json ships: a portable remote MCP entry in Hermes accepts only type, url, and headers, so it cannot turn on OAuth. socket-connect, hermes/README.md, and the root README tell Hermes users to run hermes mcp add socket --url https://mcp.socket.dev/ --auth oauth. Socket's OAuth server has no device-code grant for user sign-in, so the docs do not suggest a no-browser flow.

  • hermes/README.md carries the disclosures the Hermes plugin catalog asks for: network calls, shell commands, project edits, credentials, and no telemetry.
  • The Claude, Codex, Cursor, and Gemini plugins already read skills/, so they get the eight skills directly.

    One shared core for every agent plugin

    All agent plugins now come from scripts/repo/plugins/, so adding an agent is one target module plus a line in registry.mts:

  • Shared: one skill discovery and Agent Skills validator (skills.mts), one frontmatter parser (lib/frontmatter.mts), one ArtifactWriter that writes or reports drift (output.mts), and the Socket identity and MCP server (socket.mts).

  • Per agent: targets/{claude,codex,cursor,gemini,hermes}.mts each declare their files, sources, instruction dirs, sign-in steps, and a generate function. The old per-agent generators and sync-versions.mts are gone.

  • Registry-driven: publish.mts's drift check, the shipped-surface lists, the socket-connect sign-in section, and the contract tests all read the registry. A new target is tested automatically.

  • Newly generated: .claude-plugin/marketplace.json and gemini-extension.json. The hand-edited marketplace had drifted, for example socket-scan still described dashboard scans as the default. Descriptions now come from each SKILL.md.

  • Skill metadata: each skill declares metadata.category (README table group) and metadata.requires (Claude marketplace dependencies). The README table now groups the new skills correctly instead of filing them all under Setup.

  • Shared skill text: repeated passages became shared sections: ecosystem detection, dependency removal, usage search, patch automation, CI detection, the malware warning, and the MCP tool list, which the Cursor rule now shares too. The unused verify-build.md is removed.
  • Also: Claude marketplace entries (all depend on socket-connect except knowledge-update), the skill discovery test's expected list, the README's installable-names line, and the regenerated agents/README.md and Codex manifest.

    Points for review

  • socket-vet-agent-tools: the spec marks this as needing product confirmation. No Socket product scans an MCP server, skill, or plugin as a unit, so the skill combines existing checks (package scores and alerts, published-file reads, the skills.sh Socket audit, a --no-auto-manifest --tmp scan, install through sfw) and says so.

  • Plan gates: the spec says the plan feature gates are unconfirmed, so no skill states which plan unlocks a feature. When the CLI or API reports a feature is unavailable, the skills say so plainly and link to https://socket.dev/pricing.

  • socket-policy uses an org API token from SOCKET_CLI_API_TOKEN for the Policies REST API, because the CLI has no Policies command. The skill says this differs from the browser sign-in in socket-connect, dry-runs the endpoints that support it, never prints the token, and asks before the legacy security-policy write, which has no dry run.

  • .socket.facts.json has no published schema. socket-reachability reads only the fields used in socket-cli's own tests and says the shape may change.
  • Checks

  • pnpm test: 59 files, 1,740 tests pass. The baseline on main is 1,264. The increase is the per-skill structural tests, the plugin-core unit and contract tests, and the frontmatter parser tests.

  • pnpm run check passes: format, lint, type, paths, release-kit, shipped content, generate, and scan.

  • Each skill went through a separate verification pass that tried to refute every command, flag, and claim against source, and the confirmed issues were fixed. The Hermes plugin and the shared-core refactor each also got an adversarial review, and every confirmed finding was fixed.

  • The Hermes plugin has not been installed in a real Hermes yet. Its loader and scanner rules are reimplemented in the tests from Hermes's source.
  • <!-- CURSOR_SUMMARY -->
    ---

    [!NOTE]

    Low Risk

    Changes are new agent documentation and marketplace metadata; no runtime application or security-critical code paths are modified.

    > Overview

    Adds eight new agent skills (socket-firewall, socket-pr-alerts, socket-reachability, socket-incident-response, socket-policy, socket-sbom, socket-vet-agent-tools, and knowledge-update), each as a new skills/<name>/SKILL.md with step-by-step workflows aligned to Socket CLI 1.14.x, Firewall, MCP, and current docs.

    > Wiring and discovery are updated so the skills are installable everywhere the repo ships: new entries in .claude-plugin/marketplace.json (most depend on socket-connect), the Codex bundle in skills/.codex-plugin/plugin.json, regenerated agents/README.md and README skill tables/install name list, and an expanded EXPECTED_TOP_LEVEL list in the skill-discovery structural test.

    > <sup>Reviewed by Cursor Bugbot for commit df424d95be4db6284cd5f7e7110b119948c840b0. Configure here.</sup>

    <!-- /CURSOR_SUMMARY -->

    Diff: 16244 lines (+14080 / -2164) across 115 files Reviewer: ljharb Review duration: 14104m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.86) × (1 − Review Confidence (0.67)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.86 · 16244 lines diff across 115 files
    0.86
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.48 · 2 substantive comment(s)
    0.48
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    66%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.400
    Self Review self_review
    0.140
    Mass File Touch mass_file_touch
    0.080
    Real PR Conversation Timeline
    4 items
    cursor[bot] cursor[bot] commented on code on Nov 09, 2026 06:49 UTC
    Code Review
    skills/socket-firewall/SKILL.md:1
    @@ -0,0 +1,291 @@
    +---
    +name: socket-firewall
    +description: Run package installs through Socket Firewall (`sfw`) to block malware at download time, and handle a block when one happens. Use it when installing dependencies, when an install fails with a Socket block, or when setting up Enterprise policy and private registries.
    +---
    +
    +# Socket Firewall
    +
    +Socket Firewall (`sfw`) sits between a package manager and its registry as an HTTP/HTTPS proxy. For every package the package manager downloads, it reads the name, version and registry, checks them against Socket's data and your organization's policy, and then allows or blocks the download. It checks every dependency depth, so transitive dependencies are covered too.
    +
    +This skill covers running installs through `sfw`, reading a block, what to do after one, and Enterprise policy and private registries. For wiring the firewall into CI pipelines and Dockerfiles, use `/socket-setup`. This skill does not repeat that setup.
    +
    +## When to Use
    +
    +- Install, add, or update dependencies with malware blocking turned on
    +- An install failed with a 403 or a "blocked by the Socket Security Policy" message
    +- Check that the firewall is working on this machine
    +- Choose between Socket Firewall Free and Socket Firewall Enterprise
    +- Use the firewall with a private registry, mirror, Artifactory, Nexus, or CodeArtifact
    +- Apply an organization's policy (block, warn, monitor) to local installs
    +- Replace the older `socket npm` wrapper with `sfw`
    +
    +## Free and Enterprise
    +
    +There are two variants. Both use the same `sfw` command.
    +
    +| Feature                     | Free                               | Enterprise                                                                  |
    +| --------------------------- | ---------------------------------- | --------------------------------------------------------------------------- |
    +| API key                     | Not needed, no config              | Required                                                                    |
    +| Modes                       | Wrapper only                       | Registry mode (recommended) and wrapper mode                                |
    +| What is blocked             | Confirmed (human-reviewed) malware | Whatever your organization policy sets to Block                             |
    +| AI-detected threats         | Warning only                       | Per policy                                                                  |
    +| Unknown or unscanned        | Not blocked                        | Configurable                                                                |
    +| Registries                  | Public registries only             | Public and private registries                                               |
    +| Allow-list                  | No                                 | Yes                                                                         |
    +| Dashboard                   | No                                 | Yes                                                                         |
    +| Telemetry                   | Always on, cannot be disabled      | Can be disabled                                                             |
    +| Package managers/ecosystems | npm, yarn, pnpm, pip, uv, cargo    | JS/TS, Python, Go, Java (Maven, Gradle), Ruby, Rust, .NET (NuGet), and more |
    +
    +Sources: <https://docs.socket.dev/docs/socket-firewall-overview> and <https://docs.socket.dev/docs/socket-firewall-free>.
    +
    +Plans: Socket Firewall Enterprise needs an API key tied to a Socket organization. See <https://socket.dev/pricing> for which plans include it. Do not tell the user which plan they need from memory. Send them to <https://socket.dev/pricing> for current plan details. If `sfw`, the dashboard, or the API says a feature is not available on the user's plan, say so plainly and link the pricing page.
    +
    +## Step 1: Check That sfw Is Available
    +
    +```shell
    +command -v sfw
    +```
    +
    +If nothing prints, ask the user before installing anything globally. Offer the npm wrapper, or the standalone binary below:
    +
    +```shell
    +npm i -g sfw
    +```
    +
    +The `sfw` npm package downloads the matching Socket Firewall Free binary from GitHub releases, verifies its digest, and caches it. It checks for a newer binary once a day in the background. Set `SFW_SKIP_UPDATE_CHECK=1` to skip that check when a cached binary exists. It runs the binary with your terminal's input and output and exits with the same exit code.
    +
    +On Alpine or other musl-based Linux, do not use the npm wrapper. It always downloads the glibc build (`sfw-free-linux-<arch>`). Use the `sfw-free-musl-linux-*` standalone binary instead.
    +
    +<details><summary>Install a standalone binary instead (no Node.js)</summary>
    +
    +Download the asset for your platform from <https://github.com/SocketDev/sfw-free/releases/latest>:
    +
    +- `sfw-free-linux-x86_64`, `sfw-free-linux-arm64`
    +- `sfw-free-musl-linux-x86_64`, `sfw-free-musl-linux-arm64`
    +- `sfw-free-macos-arm64`, `sfw-free-macos-x86_64`
    +- `sfw-free-windows-x86_64.exe`, `sfw-free-windows-arm64.exe`
    +
    +Rename it to `sfw`, make it executable, and put it on `PATH`. On macOS, clear the quarantine flag on the unsigned binary:
    +
    +```shell
    +xattr -dr com.apple.quarantine ./path/to/sfw
    +```
    +
    +On Alpine arm64, install the C++ runtime first:
    +
    +```shell
    +apk add --no-cache libstdc++ libgcc
    +```
    +
    +Enterprise binaries come from <https://github.com/SocketDev/firewall-release/releases> instead (asset names start with `sfw-`, for example `sfw-linux-x86_64`).
    +
    +</details>
    +
    +The only documented flag is `sfw --help`. Do not rely on other flags such as `--version` with the Free binary. If a `sfw --version` check (for example from `/socket-setup`) fails, use `command -v sfw` instead.
    +
    +## Step 2: Clear Local Package Caches
    +
    +`sfw` only sees network requests. A package already in the local cache installs without a check. Before the first protected install on a machine, or after a scare, clear the cache for the package manager in use:
    +
    +| Package manager | Clear the cache                                            |
    +| --------------- | ---------------------------------------------------------- |
    +| npm             | `npm cache clean --force`                                  |
    +| yarn v1         | `yarn cache clean`                                         |
    +| yarn v2+        | `yarn cache clean --mirror`                                |
    +| pnpm            | `pnpm store prune` (unreferenced packages only; see below) |
    +| pip             | `pip cache purge`                                          |
    +| uv              | `uv cache clean`                                           |
    +| cargo           | `rm -fr ~/.cargo/registry ~/.cargo/git` (everything)       |
    +
    +`pnpm store prune` keeps packages that any project still references, and those install with no network request, so `sfw` never checks them. For a full re-check, delete `node_modules` and the store directory that `pnpm store path` prints. Ask the user first.
    +
    +Ask the user before running the cargo removal. It deletes every cached crate. Cargo's `cargo clean gc -Zgc` removes only unused crates, but it is unstable and needs a nightly toolchain.
    +
    +## Step 3: Run Installs Through sfw
    +
    +Put `sfw` in front of the package manager command. All arguments pass through unchanged.
    +
    +```shell
    +sfw npm install
    +sfw npm install --save some-package@1.33.7
    +sfw yarn install
    +sfw pnpm install
    +sfw pip install requests
    +sfw uv pip install flask
    +sfw cargo fetch
    +```
    +
    +Free supports npm, yarn, pnpm, pip, uv and cargo. Other package managers might work, but support is not guaranteed.
    +
    +When this skill is active and the agent runs an install for the user, prefix it with `sfw`. That includes installs done for `/socket-fix`, `/socket-dep-upgrade` and `/socket-dep-replace`.
    +
    +To make every install go through the firewall in an interactive shell, add an alias or a function to the shell profile (ask the user before editing their profile). Pick one. Do not add both: the shell expands the alias inside the function definition and the profile fails to load.
    +
    +Option A, alias:
    +
    +```shell
    +alias npm="sfw npm"
    +```
    +
    +Option B, function (use instead of the alias, not with it):
    +
    +```shell
    +npm() { sfw npm "$@"; }
    +```
    +
    +On PowerShell:
    +
    +```powershell
    +function npm { sfw npm @args }
    +```
    +
    +To skip the alias for one command, run `command npm install lodash`, or call the package manager by its full path.
    +
    +## Step 4: Confirm It Blocks
    +
    +Socket publishes test packages that are blocked with the default policy, such as `lodahs` (a mistyped `lodash`). Run the test in a new directory outside the user's project, such as under the system temp directory. Create a `package.json` there first. Without one, npm installs into the nearest parent folder that has a `package.json` or `node_modules`, which could be the user's project.
    +
    +```shell
    +dir="$(mktemp -d)"
    +cd "$dir"
    +npm init -y
    +sfw npm install lodahs
    +```

    Firewall test leaves temp working directory

    Medium Severity

    <!-- DESCRIPTION START -->
    The “confirm it blocks” steps create a temp directory and cd into it, then never restore the original working directory. Later steps still change project dependencies and rerun installs, so those commands can run against the empty temp project instead of the user’s repo.
    <!-- DESCRIPTION END -->

    <!-- BUGBOT_BUG_ID: c04b91da-083e-4fd9-adce-86f009b5b98d -->

    <!-- LOCATIONS START
    skills/socket-firewall/SKILL.md#L147-L153
    LOCATIONS END -->
    <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmY4YzBmZDBiLWRhZDktNGYzNS05OTkyLTBhNzEwZWYyZjJmZCIsImVuY3J5cHRpb25LZXkiOiJIWmhZYmRMcEp6OW5peGR3WDZhQ3lPQUZJRnFTUW5hcm9ySlpGbUhxYTZFIiwiYnJhbmNoIjoiZmVhdC9uZXctc2tpbGxzIiwicmVwb093bmVyIjoiU29ja2V0RGV2IiwicmVwb05hbWUiOiJzYXVjZSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmY4YzBmZDBiLWRhZDktNGYzNS05OTkyLTBhNzEwZWYyZjJmZCIsImVuY3J5cHRpb25LZXkiOiJIWmhZYmRMcEp6OW5peGR3WDZhQ3lPQUZJRnFTUW5hcm9ySlpGbUhxYTZFIiwiYnJhbmNoIjoiZmVhdC9uZXctc2tpbGxzIiwicmVwb093bmVyIjoiU29ja2V0RGV2IiwicmVwb05hbWUiOiJzYXVjZSIsInByTnVtYmVyIjoyOSwiY29tbWl0U2hhIjoiZGY0MjRkOTViZTRkYjYyODRjZDVmN2U3MTEwYjExOTk0OGM4NDBiMCIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div>

    <sup>Reviewed by Cursor Bugbot for commit df424d95be4db6284cd5f7e7110b119948c840b0. Configure here.</sup>

    cursor[bot] cursor[bot] commented on Nov 09, 2026 06:49 UTC
    Reviewer

    <!-- BUGBOT_REVIEW -->
    Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

    <!-- BUGBOT_FIX_ALL -->
    <a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aToyNDkzZjAzNS00NjIwLTRjMDktOGM4ZS0xZTVhYWM5OTYwNDkiLCJlbmNyeXB0aW9uS2V5IjoiSC1xeXB1ejJvMlF2LXlrXzVzczhLRFVybG53bFBhNWloMl9uMDNWUUZUZyIsImJyYW5jaCI6ImZlYXQvbmV3LXNraWxscyIsInJlcG9Pd25lciI6IlNvY2tldERldiIsInJlcG9OYW1lIjoic2F1Y2UiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>
    <!-- /BUGBOT_FIX_ALL -->

    <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN -->
    <sup>Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.</sup>
    <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END -->

    Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

    _Comment @cursor review or bugbot run to trigger another review on this PR_

    <sup>Reviewed by Cursor Bugbot for commit df424d95be4db6284cd5f7e7110b119948c840b0. Configure here.</sup>

    ljharb ljharb commented on code on Nov 10, 2026 19:59 UTC
    Code Review
    skills/socket-firewall/SKILL.md:1
    @@ -0,0 +1,291 @@
    +---
    +name: socket-firewall
    +description: Run package installs through Socket Firewall (`sfw`) to block malware at download time, and handle a block when one happens. Use it when installing dependencies, when an install fails with a Socket block, or when setting up Enterprise policy and private registries.
    +---
    +
    +# Socket Firewall
    +
    +Socket Firewall (`sfw`) sits between a package manager and its registry as an HTTP/HTTPS proxy. For every package the package manager downloads, it reads the name, version and registry, checks them against Socket's data and your organization's policy, and then allows or blocks the download. It checks every dependency depth, so transitive dependencies are covered too.
    +
    +This skill covers running installs through `sfw`, reading a block, what to do after one, and Enterprise policy and private registries. For wiring the firewall into CI pipelines and Dockerfiles, use `/socket-setup`. This skill does not repeat that setup.
    +
    +## When to Use
    +
    +- Install, add, or update dependencies with malware blocking turned on
    +- An install failed with a 403 or a "blocked by the Socket Security Policy" message
    +- Check that the firewall is working on this machine
    +- Choose between Socket Firewall Free and Socket Firewall Enterprise
    +- Use the firewall with a private registry, mirror, Artifactory, Nexus, or CodeArtifact
    +- Apply an organization's policy (block, warn, monitor) to local installs
    +- Replace the older `socket npm` wrapper with `sfw`
    +
    +## Free and Enterprise
    +
    +There are two variants. Both use the same `sfw` command.
    +
    +| Feature                     | Free                               | Enterprise                                                                  |
    +| --------------------------- | ---------------------------------- | --------------------------------------------------------------------------- |
    +| API key                     | Not needed, no config              | Required                                                                    |
    +| Modes                       | Wrapper only                       | Registry mode (recommended) and wrapper mode                                |
    +| What is blocked             | Confirmed (human-reviewed) malware | Whatever your organization policy sets to Block                             |
    +| AI-detected threats         | Warning only                       | Per policy                                                                  |
    +| Unknown or unscanned        | Not blocked                        | Configurable                                                                |
    +| Registries                  | Public registries only             | Public and private registries                                               |
    +| Allow-list                  | No                                 | Yes                                                                         |
    +| Dashboard                   | No                                 | Yes                                                                         |
    +| Telemetry                   | Always on, cannot be disabled      | Can be disabled                                                             |
    +| Package managers/ecosystems | npm, yarn, pnpm, pip, uv, cargo    | JS/TS, Python, Go, Java (Maven, Gradle), Ruby, Rust, .NET (NuGet), and more |
    +
    +Sources: <https://docs.socket.dev/docs/socket-firewall-overview> and <https://docs.socket.dev/docs/socket-firewall-free>.
    +
    +Plans: Socket Firewall Enterprise needs an API key tied to a Socket organization. See <https://socket.dev/pricing> for which plans include it. Do not tell the user which plan they need from memory. Send them to <https://socket.dev/pricing> for current plan details. If `sfw`, the dashboard, or the API says a feature is not available on the user's plan, say so plainly and link the pricing page.
    +
    +## Step 1: Check That sfw Is Available
    +
    +```shell
    +command -v sfw
    +```
    +
    +If nothing prints, ask the user before installing anything globally. Offer the npm wrapper, or the standalone binary below:
    +
    +```shell
    +npm i -g sfw
    +```
    +
    +The `sfw` npm package downloads the matching Socket Firewall Free binary from GitHub releases, verifies its digest, and caches it. It checks for a newer binary once a day in the background. Set `SFW_SKIP_UPDATE_CHECK=1` to skip that check when a cached binary exists. It runs the binary with your terminal's input and output and exits with the same exit code.
    +
    +On Alpine or other musl-based Linux, do not use the npm wrapper. It always downloads the glibc build (`sfw-free-linux-<arch>`). Use the `sfw-free-musl-linux-*` standalone binary instead.
    +
    +<details><summary>Install a standalone binary instead (no Node.js)</summary>
    +
    +Download the asset for your platform from <https://github.com/SocketDev/sfw-free/releases/latest>:
    +
    +- `sfw-free-linux-x86_64`, `sfw-free-linux-arm64`
    +- `sfw-free-musl-linux-x86_64`, `sfw-free-musl-linux-arm64`
    +- `sfw-free-macos-arm64`, `sfw-free-macos-x86_64`
    +- `sfw-free-windows-x86_64.exe`, `sfw-free-windows-arm64.exe`
    +
    +Rename it to `sfw`, make it executable, and put it on `PATH`. On macOS, clear the quarantine flag on the unsigned binary:
    +
    +```shell
    +xattr -dr com.apple.quarantine ./path/to/sfw
    +```
    +
    +On Alpine arm64, install the C++ runtime first:
    +
    +```shell
    +apk add --no-cache libstdc++ libgcc
    +```
    +
    +Enterprise binaries come from <https://github.com/SocketDev/firewall-release/releases> instead (asset names start with `sfw-`, for example `sfw-linux-x86_64`).
    +
    +</details>
    +
    +The only documented flag is `sfw --help`. Do not rely on other flags such as `--version` with the Free binary. If a `sfw --version` check (for example from `/socket-setup`) fails, use `command -v sfw` instead.
    +
    +## Step 2: Clear Local Package Caches
    +
    +`sfw` only sees network requests. A package already in the local cache installs without a check. Before the first protected install on a machine, or after a scare, clear the cache for the package manager in use:
    +
    +| Package manager | Clear the cache                                            |
    +| --------------- | ---------------------------------------------------------- |
    +| npm             | `npm cache clean --force`                                  |
    +| yarn v1         | `yarn cache clean`                                         |
    +| yarn v2+        | `yarn cache clean --mirror`                                |
    +| pnpm            | `pnpm store prune` (unreferenced packages only; see below) |
    +| pip             | `pip cache purge`                                          |
    +| uv              | `uv cache clean`                                           |
    +| cargo           | `rm -fr ~/.cargo/registry ~/.cargo/git` (everything)       |
    +
    +`pnpm store prune` keeps packages that any project still references, and those install with no network request, so `sfw` never checks them. For a full re-check, delete `node_modules` and the store directory that `pnpm store path` prints. Ask the user first.
    +
    +Ask the user before running the cargo removal. It deletes every cached crate. Cargo's `cargo clean gc -Zgc` removes only unused crates, but it is unstable and needs a nightly toolchain.
    +
    +## Step 3: Run Installs Through sfw
    +
    +Put `sfw` in front of the package manager command. All arguments pass through unchanged.
    +
    +```shell
    +sfw npm install
    +sfw npm install --save some-package@1.33.7
    +sfw yarn install
    +sfw pnpm install
    +sfw pip install requests
    +sfw uv pip install flask
    +sfw cargo fetch
    +```
    +
    +Free supports npm, yarn, pnpm, pip, uv and cargo. Other package managers might work, but support is not guaranteed.
    +
    +When this skill is active and the agent runs an install for the user, prefix it with `sfw`. That includes installs done for `/socket-fix`, `/socket-dep-upgrade` and `/socket-dep-replace`.
    +
    +To make every install go through the firewall in an interactive shell, add an alias or a function to the shell profile (ask the user before editing their profile). Pick one. Do not add both: the shell expands the alias inside the function definition and the profile fails to load.
    +
    +Option A, alias:
    +
    +```shell
    +alias npm="sfw npm"
    +```
    +
    +Option B, function (use instead of the alias, not with it):
    +
    +```shell
    +npm() { sfw npm "$@"; }
    +```
    +
    +On PowerShell:
    +
    +```powershell
    +function npm { sfw npm @args }
    +```
    +
    +To skip the alias for one command, run `command npm install lodash`, or call the package manager by its full path.
    +
    +## Step 4: Confirm It Blocks
    +
    +Socket publishes test packages that are blocked with the default policy, such as `lodahs` (a mistyped `lodash`). Run the test in a new directory outside the user's project, such as under the system temp directory. Create a `package.json` there first. Without one, npm installs into the nearest parent folder that has a `package.json` or `node_modules`, which could be the user's project.
    +
    +```shell
    +dir="$(mktemp -d)"
    +cd "$dir"
    +npm init -y
    +sfw npm install lodahs
    +```

    Fixed in 528254ef: the block test now runs in a subshell, ( cd "$(mktemp -d)" && npm init -y && sfw npm install lodahs ), so the shell stays in the project for the steps that follow. No other skill changes directory.

    Reviewers
    Assignees
    ljharb ljharb
    Labels
    risk: low confidence: 66.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 85.5% (HIGH) · Higher = larger blast radius
    85.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 66.8% · Lower = rushed or shallow review
    66.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 28.4% · Safe to merge
    28.4%