Redact quoted credentials in Git diagnostics

This commit is contained in:
2026-11-02 11:32:11 +00:00
parent 473670185c
commit 31f9e48219
3 changed files with 53 additions and 16 deletions

View File

@@ -6,7 +6,8 @@ import (
"strings"
)
var httpURLSpan = regexp.MustCompile(`(?i)https?://[^\s"'<>]+`)
// Match userinfo through @ before treating quotes as diagnostic delimiters.
var httpURLSpan = regexp.MustCompile(`(?i)https?://(?:[^\s/?#<>]*@)?[^\s"'<>]*`)
// DisplayURL hides HTTP userinfo without changing the endpoint used by Git.
func DisplayURL(raw string) string {