
Product
Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.
@promptshield/sanitizer
Advanced tools
PromptShield sanitizer that applies safe, deterministic fixes to text based on detected prompt-injection threats such as invisible characters, markdown smuggling, and BOM artifacts.

Deterministic sanitizer for prompt hygiene. Applies safe, idempotent text transformations to remove invisible threats and normalization artifacts.
$ pnpm add @promptshield/sanitizer
import { sanitize, sanitizeStrict } from "@promptshield/sanitizer";
const dirty = "Hello\u200BWorld"; // Contains Zero-Width Space
// Safe sanitize (removes invisible chars)
const clean = sanitize(dirty);
console.log(clean); // "HelloWorld"
// Strict sanitize (also applies NFKC normalization)
const strict = sanitizeStrict("ℍ𝕖𝕝𝕝𝕠");
console.log(strict); // "Hello"
\u200B (ZWSP), \u200C (ZWNJ), \u200D (ZWJ), etc.\uFEFF.\uFE00-\uFE0F (often used to break tokenizers).<!-- hidden payload -->.[](javascript:...).📚 Deep Dives: For the exact execution order of the sanitization pipeline and understanding
applyFixes, see the Documentation section.
This library is licensed under the MIT open-source license.
with 💖 by Mayank Kumar Chaudhari
FAQs
PromptShield sanitizer that applies safe, deterministic fixes to text based on detected prompt-injection threats such as invisible characters, markdown smuggling, and BOM artifacts.
The npm package @promptshield/sanitizer receives a total of 4,382 weekly downloads. As such, @promptshield/sanitizer popularity was classified as popular.
We found that @promptshield/sanitizer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.