transport url should limit illegal chars

Bug #1557496 reported by JiaJunsu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.messaging
Fix Released
Undecided
JiaJunsu

Bug Description

In document:
 http://docs.openstack.org/developer/oslo.messaging/transport.html

oslo_messaging.get_transport(conf, url=None, allowed_remote_exmods=None, aliases=None)

Parameter url could be str or TransportURL, example: rabbit://me:passwd@host:5672/virtual_host

Actually, username, password and hostname should not contain chars which could be treated as functional chars, #:? etc.

I suggest to add the limitation on docs.

There are two optional ways to get the transport of messaging: oslo.config from config_file and oslo_messaging.get_transport with certain url, but the username and password limitation is different.

JiaJunsu (jiajunsu)
description: updated
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

JiaJunsu,

you should be able to url encoding for those characters. right? does that not work?

http://www.w3schools.com/tags/ref_urlencode.asp

Thanks,
Dims

Revision history for this message
JiaJunsu (jiajunsu) wrote :

I tried to quote hostname, username and password before join them in parameter url

from urllib import quote
hostname, username, password = quote(hostname), quote(username), quote(password)

But I found the oslo.messaging hadn't unquote them

https://github.com/openstack/oslo.messaging/blob/master/oslo_messaging/transport.py#L394

If we want to support functional chars in url, I suggest to add the urllib.unquote at transport.py#L394

from urllib import unquote
...
hostname, username, password = unquote(hostname), unquote(username), unquote(password)

And update the docs, tell developers to quote the url before call get_transport(...,url=xxx,...)

JiaJunsu (jiajunsu)
Changed in oslo.messaging:
assignee: nobody → JiaJunsu (jiajunsu)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.messaging (master)

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

Changed in oslo.messaging:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on oslo.messaging (master)

Change abandoned by JiaJunsu (<email address hidden>) on branch: master
Review: https://review.openstack.org/301215
Reason: cancel

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.messaging (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.messaging (master)

Reviewed: https://review.openstack.org/301223
Committed: https://git.openstack.org/cgit/openstack/oslo.messaging/commit/?id=2aab5a6370dfaced69a1b945d8e8dcec917cfcdf
Submitter: Jenkins
Branch: master

commit 2aab5a6370dfaced69a1b945d8e8dcec917cfcdf
Author: JiaJunsu <email address hidden>
Date: Sat May 7 05:53:30 2016 -0700

    Add parse.unquote to transport_url

    To support special chars in username:password and vhost

    Closes-Bug: #1557496

    Change-Id: I977bce06c6b1bb71162d49de82a6a3d62df3e6bd

Changed in oslo.messaging:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/oslo.messaging 5.2.0

This issue was fixed in the openstack/oslo.messaging 5.2.0 release.

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack/oslo.messaging 5.3.0

This issue was fixed in the openstack/oslo.messaging 5.3.0 release.

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.