cognis-digital/obscan

GitHub: cognis-digital/obscan

一款用于校验开放银行 / FAPI / PSD2 API 文档是否符合 OAuth 流程与安全规范的自托管合规检查工具。

Stars: 0 | Forks: 0

OBSCAN # OBSCAN ### 用于开放银行 / FAPI API 的一致性与安全 linter:根据规范验证 OAuth 流程、同意 scope 和 PSD2 endpoint。 [![PyPI](https://img.shields.io/pypi/v/cognis-obscan.svg?color=6b46c1)](https://pypi.org/project/cognis-obscan/) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/876901974b082911.svg)](https://github.com/cognis-digital/obscan/actions) [![License: COCL 1.0](https://img.shields.io/badge/License-COCL%201.0-2b6cb0.svg)](LICENSE) [![Suite](https://img.shields.io/badge/Cognis-Neural%20Suite-6b46c1.svg)](https://github.com/cognis-digital) *金融科技与支付安全 — PCI、欺诈、AML 以及支付网络。*
``` pip install cognis-obscan obscan scan . # → prioritized findings in seconds ``` ## 使用说明 — 分步指南 `obscan` 是一个用于 OpenAPI 文档的开放银行 / FAPI / PSD2 一致性 linter。 控制台脚本:`obscan`。 1. 从克隆的仓库中**安装**: pip install -e . 2. **Lint 一个 OpenAPI JSON 文档**: obscan lint openapi.json 3. **选择导致运行失败的条件** — 默认情况下只有 `error` 级别的发现会导致失败;可以将其收紧: obscan lint openapi.json --fail-on warning 4. **查看输出** — 使用 `--format json` 用于 CI pipeline: obscan lint openapi.json --format json | jq '.' 退出码:`0` 表示在阈值处或之上状态干净,`1` 表示在阈值处或之上存在发现,`2` 表示输入错误。 5. **在 CI 中实现自动化** — 对每次规范变更强制执行 FAPI 一致性: - run: pip install -e . - run: obscan lint api/openapi.json --fail-on error ## 目录 - [为什么选择 obscan?](#why) · [功能](#features) · [快速开始](#quick-start) · [示例](#example) · [架构](#architecture) · [AI 技术栈](#ai-stack) · [对比](#how-it-compares) · [集成](#integrations) · [在任何地方安装](#install-anywhere) · [相关项目](#related) · [贡献指南](#contributing) ## 为什么选择 obscan? FAPI/PSD2 一致性测试被限制在重量级的商业套件中;一个快速、可自托管的 CLI,能够在授权同意流程不合规时使 CI 失败,这对金融科技平台团队来说极具吸引力。 `obscan` 专注于单一用途、支持脚本化且可自托管:将其指向目标,以您的工作流已有的格式(表格 · JSON · SARIF)获取优先级排序的结果,并据此拦截 CI,同时允许 agent 通过 MCP 驱动它。
↑ 返回顶部
## 功能 - ✅ 加载文档 - ✅ 规则:存在 OAuth - ✅ 规则:无隐式授权 - ✅ 规则:使用授权码 - ✅ 规则:HTTPS Token - ✅ 规则:同意 Scope - ✅ 规则:操作受保护 - ✅ 规则:PSD2 覆盖范围 - ✅ 可在 Linux/macOS/Windows · Docker · devcontainer 上运行 - ✅ 支持 Python、JavaScript、Go 和 Rust 版本 (`ports/`)
↑ 返回顶部
## 快速开始 ``` pip install cognis-obscan obscan --version obscan scan . # scan current project obscan scan . --format json # machine-readable obscan scan . --fail-on high # CI gate (non-zero exit) ```
↑ 返回顶部
## 示例 ``` $ obscan scan . [HIGH ] OBS-001 example finding (./src/app.py) [MEDIUM ] OBS-002 another signal (./config.yaml) 2 findings · risk score 5 · 38ms ```
↑ 返回顶部
## 架构 ``` flowchart LR IN[target / manifest] --> P[obscan
checks + rules] P --> OUT[findings (JSON / SARIF)] ```
↑ 返回顶部
## 从任何 AI 技术栈中使用 `obscan` 可与每种流行的 AI 使用方式互操作: - **MCP server** — `obscan mcp` (Claude Desktop, Cursor, Cognis.Studio, [uncensored-fleet](https://github.com/cognis-digital/uncensored-fleet)) - **兼容 OpenAI / JSON** — 将 `obscan scan . --format json` 通过管道传递给任何 agent 或 LLM - **LangChain · CrewAI · AutoGen · LlamaIndex** — 一行代码将 CLI/JSON 封装为工具 - **CI / 脚本** — 退出码 + SARIF 用于非 AI pipeline
↑ 返回顶部
## 对比 | | **Cognis obscan** | OpenAPI Spectral | |---|:---:|:---:| | 可自托管,无需账号 | ✅ | 视情况而定 | | 单一命令,零配置 | ✅ | ⚠️ | | 用于 CI 的 JSON + SARIF | ✅ | 视情况而定 | | 原生 MCP (AI agent) | ✅ | ❌ | | 多语言移植 (JS/Go/Rust) | ✅ | ❌ | | 开放许可 | ✅ COCL | 视情况而定 | *秉承 **OpenAPI Spectral / FAPI 一致性套件** 的精神,以 Cognis 的方式重新构建。遗漏了致谢?欢迎提交 PR。*
↑ 返回顶部
## 集成 可整合到您的技术栈中:用于代码扫描的 **SARIF**,用于一切的 **JSON**,用于 AI agent 的 **MCP server** (`obscan mcp`),以及用于 SIEM/Slack/Jira 的 webhook 转发器。详见 [`docs/INTEGRATIONS.md`](docs/INTEGRATIONS.md)。
↑ 返回顶部
## 安装 — 各种方式、各个平台 ``` pip install "git+https://github.com/cognis-digital/obscan.git" # pip (works today) pipx install "git+https://github.com/cognis-digital/obscan.git" # isolated CLI uv tool install "git+https://github.com/cognis-digital/obscan.git" # uv pip install cognis-obscan # PyPI (when published) docker run --rm ghcr.io/cognis-digital/obscan:latest --help # Docker brew install cognis-digital/tap/obscan # Homebrew tap curl -fsSL https://raw.githubusercontent.com/cognis-digital/obscan/main/install.sh | sh ``` | Linux | macOS | Windows | Docker | Cloud | |---|---|---|---|---| | `scripts/setup-linux.sh` | `scripts/setup-macos.sh` | `scripts/setup-windows.ps1` | `docker run ghcr.io/cognis-digital/obscan` | [DEPLOY.md](docs/DEPLOY.md) (AWS/Azure/GCP/k8s) |
↑ 返回顶部
## 相关的 Cognis 工具 - [`panhound`](https://github.com/cognis-digital/panhound) — 在代码、日志、测试固件和 S3 存储桶投入生产环境之前,扫描其中泄露的 PAN(经 Luhn 校验的卡号)和 CVV。 - [`fraudlens`](https://github.com/cognis-digital/fraudlens) — 针对可插拔的欺诈规则和 ML 评分器重放交易流,并从终端输出精确率/召回率和警报量。 - [`ledgerproof`](https://github.com/cognis-digital/ledgerproof) — 通过检查余额不变量和哈希链式日记账分录,验证复式记账法账本的完整性和防篡改性。 - [`iso20022`](https://github.com/cognis-digital/iso20022) — 验证、lint 并比对 ISO 20022 / pacs / camt 支付消息,并通过感知 schema 的错误将遗留的 MT 转换为 MX。 - [`tokenvault`](https://github.com/cognis-digital/tokenvault) — 可自托管的 PCI token 化微服务和 CLI,将 PAN 替换为保持格式的 token,并证明不存在原始卡数据的留存。 - [`sanctscan`](https://github.com/cognis-digital/sanctscan) — 使用模糊名称匹配和可解释的命中评分,根据 OFAC/EU/UN 制裁名单筛查交易对手和交易。 **探索全套工具 →** [🗂️ 全部 170+ 工具](https://github.com/cognis-digital/cognis-neural-suite) · [⭐ awesome-cognis](https://github.com/cognis-digital/awesome-cognis) · [🔗 cognis-sources](https://github.com/cognis-digital/cognis-sources) · [🤖 uncensored-fleet](https://github.com/cognis-digital/uncensored-fleet) · [🧠 engram](https://github.com/cognis-digital/engram)
↑ 返回顶部
## 互操作性 `{}` 与 300+ 工具的 Cognis 套件组合使用 — JSON 输入/输出以及共享的、兼容 OpenAI 的 `/v1` 主干网络。请参阅 **[INTEROP.md](INTEROP.md)** 以获取套件图谱、组合模式和参考架构栈。 ## 许可证 在 **Cognis 开放协作许可证 (COCL) v1.0** 下提供源代码 — 可免费用于个人、内部评估、研究和教育用途;**商业 / 生产环境使用需要获取许可证** (licensing@cognis.digital)。请参阅 [LICENSE](LICENSE)。
Cognis Digital · Cognis Neural Suite 中的 170+ 工具之一 · 让明天在今天更美好
标签:API安全, JSON输出, OAuth, OpenAPI, 可视化界面, 数据可视化, 日志审计, 请求拦截, 逆向工具, 金融科技, 静态代码扫描