Skip to content

Latest commit

Β 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ScanPay β€” Code Security Scanner with x402 v2 Micropayments

πŸš€ Try ScanPay Live (Solana Mainnet)

Pay 0.0007 SOL (~$0.10) per scan. No account. No API key.

πŸ’° Pricing

  • Python / JavaScript / TypeScript scan: 0.0007 SOL
  • AgentBridge job escrow commission: 10%
  • No subscriptions, no free trial abuse.

npm version npm downloads GitHub License: MIT

Deterministic AST-based security scanning for Python and JavaScript/TypeScript. No code execution. No AI inference. Just fast, reliable vulnerability detection. Pay per scan with Solana micropayments β€” $0.10/scan.

🎯 What It Does

ScanPay analyzes source code for security vulnerabilities using deterministic AST parsing. No AI, no code execution β€” just fast, reliable pattern matching that catches 45+ vulnerability classes before code runs.

Built for AI agents that generate code: scan before execution, block dangerous patterns, log audit trails.

✨ Features

  • 45+ vulnerability patterns across Python and JS/TS/TSX
  • Deterministic analysis β€” same input always produces same output
  • x402 v2 payment protocol β€” pay per scan with SOL on Solana
  • Dual language support β€” Python (ast module) and JS/TS (tree-sitter)
  • No false AI hallucinations β€” pure rule-based detection
  • FastAPI-powered β€” sub-100ms scan latency
  • SARIF output β€” industry-standard vulnerability report format
  • Batch scanning β€” scan multiple files in one request

🌐 Live Demo

ScanPay is deployed and running:

  • Public API: https://theoretical-config-hobby-kruger.trycloudflare.com
  • Products: https://theoretical-config-hobby-kruger.trycloudflare.com/api/v1/products
  • Payment: x402 v2 on Solana mainnet (0.0007 SOL β‰ˆ $0.10 per scan)
  • Wallet: JDKXvegmW5j4sAJPB6YCA9ffJbN422WLMmCWCcpy1vm4

Try it

curl -X POST https://theoretical-config-hobby-kruger.trycloudflare.com/api/v1/scan \
  -H "Content-Type: application/json" \
  -d '{"language":"python","source_code":"import os; os.system(\"rm -rf /\")"}'

Returns 402 Payment Required with Solana payment details. Send payment and retry with X-PAYMENT header to get the scan result.

πŸš€ Quick Start

Using the Live API (mainnet)

# Health check
curl https://repository-nil-camcorder-divx.trycloudflare.com/api/v1/health

# List available products
curl https://repository-nil-camcorder-divx.trycloudflare.com/api/v1/products

# Scan code (requires payment)
curl -X POST https://repository-nil-camcorder-divx.trycloudflare.com/api/v1/scan \
  -H "Content-Type: application/json" \
  -d '{"source_code":"eval(userInput)","language":"python"}'
# β†’ 402 Payment Required (0.0007 SOL)

Self-Host

git clone https://github.com/Misterio070/scanpay.git
cd scanpay
pip install -r requirements.txt
python main.py
# β†’ http://localhost:8484

πŸ’³ Payment Flow (x402 v2)

  1. Client requests scan β†’ receives 402 Payment Required
  2. Client pays 0.0007 SOL (~$0.10) to merchant wallet via Solana
  3. Client retries with X-PAYMENT header containing payment proof
  4. Server verifies payment on-chain, runs scan, returns results

Merchant wallet: JDKXvegmW5j4sAJPB6YCA9ffJbN422WLMmCWCcpy1vm4

πŸ€– For AI Agents (MCP Server)

ScanPay includes an MCP server for AI agents to scan code before execution:

{
  "mcpServers": {
    "scanpay": {
      "command": "npx",
      "args": ["-y", "scanpay-cli", "scanpay-mcp"],
      "env": { "SCANPAY_URL": "https://repository-nil-camcorder-divx.trycloudflare.com" }
    }
  }
}

Agents call scan_code to check code for vulnerabilities before running it. Network: Solana mainnet (mainnet coming soon)

πŸ“‹ Configuration

cp .env.example .env
Env Var Default Description
SCANPAY_PAYMENT_MODE disabled disabled, mainnet, or mainnet
SCANPAY_MERCHANT_WALLET β€” Solana wallet address
SCANPAY_PRICE_LAMPORTS 700000 Price in lamports (0.0007 SOL)
SCANPAY_RPC_URL https://api.devnet.solana.com Solana RPC endpoint
SCANPAY_PORT 8484 Server port

πŸ§ͺ Detected Vulnerabilities

Python

  • eval() / exec() β€” code injection
  • subprocess with shell=True β€” command injection
  • pickle.loads() β€” deserialization attacks
  • os.system() β€” command injection
  • SQL injection patterns
  • Path traversal (../)
  • Hardcoded credentials
  • And more...

JavaScript/TypeScript

  • eval() β€” code injection
  • innerHTML β€” XSS
  • document.write() β€” XSS
  • new Function() β€” code injection
  • SQL injection patterns
  • Prototype pollution
  • And more...

πŸ“Š API Reference

GET /api/v1/health

Returns service status and configuration.

GET /api/v1/products

Returns available scan products and pricing.

POST /api/v1/scan

Scans source code for vulnerabilities. Requires payment in mainnet/mainnet mode.

Request:

{
  "source_code": "eval(userInput)",
  "language": "python"
}

Response (200):

{
  "status": "ok",
  "findings": [
    {
      "rule": "PY001",
      "severity": "critical",
      "message": "Use of eval() detected β€” code injection risk",
      "line": 1
    }
  ],
  "summary": {
    "total": 1,
    "critical": 1,
    "high": 0,
    "medium": 0,
    "low": 0
  }
}

🀝 Built For

  • AI Agents β€” scan generated code before execution
  • CI/CD Pipelines β€” pre-deployment security gate
  • IDE Extensions β€” real-time vulnerability detection
  • Code Review β€” automated security audit

πŸ“„ License

MIT

πŸ”— Links

About

Deterministic code security scanner with x402 v2 micropayments. Scans Python and JS/TS for 45 vulnerability patterns using AST analysis. No code execution, no AI inference.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages