Skip to content

Self-hosted workflows for coding-agent delivery. Orchestrate CodeBuddy, Codex and Claude Code with scripts and human approval gates. Includes Local workflows for coding assistants.

992 B
Raw Blame
package gitwork

import (
	"strings"
	"testing"
)

func TestRedactMasksURLUserinfo(t *testing.T) {
	t.Setenv("AGENTFLOW_GIT_TOKEN", "")
	out := Redact("fatal: unable to access 'https://user:[email protected]/acme/app.git/': 403 and https://[email protected]/x.git", "unrelated-git-token")
	if strings.Contains(out, "s3cret-token") || strings.Contains(out, "ghp_abc123") || strings.Contains(out, "user:") {
		t.Fatalf("URL credentials survived redaction: %s", out)
	}
	if !strings.Contains(out, "https://***@github.com/acme/app.git") {
		t.Fatalf("redacted URL lost its host: %s", out)
	}
	ssh := Redact("ssh://[email protected]/r.git ssh://git:[email protected]/r.git")
	if ssh != "ssh://[email protected]/r.git ssh://git:***@git.example.com/r.git" {
		t.Fatalf("ssh redaction: %s", ssh)
	}
	if got := Redact("see https://github.com/acme/app and mail [email protected]"); got != "see https://github.com/acme/app and mail [email protected]" {
		t.Fatalf("plain text changed: %s", got)
	}
}