Model or dataset
Pantheon-Security/medusa avatar
Pantheon-Security/medusa

Medusa by Pantheon Security: a Python scanner that vets repos and Claude Code configs before you clone

AI-first security scanner. NEW in v2026.7: Claude Code compromise detection — vet .claude/ hooks, permissions & skills before you clone — plus an always-on AI attack-signature scanner and native Rust & PHP rules. Also: medusa scan --git to vet any repo, medusa secrets scan for leaked API keys. 40,000+ patterns, zero setup.

1,023 stars156 forksPythonAGPL-3.0

At a glance

What is it?
Medusa is an AGPL-licensed Python CLI that scans code for AI and LLM attack patterns, checks a remote repo's .claude/ folder before cloning, and hunts leaked API keys in chat and shell histories. This article covers what each mode inspects and where its claims stop.
Who is it for?
Use Medusa if you routinely open unfamiliar repositories with an AI coding agent, or if you suspect keys pasted into assistant chats are sitting on disk. Skip it as a sole gate for a production pipeline until you have run it on your own code and judged its false positives yourself, because the project publishes pattern counts and no hit rates.
Can I use it commercially?
Yes, with strict conditions. AGPL-3.0 is a network copyleft licence: if people use a modified version over a network, for example as a hosted service, you must offer them its source code under the same licence.
Is it still maintained?
Yes. The repository last received commits 104 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • Pantheon-Security/medusa1,023 ★ · +43
Star history
Repository2026-09-122026-11-22
Pantheon-Security/medusa9801k

43 Stars in the last 71 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Vetting a repository you have not cloned yet

The feature Medusa leads with is `medusa scan --git <URL>`. You hand it a repository address and it inspects the remote project for AI supply chain problems: repo poisoning, prompt injection and MCP tool poisoning are the three categories named. The point of the design is ordering. Most scanners need a checkout on disk, and by then a poisoned editor config may already have been read by the tool you opened the folder with.

The pyproject description shortens the same idea to `medusa scan --git user/repo`, so a GitHub owner and repository name works as the target as well as a full URL. The v2026.7.0 release also added a context-aware screening mode for `--git` target vetting, which exists because a repo you are only deciding whether to trust is a different problem from your own code.

What this does not do is tell you the repo is safe. A clean result means none of Medusa's patterns matched. Anything outside the file types and rules it knows about passes silently, so treat a clean scan as one input to a trust decision, not the decision.

Claude Code compromise detection looks at four things in .claude/

Version 2026.7.0 extended the git scan to structurally vet the `.claude/` directory. The four targets are hooks, permissions, subagents and skills, and each has its own set of red flags.

Hooks are checked for pipe-to-shell downloads (curl piped into bash), base64 decoded straight into execution, credential exfiltration and reverse shells. Permissions are checked for over-broad grants, with `Bash(*)` and `bypassPermissions` given as the examples. Subagents are flagged when they request wildcard tools. Skills are checked for dropper behaviour, meaning a skill whose real job is to fetch and run something else.

The repo-poisoning detection is wider than Claude Code. It covers 28 or more file types across Cursor, Cline, Copilot, Claude Code, Gemini and Kiro configs. If your team uses several AI editors, that breadth matters more than the Claude-specific rules.

The limit is that these are pattern and structure checks. A hook that downloads and runs code through a route the patterns do not describe is outside what Medusa claims to catch, and a permission list that is merely generous but not literally `Bash(*)` may not trip anything. Read the hooks yourself when the stakes are high.

The always-on signature scanner closes a gap in data files and prose

Before 2026.7.0, jailbreak and prompt-injection payloads depended on Medusa deciding a file looked like LLM context. A payload sitting in a `.jsonl` or `.csv` dataset, or in plain prose, could slip past that confidence gate. The new always-on attack-signature scanner runs regardless of that confidence score, so a training set or a prompt library with an embedded injection string is now in scope.

The same release recovers invisible-unicode and bidirectional-text tricks of the Trojan Source kind, tracked as CVE-2021-42574. Those attacks hide instructions from a human reviewer while leaving them visible to a parser or a model.

The consequence for you is more findings on datasets and documentation folders than older versions produced. A security team that scans a repository of red-team prompts on purpose will see the scanner fire on its own test material. Decide ahead of time which paths hold deliberate attack strings, and exclude them in `.medusa.yml` rather than learning to ignore the output.

medusa secrets scan reads plaintext chat logs that assistants leave on disk

The second headline command works on your own machine instead of a repository. `medusa secrets scan` looks through the history files of Claude Code, Cursor, Copilot, Zed and Gemini, and through shell and database history for bash, zsh, psql, mysql and the Python REPL. The premise is that people paste keys into assistants, and the assistants store the conversation in plaintext under `$HOME`.

bash
medusa secrets scan

It recognises 21 issuer types, including Anthropic, OpenAI, PyPI, GitHub tokens, AWS, GCP, Stripe and Slack. The sample output groups findings per tool, prints a severity such as CRITICAL, gives file, line and column, and masks the secret itself (for example `sk-ant-api03***...***`), so the report does not become a second copy of the leak.

`medusa secrets purge` removes what the scan found. It asks `[y/n/s/a/q]` for each hit, writes a byte-identical backup before changing anything, and rewrites JSONL in a way that keeps the file valid. It is local-only with no telemetry.

Two caveats follow. Redacting a key from a history file does not revoke it; a key that sat in a chat log should be rotated at the issuer. And 21 issuer types means a credential from any other provider will not be recognised.

Rust and PHP rules ship in the package, other languages lean on optional linters

Medusa's pitch is that it works after install with no external tools. The v2026.7.0 release backs that up for two more languages. The Rust set has 22 rules covering disabled TLS verification, command injection, untrusted deserialization, raw SQL, unsafe memory operations, weak crypto and SSRF, and it does not need a Rust toolchain. The PHP set has 16 rules: SQL injection, command and eval injection, local and remote file inclusion, path traversal, `unserialize()` object injection, unrestricted upload, reflected XSS, SSRF and weak crypto.

For languages with established linters, Medusa detects `bandit`, `eslint`, `shellcheck` and similar tools when they are installed and uses them for extra coverage. That is optional. Without them you get only the built-in rules, so a Python project scanned on a bare machine does not get everything bandit would add.

The pyproject description cites 79 analyzers, which is the broader figure behind the language rules. The project does not break that number down per language in the text, so check the language you care about by scanning a sample file with a known flaw before relying on coverage.

--trace-rules exists because a rule once hung the scanner

A pattern-heavy scanner can be undone by one badly written regular expression. Medusa's maintainers say they hit exactly that: a catastrophic-backtracking ReDoS inside one of their own rules, found and fixed in 2026.7.0.

The response is `--trace-rules`. It writes a per-rule firing log and timing data to `rule-trace.jsonl` and `slow_rules.csv`, with a heartbeat that survives a hang, so you can see which rule was running when a scan stalled. A lint step now blocks ReDoS-prone and nested-set patterns when a rule is authored.

This matters at the scale Medusa advertises. With 40,000 or more patterns, a few slow ones decide your CI time. If a scan on a large repository drags, the trace files tell you which rule to blame instead of leaving you to guess. The same release added large-file byte-cap sampling, which means very large files are sampled, not read in full. A payload placed deep inside a huge file is therefore a place a scan can miss.

Forty thousand patterns measure volume, not accuracy

The 40,000-plus figure was reached in v2026.5.12, up from 9,600, by harvesting patterns from 8,466 AI-security research papers, and the release notes call the result false-positive-hardened. The project also lists 200 CVE detections, including Log4Shell, Spring4Shell, XZ Utils, LangChain RCE and MCP-Remote RCE.

None of those numbers is a precision or recall figure. A pattern harvested from a paper is only as good as its translation into a rule, and the project gives no measured false-positive rate for your language mix. Run it on a repository you know well and count how many findings are real before wiring `--fail-on` into a blocking CI job. Example configs for GitHub Actions, GitLab CI, pre-commit and `.medusa.yml` ship under `examples/`.

Setup facts are plain. The PyPI package is `medusa-security`, it requires Python 3.10 or newer, and the classifiers list 3.10 through 3.13. Windows, macOS and Linux are all named as supported. Reports export as JSON, HTML, Markdown and SARIF. The licence is AGPL-3.0, declared as AGPL-3.0-or-later in pyproject, so embedding it in a closed product deserves a licence review. The last push to the repository was on 10 August 2026 and the newest release listed is v2026.7.0 from 24 June 2026.

Editorial conclusion

Use Medusa if you routinely open unfamiliar repositories with an AI coding agent, or if you suspect keys pasted into assistant chats are sitting on disk. Skip it as a sole gate for a production pipeline until you have run it on your own code and judged its false positives yourself, because the project publishes pattern counts and no hit rates.

Frequently asked questions

How to install Medusa the AI security scanner?

Medusa is published on PyPI as medusa-security and installs with pip, and the project says it works immediately afterwards with no external tools. It requires Python 3.10 or newer.

How to install Medusa security scanner on Windows?

The project names Windows, macOS and Linux as natively supported, and the package is marked OS independent on PyPI. The same pip install of medusa-security applies, with Python 3.10 or newer.

How to install Medusa security scanner on Ubuntu?

Linux is a supported platform and the package is OS independent, so Ubuntu needs only a Python 3.10 or newer interpreter and pip install of medusa-security. No Ubuntu specific steps are given by the project.

Official sources

  1. License: AGPL-3.0
  2. Pantheon-Security/medusa on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/pantheon-security-medusa.svg)](https://hysenlabs.com/projects/pantheon-security-medusa)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/pantheon-security-medusa.svg)](https://hysenlabs.com/projects/pantheon-security-medusa)

Was this useful?