Skip to content

Implement IsURL util func, remove govalidator dependency #187

@cpu

Description

@cpu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions