[Feature] 为 AI 请求增加本地脱敏层,降低本地/服务器敏感信息外发风险
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Locate the AI request construction and response rendering code in the Dart/Flutter codebase; the issue suggests inserting a PrivacyFilter or LocalRedactor at those points. Start by exploring the AI chat/agent module to understand request and streaming flow. Done means suspected sensitive content is replaced with placeholders before send and restored per session, with a configurable switch and rules.
Written by the indexing model from the issue text.
Description
背景
Server Box 常接触 SSH 密钥、Token、服务器地址、数据库连接串、环境变量、命令输出等敏感信息。启用 AI 对话 / Agent 后,这些内容可能作为上下文发送到外部 AI 端点,但目前缺少客户端侧本地脱敏机制,敏感信息外发风险不可控。
实例
在 Server Box 1.0.1844 中使用 AI 功能时遇到拒绝服务,排查发现请求触发了上游泄漏保护:
leak protection blocked request: matched gitleaks rule generic-api-key
generic-api-key 是通用规则,可能误判,但这次拦截也说明:AI 出站内容中确实存在形似密钥的片段,而客户端没有发送前脱敏手段。若换成真实密钥或服务器配置,同样可能被发送出去。
期望行为
· 请求发出前,本地将疑似敏感内容替换为占位符,如 PII_API_KEY_1、PII_HOST_2。
· 响应展示时按会话映射还原,或提供可配置的脱敏展示。
· 后续轮次重新脱敏,避免真实敏感内容出设备。
· 提供开关和规则配置,默认保守开启,支持自定义正则、白名单和排除项。
· 流式响应需缓冲跨 chunk 的占位符并正确还原。
· 日志不记录原文,仅记录脱敏统计和规则命中类型。
建议实现
采用纯 Dart 客户端本地脱敏层,不引入外部 Go/Python 网关进程,保证 iOS/Android/桌面端可用:
- 抽象 PrivacyFilter / LocalRedactor,插入 AI 请求构造前和响应渲染前。
- 请求前对用户输入、历史上下文、工具调用参数、命令输出做规则匹配和占位符替换。
- 响应后按会话级映射还原;流式响应缓冲可能被拆分的占位符。
- 内置规则包括 generic-api-key、常见 Token、私钥、数据库连接串、服务器地址/主机名等,支持自定义正则。
- 可参考 Dart/Flutter 本地脱敏库(如 redact)或实现轻量规则引擎。
环境
· Server Box 版本:1.0.1844
· 平台:iOS / Android / macOS / Linux / Windows
· AI 端点:OpenAI 兼容 / 自定义
· 是否流式:是 / 否
· 错误信息:leak protection blocked request: matched gitleaks rule generic-api-key
- Dominant language
- Dart
- Stars
- 8.9k
- Forks
- 573
- Avg merge
- 6h 53m
- Merged PRs (30d)
- 133
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lollipopkit/flutter_server_box
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
lollipopkit/flutter_server_box#1851 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 8/100
lollipopkit/flutter_server_box#1844 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
F-Droid build failedOpenbug
Difficulty 3/5 Half a day Newbie friendliness 22/100
lollipopkit/flutter_server_box#1841 · 2 comments · 2 reactions ·
Maintainers usually reply within 1 day
-
优化建议Openenhancement feature
Difficulty 4/5 3-5 days Newbie friendliness 30/100
lollipopkit/flutter_server_box#1829 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 58/100
lollipopkit/flutter_server_box#1808 · 4 comments · 1 reaction ·
Maintainers usually reply within 1 day
All issues in lollipopkit/flutter_server_box
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
chriskelly/wish-together#114 ·
Maintainers usually reply within 1 day
-
type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
mikejr83/rc-soar-score#724 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
VeryGoodOpenSource/very_good_analysis#256 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ccch1mneyyy/dsh-Go#381 ·
Maintainers usually reply within 1 day