Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

redact: a model's or a toolchain's name the local model takes for a secret goes as written

yetoneb3729b8d56fc
diff --git a/internal/redact/eval_cases_test.go b/internal/redact/eval_cases_test.go
index d0040f573..01153e0c3 100644
--- a/internal/redact/eval_cases_test.go
+++ b/internal/redact/eval_cases_test.go
@@ -293,6 +293,18 @@ var evalCases = []evalCase{
Text: "The 14:55Z errors came from our own org; Dana Whitfield is the lead if this turns out to be a settlement failure, and Priya wants it fixed first.",
Mask: []evalValue{{V: "Dana Whitfield", Kind: "PERSON"}, {V: "Priya", Kind: "PERSON"}},
},
+ // the owner's 脱敏 page, 10-26: a model's id beside a setting's key,
+ // and a toolchain's
+ {
+ ID: "settings-model", From: "owner",
+ Text: `[providers]` + "\n" + `groqAPIKey = "gsk_x…"` + "\n" + `groqAPIModel = "llama3-70b-8192"` + "\n" + `claudeAPIURL = "https://api.anthropic.com"` + "\n" + `claudeAPIModel = "claude-3-5-sonnet-20241022"`,
+ Keep: []evalValue{{V: "llama3-70b-8192", Kind: "SECRET"}, {V: "claude-3-5-sonnet-20241022", Kind: "SECRET"}},
+ },
+ {
+ ID: "rust-toolchain", From: "owner",
+ Text: "- MSRV check. The repo's minimum rust-version is 1.78. Pinning to `nightly-2026-09-01` (about 7 weeks old) is plausible.\n- Risk: the pinned toolchain lacks fixes.",
+ Keep: []evalValue{{V: "nightly-2026-09-01", Kind: "PERSON"}},
+ },
// ---- what masking is for --------------------------------------------
{
diff --git a/internal/redact/model.go b/internal/redact/model.go
index fa35f4205..c3812ad52 100644
--- a/internal/redact/model.go
+++ b/internal/redact/model.go
@@ -154,13 +154,39 @@ func namesThing(v string) bool {
if u, n, ok := strings.Cut(v, ":"); ok && n != "" && strings.Trim(n, digits) == "" {
v = u
}
- if uuidRe.MatchString(v) || digestRe.MatchString(v) || slugRe.MatchString(v) || fileNameRe.MatchString(v) {
+ if uuidRe.MatchString(v) || digestRe.MatchString(v) || slugRe.MatchString(v) || fileNameRe.MatchString(v) || modelName(v) {
return true
}
return !strings.ContainsAny(v, " \t\n") && (strings.HasPrefix(v, "/") || strings.HasPrefix(v, "~/") ||
strings.HasPrefix(v, "./") || strings.HasPrefix(v, "../") || len(v) > 3 && v[1] == ':' && v[2] == '\\')
}
+// modelName says v is a model's or a toolchain's name: words in lower
+// case joined by dashes, one of them a size (70b, 8x7b, 32k) or a date
+// (20241022, 2026-09-01). The model took groqAPIModel = "llama3-70b-8192"
+// and claudeAPIModel's claude-3-5-sonnet-20241022 for secrets (10-26).
+// A key is written in neither case nor shape.
+func modelName(v string) bool {
+ if !dashedRe.MatchString(v) {
+ return false
+ }
+ if dateIn.MatchString(v) {
+ return true
+ }
+ for _, p := range strings.Split(v, "-") {
+ if sizePartRe.MatchString(p) {
+ return true
+ }
+ }
+ return false
+}
+
+var (
+ dashedRe = regexp.MustCompile(`^[a-z][a-z0-9.]*(?:-[a-z0-9.]+)+$`)
+ sizePartRe = regexp.MustCompile(`^(?:\d+x)?\d+(?:\.\d+)?[bkm]$|^20\d{6}$`)
+ dateIn = regexp.MustCompile(`(?:^|-)20\d\d-[01]\d-[0-3]\d(?:-|$)`)
+)
+
var (
uuidRe = regexp.MustCompile(`^(?i)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$`)
// a model's, a repo's or a package's name (qwen/qwen3-14b, acme/web)
diff --git a/internal/redact/modelfits_test.go b/internal/redact/modelfits_test.go
index 66bbe7653..d2335f3e3 100644
--- a/internal/redact/modelfits_test.go
+++ b/internal/redact/modelfits_test.go
@@ -18,6 +18,11 @@ func TestModelMisreadsNotMasked(t *testing.T) {
{"ba319a758 gateway: the lone tool_choice none", "ba319a758", "account_number"},
{"Update to v0.1.1442 now", "0.1.1442", "account_number"},
{"a screenshot of 1624x1487 pixels", "1624x1487", "private_phone"},
+ // a model's and a toolchain's names in a setting
+ {`groqAPIModel = "llama3-70b-8192"`, "llama3-70b-8192", "secret"},
+ {`claudeAPIModel = "claude-3-5-sonnet-20241022"`, "claude-3-5-sonnet-20241022", "secret"},
+ {"--model mixtral-8x7b-32768 --max-tokens 4096", "mixtral-8x7b-32768", "secret"},
+ {`channel = "nightly-2026-09-01"`, "nightly-2026-09-01", "secret"},
// the model's and the assistant's own names
{"You are powered by the model named Opus 5.5.", "Opus", "private_person"},
{"Claude publishes it as an Artifact.", "Claude", "private_person"},
@@ -82,6 +87,9 @@ func TestModelFindsStillMasked(t *testing.T) {
{"ring 020 7946 0958 after six", "020 7946 0958", "private_phone"},
{"send it to 42 Wallaby Way, Sydney", "42 Wallaby Way, Sydney", "private_address"},
{"the vault phrase is Zq8vR2mT6wLp", "Zq8vR2mT6wLp", "secret"},
+ // dashed words in lower case are a passphrase without a size or a date
+ {"the wifi passphrase is correct-horse-battery-staple", "correct-horse-battery-staple", "secret"},
+ {"password: maple-4-river-77", "maple-4-river-77", "secret"},
{"api key: 9f2c4e1a7b3d5c8e9f2c4e1a7b3d5c8e", "9f2c4e1a7b3d5c8e9f2c4e1a7b3d5c8e", "secret"},
{"write to [email protected]", "[email protected]", "private_email"},
// beside what the checks above leave out
diff --git a/internal/redact/testdata/eval-model.json b/internal/redact/testdata/eval-model.json
index 5adff5adc..e33f25d02 100644
--- a/internal/redact/testdata/eval-model.json
+++ b/internal/redact/testdata/eval-model.json
@@ -546,6 +546,16 @@
}
]
},
+ "rust-toolchain": {
+ "text": "5e982c7d912ab858",
+ "found": [
+ {
+ "Start": 67,
+ "End": 85,
+ "Label": "private_person"
+ }
+ ]
+ },
"session-tokens": {
"text": "6170ea7af28ec9e2",
"found": [
@@ -566,6 +576,26 @@
}
]
},
+ "settings-model": {
+ "text": "24b9db62bf272ec3",
+ "found": [
+ {
+ "Start": 26,
+ "End": 34,
+ "Label": "secret"
+ },
+ {
+ "Start": 52,
+ "End": 67,
+ "Label": "secret"
+ },
+ {
+ "Start": 130,
+ "End": 156,
+ "Label": "secret"
+ }
+ ]
+ },
"short-values": {
"text": "0133fede621b7801",
"found": [