Narthex

•
4
•

Provides robust prompt-injection defenses for Claude Code by blocking exfiltration patterns and sanitizing untrusted content.

Narthex acts as a critical transitional space between untrusted content and your development environment, safeguarding against indirect prompt injection in AI coding assistants like Claude Code. It implements a multi-layered defense strategy, featuring enforcement hooks that block compositional credential exfiltration patterns and a sanitizing Model Context Protocol (MCP) server that cleans untrusted URLs and files. Additionally, advisory scanners provide warnings for potential jailbreak phrases and suspicious write operations, significantly reducing the risk of your credentials or sensitive data being leaked due to malicious hidden instructions.

主な機能

01Comprehensive audit log records Bash and WebFetch calls, along with all findings from advisory scanners for post-incident review.
02Bash PreToolUse hook blocks compositional exfiltration patterns (e.g., secret read + network call) using AST-aware parsing with bashlex.
03Sanitizing MCP server (`safe_fetch`, `safe_read`, `inspect`) wraps untrusted URLs/files in sentinels, strips invisible unicode, and flags jailbreak phrases.
04PostToolUse hook flags sensitive write operations to critical system paths (e.g., .ssh/config, .zshrc) and detects obfuscation markers.
05PostToolUse hook scans third-party MCP responses for invisible unicode and jailbreak patterns, providing advisory warnings to the assistant.
060 GitHub stars

ユースケース

01Preventing credential exfiltration and reverse shell attempts when using Claude Code.
02Safely fetching and reading untrusted web content or local files within Claude Code's context.
03Detecting and mitigating indirect prompt injection attacks originating from external content in AI coding assistant interactions.