mirror of
https://github.com/Dvorinka/Primora.git
synced 2026-10-29 16:14:53 +00:00
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]>
28 lines
648 B
Go
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")
|
|
}
|
|
}
|