Files
Primora/apps/backend/internal/services/project_logins_test.go
T
Tomas Dvorak 2a49de2db5 feat: store app logins agents can read
Username and password live in the local vault and the project vault, keyed by a stable app id rather than a host or port. Agents fetch one named secret or login when they need it. Lists stay metadata, and project reveals stay audit-logged.

Authored By: TDvorak <[email protected]>
2026-10-29 09:31:02 +01:00

28 lines
648 B
Go

package services
import (
"strings"
"testing"
)
func TestValidLoginApp(t *testing.T) {
ok := []string{"primora", "MyApp", "app.local", "stripe-dashboard", "a"}
bad := []string{"", "has space", "http://localhost:3000", "/etc/passwd", "..", "-leading", "a/b"}
for _, app := range ok {
if !validLoginApp(app) {
t.Errorf("validLoginApp(%q) = false", app)
}
}
for _, app := range bad {
if validLoginApp(app) {
t.Errorf("validLoginApp(%q) = true", app)
}
}
if !validLoginApp(strings.Repeat("a", 64)) {
t.Error("64-char app id rejected")
}
if validLoginApp(strings.Repeat("a", 65)) {
t.Error("65-char app id accepted")
}
}