node icon indicating copy to clipboard operation
node copied to clipboard

provider validation of hostnames apparently isnt very good

Open hydrogen18 opened this issue 4 years ago • 2 comments

while setting up my provider I goofed up one of the hostnames with an invalid character. I got this error

Feb 17 18:13:10 ams0 akash[1745601]: E[2021-02-17|18:13:10.856] applying ingress                             module=provider-cluster-kube err="Ingress.extensions \"web\" is invalid: spec.rules[0].host: Invalid value: \"8uhrdv0kdpegf231vkrbiv1qag.*.pub.vufvuptyod.hydrogen18.com\": a wildcard DNS-1123 subdomain must start with '*.', followed by a valid DNS subdomain, which must consist of lower case alphanumeric characters, '-' or '.' and end with an alphanumeric character (e.g. '*.example.com', regex used for validation is '\\*\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')" lease=akash19dnhammcj3vf9dzgmtgg7pc8ujecn5azlzcu09/2470/1/1/akash1ls5wpjvaslysse33k0yyv0fh9lgc40744klv44 service=web expose="{Port:80 ExternalPort:80 Proto:TCP Service: Global:true Hosts:[]}"
Feb 17 18:13:10 ams0 akash[1745601]: E[2021-02-17|18:13:10.856] execution error                              module=provider-cluster cmp=service cmp=deployment-manager lease=akash19dnhammcj3vf9dzgmtgg7pc8ujecn5azlzcu09/2470/1/1/akash1ls5wpjvaslysse33k0yyv0fh9lgc40744klv44 manifest-group=westcoast state=deploy-active err="Ingress.extensions \"web\" is invalid: spec.rules[0].host: Invalid value: \"8uhrdv0kdpegf231vkrbiv1qag.*.pub.vufvuptyod.hydrogen18.com\": a wildcard DNS-1123 subdomain must start with '*.', followed by a valid DNS subdomain, which must consist of lower case alphanumeric characters, '-' or '.' and end with an alphanumeric character (e.g. '*.example.com', regex used for validation is '\\*\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')"

This needs to be checked early and if it is invalid just bail

hydrogen18 avatar Feb 17 '21 21:02 hydrogen18

come to think of it this is a spot that is using regexes that probably shouldn't.

boz avatar Feb 18 '21 00:02 boz

This only runs once on startup and not on data from the blockchain, so I think we should be OK to use a regex here.

hydrogen18 avatar Feb 24 '21 20:02 hydrogen18