xiaYuTian11/maskit

数据面具 Data Maskit — 专为大模型打造的本地隐私脱敏网关(请求自动打码,回复流式还原;支持 Cursor / Claude Code / Codex / Pi 等任意可配 Base URL 工具)

What is Maskit?

Maskit is a local privacy‑gateway that sits between your development tools (Cursor, Claude Code, ChatGPT, etc.) and the large‑model APIs you call. Before a request leaves your machine it automatically replaces any sensitive data—API keys, database URLs, personal IDs, phone numbers, even entities recognized by a tiny on‑device NER model—with deterministic placeholders (e.g., {{CONNSTR_zkpmqx}}). When the model returns a response, Maskit streams the answer back to you and swaps the placeholders for the original values in‑memory, in milliseconds, so the user experience feels unchanged.

Why it matters

When you ask an AI‑coding assistant to debug code or analyse a document, you often paste snippets that contain credentials or private business information. Sending that raw data to a cloud provider can leak secrets. Maskit prevents the leak without requiring any changes to the AI tool – you only point the tool at a local URL (or install a browser extension) and the gateway does the masking and un‑masking automatically.

Core features (as described in the README)

Feature What it does
Deep, rule‑based masking 21 built‑in regex categories, 7 enabled by default (API keys, bank cards, DB connection strings, emails, ID numbers, landline & mobile phones). Users can enable the other 14 categories or add custom words/regexes.
Multi‑turn consistency The same entity gets the same placeholder across a conversation, so the model can reason correctly over many turns.
Local NER model (ONNX) A lightweight Chinese‑language entity recognizer identifies names, organisations, addresses that regexes miss. It runs 100 % offline and is optional.
Browser extension MV3 Chrome/Edge extension intercepts requests to popular web‑based AI portals (ChatGPT, Claude, DeepSeek, plus 14 others). It masks prompts, masks uploaded Office files, and restores the answer in the page’s typing‑effect UI.
SSE stream handling For OpenAI/Anthropic text/event-stream responses, Maskit restores placeholders chunk‑by‑chunk, preserving the smooth “typing‑machine” experience.
Zero‑certificates, fallback passthrough Each model gets its own local port (e.g., 18701 for OpenAI). No system‑wide root‑CA install is needed; if the gateway stops, traffic is transparently forwarded unchanged so your tool never errors out.
Local test‑bed A UI panel lets you paste text and instantly see the masked version and the restored output, useful for debugging rules.
Skill contract for agents A built‑in placeholder contract (maskit-placeholders) can be downloaded so agents like Claude Code or Cursor treat placeholders as immutable tokens.
Full‑stack logging & audit Per‑request logs show the masked request, the raw response, timing, and a breakdown of detected entity types. Optional modes range from minimal (no raw text stored) to detailed (full transcript).
Prompt‑injection detection & command‑blocking The gateway can flag or rewrite dangerous model outputs (e.g., rm -rf /). This is optional and works on the tool‑parameter channel.
Cost tracking Estimates token usage and monetary cost based on the model’s pricing table.
Deployment options • Desktop client for Windows/macOS (installer with auto‑updates).
• Docker image (multi‑arch) with a web control panel on port 5801 and proxy ports starting at 18701.
• Source build for developers.

How to use it

  1. Desktop – install the appropriate package, run the tray app, and set the Base URL of your AI tool to http://127.0.0.1:18701/v1 (or the port you configured). The gateway will mask outgoing prompts and unmask incoming answers.
  2. Docker – pull ghcr.io/xiayutian11/maskit:latest and run the container, exposing the panel port and one or more proxy ports. Access the UI at http://<host>:5801 and configure clients there.
  3. Browser – load the extension from the release zip, link it to the running Maskit instance with a token, and enable the sites you use. The extension works without any manual URL changes.

Who might need it?

  • Individual developers who use AI coding assistants and want to keep credentials private.
  • Small teams that run a shared AI gateway on a server or NAS.
  • Security‑conscious organisations that require 100 % offline processing of sensitive data before it leaves the corporate network.

Limitations (as disclosed)

  • The NER model is not shipped in the source repo; it is included only in the pre‑built binaries and Docker image.
  • File‑type masking is currently implemented for ChatGPT and Claude; other sites will transmit files unchanged with a warning.
  • Command‑blocking only inspects plain‑text tool parameters; obfuscated or scripted commands may bypass it.
  • All processing happens on the local CPU – heavy concurrent usage may require more cores or disabling the NER component.

TL;DR: Maskit is an open‑source, AGPL‑licensed local proxy that automatically redacts sensitive information from prompts sent to LLM APIs and restores the original data in the model’s replies, available as a desktop app, Docker image, or browser extension.

相关

  • 项目
  • 项目
  • 项目
  • 项目