Fixed type:dict validator passes unexpected keys

Bug #1573605 reported by Pavel Gluschak
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Pavel Gluschak

Bug Description

Validation schema definition:
'params': {
    ...
    'validate': {
        'type:dict': {
            'name': {'type:string': None}
        }
    }
}

Passed data:
{'params': {'bad_param': 'val'}}

Expected result:
Validation fails, because bad_param is not defined in schema.

Actual result:
Validation passes

Pavel Gluschak (scsnow)
Changed in neutron:
assignee: nobody → Pavel Gluschak (scsnow)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron-lib (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Pavel Gluschak (<email address hidden>) on branch: master
Review: https://review.openstack.org/309401
Reason: validators were moved in to neutron_lib in commit 78fff41ee3c56908e96cc302ffcb02c48e84f68a

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron-lib (master)

Reviewed: https://review.openstack.org/309964
Committed: https://git.openstack.org/cgit/openstack/neutron-lib/commit/?id=bb13c505b9999d0d8c032bacbf5d6615281bf29b
Submitter: Jenkins
Branch: master

commit bb13c505b9999d0d8c032bacbf5d6615281bf29b
Author: Pavel Gluschak <email address hidden>
Date: Mon Apr 25 15:59:18 2016 +0300

    Fixed type:dict validator passes unexpected keys

    Validation should fail if passed parameter
    does not match defined schema.

    Change-Id: Ia93ff849396c6e2a5a170d7c01629a38e412f037
    Closes-Bug: #1573605
    Signed-off-by: Pavel Gluschak <email address hidden>

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/neutron-lib 0.3.0

This issue was fixed in the openstack/neutron-lib 0.3.0 release.

Revision history for this message
Yi Jing Zhu (nick-zhuyj) wrote :

Hello,
Seems after your changes, I found the following command can't work:
stack@VPN-dev-bonnie:~$ neutron ipsec-site-connection-update --dpd action=restart,interval=60,timeout=240 vpn-demo
Invalid input for dpd. Reason: Unexpected keys supplied: action.
Neutron server returns request_ids: ['req-2cf32a90-608d-4f50-b76c-b37ac9f5a0ba']

When I fallback to 0.2.0, then it works.

Following is the command help info:
stack@VPN-dev-bonnie:~$ neutron ipsec-site-connection-update
usage: neutron ipsec-site-connection-update [-h] [--request-format {json}]
                                            [--dpd action=ACTION,interval=INTERVAL,timeout=TIMEOUT]
                                            [--local-ep-group LOCAL_EP_GROUP]
                                            [--peer-ep-group PEER_EP_GROUP]
                                            IPSEC_SITE_CONNECTION

How to handle this case?

Revision history for this message
Pavel Gluschak (scsnow) wrote :

Hi,

Seems like your problem should be fixed by recent neutron-vpnaas commit

commit 06c8c0bbf9568dfcd518aacb3f12adcf4b4ef6cb
Author: YAMAMOTO Takashi <email address hidden>
Date: Mon Aug 1 13:06:18 2016 +0900

    Update imports (common.config -> conf.common)

    Update after the recent refactoring. [1]

    [1] Ib5fa294906549237630f87b9c848eebe0644088c

    ----------------------------------------
    This commit also includes the following unrelated change to
    pass the gate.

    Fix a typo in ipsec_site_connection dpd specification

    Found by neutron-lib 0.3.0, which has a stricter validation
    than previous versions. [2]

    [2] Ia93ff849396c6e2a5a170d7c01629a38e412f037

    Closes-Bug: #1608314
    Partial-Bug: #1608346
    Related-Bug: #1563069
    Change-Id: I07430e3064d9900db94e6abcd6ab207030bd7c3d

Revision history for this message
Yi Jing Zhu (nick-zhuyj) wrote :

Thanks @Pavel for your info.

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.