lanrat / czds

simple golang API and tools to interact with czds.icann.org
https://pkg.go.dev/github.com/lanrat/czds
GNU General Public License v3.0
72 stars 14 forks source link

czds-status -zone may reply for another "close" zone #11

Closed uggyuggy closed 2 years ago

uggyuggy commented 2 years ago

Hi,

Noticed that czds-status -zone may reply for another "close" zone.

Taking the red zone example in the readme, it replies the kred zone

$ czds-status -username "${CZDS_LOGIN}" -password "${CZDS_PASS}" -zone red
ID: xxx
TLD:    kred (kred)
Status: approved
....

Same for other like audi but reply the audible

$ czds-status -username "${CZDS_LOGIN}" -password "${CZDS_PASS}" -zone audi
ID: xxx
TLD:    audible (audible)
Status: approved
...

This is indeed how the "filter" looks working on the ICANN API (audible replied as first result for a audi search)

$ curl 'https://czds-api.icann.org/czds/requests/all' -X POST ....
--data-raw '{"status":"","filter":"audi","pagination":{"size":100,"page":0},"sort":{"field":"created","direction":"desc"}}'

{
  "requests": [
    {
      "requestId": "xxx",
      "tld": "audible",
      "ulable": "audible",
      "status": "Approved",
      "created": "xxx",
      "last_updated": "xxx",
      "expired": "xxx",
      "sftp": false
    },
    {
      "requestId": "xxx",
      "tld": "audi",
      "ulable": "audi",
      "status": "Approved",
      "created": "xxx",
      "last_updated": "xxx",
      "expired": "xxxx",
      "sftp": false
    },
    { ....

I'm not sure how to make the ICANN API reply only for the requested TLD, (may be there is a way? ) if not possible, may be the workaround would be to filter the json results where the tld match exactly what has been requested.

lanrat commented 2 years ago

Thanks for the report.

The current behavior for czds-status -zone is to return the first result returned from the API.

In your resting, when making the POST request to https://czds-api.icann.org/czds/requests/all with the zone filter. Is the desired zone returned as well?

If so, then I think it would be appropriate to update GetZoneRequestID() to return the first matching zone instead of just the first result.

lanrat commented 2 years ago

After more investigation, it appears that ExtendTLD() may be broken as well due to this behavior.

uggyuggy commented 2 years ago

Hi @lanrat

Is the desired zone returned as well?

For the tests I performed, yes it is returned as well.

In my previous posted comment I requested for audi TLD which turned to be "filter":"audi" into my POST.

I did few tests, (less than 10) but it was always returned as well.

Feel free to tell me if you want me to test further.

... to return the first matching zone instead of just the first result.

Yes I think the same. The expected/matching one should hopefully be into the first 100 results I guess.

After more investigation, it appears that ExtendTLD may be broken as well due to this behavior.

Yes, I noticed the same when I was "debugging" on my side to use that new ICANN "feature".

Thank's

lanrat commented 2 years ago

Fixed in 4c3ccea3ccc0284400d290d48e176f7f134273a7.

Released with version tag: v1.2.5.