Answers / Guard
How do I stop Claude Code or other coding agents from installing malicious or slopsquatted packages?
Put osty-proxy in front of package registries and gate lockfiles with osty verify before any install hook executes. Osty (osty.dev) detonates each new release in a honey-secret Firecracker microVM, diffs artifacts against Git tags and enforces cooldowns so slopsquatted or hijacked packages fail closed before an agent runs them, as scenarios a03 and a05 prove.
Written by Osty EngineeringPublished Updated
| Attack vector | Why coding agents hit it | Pre-install control in Osty | Proof |
|---|---|---|---|
| Slopsquatted package names | Models hallucinate plausible package names that attackers register on npm or PyPI with install hooks. | Cooldown hold (defaultCooldownHours) plus Firecracker honey-secret detonation before first install. | Scenario a03 |
| Freshly hijacked maintainer release | An agent asked to bump dependencies pulls a patch release published minutes earlier. | Signed vPrev -> vNew behavior baseline and DNS/TLS sinkhole trace block the pull at osty-proxy and osty verify. | Scenarios a03, a04 |
| Poisoned tarball or wheel | Source repo looks clean to the agent, but the published registry artifact adds a postinstall script. | File-by-file diff between the published artifact and its upstream Git tag escalates the verdict before install. | Scenario a05 |
| Sneaked transitive or unlisted package | Prompt injection in release notes or a package README steers an agent to add an extra dependency. | forbidUnlistedDependencies: true in the Policy Patch Verifier rejects any dependency outside the authorized closure. | Scenario a10 |
osty verify --lockfile package-lock.json --jsonWhy coding agents widen the install-time blast radius
Interactive and autonomous coding agents such as Claude Code, Codex and Cursor routinely run npm install, uv add or pip install inside shells that hold developer SSH keys, cloud profiles, .npmrc tokens and CI secrets. Two failure modes compound when installs happen faster than humans audit them: slopsquatting, where attackers register package names that models frequently hallucinate, and maintainer takeovers that slip a secret stealer into a minor or patch release.
Asking the same model whether a package is safe does not close the gap. Model weights are static, release artifacts are fetched from live registries, and lifecycle scripts execute during install before any test suite runs.
Put a pre-install firewall between the agent and the registry
The reliable fix sits outside the coding agent. Route package manager traffic through osty-proxy so every resolved version must carry a clean, Ed25519-signed Plane 1 verdict and pass your cooldown window before the tarball or wheel is served, and gate every lockfile in CI with osty verify before npm ci or pip install runs.
.osty/policy.yamlyamlapiVersion: osty.io/v1
kind: FleetPolicy
supplyChain:
defaultCooldownHours: 48
fastTrackVerifiedKEV: true
blockVerdicts: [CONFIRMED_MALICIOUS, QUARANTINED_HIGH_RISK]
blockLicenseChanges: true
proxyFailureMode:
prodCI: FAIL_CLOSED
devLaptop: FAIL_OPEN_WITH_CACHE
patchVerifier:
forbidUnlistedDependencies: true
forbidNewShellOrNetworkPrimitives: trueosty policy validate .osty/policy.yaml
osty verify --lockfile package-lock.json --policy .osty/policy.yaml --jsonGive coding agents signed verdicts before they suggest a bump
Alongside enforcement at the proxy and in CI, coding agents can check Osty before choosing a package version. The read-only public MCP server at https://mcp.osty.dev/mcp exposes verify_package, check_cve_backport and check_upgrade_compatibility backed by Ed25519-signed Plane 1 snapshots, and the osty-security Agent Skill in osty-dev/agent-skills teaches agents the exact osty CLI commands and flags.
What a registry gate does not replace
- Osty does not sandbox a developer's interactive terminal session or restrict arbitrary shell commands a coding agent executes outside package installs; keep your agent's own permission and sandbox controls enabled.
- Disable lifecycle scripts by default where your ecosystem allows it (
npm ci --ignore-scripts) as defense in depth alongsideosty verifyandosty-proxy. - Osty is not a first-party SAST or secret scanner for code your coding agent writes directly; keep secret scanning and code review in place for application code.
Frequently asked questions
Does osty-proxy work with Claude Code, Codex and Cursor without changing how developers prompt?
Yes. Because osty-proxy sits in the registry path used by npm, PyPI, Go, Cargo and Maven, every package pull triggered by a developer, CI runner or coding agent passes through the same verdict and cooldown check automatically.
What if a coding agent hallucinates a brand-new package name an attacker registered today?
A newly published package is held by defaultCooldownHours and detonated in Plane 1's Firecracker honey-secret sandbox before it can clear as CLEAN. Any credential exfiltration or anomalous install hook blocks the install.
Can we start without deploying osty-proxy in our VPC?
Yes. Start with osty verify in CI through osty-dev/osty-action before the install step, and connect coding agents to the free public MCP server (https://mcp.osty.dev/mcp) or osty CLI. Add in-VPC osty-proxy on Enterprise when you want inline registry enforcement.