cognis-digital/corsaudit

GitHub: cognis-digital/corsaudit

一款从 HTTP 响应头或配置文件中检测宽松或错误 CORS 配置的安全审计工具,支持 CI 集成与 MCP 原生 AI 驱动。

Stars: 0 | Forks: 0

CORSAUDIT # CORSAUDIT ### 从 headers 或配置文件中检测宽松/错误配置的 CORS [![PyPI](https://img.shields.io/pypi/v/cognis-corsaudit.svg?color=6b46c1)](https://pypi.org/project/cognis-corsaudit/) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/cd7717f633072947.svg)](https://github.com/cognis-digital/corsaudit/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) *Cognis Neural Suite 的一部分。*
``` pip install cognis-corsaudit corsaudit scan . # → prioritized findings in seconds ``` ## 用法 — 逐步指南 1. **安装:** pip install -e . 2. **使用 `headers` 子命令分析捕获的响应 headers**(读取文件或使用 `-` 表示 stdin)。传递 `--origin` 以针对您发送的探测 Origin 启用反射检查: curl -sD - -H 'Origin: https://evil.example' https://api.example.com -o /dev/null \ | corsaudit headers - --origin https://evil.example 3. **或者使用 `config` 子命令审计声明式 CORS 配置**(JSON 文件或 stdin): corsaudit config cors.json 4. **读取结果。** 每个发现都会显示 `RULE`(规则)、`SEVERITY`(严重程度)、标题、违规的 origin、详细信息以及 `fix:` 修复建议。使用 `--format json` 以便进行管道传输;当报告任何发现时,进程退出代码为 **1**,完全无误时为 **0**,使用错误时为 **2**。corsaudit 不会发起任何网络请求 —— 它仅分析您提供的输入。 corsaudit headers headers.txt --format json 5. **在 CI 中使用它** —— 遇到任何 CORS 配置错误时中断 pipeline: corsaudit config cors.json --format json || { echo "CORS misconfig"; exit 1; } ## 目录 - [为什么选择 corsaudit?](#why) · [功能](#features) · [快速开始](#quick-start) · [示例](#example) · [架构](#architecture) · [AI 技术栈](#ai-stack) · [对比](#how-it-compares) · [集成](#integrations) · [随处安装](#install-anywhere) · [相关工具](#related) · [贡献](#contributing) ## 为什么选择 corsaudit? 捕获通配符+凭据 `corsaudit` 专注于单一用途、可脚本化且支持自托管:将其指向目标,以您的工作流已使用的格式(表格 · JSON · SARIF)获取已区分优先级的结果,以此控制 CI 流程,并允许 agent 通过 MCP 驱动它。
↑ 回到顶部
## 功能 - ✅ 解析 Header 块 - ✅ 分析 Headers - ✅ 分析配置 - ✅ 支持 Linux/macOS/Windows · Docker · devcontainer 运行 - ✅ 提供 Python、JavaScript、Go 和 Rust 的移植版 (`ports/`)
↑ 回到顶部
## 快速开始 ``` pip install cognis-corsaudit corsaudit --version corsaudit scan . # scan current project corsaudit scan . --format json # machine-readable corsaudit scan . --fail-on high # CI gate (non-zero exit) ```
↑ 回到顶部
## 示例 ``` $ corsaudit scan . [HIGH ] COR-001 example finding (./src/app.py) [MEDIUM ] COR-002 another signal (./config.yaml) 2 findings · risk score 5 · 38ms ```
↑ 回到顶部
## 架构 ``` flowchart LR IN[target / manifest] --> P[corsaudit
checks + rules] P --> OUT[findings (JSON / SARIF)] ```
↑ 回到顶部
## 从任何 AI 技术栈中使用它 `corsaudit` 可与所有流行的 AI 使用方式互操作: - **MCP server** — `corsaudit mcp` (Claude Desktop、Cursor、Cognis.Studio、[uncensored-fleet](https://github.com/cognis-digital/uncensored-fleet)) - **兼容 OpenAI / JSON** — 将 `corsaudit scan . --format json` 通过管道传递给任何 agent 或 LLM - **LangChain · CrewAI · AutoGen · LlamaIndex** — 一行代码即可将 CLI/JSON 封装为工具 - **CI / 脚本** — 为非 AI pipeline 提供退出代码 + SARIF
↑ 回到顶部
## 对比 | | **Cognis corsaudit** | CORScanner | |---|:---:|:---:| | 可自托管,无需账户 | ✅ | 视情况而定 | | 单条命令,零配置 | ✅ | ⚠️ | | 支持用于 CI 的 JSON + SARIF | ✅ | 视情况而定 | | MCP 原生 (AI agents) | ✅ | ❌ | | 多语言移植版 (JS/Go/Rust) | ✅ | ❌ | | 开源许可 | ✅ COCL | 视情况而定 | *秉承 **CORScanner** 的精神,以 Cognis 的方式重新构建。遗漏了致谢?欢迎提交 PR。*
↑ 回到顶部
## 集成 可接入您的技术栈:用于代码扫描的 **SARIF**,用于任何场景的 **JSON**,用于 AI agent 的 **MCP server** (`corsaudit mcp`),以及用于 SIEM/Slack/Jira 的 webhook 转发器。详见 [`docs/INTEGRATIONS.md`](docs/INTEGRATIONS.md)。
↑ 回到顶部
## 安装 — 各种方式,所有平台 ``` pip install "git+https://github.com/cognis-digital/corsaudit.git" # pip (works today) pipx install "git+https://github.com/cognis-digital/corsaudit.git" # isolated CLI uv tool install "git+https://github.com/cognis-digital/corsaudit.git" # uv pip install cognis-corsaudit # PyPI (when published) docker run --rm ghcr.io/cognis-digital/corsaudit:latest --help # Docker brew install cognis-digital/tap/corsaudit # Homebrew tap curl -fsSL https://raw.githubusercontent.com/cognis-digital/corsaudit/main/install.sh | sh ``` | Linux | macOS | Windows | Docker | 云平台 | |---|---|---|---|---| | `scripts/setup-linux.sh` | `scripts/setup-macos.sh` | `scripts/setup-windows.ps1` | `docker run ghcr.io/cognis-digital/corsaudit` | [DEPLOY.md](docs/DEPLOY.md) (AWS/Azure/GCP/k8s) |
↑ 回到顶部
## 相关 Cognis 工具 - [`portfan`](https://github.com/cognis-digital/portfan) — 将 nmap XML 汇总并 diff 为按优先级排序的、可攻击的发现 - [`subhunt`](https://github.com/cognis-digital/subhunt) — 从多个来源聚合并去重子域名枚举结果 - [`dirsight`](https://github.com/cognis-digital/dirsight) — 将 Web 内容发现工具的输出(ffuf/gobuster)分析为排序后的 endpoint - [`jwtinspect`](https://github.com/cognis-digital/jwtinspect) — 解码 JWT 并 lint 检查 alg=none、弱密钥和缺失的 claims - [`headerscan`](https://github.com/cognis-digital/headerscan) — 从响应转储中对 HTTP 安全 headers (CSP/HSTS/XFO) 进行 A-F 评级 - [`ssltriage`](https://github.com/cognis-digital/ssltriage) — 从 openssl/sslyze 输出中对 TLS 配置(协议/密码/到期时间)进行评级 **探索套件 →** [🗂️ 全部 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 Open Collaboration License (COCL) v1.0** — 个人、内部评估、研究和教育用途免费;**商业/生产用途需要许可** (licensing@cognis.digital)。请参阅 [LICENSE](LICENSE)。
Cognis Digital · Cognis Neural Suite 中 170+ 工具之一 · Making Tomorrow Better Today
标签:CORS, 可视化界面, 子域名暴力破解, 安全合规, 数据可视化, 日志审计, 网络代理, 自动化检测, 请求拦截, 逆向工具