-
Notifications
You must be signed in to change notification settings - Fork 353
servers endpoint lacks several validation checks #4525
Description
I'm submitting a ...
- bug report
- new feature / enhancement request
- improvement request (usability, performance, tech debt, etc.)
- other
Traffic Control components affected ...
- CDN in a Box
- Documentation
- Grove
- Traffic Control Client
- Traffic Monitor
- Traffic Ops
- Traffic Ops ORT
- Traffic Portal
- Traffic Router
- Traffic Stats
- Traffic Vault
- unknown
Current behavior:
When making a POST request to /servers with any of the following keys in the body:
ipGateway, ip6Gateway, ipNetmask, iloIpAddress, iloIpGateway, iloIpNetmask, mgmtIpAddress, mgmtIpGateway, mgmtIpNetmask
There are no checks performed to validate that they are valid IP Addresses.
Traffic Portal also doesn't perform any checks on any of these fields in the server page, However it doesn't allow for an invalid IP Netmask, while TO does.
Traffic portal also doesn't allow a Router Hostname to have spaces, but TO doesn't perform this check and a Router Hostname with spaces is allowed.
Expected / new behavior:
Traffic Ops should not allow a server to be created with invalid Ip addresses and not allow a routerHostName with spaces these should return:
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"alerts": [
{
"text": "<key> must be a valid IPv4 address",
"level": "error"
}
]
}OR
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"alerts": [
{
"text": "<key> must be a valid IPv6 address",
"level": "error"
}
]
}OR
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"alerts": [
{
"text": "'routerHostName' cannot contain spaces",
"level": "error"
}
]
}Traffic Portal should display a red outline around the text box with the word "Invalid" underneath.
See screenshot below.
