Warn on empty string in whitelist
This commit is contained in:
parent
671ea1250d
commit
6fc75632c8
|
@ -409,6 +409,10 @@ func NewWhitelist(issuers []string, privateList ...[]string) (Whitelist, error)
|
|||
func newWhitelist(list []*url.URL, issuers []string, insecure bool) (Whitelist, error) {
|
||||
for i := range issuers {
|
||||
iss := issuers[i]
|
||||
if "" == strings.TrimSpace(iss) {
|
||||
fmt.Println("[Warning] You have an empty string in your keyfetch whitelist.")
|
||||
continue
|
||||
}
|
||||
|
||||
// Should have a valid http or https prefix
|
||||
// TODO support custom prefixes (i.e. app://) ?
|
||||
|
|
|
@ -20,7 +20,9 @@ func TestInvalidIssuer(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestIssuerMatches(t *testing.T) {
|
||||
// because [""] = strings.Split(os.Getenv("DOESNTEXIST"), ",")
|
||||
trusted := []string{
|
||||
"",
|
||||
"https://example.com/",
|
||||
"foobar.net/def/",
|
||||
"https://*.wild.org",
|
||||
|
@ -41,7 +43,7 @@ func TestIssuerMatches(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
// Combo list
|
||||
list, err = NewWhitelist(trusted, privates)
|
||||
list, err = NewWhitelist(trusted[1:], privates)
|
||||
if nil != err {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue