Verified Commit 951bc24d authored by Peter Stanko's avatar Peter Stanko
Browse files

Fixed bandit violations

parent 595d7abc
Pipeline #28661 passed with stage
in 8 minutes and 47 seconds
import json
import random
import secrets
from pathlib import Path
from typing import Optional
......@@ -134,7 +134,7 @@ class SubmissionProcessor:
if not workers:
self._worker_not_available()
return None
worker = random.choice(workers) # randomly select a worker
worker = secrets.choice(workers) # randomly select a worker
log.debug(f"[SCHED] Scheduling submission to worker -> {worker.log_name}")
return worker
......
......@@ -60,7 +60,7 @@ class EmailMessage:
def _read_yml(full_path):
with open(str(full_path), 'r') as stream:
try:
return yaml.load(stream)
return yaml.safe_load(stream)
except yaml.YAMLError as exc:
log.error(f"[EMAIL] Yaml parser has failed: {exc}")
raise errors.PortalServiceError(f"Cannot load email template from {full_path}")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment