Python Security Scan by sugarforever/01coder-agent-skills
npx skills add https://github.com/sugarforever/01coder-agent-skills --skill 'Python Security Scan'此技能基于 OWASP 指南、Python 安全最佳实践和特定框架漏洞,实现对 Python 项目的全面安全扫描。
此技能会自动检测并应用针对以下框架的特定检查:
专注于关键漏洞的快速扫描:
eval、exec、pickle.loads)subprocess、 进行的命令注入广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
os.system全面的安全评估,涵盖:
专注于特定的漏洞类别:
--injection - SQL/NoSQL/命令/LDAP 注入--deserialization - Pickle、YAML、JSON 反序列化--auth - 身份验证/授权问题--secrets - 硬编码凭据--deps - 依赖项漏洞--crypto - 加密问题--flask - Flask 特定漏洞--django - Django 特定漏洞--fastapi - FastAPI 特定漏洞requirements.txt、Pipfile、pyproject.toml、setup.pyfrom flask import)、Django(django.conf)、FastAPI(from fastapi import)# 检测模式
Flask: "from flask import", "Flask(__name__)"
Django: "django.conf.settings", "INSTALLED_APPS", "manage.py"
FastAPI: "from fastapi import", "FastAPI()"
运行依赖项审计脚本:
./scripts/dependency-audit.sh /path/to/project
或手动运行:
pip-audit
# 或
safety check
扫描硬编码的密钥:
python scripts/secret-scanner.py /path/to/project
重要:环境文件处理
.env 文件会被跳过(.env、.env.local、.env.production 等).env.example 和 .env.template 文件以检查文档质量--include-env-files 标志扫描器将:
.env.example 模板以检查:
针对代码库中的每个文件,对照以下模式进行检查:
references/python-vulnerabilities.md - 核心 Python 问题references/injection-patterns.md - 注入缺陷references/deserialization.md - 不安全的反序列化references/flask-security.md - Flask 漏洞references/django-security.md - Django 漏洞references/fastapi-security.md - FastAPI 漏洞使用以下工具生成安全报告:
assets/report-template.md - 报告结构| 严重性 | 描述 | 所需操作 |
|---|---|---|
| 严重 | 具有严重影响的易利用漏洞 | 需要立即修复 |
| 高 | 重大的安全风险 | 部署前修复 |
| 中 | 潜在的安全问题 | 在下一个版本中修复 |
| 低 | 轻微的安全隐患 | 考虑修复 |
| 信息 | 安全最佳实践建议 | 可选改进 |
**/*.py - 所有 Python 源文件requirements.txt、Pipfile、pyproject.toml - 依赖项setup.py、setup.cfg - 包配置config.py、settings.py - 配置文件**/secrets*、**/credentials* - 明显的密钥位置.env.example、.env.template - 扫描以进行模板分析.env、.env.local、.env.production - 默认跳过(包含真实密钥)注意: 真实的 .env 文件永远不应提交到版本控制。扫描器分析 .env.example 模板以确保所需变量的文档记录正确。
app.py、main.py、wsgi.py - 入口点**/views.py、**/routes.py - 请求处理器**/api/**/*.py - API 端点**/auth*、**/login* - 身份验证代码**/models.py - 数据库模型**/serializers.py - 数据序列化**/middleware.py - 中间件代码Flask:
app.py、__init__.py - 应用工厂**/blueprints/** - 蓝图路由templates/** - Jinja2 模板Django:
settings.py、**/settings/*.py - Django 设置urls.py - URL 配置**/views.py - 视图函数/类**/forms.py - 表单定义templates/** - Django 模板FastAPI:
main.py - 应用入口**/routers/** - API 路由器**/dependencies.py - 依赖注入**/schemas.py - Pydantic 模型发现的问题应报告为:
[严重性] 类别: 描述
文件: path/to/file.py:行号
代码: <相关代码片段>
风险: <安全风险说明>
修复: <推荐的补救措施>
此技能可以生成与以下工具兼容的输出:
根据需要加载其他上下文:
references/owasp-top-10.md - OWASP Top 10:2025 快速参考references/python-vulnerabilities.md - Python 特定漏洞references/injection-patterns.md - 注入漏洞模式references/deserialization.md - 不安全反序列化模式references/flask-security.md - Flask 安全指南references/django-security.md - Django 安全指南references/fastapi-security.md - FastAPI 安全指南每周安装次数
–
代码仓库
GitHub 星标数
78
首次出现时间
–
安全审计
This skill enables comprehensive security scanning of Python projects based on OWASP guidelines, Python security best practices, and framework-specific vulnerabilities.
This skill automatically detects and applies framework-specific checks for:
Fast scan focusing on critical vulnerabilities:
eval, exec, pickle.loads)subprocess, os.systemComprehensive security assessment covering:
Focus on specific vulnerability categories:
--injection - SQL/NoSQL/Command/LDAP injection--deserialization - Pickle, YAML, JSON deserialization--auth - Authentication/authorization issues--secrets - Hardcoded credentials--deps - Dependency vulnerabilities--crypto - Cryptographic issues--flask - Flask-specific vulnerabilities--django - Django-specific vulnerabilities--fastapi - FastAPI-specific vulnerabilitiesrequirements.txt, Pipfile, pyproject.toml, setup.pyfrom flask import), Django (django.conf), FastAPI (from fastapi import)# Detection patterns
Flask: "from flask import", "Flask(__name__)"
Django: "django.conf.settings", "INSTALLED_APPS", "manage.py"
FastAPI: "from fastapi import", "FastAPI()"
Run the dependency audit script:
./scripts/dependency-audit.sh /path/to/project
Or manually:
pip-audit
# or
safety check
Scan for hardcoded secrets:
python scripts/secret-scanner.py /path/to/project
Important: Environment File Handling
.env files are SKIPPED (.env, .env.local, .env.production, etc.).env.example and .env.template files are analyzed for documentation quality--include-env-files flag only if explicitly requested by userThe scanner will:
.env.example templates to check:
For each file in the codebase, check against patterns in:
references/python-vulnerabilities.md - Core Python issuesreferences/injection-patterns.md - Injection flawsreferences/deserialization.md - Insecure deserializationreferences/flask-security.md - Flask vulnerabilitiesreferences/django-security.md - Django vulnerabilitiesreferences/fastapi-security.md - FastAPI vulnerabilitiesGenerate a security report using:
assets/report-template.md - Report structure| Severity | Description | Action Required |
|---|---|---|
| CRITICAL | Exploitable vulnerability with severe impact | Immediate fix required |
| HIGH | Significant security risk | Fix before deployment |
| MEDIUM | Potential security issue | Fix in next release |
| LOW | Minor security concern | Consider fixing |
| INFO | Security best practice suggestion | Optional improvement |
**/*.py - All Python source filesrequirements.txt, Pipfile, pyproject.toml - Dependenciessetup.py, setup.cfg - Package configurationconfig.py, settings.py - Configuration files**/secrets*, **/credentials* - Obvious secret locations.env.example, .env.template - SCAN for template analysis.env, .env.local, .env.production - SKIP by default (contain real secrets)Note: Real .env files should never be committed to version control. The scanner analyzes .env.example templates to ensure proper documentation of required variables.
app.py, main.py, wsgi.py - Entry points**/views.py, **/routes.py - Request handlers**/api/**/*.py - API endpoints**/auth*, **/login* - Authentication code**/models.py - Database models**/serializers.py - Data serialization**/middleware.py - Middleware codeFlask:
app.py, __init__.py - Application factory**/blueprints/** - Blueprint routestemplates/** - Jinja2 templatesDjango:
settings.py, **/settings/*.py - Django settingsurls.py - URL configuration**/views.py - View functions/classes**/forms.py - Form definitionstemplates/** - Django templatesFastAPI:
main.py - Application entry**/routers/** - API routers**/dependencies.py - Dependency injection**/schemas.py - Pydantic modelsFindings should be reported as:
[SEVERITY] Category: Description
File: path/to/file.py:lineNumber
Code: <relevant code snippet>
Risk: <explanation of the security risk>
Fix: <recommended remediation>
This skill can generate output compatible with:
Load additional context as needed:
references/owasp-top-10.md - OWASP Top 10:2025 quick referencereferences/python-vulnerabilities.md - Python-specific vulnerabilitiesreferences/injection-patterns.md - Injection vulnerability patternsreferences/deserialization.md - Insecure deserialization patternsreferences/flask-security.md - Flask security guidereferences/django-security.md - Django security guidereferences/fastapi-security.md - FastAPI security guideWeekly Installs
–
Repository
GitHub Stars
78
First Seen
–
Security Audits
GitHub Actions 官方文档查询助手 - 精准解答 CI/CD 工作流问题
27,800 周安装