Skip to content

Commit

Permalink
Don't allow the user to pass in a trust ID
Browse files Browse the repository at this point in the history
Since Aodh uses trust IDs stored in alarm URLs unconditionally - without
checking for tenant safety - it is not safe to allow users to pass in their own
trust IDs. Forbid this and allow only trusts created by Aodh to be used. It is
highly unlikely that there is any (legitimate) use of this feature in the wild,
since allowing Aodh to create the trust is easier anyway.

Change-Id: I8fd11a7f9fe3c0ea5f9843a89686ac06713b7851
Closes-Bug: #1649333
  • Loading branch information
zaneb authored and jd committed Aug 15, 2017
1 parent a698264 commit cb90d3a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion aodh/api/controllers/v2/alarms.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@ def update_actions(self, old_alarm=None):
url = netutils.urlsplit(action)
if self._is_trust_url(url):
if '@' in url.netloc:
continue
errmsg = _("trust URL cannot contain a trust ID.")
raise base.ClientSideError(errmsg)
if trust_id is None:
# We have a trust action without a trust ID,
# create it
Expand Down
2 changes: 1 addition & 1 deletion aodh/notifier/trust.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ class TrustRestAlarmNotifier(TrustAlarmNotifierMixin, rest.RestAlarmNotifier):
keystone authentication. It uses the aodh service user to
authenticate using the trust ID provided.
The URL must be in the form ``trust+http://trust-id@host/action``.
The URL must be in the form ``trust+http://host/action``.
"""
2 changes: 1 addition & 1 deletion aodh/notifier/zaqar.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class TrustZaqarAlarmNotifier(trust.TrustAlarmNotifierMixin,
ZaqarAlarmNotifier):
"""Zaqar notifier using a Keystone trust to post to user-defined queues.
The URL must be in the form ``trust+zaqar://trust_id@?queue_name=example``.
The URL must be in the form ``trust+zaqar://?queue_name=example``.
"""

def _get_client_conf(self, auth_token):
Expand Down

1 comment on commit cb90d3a

@onstring
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, Zane

By introducing this commit, the "aodh alarm update" CLI will break in case of heat template creating alarms with trust id in alarm action. I wonder if it is rational for that when using trust ID?

Cheers
Shi Yan

Please sign in to comment.