muneeb-anjum0/NOPE

GitHub: muneeb-anjum0/NOPE

NOPE 是一个本地优先、证据驱动的应用安全编排平台,通过整合多种安全扫描器并映射发现结果到证据,帮助团队在交付前评估应用是否安全。

Stars: 0 | Forks: 0

# NOPE 你的应用能跑。这并不意味着它是安全的。 NOPE 是一个本地优先、证据驱动的应用安全编排平台。安全扫描器发现证据,pipeline 对其进行组织,代码图谱将其连接,RAG 仅检索关键内容,Qwen 对聚焦的上下文进行推理,测试验证结果,而重新扫描则用于检查修复情况。 ## 当前状态 NOPE 是一个可用的本地 MVP,而不是一个已完成的生产级平台。当前构建包括: - 位于 `/` 的重新设计的公开 graphite 风格着陆页。 - 透明的着陆页导航,带有需登录的 `Open dashboard` 流程。 - 位于 `/app/projects/local` 下的路由式暗色调应用工作区。 - React Bits LineSidebar 风格的 dashboard 导航外壳。 - 基于本地 Postgres 的账户创建、登录、会话和登出。 - 基于 Migration 的 Postgres 持久化,涵盖项目、扫描、阶段、scanner 运行、发现、证据、覆盖率和生成的报告 payload。 - FastAPI 编排 API。 - Next.js dashboard。 - 带有 Zip Slip 保护的 ZIP 代码库摄取。 - 带有范围检查的授权 URL 扫描路径。 - 技术栈检测。 - 攻击面映射。 - 轻量级代码图谱。 - NOPE 确定性规则包。 - 针对内置的 Semgrep、Gitleaks、OSV-Scanner、Trivy、Checkov、Hadolint 和 Bandit 的真实 scanner 执行,并带有标准化的解析器输出。 - 由 MinIO 支持的原始 scanner artifacts,与 scanner 运行和 artifact 表相关联。 - 发现结果的标准化、去重、评分、判定、覆盖率跟踪和报告。 - 通过 llama.cpp 进行的可选 Qwen/本地 AI 配置,支持优雅失败。 - 包含 web、API、worker、Postgres、Redis 和 MinIO 的 Docker Compose 技术栈。 不可用的 scanner CLI 和本地 Qwen runtime 是有意不进行模拟的。如果它们不可用,NOPE 会将该覆盖率标记为失败、跳过或未测试。 ## Pipeline DFD ``` %%{init: { "theme": "base", "themeVariables": { "background": "#f7f7f4", "primaryColor": "#ffffff", "primaryTextColor": "#171717", "primaryBorderColor": "#d9d8d1", "lineColor": "#0f766e", "secondaryColor": "#eef6f4", "tertiaryColor": "#fff7ed", "fontFamily": "Inter, Segoe UI, sans-serif" } }}%% flowchart LR classDef actor fill:#151916,color:#f4f5f1,stroke:#151916,stroke-width:1px classDef boundary fill:#fff7ed,color:#171717,stroke:#a16207,stroke-width:1px,stroke-dasharray: 5 4 classDef process fill:#ffffff,color:#171717,stroke:#0f766e,stroke-width:1.5px classDef store fill:#eef6f4,color:#171717,stroke:#1d4ed8,stroke-width:1.2px classDef external fill:#fef2f2,color:#171717,stroke:#b42318,stroke-width:1.2px classDef partial fill:#f8fafc,color:#475569,stroke:#94a3b8,stroke-width:1px,stroke-dasharray: 3 3 Dev["Developer / Security Reviewer"]:::actor UI["NOPE Web UI
Dashboard, Findings, Coverage, Reports"]:::process API["NOPE API
FastAPI orchestration"]:::process Auth["Authorization Scope Guard
ownership confirmation, approved hosts, private-IP blocking"]:::process subgraph Inputs["Authorized Inputs"] Repo["Repository ZIP
or GitHub repository"]:::external Url["Authorized URL"]:::external Creds["Optional test credentials
and scan policy"]:::external end subgraph TrustBoundary["Hostile Input Boundary"] Ingest["Secure Ingestion
size limits, Zip Slip checks, temp workspace"]:::boundary Sandbox["Sandbox Contract
Docker, limits, no host secrets"]:::boundary end subgraph Pipeline["Evidence Pipeline"] Stack["Stack Detection
languages, frameworks, data systems"]:::process Surface["Attack Surface Mapping
routes, handlers, auth hints, inputs"]:::process Graph["Code Graph
routes -> files -> data/sinks"]:::process Orchestrator["Scanner Plugin Orchestrator
health, applicability, failures visible"]:::process Rules["NOPE Rules Engine
secrets, authz, CORS, Supabase, AI abuse"]:::process URLScan["URL Scanner
headers, cookies, exposed paths, redirects"]:::process Normalize["Normalize + Deduplicate
fingerprints, merged evidence"]:::process Coverage["Coverage Calculator
Verified, Partial, Failed, Not tested"]:::process Score["Score + Verdict
not tested is not secure"]:::process end subgraph Intelligence["Focused Intelligence Layer"] RAG["Focused Retrieval
only relevant evidence snippets"]:::process Qwen["Optional Qwen Adapter
local runtime, graceful failure"]:::partial end subgraph Stores["Local Stores"] Postgres["Postgres
auth, projects, scans,
findings, coverage, reports"]:::store MinIO["MinIO
raw scanner artifacts"]:::store Redis["Redis
planned queued jobs"]:::partial end subgraph Outputs["Outputs"] Findings["Normalized Findings
severity, confidence, evidence"]:::store AttackMap["Attack Map"]:::store Reports["Reports
JSON, Markdown, SARIF-like"]:::store PR["GitHub PR / Patch Flow
requires GitHub permissions"]:::partial end Dev --> UI UI --> API Repo --> Ingest Url --> Auth Creds --> Auth Auth --> API Ingest --> API API --> Stack --> Surface --> Graph API --> Orchestrator Orchestrator --> Rules Orchestrator --> URLScan Rules --> Normalize URLScan --> Normalize Graph --> Normalize Normalize --> RAG --> Qwen Qwen --> Normalize Normalize --> Findings --> Coverage --> Score Graph --> AttackMap Score --> UI Findings --> UI Coverage --> UI AttackMap --> UI Findings --> Reports Coverage --> Reports Reports --> UI API --> Postgres API --> MinIO API -.next phase.-> Redis Sandbox -.deep scan path.-> Orchestrator Reports -.future.-> PR ``` ## 本地端点 - Web UI: `http://localhost:3000` - 登录: `http://localhost:3000/login` - Dashboard: `http://localhost:3000/app/projects/local` - API: `http://localhost:8000` - API 文档: `http://localhost:8000/docs` - MinIO UI: `http://localhost:9001` ## 本地登录 `Open dashboard` 操作会跳转至 `/login`。首次使用电子邮件和 8 位以上字符的密码成功登录后,将在 Postgres 中创建一个本地账户。后续登录使用相同的凭据,下发一个 HttpOnly 的 `nope_session` cookie,并解锁一个全新的 dashboard 工作区。 对于 Docker,web 容器使用 `API_URL_INTERNAL=http://nope-api:8000` 进行服务端身份验证调用,并使用 `NEXT_PUBLIC_API_URL=http://localhost:8000` 用于面向浏览器的报告链接。 ## 运行 ``` docker compose up --build -d ``` ``` docker compose down ``` AI CPU 模式: ``` docker compose -f docker-compose.yml -f docker-compose.ai-cpu.yml --profile ai-cpu up --build -d ``` AI GPU 模式: ``` docker compose -f docker-compose.yml -f docker-compose.ai-gpu.yml --profile ai-gpu up --build -d ``` 在启动 AI 模式之前,请设置 `NOPE_MODEL_DIR` 和 `NOPE_QWEN_MODEL_FILE`。当前的本地模型路径为 `D:\Desktop\Model\Qwen3-8B-Q4_K_M.gguf`。详见 `docs/LOCAL_AI.md`。 ## 本地开发 API: ``` cd apps/api python -m pip install -r requirements-dev.txt python -m pytest python -m uvicorn nope_api.main:app --reload --port 8000 ``` Web: ``` pnpm install pnpm --dir apps/web dev pnpm --dir apps/web lint pnpm --dir apps/web typecheck pnpm --dir apps/web build ``` ## 扫描模式 仅 URL: - 需要明确的授权确认。 - 默认阻止私有网络和 localhost 目标。 - 检查安全标头、cookie、暴露的路径、CORS 和重定向。 - 明确报告源代码未被检查。 仅代码库: - 接受 ZIP 上传。 - 提取到临时工作区,并具有大小、文件数量、symlink 和路径遍历保护。 - 运行技术栈检测、攻击面映射、代码图谱构建、NOPE 规则、scanner 适配器、去重、覆盖率和报告。 - 内置的 API 镜像包含 Semgrep、Gitleaks、OSV-Scanner、Trivy、Checkov、Hadolint 和 Bandit。 - Scanner 运行会持久化命令、退出代码、有限度的脱敏输出、标准化的发现结果以及 MinIO 原始输出 artifacts。 - 明确报告运行时行为未被验证。 全扫描: - 结合代码库和 URL 检查。 - 为沙盒、动态测试、聚焦检索和可选的 AI 审查提供契约。 - 深度沙盒执行和 ZAP 风格的爬取目前仍不完整,并在 `docs/FEATURE_STATUS.md` 中进行跟踪。 ## API 重点 - `GET /health` - `POST /api/auth/login` - `GET /api/auth/me` - `POST /api/auth/logout` - `POST /api/scans/url` - `POST /api/scans/repository` - `POST /api/scans/full` - `GET /api/scans` - `GET /api/scans/{scan_id}` - `GET /api/scans/{scan_id}/findings` - `GET /api/scans/{scan_id}/coverage` - `GET /api/scans/{scan_id}/attack-map` - `GET /api/scans/{scan_id}/report.json` - `GET /api/scans/{scan_id}/report.md` - `GET /api/scans/{scan_id}/report.sarif` - `GET /api/scanners/capabilities` - `GET /api/settings/model` - `POST /api/settings/model/test` 除了 health 和 login 之外,API 路由都需要有效的 `Authorization: Bearer ` token。Dashboard 服务端路由会自动转发 HttpOnly 的本地会话 cookie。 详见 `docs/API_REFERENCE.md`。 ## 验证快照 上次本地验证结果: - `$env:PYTHONPATH='apps/api'; python -m pytest apps/api/tests`:通过,23 项测试。 - `python -m compileall nope_api tests`:通过。 - `pnpm --dir apps/web lint`:通过。 - `pnpm --dir apps/web typecheck`:通过。 - `pnpm --dir apps/web build`:通过。 - 登录限制的 dashboard 流程:未认证的 `/app/projects/local` 重定向到 `/login`;本地 Postgres 登录下发 `nope_session`;认证后的 dashboard 返回 HTTP 200。 - 使用 Playwright + 系统 Edge 进行视觉检查:着陆页桌面版、应用概览桌面版、发现结果移动版。 - `docker compose up --build -d`:通过。 - Docker 服务健康:`NOPE`、`nope-api`、`nope-postgres`、`nope-redis`、`nope-minio`。 - API health 返回 `status: ok`。 - Web UI 返回 HTTP 200。 - MinIO 控制台返回 HTTP 200。 - 阶段 2 scanner 固件扫描 `scan_e1b6a69758a848bd` 完成,共发现 29 项:NOPE 规则 1,Semgrep 1,Gitleaks 1,OSV-Scanner 5,Trivy 10,Checkov 6,Hadolint 2,Bandit 3。 - 针对 Semgrep、Gitleaks、OSV-Scanner、Trivy、Checkov、Hadolint 和 Bandit 的 Scanner 原始输出 artifacts 已写入 MinIO,并与持久化的 scanner 运行相关联。 - 阶段 1 持久化强化验证了经过身份验证的 API 作用域和存储的报告主体。 已知的验证注意事项: - Ruff lint 未完成,因为 Ruff wheel 下载在本地停滞。 - Qwen GGUF 文件存在于 `D:\Desktop\Model\Qwen3-8B-Q4_K_M.gguf`,但 llama.cpp 容器的加载和推理尚未验证。 - npm 在 Docker 安装期间报告了两个中等程度的前端依赖公告。 ## 重要文档 - `docs/ARCHITECTURE.md` - 系统架构和数据流。 - `docs/SECURITY_MODEL.md` - 扫描授权、上传、沙盒、密钥和故障安全模型。 - `docs/FEATURE_STATUS.md` - 持续更新的功能矩阵。 - `docs/IMPLEMENTATION_WORKLOG.md` - 实现和验证日志。 - `docs/DEVELOPMENT.md` - 本地开发命令。 - `docs/DEPLOYMENT.md` - Docker 部署说明。 - `docs/API_REFERENCE.md` - API 端点参考。 - `docs/DESIGN_SYSTEM.md` - graphite 设计 token、排版、动效、组件和响应式规则。 - `docs/LOCAL_AI.md` - llama.cpp/Qwen 设置、CPU/GPU 模式、安全说明和故障排除。 - `docs/DATABASE.md` - 阶段 1 Postgres schema 和迁移说明。 - `docs/SCANNERS.md` - scanner 执行、解析器、artifact 和剩余集成说明。 ## README 维护 每当以下内容之一发生变化时,请保持此 README 为最新: - 运行命令。 - 暴露的端口或服务名称。 - 已完成的功能。 - 已知限制。 - 验证结果。 - Docker 服务健康行为。 - Scanner 或 AI runtime 支持。 内部规则:除非功能已经过实现和验证,否则不要称其为已完成。
标签:AV绕过, Docker Compose, FastAPI, 大模型安全分析, 插件系统, 搜索引擎查询, 文档安全, 测试用例, 请求拦截, 逆向工具, 静态应用安全测试