GitHub Installer Agent 🛡️
Security-first GitHub project cloning with comprehensive safety checks, dependency analysis, and secure installation guidance.
🔒 Security Features
- - ✅ Input Validation: Strict GitHub URL format and origin validation
- ✅ Repository Safety Checks: Size, stars, last update verification via GitHub API
- ✅ Shallow Cloning: Uses
git clone --depth 1 to minimize download size - ✅ Manual Installation: Provides commands but never auto-executes
pip install or INLINECODE2 - ✅ Virtual Environment Guidance: Recommends isolated testing environments
- ✅ File Safety Scanning: Checks for suspicious file types
- ✅ Transparent Reporting: Detailed operation logs and security assessments
- ✅ Permission Declaration: Clearly states required binaries and permissions
✅ When to Use This Skill
- - Need to securely download projects from GitHub
- Analyze project structure and dependencies
- Get safe installation recommendations
- Evaluate new projects in a controlled manner
- Clone repositories with safety checks
❌ When NOT to Use This Skill
- - Need automatic dependency installation (use manual commands)
- Working with unverified private repositories
- Downloading from non-GitHub platforms
- Need to execute unknown code automatically
Core Parameters
- -
repo_url: (String) Full GitHub repository URL (must be from github.com) - INLINECODE4 : (String) Local directory name (recommend using temp directory)
- INLINECODE5 : (Boolean) Enable safety checks (default: true)
- INLINECODE6 : (Number) Git clone depth (default: 1)
🔍 Safety Check Workflow
1. URL Validation
CODEBLOCK0
2. Repository Safety Check
CODEBLOCK1
3. Safe Cloning
CODEBLOCK2
4. File Safety Scan
CODEBLOCK3
📋 Safe Operation Commands
1. Basic Cloning with Checks
CODEBLOCK4
2. Dependency Analysis (No Installation)
CODEBLOCK5
3. Project Structure Analysis
CODEBLOCK6
🚨 Security Warnings and Best Practices
High-Risk Operation Warnings
CODEBLOCK7
Recommended Security Practices
CODEBLOCK8
📊 Response Template
Security Analysis Report Format
CODEBLOCK9
🧪 Example Usage
Safe Clone Example
CODEBLOCK10
📝 Security Best Practices
1. Input Validation
- - Always validate GitHub URL format
- Check if repository is from trusted organizations
- Verify repository size (avoid excessively large projects)
2. Operation Restrictions
- - Use
--depth 1 for shallow cloning - Restrict filesystem access scope
- Never auto-execute installation commands
- Limit maximum clone size
3. Environment Isolation
- - Recommend virtual environments
- Suggest using temporary directories
- Consider container isolation (Docker)
- Use separate user accounts
4. Transparent Operations
- - Report all executed operations
- List all accessed files
- Provide security risk assessments
- Log all API calls
🔧 Configuration Options
Environment Variables (Optional)
CODEBLOCK11
Skill Configuration
CODEBLOCK12
🛡️ Security Compliance
OWASP Compliance
- - ✅ Input Validation
- ✅ Output Encoding
- ✅ Authentication
- ✅ Session Management
- ✅ Access Control
- ✅ Cryptographic Practices
- ✅ Error Handling
- ✅ Logging
- ✅ Security Configuration
GitHub Security Best Practices
- - ✅ Use GitHub API for repository verification
- ✅ Implement rate limiting
- ✅ Validate repository ownership
- ✅ Check repository activity
- ✅ Verify commit signatures (when available)
📚 References
🔍 Security Testing
This skill includes built-in security testing:
CODEBLOCK13
🚀 Quick Start
- 1. Basic safe clone:
CODEBLOCK14
- 2. Clone with custom depth:
CODEBLOCK15
- 3. Clone to temp directory:
github_installer_agent(repo_url="https://github.com/psf/requests", target_dir="/tmp/requests_$(date +%s)")
Security First, Trust But Verify. 🛡️
Last Updated: 2026-03-22
Version: 2.0.1
Security Level: Low Risk
GitHub 安装代理 🛡️
安全优先的 GitHub 项目克隆工具,具备全面的安全检查、依赖分析和安全安装指导。
🔒 安全特性
- - ✅ 输入验证:严格的 GitHub URL 格式和来源验证
- ✅ 仓库安全检查:通过 GitHub API 验证仓库大小、星标数、最后更新时间
- ✅ 浅克隆:使用 git clone --depth 1 最小化下载体积
- ✅ 手动安装:提供命令但从不自动执行 pip install 或 npm install
- ✅ 虚拟环境指导:推荐隔离测试环境
- ✅ 文件安全扫描:检查可疑文件类型
- ✅ 透明报告:详细的操作日志和安全评估
- ✅ 权限声明:明确声明所需的二进制文件和权限
✅ 何时使用此技能
- - 需要安全地从 GitHub 下载项目
- 分析项目结构和依赖关系
- 获取安全的安装建议
- 以受控方式评估新项目
- 克隆仓库时进行安全检查
❌ 何时不应使用此技能
- - 需要自动安装依赖(请使用手动命令)
- 处理未经验证的私有仓库
- 从非 GitHub 平台下载
- 需要自动执行未知代码
核心参数
- - repourl:(字符串)完整的 GitHub 仓库 URL(必须来自 github.com)
- targetdir:(字符串)本地目录名称(建议使用临时目录)
- safe_mode:(布尔值)启用安全检查(默认:true)
- depth:(数字)Git 克隆深度(默认:1)
🔍 安全检查工作流程
1. URL 验证
bash
验证 URL 格式
if [[ ! $repo
url =~ ^https://github\.com/[a-zA-Z0-9.-]+/[a-zA-Z0-9_.-]+(/.*)?$ ]]; then
echo ❌ 错误:URL 必须来自 github.com
exit 1
fi
2. 仓库安全检查
bash
通过 GitHub API 获取仓库信息(无需克隆)
repo
apiurl=https://api.github.com/repos/$(echo $repo_url | sed s|https://github.com/|| | sed s|\.git$||)
curl -s -H Accept: application/vnd.github.v3+json $repo
apiurl | jq .size, .stargazers
count, .updatedat
3. 安全克隆
bash
使用 --depth 1 进行最小克隆
git clone --depth 1 $repo
url $targetdir
4. 文件安全扫描
bash
检查可疑文件
find $target_dir -type f \( -name
.sh -o -name .bat -o -name
.ps1 -o -name .exe \) | head -10
安全查看 requirements.txt 内容
if [ -f $target_dir/requirements.txt ]; then
echo 📦 依赖预览:
head -20 $target_dir/requirements.txt
fi
📋 安全操作命令
1. 带检查的基本克隆
bash
安全浅克隆
git clone --depth 1 {repo
url} {targetdir}
检查关键文件(只读)
ls -la {target_dir}/
find {target_dir} -maxdepth 2 -type f \( -name
.txt -o -name .py -o -name *.json \) | head -10
2. 依赖分析(不安装)
bash
安全分析依赖文件
if [ -f {target_dir}/requirements.txt ]; then
echo 📋 发现 Python 依赖:
cat {target_dir}/requirements.txt
echo
echo 💡 安全安装建议:
echo cd {target_dir} && python -m venv venv && source venv/bin/activate && pip install --user -r requirements.txt
fi
if [ -f {target_dir}/package.json ]; then
echo 📋 发现 Node.js 依赖:
cat {target_dir}/package.json | jq .dependencies
echo
echo 💡 安全安装建议:
echo cd {target_dir} && npm ci --ignore-scripts
fi
3. 项目结构分析
bash
安全分析结构
echo 📁 项目结构:
tree {target
dir} -L 2 2>/dev/null || find {targetdir} -maxdepth 2 -type d | sed s|[^/]*/| |g
安全查看 README
if [ -f {target_dir}/README.md ]; then
echo 📖 README 预览:
head -30 {target_dir}/README.md
fi
🚨 安全警告和最佳实践
高风险操作警告
⚠️ 安全警告:
- 1. 切勿自动执行来自未知来源的 pip install/npm install
- 始终在虚拟环境或容器中测试
- 检查 requirements.txt/package.json 中的包来源
- 避免使用 root 权限进行安装
- 执行前审查所有脚本文件
推荐的安全实践
bash
1. 使用虚拟环境
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows
2. 为 pip 使用 --user 标志
pip install --user -r requirements.txt
3. 使用哈希验证的 pip
pip install --require-hashes -r requirements.txt
4. 使用可信的包镜像
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
5. 审计 npm 包
npm audit
npm ci --ignore-scripts
📊 响应模板
安全分析报告格式
🔒 GITHUB 项目安全分析报告
═══════════════════════════════════════
项目:{repo_url}
目标目录:{target_dir}
克隆状态:✅ 成功 / ⚠️ 警告 / ❌ 失败
───────────────────────────────────────
📁 项目结构:
{项目结构摘要}
📦 依赖分析:
{发现的依赖文件}
🔍 安全检查:
- - URL 验证:✅ 通过
- 仓库大小:{size} KB
- 可疑文件:{无/列表}
- 最后更新:{date}
- 星标数:{count}
───────────────────────────────────────
💡 安全安装建议:
{分步安装命令}
🚨 安全警告:
{具体安全警告}
═══════════════════════════════════════
🧪 使用示例
安全克隆示例
用户:帮我安全分析这个项目:https://github.com/psf/requests
AI 内部逻辑:
- - 思考:用户请求安全分析 GitHub 项目。使用 githubinstalleragent 技能。
- 动作:githubinstalleragent(repourl=https://github.com/psf/requests, targetdir=/tmp/requestsanalysis, safemode=true, depth=1)
- 观察:报告克隆成功,分析依赖,提供安全安装建议。
📝 安全最佳实践
1. 输入验证
- - 始终验证 GitHub URL 格式
- 检查仓库是否来自可信组织
- 验证仓库大小(避免过大的项目)
2. 操作限制
- - 使用 --depth 1 进行浅克隆
- 限制文件系统访问范围
- 绝不自动执行安装命令
- 限制最大克隆大小
3. 环境隔离
- - 推荐虚拟环境
- 建议使用临时目录
- 考虑容器隔离(Docker)
- 使用单独的用户账户
4. 透明操作
- - 报告所有执行的操作
- 列出所有访问的文件
- 提供安全风险评估
- 记录所有 API 调用
🔧 配置选项
环境变量(可选)
bash
设置临时目录
export GITHUB
CLONETEMP=/tmp/github_clones
设置最大仓库大小(MB)
export MAX
REPOSIZE_MB=100
启用详细日志
export GITHUB
CLONEVERBOSE=1
设置 API 速率限制(每小时请求数)
export GITHUB
APIRATE_LIMIT=60
技能配置
json
{
github
installeragent: {
default
safemode: true,
default_depth: 1,
max
reposize_mb: 100,
allow
privaterepos: false,
require
apicheck: true
}
}
🛡️ 安全合规
OWASP 合规