Files
magpie/internal/redact/export_test.go
T
yetone 189db9ba5b redact: ids, digests and 毛利 go as written; the slider reaches known values; a user name goes as a made-up name
Reports on X under the masking demo (10-28):

_kaichen: "hash类型也会被过滤…长int,假如以1为开头的…会被当作电话被mask;
"毛利低"也会被当作人名被mask。即使把匹配拉到 0.95,也是一样行为".

- Hex digests: 16 to 31 hex digits in one case, with letters and digits
  both (a cache key, a short commit), are ids now (digestShaped in
  ids.go), like UUIDs and 32+ hex. The rules' SECRET keeps one only under
  a credential's field or a CJK/prose key with no field word (密钥为…);
  the model's SECRET is dropped under a field named for something else
  (cache_key, commit, object, blob, file, content, revision, partition,
  shard, bucket, dedup, lookup, row, sort) and on a JSON object's key
  (nameOfField). A bare `key` after api/access/secret/private/signing/
  license is still a credential (keyPhrase). The IBAN case kept its mask
  through the letter/digit minimums.
- 11-digit 1x numbers (phone.go, phoneAt): a phone with +86/86, as the
  value of a field whose name says phone (phone, mobile, tel, cell,
  contact, 手机, 电话, `number`), or in prose with no id word right
  before it (order, id, no., #, 订单号, 编号, 单号, 流水号…). Under
  order_id/uid, after 订单号, or with a letter or digit against it, it
  goes as written. PHONE and BANK_CARD are bounded by alnum, not digits,
  in the rule and in known values.
- 毛利: zhWords gained 毛利, 毛重, 毛坯, 毛巾, 毛衣, so 毛利低 (a margin)
  is no surname+name. The model still finds 毛利兰 (Guard). 毛利小五郎
  (indekkusu141209) is masked by neither model nor the rules now.
- The slider: a value masked once was masked again as known whatever the
  threshold. Each value now remembers the highest score it was found
  with (rules count as sure, ruleFound), and knownSpans skips one under
  Options.MinScore, which masking sets from pii.Threshold.

eerttreeeert: with mimo-v2.6-flash the home folder went as
C:\Users\{{USERNAME_…}}; the model took it for a temp folder and set out
to delete it. With the user name switch on, it now goes as a made-up name
of 8 lowercase letters (HMAC of the name, same every turn, standIn in
shape.go), restored in replies and tool calls like any placeholder;
Preview shows the same name.

Docs: docs/subsystems/gateway-routing.md masking bullets, and the site's
masking page (en, zh, ja) on mobile ids and the user name.

Run (mote, at this tree on base 6af83172d; rebased onto b01193ef9, which
changes nothing in redact, masking or pii, and redact, masking and
pii/... run again ok at the pushed head):
- gofmt -l clean; go vet ./... and GOOS=darwin/linux/windows go vet of
  redact, masking, pii: ok.
- go test -count=1 -timeout 45m redact, masking, pii/..., gateway, otlp,
  sessions, settings: all ok but internal/gateway's
  TestPluginStreamsPastTheBudgetWait (connection reset by peer, 183 of
  192), red the same alone at fresh origin/main b01193ef9 (169 of 192);
  #3946, commented.
- Real models on mote (AstrLink Guard and Privacy Filter, cached): the
  reporter's hashes, ids and every 毛利低 sentence kept; a prose phone
  masked; 毛利兰是谁 masked by Guard; 毛利小五郎姓什么 kept by both.

Broken by hand, each red: phoneAt off; the phone bound back to digits;
digestShaped off; "cache" out of the field list; nameOfField off; the
model's field check off; 毛利 out of zhWords; the slider check out of
knownSpans; standIn off.

Not tried: a real mimo-v2.6-flash session with the made-up name; the
Windows box; the GUI suite (no GUI file changed). 毛利小五郎 stays
unmasked by rules and both models, said in the doc.
2026-10-28 16:05:19 +08:00

19 lines
518 B
Go

package redact
// ModelKinds is modelKinds, for the evaluation in package redact_test,
// which reads the real model through internal/pii (eval_test.go).
var ModelKinds = modelKinds
// Forget lets go of every value masked so far, so that what the
// evaluation scores is what its texts make masked, not what the tests
// before it masked and left known.
func Forget() {
mu.Lock()
values = map[string]string{}
shapes = map[string]string{}
scores = map[string]float64{}
reindexKnown()
mu.Unlock()
resetSent()
}