Invalid JSON input type raises incorrect exceptions

Bug #1473212 reported by Tristan Cacqueray on 2015-07-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Designate
Medium
Graham Hayes
Kilo
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)

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

Changed in designate:
status: New → In Progress
Kiall Mac Innes (kiall) on 2015-07-28
Changed in designate:
milestone: none → liberty-2
importance: Undecided → Medium

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) on 2015-07-29
Changed in designate:
status: Fix Committed → Fix Released

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) on 2015-10-15
Changed in designate:
milestone: liberty-2 → 1.0.0
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers