cognis-digital/cookieaudit

GitHub: cognis-digital/cookieaudit

从 HTTP 响应转储中审计 Set-Cookie 安全标志(Secure/HttpOnly/SameSite)并将其集成到 CI 流水线或 AI Agent 中的命令行工具。

Stars: 0 | Forks: 0

COOKIEAUDIT # COOKIEAUDIT ### 从响应转储中审计 Set-Cookie 标志 (Secure/HttpOnly/SameSite) [![PyPI](https://img.shields.io/pypi/v/cognis-cookieaudit.svg?color=6b46c1)](https://pypi.org/project/cognis-cookieaudit/) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/b8d2f98984073030.svg)](https://github.com/cognis-digital/cookieaudit/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-cookieaudit cookieaudit scan . # → prioritized findings in seconds ``` ## 使用说明 — 分步指南 1. **安装**(通过克隆的可编辑模式,或从仓库安装): pip install -e . 2. **审计捕获的 HTTP 响应转储**(`audit` 子命令读取文件,或使用 `-` 读取标准输入)。使用您喜欢的任何方式捕获响应标头,然后将其通过管道传入: curl -sD - https://example.com -o /dev/null | cookieaudit audit - 或者指向已保存的转储文件: cookieaudit audit response.txt 3. **获取机器可读的输出**,使用 `--format json`,或使用 `--format html -o` 生成可共享的 HTML 报告: cookieaudit audit response.txt --format json cookieaudit audit response.txt --format html -o cookie-report.html 4. **读取结果。** 表格列出了每个 `Set-Cookie` 及其缺失/薄弱的安全标志(`Secure`、`HttpOnly`、`SameSite` 等)。当存在任何中等或更高等级的发现时,进程将退出并返回**非零状态码 (1)**,因此您可以据此进行拦截控制。 5. **在 CI 中使用** — 当发布不安全的 cookie 时使构建失败: curl -sD - "$TARGET_URL" -o /dev/null | cookieaudit audit - --format json || { echo "Insecure cookie flags detected"; exit 1; } ## 目录 - [为什么选择 cookieaudit?](#why) · [功能](#features) · [快速开始](#quick-start) · [示例](#example) · [架构](#architecture) · [AI 技术栈](#ai-stack) · [对比分析](#how-it-compares) · [集成](#integrations) · [随处安装](#install-anywhere) · [相关工具](#related) · [贡献](#contributing) ## 为什么选择 cookieaudit? 无需搭建重型基础设施,直接从响应转储中审计 Set-Cookie 标志(Secure/HttpOnly/SameSite)。 `cookieaudit` 是单一用途、可脚本化且可自托管的:将其指向目标,以您的工作流已支持的语言(表格 · JSON · SARIF)获取已排定优先级的结果,在 CI 中对其进行拦截控制,并允许 agent 通过 MCP 驱动它。
↑ 回到顶部
## 功能 - ✅ 解析 Set Cookie - ✅ 解析转储 - ✅ 审计 Cookie - ✅ 审计转储 - ✅ 渲染表格 - ✅ 渲染 Json - ✅ 渲染 Html - ✅ 运行于 Linux/macOS/Windows · Docker · devcontainer - ✅ 提供 Python, JavaScript, Go, 和 Rust 的移植版本 (`ports/`)
↑ 回到顶部
## 快速开始 ``` pip install cognis-cookieaudit cookieaudit --version cookieaudit scan . # scan current project cookieaudit scan . --format json # machine-readable cookieaudit scan . --fail-on high # CI gate (non-zero exit) ```
↑ 回到顶部
## 示例 ``` $ cookieaudit scan . [HIGH ] COO-001 example finding (./src/app.py) [MEDIUM ] COO-002 another signal (./config.yaml) 2 findings · risk score 5 · 38ms ```
↑ 回到顶部
## 架构 ``` flowchart LR IN[target / manifest] --> P[cookieaudit
checks + rules] P --> OUT[findings (JSON / SARIF)] ```
↑ 回到顶部
## 从任何 AI 技术栈中使用 `cookieaudit` 兼容所有流行的 AI 使用方式: - **MCP server** — `cookieaudit mcp` (Claude Desktop, Cursor, Cognis.Studio, [uncensored-fleet](https://github.com/cognis-digital/uncensored-fleet)) - **OpenAI-compatible / JSON** — 将 `cookieaudit scan . --format json` 通过管道传入任何 agent 或 LLM - **LangChain · CrewAI · AutoGen · LlamaIndex** — 一行代码将 CLI/JSON 封装为工具 - **CI / 脚本** — 为非 AI pipeline 提供 exit code + SARIF
↑ 回到顶部
## 对比分析 | | **Cognis cookieaudit** | 典型工具 | |---|:---:|:---:| | 可自托管,无需账户 | ✅ | 视情况而定 | | 单一命令,零配置 | ✅ | ⚠️ | | 用于 CI 的 JSON + SARIF | ✅ | 视情况而定 | | MCP 原生支持 (AI agent) | ✅ | ❌ | | 多语言移植版本 (JS/Go/Rust) | ✅ | ❌ | | 开源许可 | ✅ COCL | 视情况而定 |
↑ 回到顶部
## 集成 接入您的技术栈:用于代码扫描的 **SARIF**,用于一切的 **JSON**,用于 AI agent 的 **MCP server** (`cookieaudit mcp`),以及用于 SIEM/Slack/Jira 的 webhook 转发器。详见 [`docs/INTEGRATIONS.md`](docs/INTEGRATIONS.md)。
↑ 回到顶部
## 安装 — 全方式、全平台 ``` pip install "git+https://github.com/cognis-digital/cookieaudit.git" # pip (works today) pipx install "git+https://github.com/cognis-digital/cookieaudit.git" # isolated CLI uv tool install "git+https://github.com/cognis-digital/cookieaudit.git" # uv pip install cognis-cookieaudit # PyPI (when published) docker run --rm ghcr.io/cognis-digital/cookieaudit:latest --help # Docker brew install cognis-digital/tap/cookieaudit # Homebrew tap curl -fsSL https://raw.githubusercontent.com/cognis-digital/cookieaudit/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/cookieaudit` | [DEPLOY.md](docs/DEPLOY.md) (AWS/Azure/GCP/k8s) |
↑ 回到顶部
## 相关 Cognis 工具 **探索套件 →** [🗂️ 全部 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+ 工具之一 · 让明天从今天开始变得更好
标签:Cookie安全, MCP, Python, Web安全, 可视化界面, 数据可视化, 无后门, 日志审计, 蓝队分析, 请求拦截, 逆向工具