From 350899bdca5cf284db9a1e9cb2a7e919a29b351e Mon Sep 17 00:00:00 2001 From: John Chilton Date: Mon, 12 Dec 2022 14:18:36 -0500 Subject: [PATCH] Fix up security for galaxy.tool_util.verify.asserts --- lib/galaxy/tool_util/verify/asserts/archive.py | 4 +++- mypy.ini | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/tool_util/verify/asserts/archive.py b/lib/galaxy/tool_util/verify/asserts/archive.py index a65bb814df3..ae00a36168e 100644 --- a/lib/galaxy/tool_util/verify/asserts/archive.py +++ b/lib/galaxy/tool_util/verify/asserts/archive.py @@ -17,7 +17,9 @@ def _extract_from_tar(bytes, fn): # so make this consistent for tar if ti.isdir(): return "" - with tar_temp.extractfile(fn) as member_fh: + tar_file = tar_temp.extractfile(fn) + assert tar_file is not None + with tar_file as member_fh: return member_fh.read() diff --git a/mypy.ini b/mypy.ini index 9f9175740b2..0b3854526be 100644 --- a/mypy.ini +++ b/mypy.ini @@ -109,8 +109,6 @@ check_untyped_defs = False check_untyped_defs = False [mypy-galaxy.tools.bundled.filters.random_lines_two_pass] check_untyped_defs = False -[mypy-galaxy.tool_util.verify.asserts.archive] -check_untyped_defs = False [mypy-galaxy.tool_util.deps.brew_exts] check_untyped_defs = False [mypy-galaxy.model.item_attrs]