weak point instat middleware

Bug #1189121 reported by Wu Wenxiang on 2013-06-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Low
Wu Wenxiang

Bug Description

In StatsMiddleware::_resolve_api

if str(CONF.admin_port) in host:
            return 'admin'
elif str(CONF.public_port) in host:
            return 'public'

If public_port = 5000, admin_port = 35000, then all requests would be stated as 'admin'.

Changed in keystone:
assignee: nobody → Wu Wenxiang (wu-wenxiang)

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

Changed in keystone:
status: New → In Progress
Dolph Mathews (dolph) on 2013-06-10
Changed in keystone:
importance: Undecided → Low
Dolph Mathews (dolph) wrote :

I think the patch is an improvement, but I don't understand the bug it's resolving. Why would it default to reporting 'admin' as a result of non-default ports?

Changed in keystone:
status: In Progress → Incomplete
Changed in keystone:
status: Incomplete → In Progress
Wu Wenxiang (wu-wenxiang) wrote :

My example is incorrect, it should be:

If public_port = 35000, admin_port = 5000, then all requests would be stated as 'admin'.
because
if str(CONF.admin_port) in host:
would always return "True".

Dolph Mathews (dolph) wrote :

Ah, that makes much more sense. Thanks!

Reviewed: https://review.openstack.org/32317
Committed: http://github.com/openstack/keystone/commit/d0d4976f284361375ad8dc34d0817fbdae900ddf
Submitter: Jenkins
Branch: master

commit d0d4976f284361375ad8dc34d0817fbdae900ddf
Author: Wu Wenxiang <wu.wenxiang@99cloud.net>
Date: Sun Jun 9 18:10:30 2013 +0800

    Correct the resolving api logic in stat middleware

    If the admin_port string is a substring of public_port string, all the
    requests would be stated as 'admin' either their real dest port is
    admin_port or public_port. It's due to the incorrect logic in stat
    middleware.
    For example, if public_port = 35000, admin_port = 5000, the first
    judgement branch: "if str(CONF.admin_port) in host" in
    StatsMiddleware::_resolve_api() would always return "True" either the
    host port number equal to 5000 or 35000, so that the following judgement
    branches would be incorrectly ignored.

    Fixes bug #1189121
    Change-Id: I1086b7d11f83dd218d66376f79747a1f720eb807

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2013-07-17
Changed in keystone:
milestone: none → havana-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-17
Changed in keystone:
milestone: havana-2 → 2013.2
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers