diff --git a/internal/redact/cloudflare_test.go b/internal/redact/cloudflare_test.go
new file mode 100644
index 000000000..4c732bb1a
--- /dev/null
+++ b/internal/redact/cloudflare_test.go
@@ -0,0 +1,79 @@
+package redact
+
+import (
+ "strings"
+ "testing"
+)
+
+// Fake credentials in Cloudflare's documented shapes
+// (developers.cloudflare.com/fundamentals/api/get-started/token-formats,
+// .../ca-keys, and cloudflared's tunnel token, which is base64 of
+// {"a":account,"t":tunnel,"s":secret}).
+const (
+ cfUserTok = "cfut_Kq3vXm9ZpL2wRt7YbN4cHd8sJf6GaE1uVoTi5MxA" + "9f3c1b7e"
+ cfAcctTok = "cfat_Zr8dQw2LmN5vXc7BtY1pHk4sJg6FaE3uVoTi9MxP" + "02a8d4c6"
+ cfGlobalNew = "cfk_Hb4nXw7ZpL2qRt9YcN3vMd8sJf6GaE1uKoTi5MyQ" + "5e1b7a90"
+ cfOriginCA = "v1.0-3f9a1c7e5b2d4a6c8e0f1a2b-" + "4d6f8a0c2e4b6d8f0a1c3e5a7b9d1f3a5c7e9b1d3f5a7c9e1b3d5f7a9c1e3b5d7f9a1c3e5b7d9f1a3c5e7b9d1f3a5c7e9b1d3f5a7c9e1b3d5f7a9c1e3b5d7f"
+ cfTunnelTok = "eyJhIjoiMGE0YzNmOWU3YjFkMmM2ZThmNWE5MDQ3YjNjMWUyZDQiLCJ0IjoiN2M5ZTFiM2EtNGQ2Zi00YThjLTllMGYtMWEyYjNjNGQ1ZTZmIiwicyI6IlpYaGhiWEJzWlhObFkzSmxkSFpoYkhWbE1USXpORFUyTnpnNU1BPT0ifQ=="
+ cfGlobalOld = "c2547eb745079dac9320b638f5e225cf483cc" // 37 hex
+ cfLegacyTok = "8M7wS6hCpXQ5QeL2Ek4xj3Bt9nVa1uRyZfDgHi0O" // 40 alnum
+ cfR2KeyID = "9d1f3b5a7c2e4a6c8e0b1d3f5a7c9e2b" // 32 hex
+ cfR2Secret = "a3f5c7e9b1d3f5a7c9e1b3d5f7a9c1e3b5d7f9a1c3e5b7d9f1a3c5e7b9d1f3a5" // 64 hex
+)
+
+func TestCloudflareCredentials(t *testing.T) {
+ cases := []struct{ name, in, gone string }{
+ {"user token", "token is " + cfUserTok + " ok", cfUserTok},
+ {"account token", "use " + cfAcctTok + ".", cfAcctTok},
+ {"global key", "key=" + cfGlobalNew, cfGlobalNew},
+ {"origin ca", "X-Auth-User-Service-Key: " + cfOriginCA, cfOriginCA},
+ {"origin ca bare", "see " + cfOriginCA + " here", cfOriginCA},
+ {"wrangler oauth", "cfoat_" + strings.Repeat("aB3dE5gH7j", 5) + "12345678", "cfoat_"},
+ {"tunnel token flag", "cloudflared tunnel run --token " + cfTunnelTok, cfTunnelTok},
+ {"tunnel token env", "TUNNEL_TOKEN=" + cfTunnelTok, cfTunnelTok},
+ {"tunnel token bare", "run " + cfTunnelTok + " now", cfTunnelTok},
+ {"legacy token env", "CLOUDFLARE_API_TOKEN=" + cfLegacyTok, cfLegacyTok},
+ {"legacy token cf", "CF_API_TOKEN: " + cfLegacyTok, cfLegacyTok},
+ {"bearer", "curl -H 'Authorization: Bearer " + cfLegacyTok + "' https://api.cloudflare.com/client/v4/user/tokens/verify", cfLegacyTok},
+ {"global key header", "curl -H 'X-Auth-Key: " + cfGlobalOld + "' -H 'X-Auth-Email: a@b.co'", cfGlobalOld},
+ {"global key env", "CLOUDFLARE_API_KEY=" + cfGlobalOld, cfGlobalOld},
+ {"r2 secret env", "R2_SECRET_ACCESS_KEY=" + cfR2Secret, cfR2Secret},
+ {"r2 aws env", "AWS_ACCESS_KEY_ID=" + cfR2KeyID + "\nAWS_SECRET_ACCESS_KEY=" + cfR2Secret + "\nendpoint https://acc.r2.cloudflarestorage.com", cfR2Secret},
+ {"origin ca env", "CLOUDFLARE_ORIGIN_CA_KEY=" + cfOriginCA, cfOriginCA},
+ }
+ for _, c := range cases {
+ out, n := Mask(c.in, Options{Secrets: true})
+ if strings.Contains(unmarked(out), c.gone) || n == 0 {
+ t.Errorf("%s: not masked (%d): %q", c.name, n, out)
+ }
+ }
+}
+
+func TestCloudflareLookalikesKept(t *testing.T) {
+ sha1 := "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+ sha256 := "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+ md5 := "d41d8cd98f00b204e9800998ecf8427e"
+ b62 := "Zm9vYmFyYmF6cXV4Z3JhdWx0aGVsbG93b3JsZDEyMzQ1Ng"
+ for _, in := range []string{
+ "commit " + sha1,
+ "sha256: " + sha256,
+ "etag " + md5,
+ "digest " + sha256 + " and " + sha1,
+ "id " + b62,
+ "version v1.0-beta.2 released, v1.0-rc1",
+ "cloudflare zone id " + md5 + " in the dashboard",
+ "cf account " + cfR2KeyID,
+ "R2_ACCESS_KEY_ID=" + cfR2KeyID,
+ "AWS_ACCESS_KEY_ID=" + cfR2KeyID,
+ "cfut_ is the prefix of user tokens",
+ "cfk_short",
+ "Image digest sha256:" + sha256,
+ "CLOUDFLARE_ACCOUNT_ID=" + cfR2KeyID,
+ "eyJhbGciOiJub25lIn0 is a jwt header",
+ } {
+ out, n := Mask(in, Options{Secrets: true})
+ if n != 0 || out != in {
+ t.Errorf("masked a lookalike: %q -> %q", in, out)
+ }
+ }
+}
diff --git a/internal/redact/redact.go b/internal/redact/redact.go
index 7b24c5070..9f8da9fa6 100644
--- a/internal/redact/redact.go
+++ b/internal/redact/redact.go
@@ -182,6 +182,25 @@ var rules = append([]rule{
{kind: "API_KEY", re: lazyre.New(`(?:AKIA|ASIA)[0-9A-Z]{16}`), markers: []string{"AKIA", "ASIA"}, bound: alnum},
{kind: "API_KEY", re: lazyre.New(`(?:hf_[A-Za-z0-9]{30,}|gsk_[A-Za-z0-9]{40,}|xai-[A-Za-z0-9]{40,}|npm_[A-Za-z0-9]{36}|pypi-[A-Za-z0-9_-]{50,}|dop_v1_[a-f0-9]{64}|SG\.[A-Za-z0-9_-]{22}\.[A-Za-z0-9_-]{43})`),
markers: []string{"hf_", "gsk_", "xai-", "npm_", "pypi-", "dop_v1_", "SG."}, bound: tokenCh},
+ // Cloudflare's: the scannable prefixes of a user token, an account
+ // token, a Global API Key and a Wrangler OAuth token (cfut_, cfat_,
+ // cfk_, cfoat_; 40 characters and a checksum,
+ // developers.cloudflare.com/fundamentals/api/get-started/token-formats),
+ // an Origin CA key (always v1.0-, two hex runs), and a tunnel token
+ // (base64 of {"a":account,"t":tunnel,"s":secret}, so it starts eyJhIjoi).
+ // The unprefixed older tokens and keys are 40 letters or 37 to 45 hex
+ // and have no shape of their own; they are masked by the name they sit
+ // under (secretNames).
+ {kind: "API_KEY", re: lazyre.New(`cf(?:ut|at|k|oat)_[A-Za-z0-9_-]{40,}`), markers: []string{"cfut_", "cfat_", "cfk_", "cfoat_"}, bound: tokenCh},
+ {kind: "API_KEY", re: lazyre.New(`v1\.0-[A-Za-z0-9]{16,}-[A-Za-z0-9]{40,}`), markers: []string{"v1.0-"}, bound: tokenCh},
+ {kind: "TOKEN", re: lazyre.New(`eyJhIjoi[A-Za-z0-9+/_-]{40,}={0,2}`), markers: []string{"eyJhIjoi"}, bound: tokenCh},
+ // X-Auth-Key (the Global API Key) and X-Auth-User-Service-Key (the
+ // Origin CA key) headers, whatever the key looks like
+ {kind: "SECRET", re: lazyre.New(`(?i)x-auth-(?:user-service-)?key["']?[ \t]*[:=][ \t]*["']?([A-Za-z0-9._-]{16,})`),
+ fold: []string{"x-auth-"}, ahead: 120, ok: notAVariable},
+ // An R2 Access Key ID (32 hex, the id of its API token) is an id and
+ // goes as written (TestIDsGoAsWritten); its Secret Access Key (64 hex)
+ // is masked under a secret's name.
{kind: "TOKEN", re: lazyre.New(`eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}`), markers: []string{"eyJ"}, bound: tokenCh},
// the password of user:password@host, or of :password@host as a Redis
// URL has it with no user
diff --git a/site/public/docs/ja/masking.html b/site/public/docs/ja/masking.html
index 971164070..17345dfa0 100644
--- a/site/public/docs/ja/masking.html
+++ b/site/public/docs/ja/masking.html
@@ -170,7 +170,7 @@
| スイッチ | 見つけるもの |
- | シークレットをマスク | 秘密鍵のブロック(-----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。それと自分の マスクルール。 ウォレットの秘密鍵も、ウォレットが書き出す形で探します:Bitcoin の WIF、BIP32 の xprv、Ethereum と TRON の 0x 鍵、Solana の鍵と id.json のキーペア、Sui の suiprivkey1…、Aptos の ed25519-priv-0x…、Stellar のシード、NEAR の ed25519:…、Nostr の nsec1…、age の ID、Zcash の拡張支払鍵、seed や ニーモニック の後の、どの語も BIP39 の単語リストにある 12〜25 語のシードフレーズ。決まった接頭辞のない鍵は検証を通ったときだけ置き換えます:WIF と xprv はチェックサム、Solana の鍵は後半の公開鍵、Stellar のシードは CRC で確かめるので、Solana のトランザクション署名はそのまま送られます。0x 鍵はトランザクションハッシュと同じ形なので、鍵の名前の後(PRIVATE_KEY=、--private-key、new Wallet(…)、私钥)でだけ置き換えます。ハッシュ、ストレージスロット、sha256 の値はそのまま送られます。取引所の API キー、シークレット、passphrase はフィールド名で置き換えます。 |
+ | シークレットをマスク | 秘密鍵のブロック(-----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.、Cloudflare のもの(cfut_、cfat_、cfk_、cfoat_、Origin CA v1.0-、Tunnel トークン)、それに oc_sk_… のような中継サービスのキー。JWT。user:password@host のパスワード。.env や設定ファイルでシークレットの名前が付いたフィールドの値:DB_PASSWORD=…、api_key: …、client_secret、token、credential。それと自分の マスクルール。 ウォレットの秘密鍵も、ウォレットが書き出す形で探します:Bitcoin の WIF、BIP32 の xprv、Ethereum と TRON の 0x 鍵、Solana の鍵と id.json のキーペア、Sui の suiprivkey1…、Aptos の ed25519-priv-0x…、Stellar のシード、NEAR の ed25519:…、Nostr の nsec1…、age の ID、Zcash の拡張支払鍵、seed や ニーモニック の後の、どの語も BIP39 の単語リストにある 12〜25 語のシードフレーズ。決まった接頭辞のない鍵は検証を通ったときだけ置き換えます:WIF と xprv はチェックサム、Solana の鍵は後半の公開鍵、Stellar のシードは CRC で確かめるので、Solana のトランザクション署名はそのまま送られます。0x 鍵はトランザクションハッシュと同じ形なので、鍵の名前の後(PRIVATE_KEY=、--private-key、new Wallet(…)、私钥)でだけ置き換えます。ハッシュ、ストレージスロット、sha256 の値はそのまま送られます。取引所の API キー、シークレット、passphrase はフィールド名で置き換えます。 |
| 個人情報をマスク | メールアドレス、中国本土の携帯番号(11 桁の ID は別:order_id の値や 订单号 の後ろのものはそのまま)、チェックサムの合う中国の身分証番号と銀行カード番号。既定でオンのもの:米国の社会保障番号、パスポート番号(passport、护照、パスポートの後)、IBAN、誕生日(birthday、DOB、生日の近くにある、一年以上前の日付。今日の日付はそのまま)、MAC アドレス、シリアル番号(S/N の後)。エージェントがほぼ毎回送るので、自分でオンにするまでオフのもの:ホームフォルダのユーザー名(毎回同じ仮の名前で送るので、モデルにはプレースホルダーではなく普通のフォルダに見えます)、ユーザー名とコンピュータ名(user@host)、パブリック IP アドレス(public-ip-kvxqmrtz のような名前として送るので、モデルはパブリックなアドレスだとわかったまま接続に使い、コマンドの中で本物のアドレスに戻ります)、クラウドストレージのバケット。ウォレットやコントラクトのアドレス(0x と 16 進 40 桁)は公開情報なのでそのまま送ります。秘密鍵は引き続きマスクします。 |
| マスクする語 | 入れた語そのままを {{TERM_…}} に。日付(1990-05-12 など)を入れると、同じ日のどの書き方もマスクされます:1990/5/12、1990.05.12、1990年5月12日、19900512、May 12, 1990。13/05/1990 のような日が先の書き方は、日と月を取り違えようがないときだけです。別の日付や 1990.5.12.1 のようなバージョン番号はマスクされません。 |
| ローカルモデルで検出 | 検出方法 の中にあります。このコンピュータで動くモデルが、ルールでは見つからない自由文中の名前や住所を見つけます。オフにしない限りオンで、最初にマスクするリクエストで AstrLink Guard をダウンロードします。ダウンロードが終わるまではルールだけでマスクします。シークレットをマスク か 個人情報をマスク がオンのときに使え、見つけたものは同じスイッチに従います。横のメニューでモデルを選べます:AstrLink Guard(中国語と英語、39 MB のダウンロード、コードでの誤検出が少ない、Mac では Neural Engine で動く。既定)か OpenAI の Privacy Filter(1.6 GB、GPU を使える、コード中の普通の値も多く隠す)。その下の 信頼度のしきい値 は、値をマスクするのにモデルがどれだけ確かである必要があるかです。既定は Privacy Filter が 0.5、AstrLink Guard が公開元の 0.8。上げると普通の値のマスクは減りますが、本物の名前や住所もそのまま送られやすくなります。誤検出の多くはモデルのあとのルールが既に外すので、既定値は測った中で本物の値を最も逃さない値です。 |
diff --git a/site/public/docs/masking.html b/site/public/docs/masking.html
index 456bb39b4..98da73d32 100644
--- a/site/public/docs/masking.html
+++ b/site/public/docs/masking.html
@@ -170,7 +170,7 @@
| Switch | What it finds |
- | Mask secrets | Private 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. Wallet private keys by the shape their wallets export: a Bitcoin WIF, a BIP32 xprv, an Ethereum or TRON 0x key, a Solana key or id.json keypair, a Sui suiprivkey1…, an Aptos ed25519-priv-0x…, a Stellar seed, a NEAR ed25519:… key, a Nostr nsec1…, an age identity, a Zcash extended spending key, and a 12 to 25 word seed phrase after seed or mnemonic whose every word is in the BIP39 list. A key with no prefix of its own is masked only when it checks out: a WIF or xprv by its checksum, a Solana key by its public half, a Stellar seed by its CRC, so a Solana transaction signature goes as written. A 0x key has the shape of a transaction hash, so it is masked only after a key’s name (PRIVATE_KEY=, --private-key, new Wallet(…), 私钥); a hash, a storage slot or a sha256 sum goes as written. An exchange’s API key, secret and passphrase go by their fields’ names. |
+ | Mask secrets | Private 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., Cloudflare's (cfut_, cfat_, cfk_, cfoat_, Origin CA v1.0-, tunnel tokens), 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. Wallet private keys by the shape their wallets export: a Bitcoin WIF, a BIP32 xprv, an Ethereum or TRON 0x key, a Solana key or id.json keypair, a Sui suiprivkey1…, an Aptos ed25519-priv-0x…, a Stellar seed, a NEAR ed25519:… key, a Nostr nsec1…, an age identity, a Zcash extended spending key, and a 12 to 25 word seed phrase after seed or mnemonic whose every word is in the BIP39 list. A key with no prefix of its own is masked only when it checks out: a WIF or xprv by its checksum, a Solana key by its public half, a Stellar seed by its CRC, so a Solana transaction signature goes as written. A 0x key has the shape of a transaction hash, so it is masked only after a key’s name (PRIVATE_KEY=, --private-key, new Wallet(…), 私钥); a hash, a storage slot or a sha256 sum goes as written. An exchange’s API key, secret and passphrase go by their fields’ names. |
| Mask personal data | Emails, mainland China mobile numbers (not an 11-digit id: one under order_id or after 订单号 goes as written), 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 生日, and over a year ago, so today’s date stays), 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 (sent as a made-up name, the same every turn, so the model reads a real folder rather than a placeholder), user and computer names (user@host), public IP addresses (sent as a name such as public-ip-kvxqmrtz, so the model still knows the address is public and connects with it, and the real address goes back into its commands) and cloud storage buckets. A wallet or contract address (0x and 40 hex digits) is public and goes as written; a private key is still masked. |
| Masked words | Each word you listed, exactly, as {{TERM_…}}. A date, such as 1990-05-12, matches that day however it is written: 1990/5/12, 1990.05.12, 1990年5月12日, 19900512, May 12, 1990, and 13/05/1990 style only where the day can’t be read as a month. Never another date or a version like 1990.5.12.1. |
| Find with a local model | Under How it’s found. A model on this computer finds what no rule can: a name or an address in free text. It is on unless you turned it off, and AstrLink Guard downloads with the first masked request; until it is on disk, the rules mask alone. It needs Mask secrets or Mask personal data on, and finds under the same switches. The menu beside it picks the model: AstrLink Guard (Chinese and English, a 39 MB download, few false alarms in code, on a Mac it runs on the Neural Engine; the default) or OpenAI’s Privacy Filter (1.6 GB, uses the GPU, masks more ordinary values in code). Confidence threshold under it is how sure the model must be before a value is masked: Privacy Filter’s default is 0.5, AstrLink Guard’s 0.8, its publisher’s. Higher masks fewer ordinary values, and lets more real names and addresses through: the rules after the model drop most false alarms already, so the default is where we measured the fewest real values lost. |
diff --git a/site/public/docs/zh/masking.html b/site/public/docs/zh/masking.html
index 7954ac489..d9ba9ae15 100644
--- a/site/public/docs/zh/masking.html
+++ b/site/public/docs/zh/masking.html
@@ -170,7 +170,7 @@
| 开关 | 能找到什么 |
- | 脱敏密钥 | 私钥块(-----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。以及你的 自定义脱敏规则。 钱包私钥按钱包导出的格式匹配:比特币 WIF、BIP32 xprv、以太坊和 TRON 的 0x 私钥、Solana 私钥与 id.json 密钥对、Sui suiprivkey1…、Aptos ed25519-priv-0x…、Stellar 种子、NEAR ed25519:…、Nostr nsec1…、age 身份、Zcash 扩展支出密钥,以及 seed、助记词 后面、每个词都在 BIP39 词表里的 12 到 25 个单词。没有固定前缀的私钥要先通过校验才会被替换:WIF 和 xprv 看校验和,Solana 私钥看后半段公钥,Stellar 种子看 CRC,所以 Solana 交易签名照原样发送。0x 私钥和交易哈希形状相同,只在私钥的名字后面才替换(PRIVATE_KEY=、--private-key、new Wallet(…)、私钥);哈希、存储槽和 sha256 校验值照原样发送。交易所的 API key、secret 和 passphrase 按字段名替换。 |
+ | 脱敏密钥 | 私钥块(-----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.、Cloudflare 的(cfut_、cfat_、cfk_、cfoat_、Origin CA v1.0-、Tunnel token),以及 oc_sk_… 这类中转站的 key。JWT。user:password@host 里的密码。.env 和配置文件里以密钥命名的字段的值:DB_PASSWORD=…、api_key: …、client_secret、token、credential。以及你的 自定义脱敏规则。 钱包私钥按钱包导出的格式匹配:比特币 WIF、BIP32 xprv、以太坊和 TRON 的 0x 私钥、Solana 私钥与 id.json 密钥对、Sui suiprivkey1…、Aptos ed25519-priv-0x…、Stellar 种子、NEAR ed25519:…、Nostr nsec1…、age 身份、Zcash 扩展支出密钥,以及 seed、助记词 后面、每个词都在 BIP39 词表里的 12 到 25 个单词。没有固定前缀的私钥要先通过校验才会被替换:WIF 和 xprv 看校验和,Solana 私钥看后半段公钥,Stellar 种子看 CRC,所以 Solana 交易签名照原样发送。0x 私钥和交易哈希形状相同,只在私钥的名字后面才替换(PRIVATE_KEY=、--private-key、new Wallet(…)、私钥);哈希、存储槽和 sha256 校验值照原样发送。交易所的 API key、secret 和 passphrase 按字段名替换。 |
| 脱敏个人信息 | 邮箱、中国大陆手机号(11 位的编号不算:在 order_id 下或跟在「订单号」后面的照原样发出)、校验位对得上的身份证号和银行卡号。默认也开着的:美国社会安全号、护照号(跟在 passport、护照或パスポート后面)、IBAN、生日(旁边有 birthday、DOB 或「生日」,且是一年以前的日期,所以今天的日期不动)、MAC 地址、序列号(跟在 S/N 后面)。默认关闭、需要自己打开的(Agent 几乎每个请求都会带):主目录里的用户名(以一个每轮都相同的假名发出,模型看到的是正常的文件夹,而不是占位符)、用户名和主机名(user@host)、公网 IP 地址(以 public-ip-kvxqmrtz 这样的名字发出,模型仍知道这是公网地址,照常用它连接,命令里再换回真实地址)、云存储桶。钱包或合约地址(0x 加 40 位十六进制)是公开的,照原样发出;私钥照样脱敏。 |
| 脱敏词 | 你填的每个词,精确匹配,换成 {{TERM_…}}。填的是日期(比如 1990-05-12)时,同一天的各种写法都会遮掉:1990/5/12、1990.05.12、1990年5月12日、19900512、May 12, 1990;13/05/1990 这种日在前的写法只在日和月不会混淆时才算。别的日期和 1990.5.12.1 这样的版本号不会被遮。 |
| 用本地模型查找 | 在 怎么找 下面。一个在这台电脑上运行的模型能找出规则找不到的东西:自由文本里的人名、地址。除非你关掉,它默认打开:第一个要脱敏的请求开始下载 AstrLink Guard,下载完成前只用规则脱敏。需要先打开 脱敏密钥 或 脱敏个人信息,找到的内容按同样的开关处理。旁边的菜单选择模型:AstrLink Guard(中英文,下载 39 MB,代码里很少误判,在 Mac 上用神经网络引擎运行;默认)或 OpenAI 的 Privacy Filter(1.6 GB,可用 GPU,代码里会遮盖更多普通值)。下面的 置信度阈值 是模型要多确定才遮盖一个值:Privacy Filter 默认 0.5,AstrLink Guard 默认 0.8(发布者的值)。调高会少遮一些普通值,也会让更多真实的人名、地址原样发出去;模型之后的规则已经去掉了大部分误判,所以默认值是我们测下来漏掉真实信息最少的那一档。 |
diff --git a/site/public/llms-full.txt b/site/public/llms-full.txt
index 37ca06648..1b8ab1994 100644
--- a/site/public/llms-full.txt
+++ b/site/public/llms-full.txt
@@ -3714,7 +3714,7 @@ There is no CLI command for it. Without the window (`magpie serve`, [Docker](htt
| Switch | What it finds |
| --- | --- |
-| Mask secrets | Private 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. Wallet private keys by the shape their wallets export: a Bitcoin WIF, a BIP32 `xprv`, an Ethereum or TRON `0x` key, a Solana key or `id.json` keypair, a Sui `suiprivkey1…`, an Aptos `ed25519-priv-0x…`, a Stellar seed, a NEAR `ed25519:…` key, a Nostr `nsec1…`, an age identity, a Zcash extended spending key, and a 12 to 25 word seed phrase after *seed* or *mnemonic* whose every word is in the BIP39 list. A key with no prefix of its own is masked only when it checks out: a WIF or `xprv` by its checksum, a Solana key by its public half, a Stellar seed by its CRC, so a Solana transaction signature goes as written. A `0x` key has the shape of a transaction hash, so it is masked only after a key’s name (`PRIVATE_KEY=`, `--private-key`, `new Wallet(…)`, 私钥); a hash, a storage slot or a sha256 sum goes as written. An exchange’s API key, secret and `passphrase` go by their fields’ names. |
+| Mask secrets | Private 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.`, Cloudflare's (`cfut_`, `cfat_`, `cfk_`, `cfoat_`, Origin CA `v1.0-`, tunnel tokens), 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. Wallet private keys by the shape their wallets export: a Bitcoin WIF, a BIP32 `xprv`, an Ethereum or TRON `0x` key, a Solana key or `id.json` keypair, a Sui `suiprivkey1…`, an Aptos `ed25519-priv-0x…`, a Stellar seed, a NEAR `ed25519:…` key, a Nostr `nsec1…`, an age identity, a Zcash extended spending key, and a 12 to 25 word seed phrase after *seed* or *mnemonic* whose every word is in the BIP39 list. A key with no prefix of its own is masked only when it checks out: a WIF or `xprv` by its checksum, a Solana key by its public half, a Stellar seed by its CRC, so a Solana transaction signature goes as written. A `0x` key has the shape of a transaction hash, so it is masked only after a key’s name (`PRIVATE_KEY=`, `--private-key`, `new Wallet(…)`, 私钥); a hash, a storage slot or a sha256 sum goes as written. An exchange’s API key, secret and `passphrase` go by their fields’ names. |
| Mask personal data | Emails, mainland China mobile numbers (not an 11-digit id: one under `order_id` or after 订单号 goes as written), 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 生日, and over a year ago, so today’s date stays), 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 (sent as a made-up name, the same every turn, so the model reads a real folder rather than a placeholder), user and computer names (`user@host`), public IP addresses (sent as a name such as `public-ip-kvxqmrtz`, so the model still knows the address is public and connects with it, and the real address goes back into its commands) and cloud storage buckets. A wallet or contract address (`0x` and 40 hex digits) is public and goes as written; a private key is still masked. |
| Masked words | Each word you listed, exactly, as `{{TERM_…}}`. A date, such as *1990-05-12*, matches that day however it is written: *1990/5/12*, *1990.05.12*, *1990年5月12日*, *19900512*, *May 12, 1990*, and *13/05/1990* style only where the day can’t be read as a month. Never another date or a version like *1990.5.12.1*. |
| Find with a local model | Under How it’s found. A model on this computer finds what no rule can: a name or an address in free text. It is on unless you turned it off, and AstrLink Guard downloads with the first masked request; until it is on disk, the rules mask alone. It needs Mask secrets or Mask personal data on, and finds under the same switches. The menu beside it picks the model: AstrLink Guard (Chinese and English, a 39 MB download, few false alarms in code, on a Mac it runs on the Neural Engine; the default) or OpenAI’s Privacy Filter (1.6 GB, uses the GPU, masks more ordinary values in code). Confidence threshold under it is how sure the model must be before a value is masked: Privacy Filter’s default is 0.5, AstrLink Guard’s 0.8, its publisher’s. Higher masks fewer ordinary values, and lets more real names and addresses through: the rules after the model drop most false alarms already, so the default is where we measured the fewest real values lost. |