Invalid JSON input type raises incorrect exceptions

Bug #1473212 reported by Tristan Cacqueray
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Designate
Fix Released
Medium
Graham Hayes
Kilo
Fix Committed
Undecided
Kiall Mac Innes

Bug Description

Traces:

File "/opt/stack/designate/designate/objects/domain.py", line 175, in set_masters
    for m in masters:
TypeError: 'bool' object is not iterable

Steps to reproduce:

token=$(keystone token-get | grep ' id ' | awk '{ print $4 }')
endpoint=http://10.43.97.3:9001
curl -H "Content-Type: application/json" -H "X-Auth-Token:${token}" -X POST ${endpoint}/v2/zones -d '{"masters": false, "email": "<email address hidden>", "name": "jsonexample.com."}'; echo;

Traces:

File "/opt/stack/designate/designate/objects/rrdata_sshfp.py", line 54, in _from_string
    algorithm, fp_type, fingerprint = value.split(' ')
AttributeError: 'NoneType' object has no attribute 'split'

Steps to reproduce:

token=$(keystone token-get | grep ' id ' | awk '{ print $4 }')
endpoint=http://10.43.97.3:9001
zone_id=$(designate domain-list | awk '{ print $2 }' | grep -- -)
curl -H "Content-Type: application/json" -H "X-Auth-Token:${token}" -X POST ${endpoint}/v2/zones/${zone_id}/recordsets -d '{"records": [null], "type": "SSHFP", "name": "blah."}

Traces:

File "/usr/local/lib/python2.7/dist-packages/dns/rdtypes/txtbase.py", line 57, in from_text
    raise dns.exception.UnexpectedEnd

Steps to reproduce:

token=$(keystone token-get | grep ' id ' | awk '{ print $4 }')
endpoint=http://10.43.97.3:9001
zone_id=$(designate domain-list | awk '{ print $2 }' | grep -- - | head -n 1)
zone_name=$(designate domain-list | awk '{ print $4 }' | grep '\.$' | head -n 1)
curl -H "Content-Type: application/json" -H "X-Auth-Token:${token}" -X POST ${endpoint}/v2/zones/${zone_id}/recordsets -d '{"records": "1 2 blablabla", "type": "TXT", "name": "'$RANDOM.${zone_name}'"}'

Changed in designate:
assignee: nobody → Graham Hayes (grahamhayes)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (master)

Fix proposed to branch: master
Review: https://review.openstack.org/201535

Changed in designate:
status: New → In Progress
Kiall Mac Innes (kiall)
Changed in designate:
milestone: none → liberty-2
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (master)

Reviewed: https://review.openstack.org/201535
Committed: https://git.openstack.org/cgit/openstack/designate/commit/?id=16c84d40d703af21240fdc99e302f0f92f1027f6
Submitter: Jenkins
Branch: master

commit 16c84d40d703af21240fdc99e302f0f92f1027f6
Author: Graham Hayes <email address hidden>
Date: Mon Jul 13 19:55:00 2015 +0100

    Fixup v2 API Validation

    * Added list type checking to recordset.records
    * Added list type checking to domain.masters
    * Added extra debug output
    * Catch all Exception clause in objects.adaptors.base.parse()

    Change-Id: I900d418c16f016e0bd4e3f30cec393734b2feca4
    Closes-Bug: #1473212

Changed in designate:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in designate:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/207422

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (stable/kilo)

Reviewed: https://review.openstack.org/207422
Committed: https://git.openstack.org/cgit/openstack/designate/commit/?id=28b071f5611f571bff399ef3c4c092dfa973dcd1
Submitter: Jenkins
Branch: stable/kilo

commit 28b071f5611f571bff399ef3c4c092dfa973dcd1
Author: Graham Hayes <email address hidden>
Date: Mon Jul 13 19:55:00 2015 +0100

    Fixup v2 API Validation

    * Added list type checking to recordset.records
    * Added list type checking to domain.masters
    * Added extra debug output
    * Catch all Exception clause in objects.adaptors.base.parse()

    Change-Id: I900d418c16f016e0bd4e3f30cec393734b2feca4
    Closes-Bug: #1473212

Thierry Carrez (ttx)
Changed in designate:
milestone: liberty-2 → 1.0.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.