File tree Expand file tree Collapse file tree
packages/markitdown/src/markitdown/converters Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import json
2- import subprocess
32import locale
4- from typing import BinaryIO , Any , Union
3+ import subprocess
4+ from typing import Any , BinaryIO , Union
5+
6+
7+ def _parse_version (version : str ) -> tuple :
8+ return tuple (map (int , (version .split ("." ))))
59
610
711def exiftool_metadata (
@@ -13,6 +17,24 @@ def exiftool_metadata(
1317 if not exiftool_path :
1418 return {}
1519
20+ # Verify exiftool version
21+ try :
22+ version_output = subprocess .run (
23+ [exiftool_path , "-ver" ],
24+ capture_output = True ,
25+ text = True ,
26+ check = True ,
27+ ).stdout .strip ()
28+ version = _parse_version (version_output )
29+ min_version = (12 , 24 )
30+ if version < min_version :
31+ raise RuntimeError (
32+ f"ExifTool version { version_output } is vulnerable to CVE-2021-22204. "
33+ "Please upgrade to version 12.24 or later."
34+ )
35+ except (subprocess .CalledProcessError , ValueError ) as e :
36+ raise RuntimeError ("Failed to verify ExifTool version." ) from e
37+
1638 # Run exiftool
1739 cur_pos = file_stream .tell ()
1840 try :
You can’t perform that action at this time.
0 commit comments