code-pathfinder
웹사이트 · 문서 · 규칙 레지스트리 · MCP 서버 · 블로그
빠른 시작
설치:
brew install shivasurya/tap/pathfinderPython 프로젝트 스캔 (규칙 자동 다운로드):
pathfinder scan --ruleset python/all --project .Dockerfile 스캔:
pathfinder scan --ruleset docker/all --project .설정 파일, API 키, 클라우드 계정이 필요 없습니다. 몇 초 만에 터미널에서 결과를 확인하세요.
Related MCP server: CodeAudit Agent
Code Pathfinder란?
Code Pathfinder는 코드베이스의 그래프를 구축하고 데이터가 어떻게 흐르는지 추적하는 오픈소스 정적 분석 엔진입니다. 소스 코드를 추상 구문 트리로 파싱하고, 파일 간 호출 그래프를 구성하며, 여러 파일과 함수 경계에 걸쳐 있는 소스-싱크 취약점을 찾기 위해 오염 분석을 실행합니다.
v2.0은 파일 간 데이터 흐름 분석을 도입했습니다. 한 파일의 HTTP 핸들러에서 사용자 입력을 추적하여 헬퍼 함수를 거쳐 다른 파일의 SQL 쿼리로 이어지는 흐름을 추적합니다. 이는 패턴 매칭 도구가 완전히 놓치는 종류의 분석입니다.
파일 간 오염 분석
대부분의 오픈소스 SAST 도구는 단일 파일에서 동작합니다. Code Pathfinder v2.0은 파일 경계를 넘어 오염된 데이터를 추적합니다:
app.py:5 user_input = request.get("query") ← Source: user-controlled input
↓ calls
db.py:12 cursor.execute(query) ← Sink: SQL execution엔진은 함수별로 변수 종속성 그래프(VDG)를 구축한 후, 프로시저 간 오염 전달 요약을 통해 연결합니다. user_input이 다른 파일의 함수 매개변수로 흘러들어가면, 오염이 호출 그래프를 통해 싱크까지 전파됩니다.
작동 방식
Source Code → Tree-sitter AST → Call Graph → Variable Dependency Graph → Taint Analysis → Findings
↓
Inter-procedural
Taint Summaries
(cross-file flows)파싱: Tree-sitter가 Python, Dockerfile, Docker Compose 파일에 대한 AST를 구축합니다.
인덱싱: 함수, 호출 지점, 매개변수, 할당을 추출하여 쿼리 가능한 호출 그래프를 만듭니다.
분석: 함수별로 VDG를 구축하고, 프로시저 간 흐름을 해결하며, 오염 분석을 실행합니다.
탐지: Python 기반 보안 규칙이 그래프를 쿼리하여 소스-싱크 경로를 찾습니다.
보고: 결과를 텍스트, JSON, SARIF(GitHub Code Scanning), CSV로 출력합니다.
190개의 보안 규칙, 즉시 사용 가능
규칙은 CDN에서 자동으로 다운로드됩니다. 저장소를 클론하거나 규칙 파일을 관리할 필요가 없습니다.
언어 | 번들 | 규칙 수 | 적용 범위 |
django, flask, aws_lambda, cryptography, jwt, lang, deserialization, pyramid | 158 | SQL 인젝션, RCE, SSRF, 경로 탐색, XSS, 역직렬화, 암호화 오용, JWT 취약점 | |
security, best-practice, performance | 37 | 루트 사용자, 노출된 비밀, 이미지 고정, 멀티스테이지 빌드, 레이어 최적화 | |
security, networking | 10 | 권한 모드, 소켓 노출, 권한 상승, 네트워크 격리 |
# Scan with a specific bundle
pathfinder scan --ruleset python/django --project .
# Scan with multiple bundles
pathfinder scan --ruleset python/flask --ruleset python/jwt --project .
# Scan a single rule
pathfinder scan --ruleset python/PYTHON-DJANGO-SEC-001 --project .
# Scan all rules for a language
pathfinder scan --ruleset python/all --project .모든 규칙을 예제와 테스트 케이스와 함께 규칙 레지스트리에서 확인하세요.
AI 코딩 어시스턴트를 위한 MCP 서버
Code Pathfinder는 MCP 서버로 실행되어 Claude Code, Cursor, Cline 등 AI 어시스턴트가 호출 그래프, 데이터 흐름, 보안 분석에 접근할 수 있게 합니다. LSP보다 더 많은 컨텍스트를 제공하며 보안과 코드 구조에 초점을 맞춥니다.
pathfinder serve --project .MCP 서버는 코드 그래프를 쿼리하기 위한 도구를 제공합니다: 호출자/피호출자 찾기, 데이터 흐름 추적, 패턴 검색, 보안 규칙 실행 — 모두 코드 리뷰 또는 개발 중에 AI 어시스턴트가 사용할 수 있습니다.
사용자 정의 규칙 작성
보안 규칙은 PathFinder SDK를 사용하는 Python 스크립트입니다. 소스, 싱크, 살균기를 정의하면 데이터 흐름 엔진이 분석을 처리합니다.
다음은 저장소에 있는 실제 규칙(PYTHON-DJANGO-SEC-001)으로 Django에서 SQL 인젝션을 탐지합니다:
from codepathfinder import calls, flows, QueryType
from codepathfinder.presets import PropagationPresets
class DBCursor(QueryType):
fqns = ["sqlite3.Cursor", "psycopg2.extensions.cursor"]
match_subclasses = True
@python_rule(
id="PYTHON-DJANGO-SEC-001",
name="Django SQL Injection via cursor.execute()",
severity="CRITICAL",
cwe="CWE-89",
)
def detect_django_cursor_sqli():
return flows(
from_sources=[
calls("request.GET.get"),
calls("request.POST.get"),
],
to_sinks=[
DBCursor.method("execute").tracks(0),
calls("cursor.execute"),
],
sanitized_by=[calls("escape"), calls("escape_string")],
propagates_through=PropagationPresets.standard(),
scope="global", # cross-file taint analysis
)# Run your custom rules
pathfinder scan --rules ./my_rules/ --project .rules/ 디렉토리에서 190개의 모든 규칙을 탐색하거나 규칙 레지스트리를 확인하세요. 규칙 작성 가이드와 데이터 흐름 문서를 참조하여 직접 규칙을 작성하세요.
자세한 내용은 규칙 작성 가이드와 데이터 흐름 문서를 참조하세요.
설치
Homebrew (권장)
brew install shivasurya/tap/pathfinderpip
CLI 바이너리와 규칙 작성을 위한 Python SDK를 설치합니다.
pip install codepathfinderDocker
docker pull shivasurya/code-pathfinder:stable-latest
docker run --rm -v "$(pwd):/src" \
shivasurya/code-pathfinder:stable-latest \
scan --ruleset python/all --project /src사전 빌드된 바이너리
GitHub Releases에서 Linux(amd64, arm64), macOS(Intel, Apple Silicon), Windows(x64)용 바이너리를 다운로드하세요.
소스에서 빌드
git clone https://github.com/shivasurya/code-pathfinder
cd code-pathfinder/sast-engine
gradle buildGo
./build/go/pathfinder --help사용법
# Scan with text output (default)
pathfinder scan --ruleset python/all --project .
# JSON output
pathfinder scan --ruleset python/all --project . --output json --output-file results.json
# SARIF output (GitHub Code Scanning)
pathfinder scan --ruleset python/all --project . --output sarif --output-file results.sarif
# CSV output
pathfinder scan --ruleset python/all --project . --output csv --output-file results.csv
# Fail CI on critical/high findings
pathfinder scan --ruleset python/all --project . --fail-on=critical,high
# MCP server mode
pathfinder serve --project .
# Verbose output with statistics
pathfinder scan --ruleset python/all --project . --verboseGitHub Action
name: Code Pathfinder Security SAST Scan
on:
pull_request:
permissions:
security-events: write
contents: read
pull-requests: write
jobs:
security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Run Security Scan
uses: shivasurya/code-pathfinder@v2.1.1
with:
ruleset: python/all, docker/all, docker-compose/all
verbose: true
pr-comment: ${{ github.event_name == 'pull_request' }}
pr-inline: ${{ github.event_name == 'pull_request' }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: pathfinder-results.sarif전체 예제: .github/workflows/code-pathfinder-scan.yml
입력 | 설명 | 기본값 |
| 로컬 Python 규칙 파일 또는 디렉토리 경로 | - |
| 원격 규칙셋, 쉼표로 구분 (예: | - |
| 소스 코드 경로 |
|
| 출력 형식: |
|
| 출력 파일 경로 |
|
| 실패할 심각도 (예: | - |
| 상세 출력 활성화 |
|
| 타임스탬프가 포함된 디버그 진단 활성화 |
|
| 테스트 파일 건너뛰기 |
|
| 캐시된 규칙셋 강제 새로고침 |
|
| 익명 사용 통계 비활성화 |
|
| 사용할 Python 버전 |
|
| 풀 리퀘스트에 요약 코멘트 게시 |
|
| 중요/높음 심각도 발견에 대해 인라인 리뷰 코멘트 게시 |
|
| GitHub 토큰 ( | - |
| diff 인식 스캔 비활성화 (모든 파일 스캔) |
|
rules 또는 ruleset 중 하나는 필수입니다.
지원 언어
언어 | 분석 | 상태 |
Python | 파일 간 데이터 흐름, 오염 분석, 호출 그래프 | 안정 |
Dockerfile | 명령어 분석, 보안 패턴 | 안정 |
Docker Compose | 구성 분석, 보안 패턴 | 안정 |
Go | AST 분석, 호출 그래프 | 곧 지원 예정 |
기여하기
기여를 환영합니다. 기여 가이드에서 설정 방법, 로컬에서 테스트를 실행하는 방법, PR 프로세스를 확인하세요.
제품 내 공지사항 푸시
제품 내 공지사항(워크숍, 블로그 게시물, 보안 권고)은
release/latest.json을 통해 관리됩니다. announcements[]에 항목을 추가하고,
PR을 연 후 main에 병합되면 게시 워크플로우가 약 60초 이내에 매니페스트를
CDN에 업로드합니다. 스키마와 version_range 의미는 버전 업데이트 확인 기술 사양을 참조하세요.
모든 기여자는 풀 리퀘스트가 병합되기 전에 기여자 라이선스 계약(CLA)에 서명해야 합니다.
라이선스
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
Alicense-qualityAmaintenanceMCP server that gives AI assistants impact analysis, cross-project reference tracking, and code health scoring.4Apache 2.0- Flicense-qualityCmaintenanceMCP server for AI-powered code security, quality, and performance review. Enables auditing code directly from VS Code via right-click or MCP tools.
- Flicense-qualityCmaintenanceMCP server for AI coding agents that builds a complete code structure graph and semantic vector index, enabling fast querying of code entities, relationships, and impact analysis.788
- Alicense-qualityAmaintenanceA production-ready MCP server that enables AI assistants to intelligently understand, analyze, edit, navigate, and review software projects with multi-workspace support, Git integration, and semantic search.MIT
Related MCP Connectors
Zero-config MCP security scanner for AI-generated apps. 25K+ vulnerability patterns.
Hosted MCP server for structured code review passes on human- and AI-written code. Free tier.
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/shivasurya/code-pathfinder'
If you have feedback or need assistance with the MCP directory API, please join our Discord server