hel-isa/appsec-lens-aws
GitHub: hel-isa/appsec-lens-aws
面向 AWS 环境的 AppSec 情报聚合平台,将多种安全扫描工具的发现统一标准化并支持自然语言查询。
Stars: 0 | Forks: 0
# appsec-lens-aws(专注 AWS 的 MVP)
内部 AppSec 情报 MVP,可汇总来自多种工具的扫描发现,存储原始和标准化记录,并支持自然语言安全查询。
## 技术栈
- **API**: FastAPI
- **语言**: Python
- **原始存储**: MongoDB
- **标准化存储**: PostgreSQL
- **本地运行环境**: Podman + podman-compose
- **云端目标**: AWS ECS Fargate + RDS PostgreSQL + EventBridge Scheduler + Secrets Manager + CloudWatch
## 项目布局
```
api/ # FastAPI app entrypoint and schemas
app/ # app config/templates
connectors/ # connector-based ingestion (sonatype_iq, polaris, ghas, cnapp)
db/ # MongoDB/PostgreSQL clients
models/ # SQLAlchemy normalized finding model
services/ # normalization, query parsing, ask + ingest services
workers/ # scheduler-oriented ingestion entrypoint
infra/aws/ # AWS deployment notes
docs/ # architecture and normalization strategy
tests/ # sample pytest tests
scripts/ # local run helpers
Containerfile
podman-compose.yml
requirements.txt
```
## 规范化标准化发现模型
- id
- source_tool
- source_record_id
- cve
- cwe
- severity
- status
- application
- repository
- asset
- environment
- team_owner
- business_unit
- first_seen
- last_seen
- internet_exposed
- evidence_url
- ticket_id
- raw_document_id
## 使用 Podman 进行本地开发
1. 安装 Podman + podman-compose。
2. 构建并运行:
podman-compose up --build
3. 在 `http://localhost:8000/docs` 打开 API 文档。
4. UI 占位符位于 `http://localhost:8000/`。
## API endpoint
- `GET /health`
- `POST /ingest/{tool}`,其中 tool 是 `sonatype_iq`、`polaris`、`ghas`、`cnapp` 之一
- `POST /ask`
- `GET /findings`
- `GET /findings/{id}`
## `/ask` 行为
1. 解析问题意图(CVE/CWE/severity/status 线索)。
2. 查询 PostgreSQL 标准化发现记录。
3. 仅根据匹配的记录返回**有依据的**总结。
4. 不执行自动修复/工单处理/代理操作。
ask payload 示例:
```
{"question": "Do we currently have CVE-2025-12345?"}
```
## Connector 工作流
每个 connector:
1. 向源 API 进行身份验证(已搭建基础骨架;通过环境变量/secrets 提供令牌)。
2. 获取原始发现结果。
3. 将确切的 payload 和摄入元数据存储在 MongoDB 中。
4. 标准化为规范化记录。
5. Upsert 到 PostgreSQL 中。
## 调度指南
为每个工具使用一个调度计划:
- Sonatype IQ:每小时
- Polaris:每小时(或与扫描同步)
- GHAS:每 30–60 分钟
- CNAPP/CSPM:每 2–4 小时
## 安全态势(准生产环境 MVP)
- secrets 仅存在于环境变量或云 secret 存储中。
- 保留摄入元数据以供审计。
- 通过 Pydantic 和 FastAPI 进行输入验证。
- 分层设计,为未来的 SSO/RBAC 中间件做准备。
- 建议在部署环境中使用 TLS 和加密的数据库连接。
## 备注
- Sonatype IQ 集成骨架引用了公开的 OpenAPI spec:
`https://sonatype.github.io/sonatype-documentation/api/iq/latest/iq-api.json`
- 为了进行 MVP 引导,当前的 connector 包含确定性的样本获取行为。
标签:AV绕过, AWS, DPI, FastAPI, GPT, MongoDB, PostgreSQL, Python, 安全情报平台, 无后门, 测试用例, 漏洞管理, 逆向工具