Pick up patch from github
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
parent
cb62d23a96
commit
0b76dd4cb5
2 changed files with 54 additions and 26 deletions
|
@ -1,6 +1,18 @@
|
||||||
--- __init__.py.orig 2016-12-01 11:50:40.064820904 +0000
|
From 922c6f390525faa9a9d65a501a44d8081940194a Mon Sep 17 00:00:00 2001
|
||||||
+++ __init__.py 2016-12-01 11:51:00.276026941 +0000
|
From: Patrick Uiterwijk <puiterwijk@redhat.com>
|
||||||
@@ -204,10 +204,12 @@
|
Date: Thu, 1 Dec 2016 11:56:34 +0000
|
||||||
|
Subject: [PATCH] Only check for stomp messages after we decoded any ZMQMessage
|
||||||
|
|
||||||
|
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
|
||||||
|
---
|
||||||
|
fedmsg/consumers/__init__.py | 24 ++++++++++++------------
|
||||||
|
1 file changed, 12 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/fedmsg/consumers/__init__.py b/fedmsg/consumers/__init__.py
|
||||||
|
index 88324b1..a12a587 100644
|
||||||
|
--- a/fedmsg/consumers/__init__.py
|
||||||
|
+++ b/fedmsg/consumers/__init__.py
|
||||||
|
@@ -204,16 +204,23 @@ def _make_query(page=1):
|
||||||
|
|
||||||
def validate(self, message):
|
def validate(self, message):
|
||||||
""" This needs to raise an exception, caught by moksha. """
|
""" This needs to raise an exception, caught by moksha. """
|
||||||
|
@ -8,29 +20,31 @@
|
||||||
- # If this is turned on globally, our child class can override it.
|
- # If this is turned on globally, our child class can override it.
|
||||||
- if not self.validate_signatures:
|
- if not self.validate_signatures:
|
||||||
- return
|
- return
|
||||||
|
-
|
||||||
|
if hasattr(message, '__json__'):
|
||||||
|
message = message.__json__()
|
||||||
|
if isinstance(message['body'], basestring):
|
||||||
|
message['body'] = json.loads(message['body'])
|
||||||
|
|
||||||
+ # Massage STOMP messages into a more compatible format.
|
+ # Massage STOMP messages into a more compatible format.
|
||||||
+ if 'topic' not in message['body']:
|
+ if 'topic' not in message['body']:
|
||||||
+ message['body'] = {
|
+ message['body'] = {
|
||||||
+ 'topic': message.get('topic'),
|
+ 'topic': message.get('topic'),
|
||||||
+ 'msg': message['body'],
|
+ 'msg': message['body'],
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
if hasattr(message, '__json__'):
|
|
||||||
message = message.__json__()
|
|
||||||
@@ -218,18 +220,15 @@
|
|
||||||
if not message['topic'] == message['body']['topic']:
|
|
||||||
raise RuntimeWarning("Topic envelope mismatch.")
|
|
||||||
|
|
||||||
+ # If we're not validating, then everything is valid.
|
+ # If we're not validating, then everything is valid.
|
||||||
+ # If this is turned on globally, our child class can override it.
|
+ # If this is turned on globally, our child class can override it.
|
||||||
+ if not self.validate_signatures:
|
+ if not self.validate_signatures:
|
||||||
+ return
|
+ return
|
||||||
+
|
+
|
||||||
if not fedmsg.crypto.validate(message['body'], **self.hub.config):
|
# We assume these match inside fedmsg.crypto, so we should enforce it.
|
||||||
raise RuntimeWarning("Failed to authn message.")
|
if not message['topic'] == message['body']['topic']:
|
||||||
|
raise RuntimeWarning("Topic envelope mismatch.")
|
||||||
|
@@ -223,13 +230,6 @@ def validate(self, message):
|
||||||
|
|
||||||
def _consume(self, message):
|
def _consume(self, message):
|
||||||
-
|
|
||||||
- # Massage STOMP messages into a more compatible format.
|
- # Massage STOMP messages into a more compatible format.
|
||||||
- if 'topic' not in message['body']:
|
- if 'topic' not in message['body']:
|
||||||
- message['body'] = {
|
- message['body'] = {
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
--- __init__.py.orig 2016-12-01 11:50:40.064820904 +0000
|
From 922c6f390525faa9a9d65a501a44d8081940194a Mon Sep 17 00:00:00 2001
|
||||||
+++ __init__.py 2016-12-01 11:51:00.276026941 +0000
|
From: Patrick Uiterwijk <puiterwijk@redhat.com>
|
||||||
@@ -204,10 +204,12 @@
|
Date: Thu, 1 Dec 2016 11:56:34 +0000
|
||||||
|
Subject: [PATCH] Only check for stomp messages after we decoded any ZMQMessage
|
||||||
|
|
||||||
|
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
|
||||||
|
---
|
||||||
|
fedmsg/consumers/__init__.py | 24 ++++++++++++------------
|
||||||
|
1 file changed, 12 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/fedmsg/consumers/__init__.py b/fedmsg/consumers/__init__.py
|
||||||
|
index 88324b1..a12a587 100644
|
||||||
|
--- a/fedmsg/consumers/__init__.py
|
||||||
|
+++ b/fedmsg/consumers/__init__.py
|
||||||
|
@@ -204,16 +204,23 @@ def _make_query(page=1):
|
||||||
|
|
||||||
def validate(self, message):
|
def validate(self, message):
|
||||||
""" This needs to raise an exception, caught by moksha. """
|
""" This needs to raise an exception, caught by moksha. """
|
||||||
|
@ -8,29 +20,31 @@
|
||||||
- # If this is turned on globally, our child class can override it.
|
- # If this is turned on globally, our child class can override it.
|
||||||
- if not self.validate_signatures:
|
- if not self.validate_signatures:
|
||||||
- return
|
- return
|
||||||
|
-
|
||||||
|
if hasattr(message, '__json__'):
|
||||||
|
message = message.__json__()
|
||||||
|
if isinstance(message['body'], basestring):
|
||||||
|
message['body'] = json.loads(message['body'])
|
||||||
|
|
||||||
+ # Massage STOMP messages into a more compatible format.
|
+ # Massage STOMP messages into a more compatible format.
|
||||||
+ if 'topic' not in message['body']:
|
+ if 'topic' not in message['body']:
|
||||||
+ message['body'] = {
|
+ message['body'] = {
|
||||||
+ 'topic': message.get('topic'),
|
+ 'topic': message.get('topic'),
|
||||||
+ 'msg': message['body'],
|
+ 'msg': message['body'],
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
if hasattr(message, '__json__'):
|
|
||||||
message = message.__json__()
|
|
||||||
@@ -218,18 +220,15 @@
|
|
||||||
if not message['topic'] == message['body']['topic']:
|
|
||||||
raise RuntimeWarning("Topic envelope mismatch.")
|
|
||||||
|
|
||||||
+ # If we're not validating, then everything is valid.
|
+ # If we're not validating, then everything is valid.
|
||||||
+ # If this is turned on globally, our child class can override it.
|
+ # If this is turned on globally, our child class can override it.
|
||||||
+ if not self.validate_signatures:
|
+ if not self.validate_signatures:
|
||||||
+ return
|
+ return
|
||||||
+
|
+
|
||||||
if not fedmsg.crypto.validate(message['body'], **self.hub.config):
|
# We assume these match inside fedmsg.crypto, so we should enforce it.
|
||||||
raise RuntimeWarning("Failed to authn message.")
|
if not message['topic'] == message['body']['topic']:
|
||||||
|
raise RuntimeWarning("Topic envelope mismatch.")
|
||||||
|
@@ -223,13 +230,6 @@ def validate(self, message):
|
||||||
|
|
||||||
def _consume(self, message):
|
def _consume(self, message):
|
||||||
-
|
|
||||||
- # Massage STOMP messages into a more compatible format.
|
- # Massage STOMP messages into a more compatible format.
|
||||||
- if 'topic' not in message['body']:
|
- if 'topic' not in message['body']:
|
||||||
- message['body'] = {
|
- message['body'] = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue