From 09e1d594ea081d662ed67484a8a0407e4dd6f899 Mon Sep 17 00:00:00 2001 From: Birger Schacht Date: Mon, 16 Aug 2021 09:41:32 +0200 Subject: [PATCH] Use the YAML unsafe loader instead of the safe loader This lets us be backwards compatible to JSON and still dump YAML in a readable format. Closes: #2003 --- intelmq/lib/pipeline.py | 4 ++-- intelmq/lib/utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/intelmq/lib/pipeline.py b/intelmq/lib/pipeline.py index 6c276b0ff..fc7d36c96 100644 --- a/intelmq/lib/pipeline.py +++ b/intelmq/lib/pipeline.py @@ -110,14 +110,14 @@ def set_queues(self, queues: Optional[str], queues_type: str): q = {"_default": queues} elif type_ is str: q = {"_default": queues.split()} - elif type_ is dict: + elif isinstance(queues, dict): q = queues q.update({key: (val if isinstance(val, list) else val.split()) for key, val in queues.items()}) else: raise exceptions.InvalidArgument( 'queues', got=queues, expected=["None", "list of strings", "dict (of strings or lists that should have the _default key)"]) - self.destination_queues = q + self.destination_queues = dict(q) else: raise exceptions.InvalidArgument('queues_type', got=queues_type, expected=['source', 'destination']) diff --git a/intelmq/lib/utils.py b/intelmq/lib/utils.py index d0c10cc8a..59e6fa302 100644 --- a/intelmq/lib/utils.py +++ b/intelmq/lib/utils.py @@ -51,7 +51,7 @@ from intelmq.lib.exceptions import DecodingError from intelmq import RUNTIME_CONF_FILE -yaml = YAML(typ="safe", pure=True) +yaml = YAML(typ="unsafe", pure=True) __all__ = ['base64_decode', 'base64_encode', 'decode', 'encode', 'load_configuration', 'load_parameters', 'log', 'parse_logline',