Skip to content

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

redact: git@host, a git remote's SSH user, is not masked as an email (jumy on Discord)

yetonedce7fe609651
diff --git a/internal/redact/git_remote_test.go b/internal/redact/git_remote_test.go
new file mode 100644
index 000000000..561bd4bfe
--- /dev/null
+++ b/internal/redact/git_remote_test.go
@@ -0,0 +1,41 @@
+package redact
+
+import (
+ "strings"
+ "testing"
+)
+
+// git@host is how every git host is reached over SSH, and was masked as
+// an address, remote and all (jumy on Discord). It stays, whichever host;
+// an address beside it, and one whose name only starts with git, is still
+// masked, by the rules and the local model's EMAIL alike.
+func TestGitRemoteIsNoEmail(t *testing.T) {
+ o := Options{Secrets: true, Personal: true}
+ for _, s := range []string{
+ "[email protected]:yetone/magpie.git",
+ "git clone [email protected]:group/sub/repo.git",
+ "origin\[email protected]:owner/repo.git (fetch)",
+ "ssh -T [email protected]",
+ "url = [email protected]:team/svc.git",
+ } {
+ if out, n := Mask(s, o); n != 0 || out != s {
+ t.Errorf("%q: %d masked: %q", s, n, out)
+ }
+ }
+ for _, s := range []string{"[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)
+ }
+ }
+ body := `{"messages":[{"role":"user","content":"push to [email protected]:o/r.git and tell [email protected]"}]}`
+ out, n := MaskJSON([]byte(body), o)
+ if n != 1 || !strings.Contains(string(out), "[email protected]:o/r.git") || strings.Contains(string(out), "[email protected]") {
+ t.Fatalf("request: %d masked: %s", n, out)
+ }
+ f := &fakeModel{values: map[string]string{"[email protected]": "private_email"}}
+ if out, n := Mask("[email protected]:o/r.git", Options{Personal: true, Model: f.find}); n != 0 {
+ t.Fatalf("model's: %d masked: %q", n, out)
+ }
+}
diff --git a/internal/redact/redact.go b/internal/redact/redact.go
index 7f3b535a2..4cf7ac136 100644
--- a/internal/redact/redact.go
+++ b/internal/redact/redact.go
@@ -370,8 +370,16 @@ func inUserinfo(s string, a int) bool {
return k < j
}
+// realEmail is whether v, matched as an address, is someone's. git@ is
+// 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).
func realEmail(v string) bool {
- host := strings.ToLower(v[strings.LastIndexByte(v, '@')+1:])
+ at := strings.LastIndexByte(v, '@')
+ if strings.EqualFold(v[:at], "git") {
+ return false
+ }
+ host := strings.ToLower(v[at+1:])
if fileHost(host) {
return false
}