By · Last updated 2026-03-31

返回博客人工智能安全

IDE 与浏览器:开发者 AI 安全的双层防护

开发者在两种环境中使用 AI:IDE(Cursor、VS Code)和浏览器(Claude.ai、ChatGPT)。每种环境都需要不同的安全控制措施。

March 31, 20268 分钟阅读
developer AI securityMCP Server IDEChrome Extension browsertwo-layer protectioncredential leak prevention

两条通道,两个攻击面

开发者在两个场景中使用 AI,每个场景的数据流向不同,所需的安全控制也不同。

IDE 集成 AI——Cursor、GitHub Copilot、VS Code 扩展以及 Claude Desktop 均可读取您的项目文件。代码文件、配置文件、环境变量,都在可访问范围之内。AI 模型获取的是开发者粘贴的内容,或客户端从项目上下文中拉取的信息。

浏览器端 AI——Claude.ai、ChatGPT 和 Gemini 在浏览器中运行。开发者通过浏览器文本框粘贴代码、堆栈跟踪和错误信息,文本直接传输至 AI 服务商,中间没有任何过滤层。

两条通道都会将敏感数据暴露给 AI 服务商,都需要相应的控制措施。但两者所需的控制方式并不相同。只防护一条通道的团队,等于只保护了开发者工作流程的一半。

IDE 层:MCP 服务器

对于 Claude Desktop 和 Cursor 用户,Model Context Protocol(MCP)是正确的安全防护层。

MCP 位于 AI 客户端与 AI 模型 API 之间,在数据到达模型之前,MCP 服务器会读取所有经过该接口的内容。

这一位置赋予了三项关键能力:

密钥与凭证移除——API 密钥、数据库连接字符串、认证令牌、内部 URL 在发送前均会被检测并替换为安全令牌。模型看到的是 [API_KEY_1],而非真实的密钥值。

自定义代码模式——团队可以针对内部产品代码、客户 ID 和服务名称添加自定义匹配规则。标准 PII 工具并不了解这些模式,自定义规则在数据离开之前于 MCP 服务器中执行。

不干扰开发工作——开发者像往常一样使用 Cursor 或 Claude Desktop,MCP 服务器在客户端与 API 之间静默运行,开发者无需改变任何习惯,仍能获得同等的 AI 辅助。

GitHub Octoverse 2024 记录到 GitHub 上发生了 3,900 万次密钥泄露事件,同比增长 25%。驱动这些泄露的习惯,同样也在驱动 IDE AI 的数据泄露——凭证混入提交代码,也混入粘贴的上下文。MCP 服务器拦截正是针对这一模式的 AI 通道防护方案。

另请参阅:2026 年 MCP 服务器 PII 安全实践

浏览器层:Chrome 扩展程序

对于浏览器端 AI——Claude.ai、ChatGPT、Gemini——Chrome 扩展程序是正确的控制方式。

该扩展程序以内容脚本的形式运行于各 AI 平台上。在开发者提交内容之前,它会读取文本,检测敏感内容——包括姓名、密钥以及您自定义的代码模式——并在文本到达 AI 服务商之前完成脱敏处理。

两个防护层覆盖了不同的通道:

MCP 服务器负责——通过 Claude Desktop 或 Cursor 进行的所有 AI 交互:代码审查、调试会话以及项目上下文查询,均经过此层处理。

Chrome 扩展程序负责——所有基于浏览器的 AI 交互:Claude.ai、ChatGPT、Gemini、Perplexity,以及浏览器中任何其他 AI 界面——包括开发者希望在 IDE 之外处理的文档工作或临时查询。

另请参阅:浏览器 DLP:拦截 vs 匿名化对比

双层防护的完整覆盖效果

同时部署两个防护层的开发团队可以实现全面覆盖。以下是实际运作方式:

开发者使用 Cursor 与 Claude 协作调试线上问题。MCP 服务器在堆栈跟踪中的密钥到达 Claude 之前完成脱敏,不会有密钥被发送出去。

同一位开发者随后在浏览器中打开 Claude.ai 进行架构讨论,并附上了内部服务 URL。Chrome 扩展程序在发送前移除该 URL,内部地址不会传至 Claude。

另一位同事使用 ChatGPT 处理文档工作,粘贴的代码中包含 API 密钥。Chrome 扩展程序在代码传至 OpenAI 之前捕获该密钥,不会有密钥泄露。

两条通道均不会将密钥或敏感代码暴露给 AI 服务商,两位开发者都能正常开展实质性工作,安全团队在两条通道上均有技术管控——而非仅依赖规章制度。

CVE-2024-59944 展示了这一广泛风险的典型案例。缺乏拦截层的开发者 AI 工具就是数据泄露的渠道,双层模型正是对这一风险的直接回应。

另请参阅:生产环境中 AI 编码助手的 PII 泄露问题

为什么单层防护还不够

部分团队屏蔽了浏览器 AI 而仅依赖 IDE 工具;另一些团队允许使用浏览器 AI 但未覆盖 IDE 通道。两种方式都留有漏洞。

一名开发者在工作中使用 Cursor,也可能随时打开浏览器标签查询 ChatGPT。仅有 IDE 层管控无法捕获浏览器行为;仅有浏览器层管控则无法覆盖 IDE 会话。在实际的开发工作日中,两条通道都是活跃的。

双层模型实现了全面覆盖,不需要开发者刻意回避某一通道,在两个场景下均静默运行。


anonym.legal 提供双层防护:面向 IDE 集成 AI 的 MCP 服务器,以及面向浏览器端 AI 的 Chrome 扩展程序。两者基于同一检测引擎——285+ 种实体类型、48 种语言、可逆加密。

参考来源

准备好保护您的数据了吗?

开始使用 285 种实体类型在 48 种语言中匿名化 PII。

About this page

We update this page when our platform or the law changes.

Read our founder note for how we work.

Each change shows up in the timestamp at the top.

Related reading

We follow these rules

  • GDPR (EU 2016/679).
  • ISO/IEC 27001:2022.
  • NIS2 (EU 2022/2555).
  • HIPAA safe harbor under 45 CFR § 164.514(b)(2).

Our promise

We do not sell your data.

We do not train models on your text.

We store your files in Germany.

You can delete your account at any time.

You own your work.

Where we run

Our servers live in Falkenstein, Germany.

We use Hetzner. They hold ISO 27001 certification.

All data stays in the EU.

Backups run every day.

Need help?

Email support@anonym.legal.

We reply within one business day.

How we test

We run a full check suite on every release.

Each surface gets its own sweep script and report.

Human reviewers spot-check the output each week.

We track recall and precision on a labelled set.

Bad runs block the deploy.

What we never do

  • We never sell your information to third parties.
  • We never train models on what you upload.
  • We never keep your work after you delete it.
  • We never share keys with any outside firm.
  • We never run ads inside the product.

Plans in plain words

We sell credits, not seats.

One credit covers one short job.

Long jobs use a few credits each.

You can top up at any time.

Unused credits roll over each month.

Read the plans page for current rates.

Who built this

A small team of engineers and lawyers built this.

We ship from Europe and work in the open.

Our founder note spells out why we started.

Where to start

How the parts fit

A browser add-on cleans text inside Chrome.

A Word plug-in handles drafts in Office.

A small desktop tool works on whole folders.

An agent protocol link feeds large models safely.

All four share one core engine and one rule set.

Words from our team

We started this work after a lunch about cookies.

One friend kept getting odd ads on her phone.

We asked why a court file leaked through a draft.

We sketched the first build on a napkin that week.

By month three we had a tiny demo for a friend.

She used it on her first case the next day.

Common questions we hear

Can the tool read scanned PDFs? Yes, with OCR.

Does it work on long files? Yes, in small chunks.

Can I roll my own rule set? Yes, save it as a preset.

Does it run offline? The desktop build runs offline.

Do you keep my files? No, the cloud build wipes after each run.

Will it learn from my work? No, we never train on inputs.

A short tour of the workflow

Upload a file or paste a snippet of prose.

Pick the entities you want gone from the draft.

Choose a method: replace, mask, hash, encrypt, or redact.

Press run and watch the side panel show each hit.

Skim the result and tweak any rule that misfired.

Save the cleaned file or send it to a teammate.