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

Add validation for IP input fields #784

Closed
Tracked by #1252
zephraph opened this issue Apr 11, 2022 · 3 comments
Closed
Tracked by #1252

Add validation for IP input fields #784

zephraph opened this issue Apr 11, 2022 · 3 comments

Comments

@zephraph
Copy link
Contributor

We should create validators (or special fields that are pre-validated) for IP type inputs. IPv4, IPv6, subnets, etc.

@david-crespo
Copy link
Collaborator

Note we are already pulling in the API's regexes for these things.

/** Regex pattern for validating Ipv4Net */
export const ipv4NetPattern =
'(^(10.(25[0-5]|[1-2][0-4][0-9]|[1-9][0-9]|[0-9].){2}(25[0-5]|[1-2][0-4][0-9]|[1-9][0-9]|[0-9])/(1[0-9]|2[0-8]|[8-9]))$)|(^(172.16.(25[0-5]|[1-2][0-4][0-9]|[1-9][0-9]|[0-9]).(25[0-5]|[1-2][0-4][0-9]|[1-9][0-9]|[0-9])/(1[2-9]|2[0-8]))$)|(^(192.168.(25[0-5]|[1-2][0-4][0-9]|[1-9][0-9]|[0-9]).(25[0-5]|[1-2][0-4][0-9]|[1-9][0-9]|[0-9])/(1[6-9]|2[0-8]))$)'

/** Regex pattern for validating Ipv6Net */
export const ipv6NetPattern =
'^(fd|FD)[0-9a-fA-F]{2}:((([0-9a-fA-F]{1,4}:){6}[0-9a-fA-F]{1,4})|(([0-9a-fA-F]{1,4}:){1,6}:))/(6[4-9]|[7-9][0-9]|1[0-1][0-9]|12[0-6])$'

@zephraph zephraph added this to the Remote Access Preview Demo milestone May 17, 2022
@david-crespo david-crespo removed this from the Remote Access Preview Demo milestone Jun 23, 2022
@zephraph zephraph added this to the First Customer Demo milestone Jun 30, 2022
@david-crespo david-crespo modified the milestones: Guided Demo, First Rack Shipment Oct 22, 2022
@david-crespo
Copy link
Collaborator

Now we even have generated Zod validators using those regexes. But we are still not using them.

@david-crespo
Copy link
Collaborator

Done in #1930, followup in #1963

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

No branches or pull requests

2 participants