Skip to content

Commit

Permalink
Merge pull request from GHSA-v3vh-7qx4-f582
Browse files Browse the repository at this point in the history
(cherry picked from commit 4b36724)
  • Loading branch information
cogk authored and ankush committed Dec 11, 2023
1 parent c2daee6 commit fc8d798
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions frappe/utils/safe_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,16 @@ def _validate_safe_eval_syntax(code):

@contextmanager
def safe_exec_flags():
frappe.flags.in_safe_exec = True
yield
frappe.flags.in_safe_exec = False
if not frappe.flags.in_safe_exec:
frappe.flags.in_safe_exec = 0

frappe.flags.in_safe_exec += 1

try:
yield
finally:
# Always ensure that the flag is decremented
frappe.flags.in_safe_exec -= 1


def get_safe_globals():
Expand Down

0 comments on commit fc8d798

Please sign in to comment.