fix: semgrep_python.lang.security.audit.eval-detected.eval-detected_apps/slack_data/slack_mcp_reader.py_157
This commit is contained in:
@@ -10,6 +10,7 @@ flexible message processing options.
|
|||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import ast
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -146,7 +147,7 @@ class SlackMCPReader:
|
|||||||
match = re.search(r"'error':\s*(\{[^}]+\})", str(e))
|
match = re.search(r"'error':\s*(\{[^}]+\})", str(e))
|
||||||
if match:
|
if match:
|
||||||
try:
|
try:
|
||||||
error_dict = eval(match.group(1))
|
error_dict = ast.literal_eval(match.group(1))
|
||||||
except (ValueError, SyntaxError, NameError):
|
except (ValueError, SyntaxError, NameError):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@@ -154,7 +155,7 @@ class SlackMCPReader:
|
|||||||
match = re.search(r"Failed to fetch messages:\s*(\{[^}]+\})", str(e))
|
match = re.search(r"Failed to fetch messages:\s*(\{[^}]+\})", str(e))
|
||||||
if match:
|
if match:
|
||||||
try:
|
try:
|
||||||
error_dict = eval(match.group(1))
|
error_dict = ast.literal_eval(match.group(1))
|
||||||
except (ValueError, SyntaxError, NameError):
|
except (ValueError, SyntaxError, NameError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user