mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 22:14:55 -04:00
Reject malformed 3PE query metadata results earlier in AS API handling code
This commit is contained in:
parent
f25d74f69c
commit
ed44c475d8
2 changed files with 15 additions and 11 deletions
|
@ -162,11 +162,19 @@ class ApplicationServiceApi(SimpleHttpClient):
|
|||
urllib.quote(protocol)
|
||||
)
|
||||
try:
|
||||
defer.returnValue((yield self.get_json(uri, {})))
|
||||
info = yield self.get_json(uri, {})
|
||||
|
||||
# Ignore any result that doesn't contain an "instances" list
|
||||
if "instances" not in info:
|
||||
defer.returnValue(None)
|
||||
if not isinstance(info["instances"], list):
|
||||
defer.returnValue(None)
|
||||
|
||||
defer.returnValue(info)
|
||||
except Exception as ex:
|
||||
logger.warning("query_3pe_protocol to %s threw exception %s",
|
||||
uri, ex)
|
||||
defer.returnValue({})
|
||||
defer.returnValue(None)
|
||||
|
||||
key = (service.id, protocol)
|
||||
return self.protocol_meta_cache.get(key) or (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue