Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
redact: an address needs a mail domain ([email protected], [email protected])
yetone25341b4ca522
diff --git a/internal/redact/email_tld_test.go b/internal/redact/email_tld_test.gonew file mode 100644index 000000000..5228fc73d--- /dev/null+++ b/internal/redact/email_tld_test.go@@ -0,0 +1,40 @@+package redact++import (+ "strings"+ "testing"+)++// What follows the @ of a decorator or a module's attribute (pytest.fixture)+// ends in a word no registry has, and an agent's own files (AGENTS.md)+// end in .md: neither was an address, and both were masked (ydzh on+// Discord). Addresses on real domains, a company's own (.local, .corp)+// and the .md of a domain that isn't such a file are still masked.+func TestEmailNeedsAMailDomain(t *testing.T) {+ o := Options{Secrets: true, Personal: true}+ for _, s := range []string{+ "[email protected]", "[email protected]",+ } {+ in := "look at " + s + " now"+ if out, n := Mask(in, o); n != 0 || out != in {+ t.Errorf("%q: %d masked: %q", s, n, out)+ }+ }+ for _, s := range []string{+ "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]",+ } {+ in := "mail " + s + " today"+ if out, n := Mask(in, o); n != 1 || strings.Contains(out, s) {+ t.Errorf("%q: %d masked: %q", s, n, out)+ }+ }+ f := &fakeModel{values: map[string]string{"[email protected]": "private_email", "[email protected]": "private_email"}}+ for _, s := range []string{"[email protected]", "[email protected]"} {+ if out, n := Mask(s, Options{Personal: true, Model: f.find}); n != 0 {+ t.Errorf("model's %q: %d masked: %q", s, n, out)+ }+ }+}diff --git a/internal/redact/redact.go b/internal/redact/redact.goindex 4cf7ac136..c7e149dd6 100644--- a/internal/redact/redact.go+++ b/internal/redact/redact.go@@ -30,6 +30,8 @@ import ("strings""sync""unicode/utf8"++ "golang.org/x/net/publicsuffix")// Options says what to mask.@@ -380,7 +382,7 @@ func realEmail(v string) bool {return false}host := strings.ToLower(v[at+1:])- if fileHost(host) {+ if fileHost(host) || docFiles[host] || !mailTLD(host[strings.LastIndexByte(host, '.')+1:]) {return false}for _, fake := range []string{"example.com", "example.org", "example.net", "localhost", ".test", ".invalid", ".example"} {@@ -391,6 +393,31 @@ func realEmail(v string) bool {return !strings.HasPrefix(host, "noreply") && !strings.Contains(v, "noreply@")}+// docFiles are the files agents read by name, on a domain's ending+// (.md): "@AGENTS.md" after a word, as a prompt names one, is no address+// (ydzh on Discord: [email protected] was masked).+var docFiles = map[string]bool{+ "agents.md": true, "claude.md": true, "gemini.md": true, "readme.md": true, "skill.md": true,+ "changelog.md": true, "contributing.md": true, "license.md": true, "lessons.md": true, "todo.md": true,+ "copilot-instructions.md": true, "crush.md": true, "qwen.md": true, "iflow.md": true, "warp.md": true,+}++// localTLDs are names an organisation's own mail can end in that no+// registry has: an address there is someone's all the same.+var localTLDs = map[string]bool{"local": true, "internal": true, "lan": true, "corp": true, "home": true, "intranet": true, "localdomain": true}++// mailTLD is whether tld, an address's last label, is one mail can be+// sent to: in the public suffix list's ICANN part, or an organisation's+// own. A decorator's or a module's attribute after a name+// ([email protected], ydzh on Discord) ends in a word no registry has.+func mailTLD(tld string) bool {+ if localTLDs[tld] {+ return true+ }+ _, icann := publicsuffix.PublicSuffix(tld)+ return icann+}+// fileExt are file name extensions that are no top-level domain, so// what ends in one is a file's name and not an address: an image a Mac// saved at twice its size, [email protected], went to the model as