{"action":"created","issue":{"url":"https://api.github.com/repos/opnsense/core/issues/1109","repository_url":"https://api.github.com/repos/opnsense/core","labels_url":"https://api.github.com/repos/opnsense/core/issues/1109/labels{/name}","comments_url":"https://api.github.com/repos/opnsense/core/issues/1109/comments","events_url":"https://api.github.com/repos/opnsense/core/issues/1109/events","html_url":"https://github.com/opnsense/core/issues/1109","id":169316049,"number":1109,"title":"Incorrect form validation in aliases edit form","user":{"login":"pv2b","id":7115238,"avatar_url":"https://avatars.githubusercontent.com/u/7115238?v=3","gravatar_id":"","url":"https://api.github.com/users/pv2b","html_url":"https://github.com/pv2b","followers_url":"https://api.github.com/users/pv2b/followers","following_url":"https://api.github.com/users/pv2b/following{/other_user}","gists_url":"https://api.github.com/users/pv2b/gists{/gist_id}","starred_url":"https://api.github.com/users/pv2b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pv2b/subscriptions","organizations_url":"https://api.github.com/users/pv2b/orgs","repos_url":"https://api.github.com/users/pv2b/repos","events_url":"https://api.github.com/users/pv2b/events{/privacy}","received_events_url":"https://api.github.com/users/pv2b/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-04T08:12:06Z","updated_at":"2016-08-04T17:28:41Z","closed_at":null,"body":"# Summary\r\n\r\nThere is an error in the form validation logic in the Aliases edit form.\r\n\r\n# Steps to reproduce:\r\n\r\n1. Go to Firewall -> Aliases -> View\r\n2. Click on Add a new alias\r\n3. Enter a valid name for the alias, e.g. \"test\"\r\n4. Leave the description blank (probably does not matter)\r\n5. Choose Host(s) as type (probably does not matter)\r\n6. In the hosts field, enter 192.0.2.10 192.0.2.11 with a space between them.\r\n7. Enter \"Ten\" in the host description field.\r\n8. Click the + button to add a second host row.\r\n9. In the hosts field, enter 192.0.2.20 192.0.2.21 with a space between them.\r\n10. Enter \"Twenty\" in the host description field.\r\n11.. Press save.\r\n\r\n# Expected result\r\n\r\nAn error message pops up complaining of the invalid format, and the form is re-populated as it was left without any changes.\r\n\r\n# Actual result\r\n\r\nAn error message pops up complaining about the input format. The form does not return as submitted, instead the following unwanted changes occur:\r\n\r\n- The hosts are actually split up into four fields rows, however, the descriptions do not line up properly. The descriptions \"Ten\" and \"Twenty\" line up with the first two rows, which as 192.0.2.10 and 192.0.2.11, in contrast to what was desired.\r\n\r\n# Discussion\r\n\r\nAt this point, the alias is (correctly) not saved, clicking the save button a second time will however save it, since now the form is valid.\r\n\r\nIt would appear that the form seems a bit schitzofrenic about whether to fix the user's mistakes and be flexible, or just point them out. It can be argued that the ability to enter a space-separated list is a desired behavior that may have become ingrained in user's workflows. However, the Aliases->Import feature would seem to negate the neccessity of this unintentional feature.\r\n\r\nIf you intend to keep this feature, care should be taken that the descriptions line up properly after the space-seperated lists are expanded.\r\n\r\nWithout looking at the code, I think the root to this problem may have something to do with how aliases are represented in config.xml. As an example, this is how an alias might be represented.\r\n\r\n```\r\n<opnsense>\r\n  <!-- Snip... -->\r\n  <aliases>\r\n    <alias>\r\n      <name>test</name>\r\n      <address>192.0.2.1 192.0.2.2 192.0.2.3 192.0.2.4</address>\r\n      <descr>Test entry</descr>\r\n      <type>host</type>\r\n      <detail>First entry||Second entry||Third entry||Fourth entry</detail>\r\n    </alias>\r\n    <!-- Snip... -->\r\n  </aliases>\r\n  <!-- Snip... -->\r\n</opnsense>\r\n\r\n```\r\nNote how the list of aliases is listed as a space-separated list. Granted, this file format is brain damaged, but that is the topic of [another issue](https://github.com/opnsense/core/issues/1110)."},"comment":{"url":"https://api.github.com/repos/opnsense/core/issues/comments/237623991","html_url":"https://github.com/opnsense/core/issues/1109#issuecomment-237623991","issue_url":"https://api.github.com/repos/opnsense/core/issues/1109","id":237623991,"user":{"login":"AdSchellevis","id":9783985,"avatar_url":"https://avatars.githubusercontent.com/u/9783985?v=3","gravatar_id":"","url":"https://api.github.com/users/AdSchellevis","html_url":"https://github.com/AdSchellevis","followers_url":"https://api.github.com/users/AdSchellevis/followers","following_url":"https://api.github.com/users/AdSchellevis/following{/other_user}","gists_url":"https://api.github.com/users/AdSchellevis/gists{/gist_id}","starred_url":"https://api.github.com/users/AdSchellevis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdSchellevis/subscriptions","organizations_url":"https://api.github.com/users/AdSchellevis/orgs","repos_url":"https://api.github.com/users/AdSchellevis/repos","events_url":"https://api.github.com/users/AdSchellevis/events{/privacy}","received_events_url":"https://api.github.com/users/AdSchellevis/received_events","type":"User","site_admin":false},"created_at":"2016-08-04T17:28:40Z","updated_at":"2016-08-04T17:28:40Z","body":"@pv2b https://github.com/opnsense/core/commit/214d92c39f76a6eadafbef6f7d8ce18f2762c3d2 should improve the current situation. Do you have time to do some additional testing. "}}
{"actor":{"display_login":"AdSchellevis"}}