certat / do-portal

This project is in maintenance mode and will only receive bug fixes, but no new features. A new version of this software is being developed.
5 stars 5 forks source link

Empty, invalid and already used RIPE handles give error message "Bad gateway" #49

Closed ghost closed 5 years ago

ghost commented 5 years ago

It is possible to submit "empty" ripe handles

davewood commented 5 years ago

do you want it to be possible? does it make sense?

edit: my bad, i read that as a question.

davewood commented 5 years ago

the backend throws an error and the empty RIPE handle is dismissed. thats a valid behaviour i'd say

ghost commented 5 years ago

I get an error "Bad gateway" when clicking on "Add RIPE handle" when the text box is empty.

ghost commented 5 years ago

The same behavior for empty, invalid and already used RIPE handles. This is just about better error handling.

davewood commented 5 years ago

das passiert wenn man ein leeres handle schicken will

root@cp-backend-aec-stg:~# tail -f /var/log/uwsgi/app/doportal.log

  File "./app/cp/organizations.py", line 445, in update_cp_organization
    o.from_json(request.json)
  File "./app/models.py", line 143, in from_json
    setattr(self, attr, value)
  File "./app/models.py", line 995, in ripe_handles
    forg_x_org.ripe_org_hdl = ripe_handle
  File "./app/models.py", line 724, in ripe_org_hdl
    fody_org = FodyOrganization(ripe_org_hdl = ripe_org_hdl)
  File "./app/fody_models.py", line 42, in __init__
    raise AttributeError('no such handle')
AttributeError: no such handle
[pid: 23247|app: 0|req: 4/13] 83.136.38.239 () {56 vars in 1308 bytes} [Thu Nov  8 10:18:48 2018] PUT /cp/1.0/organizations/28 => generated 0 bytes in 307 msecs (HTTP/1.0 500) 0 headers in 0 bytes (0 switches on core 1)
ghost commented 5 years ago

Submitting an existing RIPE handle sometimes shows a "Bad Gateway" error and sometime a (correct) "this RIPE handle already exists." error

davewood commented 5 years ago

if you add a RIPE handle the following happens on the frontend

1) add ripe handle to js array (handle is displayed immediately) 2) send to backend 3) on error, delete from frontend

if you click too fast the handle still exists on the frontend and a "already ecists" notification is shown

MarkHofstetter commented 5 years ago

in commit 0d23b866eb64d64faaba7aaf459a5cc3a49a1b48

always sends {.... "ripe_handles":[null]} on update

update with nonexisting ripe handle returns 404 now curl 'http://127.0.0.1:8000/cp/1.0/organizations/4' -X PUT -H 'Origin: http://127.0.0.1:5002' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.9,de;q=0.8,es;q=0.7' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' -H 'Content-Type: application/json;charset=UTF-8' -H 'Accept: application/json, text/plain, /' -H 'Referer: http://127.0.0.1:5002/' -H 'Cookie: rm=1|ba943e7bd05004f3d501e5dff6741fc1a30a10118cfc128d50d5916d3a01b6d246e2ff374ed0f63d1db127c6bdbaadca3ea24148b3329b79cf99770fc278a72d; username=cert%40master.at' -H 'Connection: keep-alive' -H 'DNT: 1' --data-binary '{"abbreviation":"eorg-gas","abuse_emails":[],"asns":[],"display_name":"eorg-gas","fqdns":[],"full_name":"eorg-gas updated4","id":4,"ip_ranges":[],"is_sla":true,"mail_template":"EnglishReport","mail_times":3600,"parent_org_abbreviation":"eorg","parent_org_id":2,"ripe_handles":["bla"]}' --compressed {"message": "no such handle"}

davewood commented 5 years ago

?

cant find that commit and dont know why you assigned me.

MarkHofstetter commented 5 years ago

the frontend always sends "ripe_handles":[null] and not "ripe_handles":[] which would be correct

davewood commented 5 years ago

cause of problem: https://stackoverflow.com/questions/18342917/angularjs-ng-model-doesnt-work-inside-ng-if

davewood commented 5 years ago