Skip to content

Commit

Permalink
hide http push security token in the subscribers api [SDESK-7093]
Browse files Browse the repository at this point in the history
  • Loading branch information
devketanpro committed Oct 31, 2023
1 parent ce3862e commit f034e5a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions superdesk/publish/subscribers.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ def get(self, req, lookup):
req = ParsedRequest()
if req.args and req.args.get("filter_condition"):
filter_condition = json.loads(req.args.get("filter_condition"))
return ListCursor(self._get_subscribers_by_filter_condition(filter_condition))
return super().get_from_mongo(req=req, lookup=lookup)
return self.hideConfigField(self._get_subscribers_by_filter_condition(filter_condition), "secret_token")

return self.hideConfigField(list(super().get_from_mongo(req=req, lookup=lookup)), "secret_token")

def on_create(self, docs):
for doc in docs:
Expand Down Expand Up @@ -291,3 +292,11 @@ def generate_sequence_number(self, subscriber):

def get_active(self):
return self.get_cached()

def hideConfigField(self, docs, field_name):
for doc in docs:
for destination in doc["destinations"]:
config = destination.get("config", {})
if config.get(field_name):
del config[field_name]
return ListCursor(docs)

0 comments on commit f034e5a

Please sign in to comment.