ac4af582301a4e8a29245dbba767eba31334ddf9
5
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
53c81a2700 |
redact: 白名单 is read as a word, not a name (tianyk, #4087)
With the local model on, 白名单 went out as a name placeholder 821 times
in three days: the model took it for a name, and the reader's list of
ordinary words (zhWords, zhNounEnds), which every Chinese-name find is
checked against (zhWordNotName), had no word for it. 白名 is now in
zhWords and 单 in zhNounEnds, so the model's find goes as written and
never becomes a known value.
Of the report's other rows: node_modules and 连续 are already left as
written at this tree (probed with a fake model finding each as a name
and a path). 时按 and 时隐藏, the model's finds cut across two words
(超时+按住, 超时+隐藏), are still masked; this change does not cover them.
Changed from the contributor's patch: its second half, a gate in
knownSpans that let a known PERSON value go wherever it reads as a word,
is not taken. Every PERSON finder already asks zhWordNotName, so the
only values that gate let go are names masked where a role said a person
was meant: with it, "联系人:白名单" masked and the next request's
"白名单说明天到" went out as written. The test now checks that case and
resets the known values around itself.
Run (mote): go test -tags nogui ./internal/redact/... ./internal/pii/...
./internal/masking/... (ok), -shuffle=on ./internal/redact/ (ok);
go vet -tags nogui ./internal/redact/...; gofmt -l (empty).
Broken by hand: with the old zhname.go, TestModelMisreadsNotMasked and
TestKnownWordTakenForANameGoesAsWritten fail (开启{{PERSON_…}}之后);
with the patch's knownSpans gate put back, TestKnownWordTakenForANameGoes
AsWritten fails ("a name masked once left as written: 白名单说明天到").
Not tried: the reporter's real AstrLink Guard model on their requests.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
|
||
|
|
e737dff447 |
redact: a dotted name a call is made on is no secret to the masking model (#4444)
kewab's redaction shot: gctx.GetInt64("user_id") went out with
gctx.GetInt64 replaced by a made-up key. No rule reaches such a span;
the local model called it a SECRET, and modelFits let it through.
modelFits's SECRET case now turns away an identifier path (identPath)
that a '(' touches: the name a call is made on. ggbdpq's patch (via
gua2100) asked notCode there, the rules' check, which also skips a name
with a space before its '(' and one after a colon that a comma follows.
The model is asked about prose too, and there those are secrets: with
notCode, "tell Bob it is Pw7nK4xQ9rTe (rotated today)" and "note:
hunterTwoThree, keep it" went out as written. Only the touching '(' is
taken.
Run at this tree on mote: go test ./internal/redact ./internal/usage
-count=1: ok. gofmt -l clean.
Broken by hand: the guard gone: TestModelMisreadsNotMasked red on
gctx.GetInt64; the patch's notCode in its place: TestModelFindsStill
Masked red on the three prose secrets above.
Not tried: the real local masking model (the tests use the stand-in
model the suite's other model finds use).
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
|
||
|
|
b3729b8d56 |
redact: a model's or a toolchain's name the local model takes for a secret goes as written
The owner's 脱敏 page showed groqAPIModel = "llama3-70b-8192" masked as
a secret by the local model. The real model, asked again, also takes
claude-3-5-sonnet-20241022 beside it for one. namesThing now holds
modelName: lower-case words joined by dashes with a size part (70b,
8x7b, 32k), an eight-digit date part (20241022) or a yyyy-mm-dd date
(nightly-2026-09-01). A diceware passphrase (correct-horse-battery-
staple) or maple-4-river-77 has neither and is still masked.
The page's other value, nightly-2026-09-01 as a name, was recorded by
the running v0.1.1370 (10-24). The model labels it private_person, and
main already drops it (a name with a digit, a word in lower case, since
|
||
|
|
720e491d2b |
redact: the local model's ids, decimals, model names and products in agent sessions go as written
A reporter on X (tearicerice, 10-26) had Claude Code check what the
local model masked and found "大概95%以上都是误判". Run over the last
120 turns of 22 real Claude Code sessions, rules-only against
rules-plus-model, the model alone found 69 distinct values, ~55 of them
wrongly. modelFits and modelTakes now leave these as written:
- PHONE: a decimal (a metric's 104.21875033916251, 23 such values) and
a value starting with a letter ("run 48213097715").
- SECRET: a value right after an id's name (Claude Code's "with ID:
kq3m8zx2t", "(ID: …)", <task-id>…, "backgroundTaskId":"…"); a
lower-case slug with a slash (qwen/qwen3-14b); a lower-case file name
(make-icons.sh); a grep regexp with \| or \b; words with a time of day
in them (release about 17:05Z); a hex or digit run whose key cue is
further back than "key:" / "token is" (GH_TOKEN in "env -u GH_TOKEN
gh run view 48213097716" made the run id a secret).
- SECRET spans that took in a JSON key (ledgerId":"gl_…) start after
the key's `":"`.
- madeID takes ids with more words and a nanoid's - and _
(req_gateway_<hex>, tb_Ra4K…-ZqT2…), except under sk/rk/pk/whsec/
shpat/shpss/xoxb/xoxp, whose keys have that shape.
- ADDRESS: an ASCII value with no space and a slash (a transcript's
path). A Chinese address has no spaces and is unchanged; "3/12 Smith
Street, Sydney" still masks.
- EMAIL: a value with no @ (eu.stg.acme.io, a host).
- PERSON, one word: an acronym (CI), a camel-case product with a
capital after 3+ lower-case letters (CodeRabbit; McDonald, MacKenzie
still mask), and a word the same text has as a host's name (Greptile
beside app.greptile.com; not an address's local part, matt.lee@…).
Measured again on the same 22 sessions: 20 distinct model-only values,
12 of them real (people's names, the user's emails, an AWS account). The
8 left wrong are single dictionary or product words (Alma, Greptile
where no host is in the same text, Harness, Reds, Todo, Zhipu), 查询,
and an org id seen bare in a grep. The sessions' values were read in a
scratch test that isn't committed, and its logs are deleted; every
value in the tests and here is made up in the sessions' shapes.
Tests: 19 TestModelMisreadsNotMasked cases and 6 TestModelFindsStillMasked
cases (a Stripe-shaped sk_test_ key, a hex after "token is", McDonald,
Rina beside rina.lee@…, +1 415.555.0132, an address with a slash). 9
evaluation cases (metric-decimals, run-ids, background-tasks,
model-names, ls-files, gateway-ids, transcript-path, pr-checks,
team-notes), recorded with the real model.
Broken by hand, one at a time (each red): the decimal and leading-letter
phone checks, the path address check, regexpLike, idAfter and its camel
and > forms, the clock check, secretCued (back to cued), the slug and
file name checks, the JSON key trim, EMAIL needing an @, the acronym,
camel and hostIn name checks, madeID's longer ids and its keyHeads.
A decimal check for ACCOUNT was green when broken (versionRe already
covers it) and was dropped.
Run: go test -count=1 ./internal/redact ./internal/pii (ok),
MAGPIE_EVAL_CACHE TestMaskEval (re-recorded, ok). gofmt -l clean; go vet
./internal/redact for linux, windows and darwin. The packages that
import redact (gateway, gui, masking, otlp, sessions, settings) were
still running at push, beside another session's gateway run; not a
record of a pass.
Not tried: the reporter's own sessions, the WorkBuddy AI group/flash
traffic in their screenshot (~160 values a request), or their version.
Not looked at in the GUI's Masking page; the change is in what is
found, not in how it is shown.
|
||
|
|
611b9e1731 |
redact: what the local model misreads in agent requests is not masked
With "Use a local model" on, the model masked far more than the rules
did. Over 3 MB of real Claude Code requests (19,258 texts, the fields
MaskJSON leaves as sent skipped) the model alone masked about 1,800
pieces before this change, almost all wrong; the rules masked 17. It
took the turn's <total_tokens> count, run ids, commit hashes and
versions for accounts; Claude, Opus and other model names, a user name
inside a path and skill names for people; pieces of toolu_/srvtoolu_
ids, of base64 images, bare hashes, grep alternations, session file
names, links and Go module-cache names for secrets.
modelFits now judges each span the model reports against the text
around it: a span cut out of a longer word is no finding; a person's
name has no digits, path signs or lowercase words (bar van, de, bin and
the like) and no assistant's name; an account or phone number is
number-like and not a hash, version or size, and a bare run of digits
needs a cue before it ("account", "卡号", "phone", "手机"); a secret
starts with a letter or digit, is not a link, a UUID, a pattern of
words or a piece of a base64 run, and a bare hex run needs "key",
"token", "password" or 密钥/密码/令牌 before it. madeID takes prefixes
up to 8 letters (srvtoolu_).
After: the model masks 32 pieces on the same texts, 13 of them real
email addresses; what's left wrong is mostly a lone capitalised word
(Rerun, Relay, Xferd, Alma). On the synthetic set rules+model miss 1 of
20 secrets (rules alone 4) and flag 0 of 15 clean texts. The default
stays off.
Run at this head (rebased on
|