agentleFS
zedarvateszedarvates/frugal-skills/skills/security-scanner/SKILL.md

security-scanner

Skill1 starsChanged 31 days agoMITView on GitHub

Instructions for the upstream workflow: Scan Python skills and MCP servers for malicious code — dangerous imports, network exfiltration, filesystem abuse, subprocess injection, obfuscation, crypto weakness, environment leaks, and supply-chain attacks. Use when auditing code for security, running pre-commit hooks, or preparing CI/CD security gates.

14 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

security-scanner — code security scanner

Package scope and prerequisites

This catalog ships instructions, not the executable runtime. Python modules, scripts, local services and optional tools named below must be installed separately from the upstream project. Check their availability before running commands; if they are missing, explain the prerequisite instead of claiming execution or results. The host agent may use model tokens while following these instructions.

Détecte les patterns malveillants dans les skills Python, MCP servers, et pipelines. Combinaison de regex pattern-matching et d'analyse AST Python.

Usage

# Scanner un dossier
python -m skills.security_scanner.cli scan skills/ --fail-on critical
python -m skills.security_scanner.cli scan . --format json
python -m skills.security_scanner.cli scan src/main.py --verbose

# Audit complet
python -m skills.security_scanner.cli audit skills/ --format compact

Checks effectués

CheckRegexASTExemple
dangerous_imports✅✅eval(user_input), exec(code)
network_exfil✅✅requests.post("evil.com")
filesystem_abuse✅✅open("/etc/passwd", "w")
subprocess_injection✅✅shell=True avec input concaténé
obfuscation✅❌base64.b64decode, bytes([...]).decode()
crypto_weak✅❌RSA.generate(512), MD5
env_leak✅✅print(os.environ["SECRET"])
supply_chain✅❌Imports de packages inconnus

Architecture

security_scanner/
├── scanner.py     # Orchestrateur : itère fichiers, appelle analyseurs
├── patterns.py    # Base de patterns (regex + metadata)
├── ast_checker.py # Analyse Python AST
├── report.py      # Compilation du rapport
├── rules/         # YAML rules extensibles
├── cli.py         # CLI argparse
└── test_security_scanner.py

Intégration

# Pre-commit hook
python -m skills.security_scanner.cli scan . --fail-on critical --format compact

# CI/CD
python -m skills.security_scanner.cli scan skills/ --format json --output security-report.json

# Nightly audit
python -m skills.security_scanner.cli audit . --format markdown

Pitfalls

  1. Faux positifs — eval dans un contexte contrôlé (ex: eval("1+1")) est signalé. L'AST checker permet de filtrer les évaluations statiques.
  2. Fichiers binaires — Skip automatique (.pyc, .so, .dll, images).
  3. Dossiers ignorés — .git, node_modules, pycache, .venv.
  4. Performance — Utilise concurrent.futures pour scanner en parallèle.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.