diff --git a/profile/endpoints/endpoint.go b/profile/endpoints/endpoint.go index 39f9700a..63c1e8b3 100644 --- a/profile/endpoints/endpoint.go +++ b/profile/endpoints/endpoint.go @@ -208,6 +208,14 @@ func parseEndpoint(value string) (endpoint Endpoint, err error) { //nolint:gocog return nil, fmt.Errorf(`invalid endpoint definition: "%s"`, value) } + // Remove comment. + for i, field := range fields { + if strings.HasPrefix(field, "#") { + fields = fields[:i] + break + } + } + // any if endpoint, err = parseTypeAny(fields); endpoint != nil || err != nil { return diff --git a/profile/endpoints/endpoints.go b/profile/endpoints/endpoints.go index 7b16fab5..05273f95 100644 --- a/profile/endpoints/endpoints.go +++ b/profile/endpoints/endpoints.go @@ -62,11 +62,13 @@ entriesLoop: // ListEntryValidationRegex is a regex to bullshit check endpoint list entries. var ListEntryValidationRegex = strings.Join([]string{ `^(\+|\-) `, // Rule verdict. + `(! +)?`, // Invert matching. `[A-z0-9\.:\-*/]+`, // Entity matching. `( `, // Start of optional matching. `[A-z0-9*]+`, // Protocol matching. `(/[A-z0-9]+(\-[A-z0-9]+)?)?`, // Port and port range matching. - `)?$`, // End of optional matching. + `)?`, // End of optional matching. + `( +#.*)?`, // Optional comment. }, "") // ValidateEndpointListConfigOption validates the given value.