Copies source (no node_modules, dist, .tasks, .wiki, __pycache__) for: - projects-meta-mcp v2.25.0 (TypeScript/Node) - wiki-graph v0.3.1 (TypeScript/Node) - interns-mcp v0.3.3 (Python/FastMCP) .gitignore: exclude lib build artefacts (node_modules, dist, .venv, __pycache__, *.pyc) bootstrap.ps1: add MCP build step — npm install+build for TS servers, venv+pip for Python Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
"""Tests for safety path matcher."""
|
|
|
|
from interns_mcp.safety import check_paths
|
|
|
|
|
|
def test_clean_paths_pass():
|
|
assert check_paths(["/home/user/project/src/main.py"]) == []
|
|
|
|
|
|
def test_env_file_blocked():
|
|
blocked = check_paths(["project/.env"])
|
|
assert len(blocked) == 1
|
|
assert blocked[0]["pattern"] == "**/.env"
|
|
|
|
|
|
def test_env_local_blocked():
|
|
blocked = check_paths(["project/.env.local"])
|
|
assert len(blocked) == 1
|
|
|
|
|
|
def test_secrets_dir_blocked():
|
|
blocked = check_paths(["project/secrets/api_key.txt"])
|
|
assert len(blocked) == 1
|
|
|
|
|
|
def test_pem_file_blocked():
|
|
blocked = check_paths(["/home/user/.ssh/id_rsa.pem"])
|
|
assert len(blocked) == 1
|
|
|
|
|
|
def test_ssh_dir_blocked():
|
|
blocked = check_paths(["/home/user/.ssh/config"])
|
|
assert len(blocked) == 1
|
|
|
|
|
|
def test_credentials_blocked():
|
|
blocked = check_paths(["project/credentials.json"])
|
|
assert len(blocked) == 1
|
|
|
|
|
|
def test_key_file_blocked():
|
|
blocked = check_paths(["project/server.key"])
|
|
assert len(blocked) == 1
|
|
|
|
|
|
def test_mixed_paths():
|
|
blocked = check_paths(["src/app.py", "project/.env", "README.md"])
|
|
assert len(blocked) == 1
|
|
assert blocked[0]["path"] == "project/.env"
|
|
|
|
|
|
def test_extra_patterns():
|
|
blocked = check_paths(["data/private.csv"], extra_patterns=["data/**"])
|
|
assert len(blocked) == 1 |