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

Traffic Portal warning when user enters unusually large CIDR #5038

Closed
dneuman64 opened this issue Sep 17, 2020 · 3 comments · Fixed by #5052
Closed

Traffic Portal warning when user enters unusually large CIDR #5038

dneuman64 opened this issue Sep 17, 2020 · 3 comments · Fixed by #5052
Assignees
Labels
good first issue first-time committers will find this easy to resolve new feature A new feature, capability or behavior Traffic Ops related to Traffic Ops Traffic Portal v1 related to Traffic Portal version 1

Comments

@dneuman64
Copy link
Contributor

I'm submitting a ...

  • new feature / enhancement request

Traffic Control components affected ...

  • Documentation
  • Traffic Portal

Current behavior:

Currently, a user can add an IP for a server with an unreasonable CIDR. This is specifically true for IPv6 where CIDRs are commonly included with the IP Address. We would usually expect a /64 with an IP but a user can enter something like a /12. This leads to issues with the way ip_allow.config is generated on caches which can result in requests being incorrectly denied.

Expected / new behavior:

If a user enters less than a /64 for IPv6 and less than a /27 for Ipv4, Traffic Portal should show the user a warning and make sure they really want to enter a CIDR that large.

Minimal reproduction of the problem with instructions:

Create a new server, add an IPv6 with a /30 and a IPv4 with a /24.

Anything else:

@dneuman64 dneuman64 added new feature A new feature, capability or behavior Traffic Portal v1 related to Traffic Portal version 1 good first issue first-time committers will find this easy to resolve labels Sep 17, 2020
@mitchell852
Copy link
Member

mitchell852 commented Sep 17, 2020

Not sure if this should be done in TP (before save) or in the TO API (after save)....or both. TO API (Go) probably has better IP parsing tools...

@mitchell852 mitchell852 added the Traffic Ops related to Traffic Ops label Sep 17, 2020
@ocket8888
Copy link
Contributor

CIDR parsing is trivial to extract, though. We already have regular expressions that can match IPv4 and IPv6, and after that's known you can just extract the CIDR with a simple parseInt(/.+\/(\d+)/.exec(ip).groups[1], 10).

@dneuman64 dneuman64 changed the title Traffic Portal warining when user enters unusually large CIDR Traffic Portal warning when user enters unusually large CIDR Sep 17, 2020
@mitchell852
Copy link
Member

something like this @dneuman64 ?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue first-time committers will find this easy to resolve new feature A new feature, capability or behavior Traffic Ops related to Traffic Ops Traffic Portal v1 related to Traffic Portal version 1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants