InternetHealthReport / ihr-website

Vue.js code for IHR website
https://ihr.iijlab.net
GNU General Public License v3.0
63 stars 118 forks source link

Problematic parsing of AS number in network report #147

Closed m-appel closed 1 year ago

m-appel commented 2 years ago

Describe the bug The regular expression used to extract the AS or IXP number from strings will accept an arbitrary prefix as long as the string ends with a number. This can lead to confusion, especially if an IXP link is mistyped.

To Reproduce

  1. Go to https://ihr.iijlab.net/ihr/en-us/networks/IX208
  2. The result is actually for AS208, instead of IXP208 (DE-CIX) since the P is missing from the URL. This is not directly obvious, especially sind the string IX208 is automatically inserted into the heading.

Expected behavior At least, the arbitrary string should not be displayed in the header, but corrected to ASXXX instead. However, the best solution would probably be to only accept ^AS[0-9]+$ and ^IXP[0-9]+$ strings and show an error / redirect to 404 otherwise.

Screenshots Report for IX208, which is actually AS208 image

Additional context The problematic function is ihr_AsOrIxpToNumber in IhrApi.js

romain-fontugne commented 1 year ago

Thanks, that's fixed now (2166539f020d2f4f8ea73b081ab342b103d0b1e0) but eventually we'd need a proper page for IXPs. The current has meaningless things for IXPs (ROV, AS hegemony)