Skip to content

Commit

Permalink
πŸ› Added regex validation for eval()
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafalz13 authored and trymzet committed Nov 6, 2024
1 parent f29de99 commit 05614c0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/viadot/orchestration/prefect/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,10 @@ def _process_string(self, text: str) -> list[str] | str:

if match_no_symbols in self.replacements:
replacement = self.replacements[match_no_symbols]
if not replacement:
replacement = eval(match_no_symbols)
if not replacement and bool(
re.match(r"^\s*pendulum\.\w+\(.*\)\s*$", match_no_symbols)
):
replacement = eval(match_no_symbols) # noqa: S307
text = text.replace(
match,
(
Expand Down

0 comments on commit 05614c0

Please sign in to comment.