package gitsource import "strings" // RedactURL strips user:password credentials embedded in a URL so tokens // never surface in error messages or logs. func RedactURL(u string) string { scheme, rest, found := strings.Cut(u, "://") if !found { return u } if at := strings.Index(rest, "@"); at >= 0 && !strings.Contains(rest[:at], "/") { return scheme + "://" + rest[at+1:] } return u }