Newshot

Show HN: Kavach AI – 低于16毫秒的AST安全网关,零误报

Translation(model translation, not the source's own text)

本站仅限主流 Coding 客户端/CLI 使用,支持:Codex、Claude Code、OpenCode、Magpie、DeepSeek Harness、ZCode、Pi、Oh My Pi。当前客户端不支持。

jobs: kavach-ci: runs-on: ubuntu-latest steps:

  • name: Checkout Code

uses: actions/checkout@v4 with: fetch-depth: 0

  • name: Set up Python 3.11

uses: actions/setup-python@v5 with: python-version: '3.11'

  • name: Kavach AI PR Reviewer

env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | python ci_bot.py --fail-on CRITICAL


        
## 打开 PR 时会发生什么:

- 在 0.05 秒内检查变更集,不受外部网络延迟影响。

- 发布一条正式的 PR 审查评论,包含确切行号和 1 键 GitHub 提交建议。

- 用执行指标和 CWE 分类填充 GitHub Step Summary。

- 如果检测到严重漏洞,则使 CI 状态检查失败,从而阻止合并。

## 🏗️ 系统架构

      

┌───────────────────────────────┐ │ 传入的 Git Pull Request │ │ (git diff main...feature) │ └───────────────┬───────────────┘ │ ▼ ┌───────────────────────────────┐ │ DiffParser(零噪声) │ │ - 过滤锁定文件/资源文件 │ │ - 提取修改的代码块 │ └───────────────┬───────────────┘ │ ▼ ┌───────────────────────────────┐ │ 精准分析器 │ │ - Python 与 JS/TS 解析器 │ │ - CWE-798 凭据泄露 │ │ - CWE-89 SQL 注入 │ │ - CWE-78 命令注入 │ │ - CWE-775 描述符泄露 │ └───────────────┬───────────────┘ │ ▼ ┌───────────────────────────────┐ │ 1 键补丁引擎 │ │ - GitHub 建议块 │ │ - PR 评论机器人(CI/CD) │ │ - 独立 .patch 导出 │ └───────────────────────────────┘


        
## 🚀 快速开始与用法

## 1. 安装

克隆仓库并安装依赖:

      

git clone https://github.com/rajrajak99/kavach-ai.git cd kavach-ai pip install -r requirements.txt


        
## 2. 独立终端 CLI(本地扫描 10,000+ 个文件)

      

Scan a directory and generate unified .patch

python cli.py ./my-project --patch kavach.patch

Apply patch directly via git

git apply kavach.patch


        
## 3. 启动本地审查工作站(Raycast / Linear 深色 UI)

      

streamlit run app.py


        
在浏览器中打开 http://localhost:8502。

## 4. 运行自动化单元测试

      

pytest -o pythonpath=. tests/


        
## 📂 项目结构

Show HN: Kavach AI – 低于 16ms 的 AST 安全门禁,0% 误报

      

kavach-ai/ ├── action.yml # GitHub Action 规范(Composite) ├── ci_bot.py # 自动化 CI/CD PR 审查器与评论器 ├── cli.py # 独立高速终端 CLI 扫描器 ├── app.py # 豪华 Raycast/Linear 深色审查工作台 ├── core/ │ ├── __init__.py │ ├── diff_parser.py # 统一 Git diff 与 hunk 预过滤 │ ├── surgical_analyzer.py # 零噪声 CWE 与缺陷检测引擎 │ └── patch_validator.py # 语法与缩进补丁验证器 ├── samples/ │ ├── __init__.py │ └── vulnerable_samples.py # 多语言测试场景(Python + Node.js) ├── tests/ │ ├── __init__.py │ └── test_autopatch.py # 全面 pytest 测试套件(4/4 通过) ├── .github/ │ └── workflows/ │ └── kavach.yml # 生产 CI 工作流配置 ├── .streamlit/ │ └── config.toml # Raycast/Linear Obsidian 主题配置 ├── requirements.txt # 最小生产

The translation is machine-generated and individual terms may be off. Nothing is rewritten or cut; the original is authoritative.

Published by HN AI
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗