ncreighton/9fba5e20-cybersecurity-data-validation-

GitHub: ncreighton/9fba5e20-cybersecurity-data-validation-

基于 FastAPI 构建的轻量级网络安全数据验证与增强 API 模板,为威胁情报流水线提供即插即用的数据校验和富化中间件服务。

Stars: 0 | Forks: 0

# 网络安全数据验证与增强 API ## 功能 - 完整的 REST API ## 快速开始 ``` # 1. 安装依赖 pip install -r requirements.txt # 2. 配置环境 cp .env.example .env # 使用你的设置编辑 .env # 3. 本地运行 uvicorn main:app --reload --port 8000 # 4. 查看交互式文档 open http://localhost:8000/docs ``` ## Docker 部署 ``` # 构建并运行 docker compose up -d # 检查健康状况 curl http://localhost:8000/health ``` ## 身份验证 首先获取 token: ``` curl -X POST "http://localhost:8000/auth/token?username=admin&password=admin123" ``` 在后续请求中使用该 token: ``` curl -H "Authorization: Bearer YOUR_TOKEN" http://localhost:8000/items ``` ## API 接口 | Method | Path | Description | |--------|------|-------------| | GET | `/health` | 系统健康状态 | | POST | `/auth/token` | 获取 JWT token | | GET | `/items` | 列出所有项目 | | POST | `/items` | 创建项目 | | GET | `/items/{id}` | 获取项目 | | PATCH | `/items/{id}` | 更新项目 | | DELETE | `/items/{id}` | 删除项目 | | GET | `/stats` | API 统计信息 | 完整的交互式文档:`http://localhost:8000/docs` ## 速率限制 | Endpoint | Limit | |----------|-------| | `/auth/token` | 10次/分钟 | | `GET /items` | 60次/分钟 | | `POST /items` | 30次/分钟 | | `DELETE /items` | 20次/分钟 | ## 运行测试 ``` pip install pytest httpx pytest tests/ -v ``` ## 生产环境注意事项 - 部署前更改 `.env` 中的 `SECRET_KEY` - 将内存数据库 `_db` 替换为真正的数据库 - 在 `auth.py` 中添加适当的用户管理 - 配置用于 CORS 的 `ALLOWED_ORIGINS` - 使用 Nginx/Traefik 作为反向代理 ## 许可证 MIT ### 升级到 Pro 版 获取包含所有高级功能、优先支持和终身更新的完整版本。 **[获取 Pro 版本](https://buy.stripe.com/fZu14ndPp1g06xydI0cZa13)** - [立即购买 (Stripe)](https://buy.stripe.com/fZu14ndPp1g06xydI0cZa13) - [在 Gumroad 上购买](https://devforgetools.gumroad.com/l/xdpzdj) - [在 Whop 上购买](https://whop.com/cybersecurity-data-validation-and-enrichment-api)
标签:API安全, API开发, AV绕过, CORS, DNS枚举, Docker, Docker Compose, FastAPI, JSON输出, JWT认证, Nginx, Python, REST API, Traefik, Uvicorn, 中间件, 反向代理, 威胁情报, 安全规则引擎, 安全防御评估, 开发者工具, 情报分析管道, 数据富化, 数据管道, 数据验证, 无后门, 网络安全, 网络安全工具, 网络安全数据接口, 网络测绘, 请求拦截, 软件工程, 运行时操纵, 逆向工具, 隐私保护