Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
redact: an address's words joined by hyphens are no sk- key (sk-hynix-…)
yetone3e96197da377
diff --git a/internal/redact/redact.go b/internal/redact/redact.goindex 4ebc5ca23..31b6ef334 100644--- a/internal/redact/redact.go+++ b/internal/redact/redact.go@@ -141,7 +141,7 @@ const (var rules = append([]rule{{kind: "PRIVATE_KEY", re: regexp.MustCompile(`-----BEGIN (?:[A-Z0-9]+ )*PRIVATE KEY(?: BLOCK)?-----[\s\S]+?-----END (?:[A-Z0-9]+ )*PRIVATE KEY(?: BLOCK)?-----`), markers: []string{"PRIVATE KEY"}},- {kind: "API_KEY", re: regexp.MustCompile(`sk-(?:ant-|proj-|or-|svcacct-|admin-)?[A-Za-z0-9_-]{20,}`), markers: []string{"sk-"}, bound: tokenCh},+ {kind: "API_KEY", re: regexp.MustCompile(`sk-(?:ant-|proj-|or-|svcacct-|admin-)?[A-Za-z0-9_-]{20,}`), markers: []string{"sk-"}, bound: tokenCh, ok: notASlug},// a gateway's or a relay's own: oc_sk_…, or_sk_… (#195){kind: "API_KEY", re: regexp.MustCompile(`[a-z]{2,4}_sk_[A-Za-z0-9_-]{20,}`), markers: []string{"_sk_"}, bound: tokenCh, ok: secretValue},{kind: "API_KEY", re: regexp.MustCompile(`(?:gh[pousr]_[A-Za-z0-9]{30,}|github_pat_[A-Za-z0-9_]{40,}|glpat-[A-Za-z0-9_-]{20,})`), markers: []string{"gh", "github_pat_", "glpat-"}, bound: tokenCh},@@ -399,6 +399,24 @@ func inUserinfo(s string, a int) bool {// the user every git host is reached by over SSH ([email protected]:o/r.git,// [email protected], a company's own [email protected]), no one's mailbox, and// was masked so a remote no longer read as one (jumy on Discord).+// notASlug is false for words in lower case joined by hyphens, as a+// page's address names an article about SK hynix+// (cnbc.com/…/sk-hynix-third-quarter-profit.html), which went to the model+// as a key. A key's characters are random: it has a capital, or a run of+// 16 or more with no hyphen (DeepSeek's sk- and 32 hex digits, OpenRouter's+// sk-or-v1- and 64).+func notASlug(v string) bool {+ if strings.ContainsFunc(v, func(r rune) bool { return r >= 'A' && r <= 'Z' }) {+ return true+ }+ for _, w := range strings.FieldsFunc(v, func(r rune) bool { return r == '-' || r == '_' }) {+ if len(w) >= 16 {+ return true+ }+ }+ return false+}+func realEmail(v string) bool {at := strings.LastIndexByte(v, '@')if strings.EqualFold(v[:at], "git") {diff --git a/internal/redact/slug_test.go b/internal/redact/slug_test.gonew file mode 100644index 000000000..1c495a5aa--- /dev/null+++ b/internal/redact/slug_test.go@@ -0,0 +1,36 @@+package redact++import (+ "strings"+ "testing"+)++// Addresses of articles about SK hynix were masked as sk- keys+// (innerpeacebuild on X, the reporter's search results). A key beside+// them still is, and so are keys in lower case: DeepSeek's and+// OpenRouter's.+func TestSlugIsNoKey(t *testing.T) {+ o := Options{Secrets: true}+ for _, s := range []string{+ "https://www.cnbc.com/2026/10/28/sk-hynix-third-quarter-profit.html",+ "https://finance.yahoo.com/markets/stocks/articles/sk-hynix-announces-3q26-financial-234500011.html",+ "https://www.techpowerup.com/354203/sk-hynix-announces-3q26-financial-results",+ "https://au.investing.com/news/stock-market-news/sk-hynix-q3-2026-slides-revenue-tops-100t-80-margin-on-ai-boom",+ } {+ if out, n := Mask(s, o); n != 0 || out != s {+ t.Errorf("%q masked: %q", s, out)+ }+ }+ for _, key := range []string{+ "sk-proj-abcdEFGH1234ijklMNOP5678qrst",+ "sk-" + strings.Repeat("0123456789abcdef", 2),+ "sk-or-v1-" + strings.Repeat("0123456789abcdef", 4), // built, as a literal one stops GitHub's push+ "sk-ant-api03-Ab3dE-fGh1_jKl2mN-oPq3rSt4",+ } {+ in := "url sk-hynix-third-quarter-profit key " + key+ out, n := Mask(in, o)+ if n != 1 || strings.Contains(unmarked(out), key) || !strings.Contains(out, "sk-hynix-third-quarter-profit") {+ t.Errorf("%q: %d masked: %q", key, n, out)+ }+ }+}