Browse Source

fix(hc): Escape file and function names in regex (#64607)

Ryan Skonnord 1 year ago
parent
commit
5265c5bba8
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/sentry/silo/patches/silo_aware_transaction_patch.py

+ 1 - 1
src/sentry/silo/patches/silo_aware_transaction_patch.py

@@ -78,7 +78,7 @@ def is_in_test_case_body() -> bool:
 
     def seek(module_path: str, function_name: str) -> bool:
         """Check whether the named function has been called in the current stack."""
-        pattern = re.compile(rf"/{module_path}\b.*\b{function_name}>$")
+        pattern = re.compile(rf"/{re.escape(module_path)}\b.*\b{re.escape(function_name)}>$")
         return any(pattern.search(frame) for frame in frames)
 
     return seek("_pytest/runner.py", "pytest_runtest_call") and not (