Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement IsURL util func, remove govalidator dependency #187

Closed
cpu opened this issue Mar 7, 2019 · 1 comment · Fixed by #199
Closed

Implement IsURL util func, remove govalidator dependency #187

cpu opened this issue Mar 7, 2019 · 1 comment · Fixed by #199

Comments

@cpu
Copy link
Member

cpu commented Mar 7, 2019

The github.com/asaskevich/govalidator dependency could be removed from both zcrypto and zlint if zcrypto provided its own IsURL utility function.

Alternatively, removing the three invocations of govalidator.IsURL in x509/json.go would accomplish similar.

zcrypto/x509/json.go

Lines 458 to 462 in 0afe7b2

for _, name := range c.URIs {
if govalidator.IsURL(name) {
jc.Names = append(jc.Names, name)
}
}

zcrypto/x509/json.go

Lines 464 to 469 in 0afe7b2

for _, name := range c.IPAddresses {
str := name.String()
if govalidator.IsURL(str) {
jc.Names = append(jc.Names, str)
}
}

zcrypto/x509/json.go

Lines 557 to 563 in 0afe7b2

// Check for wildcards and redacts, ignore malformed urls
if strings.HasPrefix(name, "?.") || strings.HasPrefix(name, "*.") {
ret = isValidName(name[2:])
} else {
ret = govalidator.IsURL(name)
}
return

@cpu
Copy link
Member Author

cpu commented Mar 7, 2019

Relates to #183 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant