diff --git a/site/public/docs/docker.html b/site/public/docs/docker.html index 4410ef694..894dd81b1 100644 --- a/site/public/docs/docker.html +++ b/site/public/docs/docker.html @@ -49,6 +49,7 @@ Remote magpie Docker Privacy + Privacy masking Add to magpie Integrate Releases @@ -219,6 +220,7 @@ docker logs magpie Remote magpie Docker Privacy + Privacy masking Add to magpie Integrate GitHub diff --git a/site/public/docs/import.html b/site/public/docs/import.html index cf58e2130..8271b3ba2 100644 --- a/site/public/docs/import.html +++ b/site/public/docs/import.html @@ -49,6 +49,7 @@ Remote magpie Docker Privacy + Privacy masking Add to magpie Integrate Releases @@ -263,6 +264,7 @@ href = "https://usemagpie.ai/import#" + urlencode({ Remote magpie Docker Privacy + Privacy masking GitHub Discord Releases diff --git a/site/public/docs/integrate.html b/site/public/docs/integrate.html index 1ff43e88a..100212f15 100644 --- a/site/public/docs/integrate.html +++ b/site/public/docs/integrate.html @@ -48,6 +48,7 @@ Remote magpie Docker Privacy + Privacy masking Add to magpie Integrate Releases @@ -154,6 +155,7 @@ curl -s http://127.0.0.1:3425/v1/models -H "Authorization: Bearer magpie-acme"Remote magpie Docker Privacy + Privacy masking Add to magpie Integrate GitHub diff --git a/site/public/docs/intent.html b/site/public/docs/intent.html index b8ffaee48..536bcc7dc 100644 --- a/site/public/docs/intent.html +++ b/site/public/docs/intent.html @@ -49,6 +49,7 @@ Remote magpie Docker Privacy + Privacy masking Add to magpie Integrate Releases @@ -326,6 +327,7 @@ The number of its kind (0 for none): Remote magpie Docker Privacy + Privacy masking Add to magpie Integrate GitHub diff --git a/site/public/docs/ja/docker.html b/site/public/docs/ja/docker.html index 20457ef44..8d9d2d93a 100644 --- a/site/public/docs/ja/docker.html +++ b/site/public/docs/ja/docker.html @@ -49,6 +49,7 @@ リモート magpie Docker プライバシー + プライバシーマスキング magpie に追加 アプリ連携 リリース @@ -219,6 +220,7 @@ docker logs magpie リモート magpie Docker プライバシー + プライバシーマスキング magpie に追加 アプリ連携 GitHub diff --git a/site/public/docs/ja/import.html b/site/public/docs/ja/import.html index 9d865a5e0..0b5ee7bfd 100644 --- a/site/public/docs/ja/import.html +++ b/site/public/docs/ja/import.html @@ -49,6 +49,7 @@ リモート magpie Docker プライバシー + プライバシーマスキング magpie に追加 アプリ連携 リリース @@ -263,6 +264,7 @@ href = "https://usemagpie.ai/import#" + urlencode({ リモート magpie Docker プライバシー + プライバシーマスキング GitHub Discord リリース diff --git a/site/public/docs/ja/intent.html b/site/public/docs/ja/intent.html index de4fa710e..1295d6aa8 100644 --- a/site/public/docs/ja/intent.html +++ b/site/public/docs/ja/intent.html @@ -49,6 +49,7 @@ リモート magpie Docker プライバシー + プライバシーマスキング magpie に追加 アプリ連携 リリース @@ -326,6 +327,7 @@ The number of its kind (0 for none): リモート magpie Docker プライバシー + プライバシーマスキング magpie に追加 アプリ連携 GitHub diff --git a/site/public/docs/ja/masking.html b/site/public/docs/ja/masking.html new file mode 100644 index 000000000..b1a3df8e9 --- /dev/null +++ b/site/public/docs/ja/masking.html @@ -0,0 +1,201 @@ + + + + + +プライバシーマスキング · magpie ドキュメント + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

ドキュメント · プライバシーマスキング

+

プライバシーマスキング

+

magpie は、エージェントが送る内容をこのコンピュータから出る前にマスクできます。API キー、パスワード、トークン、そして選べばメールアドレス、電話番号、自分で決めた語が、{{API_KEY_es6eu6jk}} のようなプレースホルダーとしてベンダーに送られます。応答の中のプレースホルダーは元の値に戻るので、エージェントとファイルには本物の値が残り、ベンダーには見えません。処理はこのコンピュータの magpie のゲートウェイで行われ、既定ではオフです。

+ +
magpie を通る内容だけが対象です。magpie に接続したエージェントはゲートウェイ経由でリクエストを送り、どのプロバイダやアカウントが答えてもマスクされます。magpie を通さずベンダーに直接送るエージェントは対象外です。
+ +

オンにする

+
    +
  1. ページを開く設定 → プライバシー を開きます。
  2. +
  3. シークレットをマスクマスクするもの の シークレットをマスク を オン にします。API キー、秘密鍵、トークン、パスワードが対象です。
  4. +
  5. 必要なら個人情報も個人情報をマスク を オン にすると、メールアドレス、電話番号、ID 番号、銀行カード番号もマスクされます。オンにすると、その下に個人情報の種類ごとのスイッチが並びます。
  6. +
  7. 自分の語マスクする語 に、ベンダーに見せたくない名前、コードネーム、ホスト名をカンマ区切りで入れます。マスクする語の大文字・小文字を区別しない をオンにすると、Nightjar で NIGHTJAR もマスクされます。magpie が知らないシークレット(自分のゲートウェイのキーなど)は マスクルール に、先頭の文字列か正規表現で追加します。
  8. +
  9. 試す試す にテキストを貼ると、ベンダーが実際に受け取る内容が表示されます。貼った内容は保存されません。
  10. +
+

変更は次のリクエストから効き、再起動もエージェント側の変更もいりません。実際にマスクするのは組み込みプラグイン プライバシーマスキング(redact、設定 → プラグイン)で、何かのマスクが求められている間は常にオンです。

+

専用の CLI コマンドはありません。ウィンドウがないとき(magpie serve、Docker)は magpie web で同じページを開くか、~/.config/magpie/settings.json(Docker では /config/magpie/settings.json)に書きます。ファイルはリクエストごとに読み直されます。

+
+ settings.json + +
{
+  "redact": true,
+  "redactPersonal": true,
+  "redactWords": ["Nightjar", "db.acme-corp.cn"]
+}
+
+ +

マスクされるもの

+
+ + + + + +
スイッチ見つけるもの
シークレットをマスク秘密鍵のブロック(-----BEGIN … PRIVATE KEY-----)。形で見分ける API キー:sk-…(OpenAI、Anthropic、OpenRouter)、ghp_/github_pat_、glpat-、AIza…、xox…-、sk_live_、AKIA/ASIA、hf_、gsk_、xai-、npm_、pypi-、dop_v1_、SG.、それに oc_sk_… のような中継サービスのキー。JWT。user:password@host のパスワード。.env や設定ファイルでシークレットの名前が付いたフィールドの値:DB_PASSWORD=…、api_key: …、client_secret、token、credential。それと自分の マスクルール。
個人情報をマスクメールアドレス、中国本土の携帯番号、チェックサムの合う中国の身分証番号と銀行カード番号。既定でオンのもの:米国の社会保障番号、パスポート番号(passport、护照、パスポートの後)、IBAN、誕生日(birthday、DOB、生日の近く)、MAC アドレス、シリアル番号(S/N の後)。エージェントがほぼ毎回送るので、自分でオンにするまでオフのもの:ホームフォルダのユーザー名、ユーザー名とコンピュータ名(user@host)、パブリック IP アドレス、クラウドストレージのバケット。
マスクする語入れた語そのままを {{TERM_…}} に。
ローカルモデルで検出検出方法 の中にあります。このコンピュータで動くモデル(OpenAI の Privacy Filter、1.6 GB のダウンロード)が、ルールでは見つからない自由文中の名前や住所を見つけます。シークレットをマスク か 個人情報をマスク がオンのときに使え、見つけたものは同じスイッチに従います。
+

プレースホルダーは「種類 + 鍵付きハッシュの 8 文字」です。同じ値はいつも同じプレースホルダーになるので、会話は毎ターン同じに読め、ベンダーのプロンプトキャッシュも有効なままです。値はメモリにだけ置かれます。

+ +

例

+

シークレットをマスク と 個人情報をマスク をオンにし、マスクする語 に Nightjar を入れた状態で、エージェントがこう送ったとします。

+
+ エージェントが送る内容 +
Deploy Nightjar with OPENAI_API_KEY=sk-proj-8fK2mQx7Lp4Rt9Vw3Yz6Ab1Cd, then mail li.wei@acme-corp.cn or call 13800138000.
+
+
+ ベンダーが受け取る内容 +
Deploy {{TERM_5hmsrhdc}} with OPENAI_API_KEY={{API_KEY_srhjgvja}}, then mail {{EMAIL_eh5um6mb}} or call {{PHONE_uf7iy2qq}}.
+
+

モデルが 「.env の OPENAI_API_KEY を {{API_KEY_srhjgvja}} にしました」 と答えると、エージェントにはストリームのテキストでもツール呼び出しの引数でも本物のキーが届き、書き込むファイルにも本物のキーが入ります。モデルが少し書き換えたプレースホルダー(波括弧の中の空白、大文字・小文字の違い)も元に戻ります。

+ +

効いているか確かめる

+ +

記録は ~/.config/magpie/masking に 30 日間残ります。エージェント、プロバイダ、モデル、各プレースホルダーの種類、長さ、先頭の数文字だけで、値そのものは残りません。

+ +

値が見つかったとき

+

値が見つかったとき で、種類ごとに選べます。

+ +

タスクでそのまま使う必要のある値(チームのアドレス、テスト用のキー)は マスクしない に入れます。値全体が一致すれば、そのまま送られます。

+ +

対象外のものと制限

+ +

magpie が自分で送るものは プライバシー を参照してください。コードは internal/redact と internal/masking です。

+
+
+ + + + + + + diff --git a/site/public/docs/ja/plugins.html b/site/public/docs/ja/plugins.html index f706dc5be..0d853a1ec 100644 --- a/site/public/docs/ja/plugins.html +++ b/site/public/docs/ja/plugins.html @@ -49,6 +49,7 @@ リモート magpie Docker プライバシー + プライバシーマスキング magpie に追加 アプリ連携 リリース @@ -960,6 +961,7 @@ document.getElementById("calls").textContent = `${s.calls リモート magpie Docker プライバシー + プライバシーマスキング magpie に追加 アプリ連携 GitHub diff --git a/site/public/docs/ja/privacy.html b/site/public/docs/ja/privacy.html index 2e35214b9..c806caf45 100644 --- a/site/public/docs/ja/privacy.html +++ b/site/public/docs/ja/privacy.html @@ -49,6 +49,7 @@ リモート magpie Docker プライバシー + プライバシーマスキング magpie に追加 アプリ連携 リリース @@ -197,6 +198,7 @@
  • 値はメモリにだけ置かれ、ディスク上の記録は種類、長さ、先頭の数文字だけ。マスクがオンなのに動かないときは、リクエストは 503 になり、何も送られません。
  • モデルに見えるのはプレースホルダーで、値そのものではありません。そのまま使う必要のある値(チームのアドレス、テスト用のキー)は マスクしない に入れてください。
  • +

    オンにする方法、各スイッチがマスクするもの、例、効いているかの確かめ方は プライバシーマスキング へ。

    カウントが既定でオンの理由

    magpie は何十ものエージェントとプロバイダーに対応し、少人数で保守しています。毎日のカウントは、実際に使われているものを知り、それを優先して動くように保つための手段です。リリース版で既定オンなのは、自分でオンにする人の数だけでは少なすぎて、それがわからないからです。その代わり、送るものは小さく保っています。ランダムな ID、組み込みの ID、数だけです。スイッチ 1 つか DO_NOT_TRACK=1 でオフにでき、ソースからのビルドは送らず、送るものはすべてこのページに挙げています。

    @@ -213,6 +215,7 @@ リモート magpie Docker プライバシー + プライバシーマスキング magpie に追加 アプリ連携 GitHub diff --git a/site/public/docs/ja/remote.html b/site/public/docs/ja/remote.html index 94f579512..b0ae5c9dd 100644 --- a/site/public/docs/ja/remote.html +++ b/site/public/docs/ja/remote.html @@ -49,6 +49,7 @@ リモート magpie Docker プライバシー + プライバシーマスキング magpie に追加 アプリ連携 リリース @@ -155,6 +156,7 @@ magpie provider refresh office # 一覧を再取得リモート magpie Docker プライバシー + プライバシーマスキング magpie に追加 アプリ連携 GitHub diff --git a/site/public/docs/ja/start.html b/site/public/docs/ja/start.html index 0abc15e0d..6539c4c9a 100644 --- a/site/public/docs/ja/start.html +++ b/site/public/docs/ja/start.html @@ -49,6 +49,7 @@ リモート magpie Docker プライバシー + プライバシーマスキング magpie に追加 アプリ連携 リリース @@ -325,6 +326,7 @@ IP-CIDR6,::1/128,DIRECT,no-resolve リモート magpie Docker プライバシー + プライバシーマスキング magpie に追加 アプリ連携 GitHub diff --git a/site/public/docs/masking.html b/site/public/docs/masking.html new file mode 100644 index 000000000..474fdeec5 --- /dev/null +++ b/site/public/docs/masking.html @@ -0,0 +1,201 @@ + + + + + +Privacy masking · magpie docs + + + + + + + + + + + + + + + + + + + + + +
    + + +
    +

    Docs · Privacy masking

    +

    Privacy masking

    +

    magpie can mask what your agents send before it leaves this computer. API keys, passwords and tokens, and when you ask, emails, phone numbers and words of your own, go to the vendor as placeholders such as {{API_KEY_es6eu6jk}}. In the reply each placeholder turns back into its value, so your agent and your files keep the real thing and the vendor never sees it. It runs on this computer, in magpie’s gateway, and is off by default.

    + +
    It covers what goes through magpie. An agent connected to magpie sends its requests through the gateway, and they are masked whichever provider or account answers. An agent that calls a vendor directly, not through magpie, is not covered.
    + +

    Turn it on

    +
      +
    1. Open the pageGo to Settings → Privacy.
    2. +
    3. Mask secretsUnder What to mask, set Mask secrets to On: API keys, private keys, tokens and passwords.
    4. +
    5. Personal data, if you want itSet Mask personal data to On for emails, phone numbers, ID and bank card numbers. Each further kind of personal data then gets its own switch below it.
    6. +
    7. Your own wordsIn Masked words, list names, codenames or hosts to keep from vendors, separated by commas. Masked words in any case makes Nightjar mask NIGHTJAR too. A secret magpie doesn’t know, such as your gateway’s own keys, goes under Masking rules: what it starts with, or a regular expression.
    8. +
    9. Try itPaste a text into Try it to see exactly what the vendor would get. What you paste there isn’t kept.
    10. +
    +

    It applies from the next request, with no restart and nothing to change in your agent. The work is done by the built-in plugin Privacy masking (redact, in Settings → Plugins), which is on whenever any masking is asked for.

    +

    There is no CLI command for it. Without the window (magpie serve, Docker), open the same page with magpie web, or set it in ~/.config/magpie/settings.json (/config/magpie/settings.json in Docker). The masker reads the file on every request:

    +
    + settings.json + +
    {
    +  "redact": true,
    +  "redactPersonal": true,
    +  "redactWords": ["Nightjar", "db.acme-corp.cn"]
    +}
    +
    + +

    What is masked

    +
    + + + + + +
    SwitchWhat it finds
    Mask secretsPrivate key blocks (-----BEGIN … PRIVATE KEY-----). API keys by their shape: sk-… (OpenAI, Anthropic, OpenRouter), ghp_/github_pat_, glpat-, AIza…, xox…-, sk_live_, AKIA/ASIA, hf_, gsk_, xai-, npm_, pypi-, dop_v1_, SG., and relay keys like oc_sk_…. JWTs. The password in user:password@host. The value of a field named for a secret, as .env files and configs have them: DB_PASSWORD=…, api_key: …, client_secret, token, credential. Your own Masking rules.
    Mask personal dataEmails, mainland China mobile numbers, Chinese ID numbers and bank card numbers whose checksum adds up. Also on by default: US Social Security numbers, passport numbers (after passport, 护照 or パスポート), IBANs, birthdays (next to birthday, DOB or 生日), MAC addresses and serial numbers (after S/N). Off until you turn them on, since agents send them in nearly every request: the user name in home folders, user and computer names (user@host), public IP addresses and cloud storage buckets.
    Masked wordsEach word you listed, exactly, as {{TERM_…}}.
    Find with a local modelUnder How it’s found. A model on this computer (OpenAI’s Privacy Filter, a 1.6 GB download) finds what no rule can: a name or an address in free text. It needs Mask secrets or Mask personal data on, and finds under the same switches.
    +

    A placeholder is the kind plus eight characters of a keyed hash. The same value gets the same placeholder every time, so the conversation reads the same turn after turn and the vendor’s prompt cache stays valid. The values are held in memory only.

    + +

    An example

    +

    With Mask secrets and Mask personal data on and Nightjar in Masked words, your agent sends:

    +
    + Your agent sends +
    Deploy Nightjar with OPENAI_API_KEY=sk-proj-8fK2mQx7Lp4Rt9Vw3Yz6Ab1Cd, then mail li.wei@acme-corp.cn or call 13800138000.
    +
    +
    + The vendor gets +
    Deploy {{TERM_5hmsrhdc}} with OPENAI_API_KEY={{API_KEY_srhjgvja}}, then mail {{EMAIL_eh5um6mb}} or call {{PHONE_uf7iy2qq}}.
    +
    +

    When the model answers “I set OPENAI_API_KEY to {{API_KEY_srhjgvja}} in .env”, your agent reads the real key there, in streamed text and tool-call arguments alike, so the file it writes has the real key. A placeholder the model rewrote a little (spaces inside the braces, another case) is still turned back.

    + +

    Check that it works

    + +

    The records are kept in ~/.config/magpie/masking for 30 days: the agent, provider, model, and each placeholder’s kind, length and first characters, never the value.

    + +

    When a value is found

    +

    Under When a value is found, choose per kind:

    + +

    A value the task needs as it is, such as a team address or a test key, goes in Never mask: it is sent as written wherever it is found whole.

    + +

    What it leaves alone, and limits

    + +

    See also Privacy for everything magpie sends by itself. The code is internal/redact and internal/masking.

    +
    +
    + + + + + + + diff --git a/site/public/docs/plugins.html b/site/public/docs/plugins.html index 4b6a47061..7bcec33bc 100644 --- a/site/public/docs/plugins.html +++ b/site/public/docs/plugins.html @@ -49,6 +49,7 @@ Remote magpie Docker Privacy + Privacy masking Add to magpie Integrate Releases @@ -960,6 +961,7 @@ document.getElementById("calls").textContent = `${s.calls Remote magpie Docker Privacy + Privacy masking Add to magpie Integrate GitHub diff --git a/site/public/docs/privacy.html b/site/public/docs/privacy.html index 87623b3aa..4873f9a46 100644 --- a/site/public/docs/privacy.html +++ b/site/public/docs/privacy.html @@ -49,6 +49,7 @@ Remote magpie Docker Privacy + Privacy masking Add to magpie Integrate Releases @@ -197,6 +198,7 @@
  • Values are held in memory only; the record on disk keeps each value’s kind, length and first characters. If masking is on and can’t run, the request gets a 503 and nothing is sent.
  • The model sees the placeholder, not the value. A value a task needs as it is (a team address, a test key) goes under Never mask.
  • +

    How to turn it on, what each switch masks, an example and how to check it: Privacy masking.

    Why the count is on

    magpie works with dozens of agents and providers, and is maintained by a small team. The daily count is how we know which of them people actually use, so they are kept working first. It is on in releases because counts from those who turn it on would be too few to tell that. In exchange it is kept small: a random id, built-in ids, numbers; one switch or DO_NOT_TRACK=1 turns it off, builds from source never send it, and this page lists everything that goes.

    @@ -213,6 +215,7 @@ Remote magpie Docker Privacy + Privacy masking Add to magpie Integrate GitHub diff --git a/site/public/docs/remote.html b/site/public/docs/remote.html index d88d69995..76e2da152 100644 --- a/site/public/docs/remote.html +++ b/site/public/docs/remote.html @@ -49,6 +49,7 @@ Remote magpie Docker Privacy + Privacy masking Add to magpie Integrate Releases @@ -155,6 +156,7 @@ magpie provider refresh office # fetch its list againRemote magpie Docker Privacy + Privacy masking Add to magpie Integrate GitHub diff --git a/site/public/docs/start.html b/site/public/docs/start.html index 5d31995b0..49acbeee5 100644 --- a/site/public/docs/start.html +++ b/site/public/docs/start.html @@ -49,6 +49,7 @@ Remote magpie Docker Privacy + Privacy masking Add to magpie Integrate Releases @@ -325,6 +326,7 @@ IP-CIDR6,::1/128,DIRECT,no-resolve Remote magpie Docker Privacy + Privacy masking Add to magpie Integrate GitHub diff --git a/site/public/docs/zh/docker.html b/site/public/docs/zh/docker.html index 1adbd5d00..cd76a175a 100644 --- a/site/public/docs/zh/docker.html +++ b/site/public/docs/zh/docker.html @@ -49,6 +49,7 @@ 远程 magpie Docker 隐私 + 本地脱敏 Add to magpie 接入应用 版本发布 @@ -219,6 +220,7 @@ docker logs magpie 远程 magpie Docker 隐私 + 本地脱敏 Add to magpie 接入应用 GitHub diff --git a/site/public/docs/zh/import.html b/site/public/docs/zh/import.html index 76b45f50e..8ff49f1fe 100644 --- a/site/public/docs/zh/import.html +++ b/site/public/docs/zh/import.html @@ -49,6 +49,7 @@ 远程 magpie Docker 隐私 + 本地脱敏 Add to magpie 接入应用 版本发布 @@ -263,6 +264,7 @@ href = "https://usemagpie.ai/import#" + urlencode({ 远程 magpie Docker 隐私 + 本地脱敏 GitHub Discord 版本发布 diff --git a/site/public/docs/zh/integrate.html b/site/public/docs/zh/integrate.html index 4ea3cae2f..3f38bf66b 100644 --- a/site/public/docs/zh/integrate.html +++ b/site/public/docs/zh/integrate.html @@ -48,6 +48,7 @@ 远程 magpie Docker 隐私 + 本地脱敏 Add to magpie 接入应用 版本发布 @@ -154,6 +155,7 @@ curl -s http://127.0.0.1:3425/v1/models -H "Authorization: Bearer magpie-acme"远程 magpie Docker 隐私 + 本地脱敏 Add to magpie 接入应用 GitHub diff --git a/site/public/docs/zh/intent.html b/site/public/docs/zh/intent.html index 0ddeb2753..41e2aefb6 100644 --- a/site/public/docs/zh/intent.html +++ b/site/public/docs/zh/intent.html @@ -49,6 +49,7 @@ 远程 magpie Docker 隐私 + 本地脱敏 Add to magpie 接入应用 版本发布 @@ -326,6 +327,7 @@ The number of its kind (0 for none): 远程 magpie Docker 隐私 + 本地脱敏 Add to magpie 接入应用 GitHub diff --git a/site/public/docs/zh/masking.html b/site/public/docs/zh/masking.html new file mode 100644 index 000000000..01c5bd342 --- /dev/null +++ b/site/public/docs/zh/masking.html @@ -0,0 +1,201 @@ + + + + + +本地脱敏 · magpie 文档 + + + + + + + + + + + + + + + + + + + + + +
    + + +
    +

    文档 · 本地脱敏

    +

    本地脱敏

    +

    magpie 可以在 Agent 发出的请求离开这台电脑之前先做脱敏。API Key、密码和 Token,以及你选择的邮箱、手机号和自定义词,会以 {{API_KEY_es6eu6jk}} 这样的占位符发给模型厂商;回复里的占位符再换回原值,所以 Agent 和你的文件里始终是真值,厂商看不到。脱敏在这台电脑上、在 magpie 的网关里完成,默认关闭。

    + +
    只覆盖经过 magpie 的请求。接入 magpie 的 Agent 通过网关发请求,不管由哪个供应商或账号回答都会脱敏。绕过 magpie、直接请求厂商的 Agent 不在范围内。
    + +

    打开它

    +
      +
    1. 打开页面进入 设置 → 隐私。
    2. +
    3. 脱敏密钥在 要遮什么 下把 脱敏密钥 设为 开启:API Key、私钥、Token 和密码。
    4. +
    5. 个人信息(按需)把 脱敏个人信息 设为 开启,邮箱、手机号、身份证号和银行卡号也一并脱敏。打开后,下面会列出其他各类个人信息,每类有自己的开关。
    6. +
    7. 自定义词在 脱敏词 里填不想让厂商看到的人名、项目代号或主机名,用逗号分隔。脱敏词不区分大小写 打开后,Nightjar 也会遮掉 NIGHTJAR。magpie 不认识的密钥(比如你自己网关的 key)加到 自定义脱敏规则:填它的开头,或一个正则表达式。
    8. +
    9. 试一试把一段文字粘到 试一试,就能看到厂商实际会收到什么。粘进去的内容不会保存。
    10. +
    +

    改动从下一个请求开始生效,不用重启,Agent 那边也不用改。实际做脱敏的是内置插件 隐私遮盖(redact,在 设置 → 插件),只要设置里要求了任何脱敏,它就是开着的。

    +

    没有专门的命令行命令。没有窗口时(magpie serve、Docker),可以用 magpie web 打开同一个页面,或者直接写 ~/.config/magpie/settings.json(Docker 里是 /config/magpie/settings.json)。每个请求都会重新读这个文件:

    +
    + settings.json + +
    {
    +  "redact": true,
    +  "redactPersonal": true,
    +  "redactWords": ["Nightjar", "db.acme-corp.cn"]
    +}
    +
    + +

    会遮掉什么

    +
    + + + + + +
    开关能找到什么
    脱敏密钥私钥块(-----BEGIN … PRIVATE KEY-----)。按格式识别的 API Key:sk-…(OpenAI、Anthropic、OpenRouter)、ghp_/github_pat_、glpat-、AIza…、xox…-、sk_live_、AKIA/ASIA、hf_、gsk_、xai-、npm_、pypi-、dop_v1_、SG.,以及 oc_sk_… 这类中转站的 key。JWT。user:password@host 里的密码。.env 和配置文件里以密钥命名的字段的值:DB_PASSWORD=…、api_key: …、client_secret、token、credential。以及你的 自定义脱敏规则。
    脱敏个人信息邮箱、中国大陆手机号、校验位对得上的身份证号和银行卡号。默认也开着的:美国社会安全号、护照号(跟在 passport、护照或パスポート后面)、IBAN、生日(旁边有 birthday、DOB 或「生日」)、MAC 地址、序列号(跟在 S/N 后面)。默认关闭、需要自己打开的(Agent 几乎每个请求都会带):主目录里的用户名、用户名和主机名(user@host)、公网 IP 地址、云存储桶。
    脱敏词你填的每个词,精确匹配,换成 {{TERM_…}}。
    用本地模型查找在 怎么找 下面。一个在这台电脑上运行的模型(OpenAI 的 Privacy Filter,下载 1.6 GB)能找出规则找不到的东西:自由文本里的人名、地址。需要先打开 脱敏密钥 或 脱敏个人信息,找到的内容按同样的开关处理。
    +

    占位符是「类型 + 8 位带密钥的哈希」。同一个值每次得到同一个占位符,所以对话每一轮读起来都一样,厂商的提示词缓存也不会失效。原值只保存在内存里。

    + +

    一个例子

    +

    打开 脱敏密钥 和 脱敏个人信息,并在 脱敏词 里填 Nightjar。Agent 发出:

    +
    + Agent 发出 +
    Deploy Nightjar with OPENAI_API_KEY=sk-proj-8fK2mQx7Lp4Rt9Vw3Yz6Ab1Cd, then mail li.wei@acme-corp.cn or call 13800138000.
    +
    +
    + 厂商收到 +
    Deploy {{TERM_5hmsrhdc}} with OPENAI_API_KEY={{API_KEY_srhjgvja}}, then mail {{EMAIL_eh5um6mb}} or call {{PHONE_uf7iy2qq}}.
    +
    +

    模型回复 “我已在 .env 里把 OPENAI_API_KEY 设为 {{API_KEY_srhjgvja}}” 时,Agent 读到的是真实的 key,流式文本和工具调用参数里都一样,所以它写进文件的也是真 key。模型把占位符稍微改了样子(花括号里加了空格、大小写变了)也照样能换回来。

    + +

    怎么确认生效

    + +

    记录保存在 ~/.config/magpie/masking,保留 30 天:Agent、供应商、模型,以及每个占位符的类型、长度和开头几个字符,从不保存原值。

    + +

    发现敏感值时

    +

    在 发现敏感值时 下,每种类型可以选:

    + +

    任务必须原样使用的值(团队邮箱、测试用的 key)加进 从不脱敏:只要整段匹配,就原样发出。

    + +

    不处理的内容与限制

    + +

    magpie 自己会发出什么,见 隐私。代码在 internal/redact 和 internal/masking。

    +
    +
    + + + + + + + diff --git a/site/public/docs/zh/plugins.html b/site/public/docs/zh/plugins.html index 54ae61cf0..e5da154ec 100644 --- a/site/public/docs/zh/plugins.html +++ b/site/public/docs/zh/plugins.html @@ -49,6 +49,7 @@ 远程 magpie Docker 隐私 + 本地脱敏 Add to magpie 接入应用 版本发布 @@ -960,6 +961,7 @@ document.getElementById("calls").textContent = `${s.calls 远程 magpie Docker 隐私 + 本地脱敏 Add to magpie 接入应用 GitHub diff --git a/site/public/docs/zh/privacy.html b/site/public/docs/zh/privacy.html index 57d7c1b0d..b5efa65cb 100644 --- a/site/public/docs/zh/privacy.html +++ b/site/public/docs/zh/privacy.html @@ -49,6 +49,7 @@ 远程 magpie Docker 隐私 + 本地脱敏 Add to magpie 接入应用 版本发布 @@ -197,6 +198,7 @@
  • 原值只在内存里;磁盘上的记录只留每个值的类型、长度和开头几个字符。脱敏打开却运行不了时,请求返回 503,什么都不发。
  • 模型看到的是占位符,不是值本身。任务需要原样使用的值(团队邮箱、测试用的 key)可以加进 从不脱敏。
  • +

    怎么打开、每个开关遮掉什么、例子以及怎么确认生效,见 本地脱敏。

    为什么计数默认开启

    magpie 支持几十个 agent 和供应商,维护的人不多。每日计数让我们知道大家实际在用哪些,好先保证它们能用。正式版默认开启,是因为只靠主动开启的人,数量太少,看不出这些。作为交换,它尽量少:一个随机 ID、内置 ID 和数字;一个开关或 DO_NOT_TRACK=1 就能关掉,源码构建从不发送,发送的全部内容都列在这一页。

    @@ -213,6 +215,7 @@ 远程 magpie Docker 隐私 + 本地脱敏 Add to magpie 接入应用 GitHub diff --git a/site/public/docs/zh/remote.html b/site/public/docs/zh/remote.html index 9b90d5471..884b1beb5 100644 --- a/site/public/docs/zh/remote.html +++ b/site/public/docs/zh/remote.html @@ -49,6 +49,7 @@ 远程 magpie Docker 隐私 + 本地脱敏 Add to magpie 接入应用 版本发布 @@ -155,6 +156,7 @@ magpie provider refresh office # 重新获取列表远程 magpie Docker 隐私 + 本地脱敏 Add to magpie 接入应用 GitHub diff --git a/site/public/docs/zh/start.html b/site/public/docs/zh/start.html index bb2363fed..30dae0e76 100644 --- a/site/public/docs/zh/start.html +++ b/site/public/docs/zh/start.html @@ -49,6 +49,7 @@ 远程 magpie Docker 隐私 + 本地脱敏 Add to magpie 接入应用 版本发布 @@ -325,6 +326,7 @@ IP-CIDR6,::1/128,DIRECT,no-resolve 远程 magpie Docker 隐私 + 本地脱敏 Add to magpie 接入应用 GitHub