[RESOLVED]Alias JSON Import Possible Bug

Started by skatopn, March 07, 2024, 08:48:13 AM

Previous topic - Next topic
March 07, 2024, 08:48:13 AM Last Edit: March 11, 2024, 02:23:08 AM by skatopn
I think I have found a bug with the Alias JSON import function.
Before I raise a bug ticket on github, I wanted to check here first in case there is something I have missed.

This is the test alias.json I am trying to import:

{
  "geoip": {
    "url": "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=<KEY-OMITTED>&suffix=zip"
  },
  "aliases": {
    "alias": {
      "19a042c4-e10c-4a3b-bec2-ddecc101f177": {
        "enabled": "1",
        "name": "a_AA-aaaAA-AA_99_9_9_99",
        "type": "host",
        "proto": "",
        "interface": "",
        "counters": "0",
        "updatefreq": "",
        "content": "10.7.9.56",
        "categories": "",
        "description": "Aaaaa AA Aa AA Aaaa"
      },
      "68301a50-f572-4c98-9494-73ac5ab50bfe": {
        "enabled": "1",
        "name": "a_aa_aaaa_aaa_aaa",
        "type": "urltable",
        "proto": "",
        "interface": "",
        "counters": "0",
        "updatefreq": "",
        "content": "au.pool.ntp.org",
        "categories": "",
        "description": "AA AAA Aaaa"
      }
    }
  }
}


It keeps giving me the error (first attachment):


"19a042c4-e10c-4a3b-bec2-ddecc101f177.nameThe name must start with a letter or single underscore, be less than 32 characters and only consist of alphanumeric characters or underscores.
Please note that none of the aliases provided are imported due to the errors above"

I suspect that it is checking the UUID against the name constraint and therefore failing (on length and first character), but when I create another test alias through the GUI then download it, this is what I see:

{
  "geoip": {
    "url": "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=<KEY-OMITTED>&suffix=zip"
  },
  "aliases": {
    "alias": {
        "4d69e8f5-1ba5-43a6-afd7-91db31c86f12": {
        "enabled": "1",
        "name": "test_host",
        "type": "host",
        "proto": "",
        "interface": "",
        "counters": "0",
        "updatefreq": "",
        "content": "10.1.1.1",
        "categories": "",
        "description": "test_host description"
      }
    }
  }
}


However, other default aliases do NOT use UUIDs, e.g. "bogons", "virusprot", and "__wan_network", so there is at least some inconsistency here.

Question: when creating a JSON file for alias import, should we just use the name in place of the UUID, like this:

{
  "geoip": {
    "url": "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=<KEY-OMITTED>&suffix=zip"
  },
  "aliases": {
    "alias": {
      "a_AA-aaaAA-AA_99_9_9_99": {
        "enabled": "1",
        "name": "a_AA-aaaAA-AA_99_9_9_99",
        "type": "host",
        "proto": "",
        "interface": "",
        "counters": "0",
        "updatefreq": "",
        "content": "10.7.9.56",
        "categories": "",
        "description": "Aaaaa AA Aa AA Aaaa"
      },
      "a_aa_aaaa_aaa_aaa": {
        "enabled": "1",
        "name": "a_aa_aaaa_aaa_aaa",
        "type": "urltable",
        "proto": "",
        "interface": "",
        "counters": "0",
        "updatefreq": "",
        "content": "au.pool.ntp.org",
        "categories": "",
        "description": "AA AAA Aaaa"
      }
    }
  }
}

?
(although I tested this and still got the same error, which makes no sense because no field in the JSON is breaking the rule it claims it is breaking...(see second attachment)

...hmmm, so based on that, I am concluding there is most definitely a bug that needs fixing...

QuoteThe name must start with a letter or single underscore, be less than 32 characters and only consist of alphanumeric characters or underscores
and still try to use hyphens?  ;)

Quote from: Fright on March 08, 2024, 07:54:51 PM
QuoteThe name must start with a letter or single underscore, be less than 32 characters and only consist of alphanumeric characters or underscores
and still try to use hyphens?  ;)