duckguard 3.0.1__py3-none-any.whl → 3.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -609,9 +609,9 @@ class ConditionalCheckHandler:
609
609
  # Normalize path for DuckDB (forward slashes work on all platforms)
610
610
  source_path = dataset._source.replace('\\', '/')
611
611
 
612
- # Format allowed values for SQL IN clause
612
+ # Format allowed values for SQL IN clause (with proper escaping)
613
613
  if isinstance(allowed_values[0], str):
614
- values_str = ", ".join(f"'{v}'" for v in allowed_values)
614
+ values_str = ", ".join(f"'{v.replace(chr(39), chr(39)+chr(39))}'" for v in allowed_values)
615
615
  else:
616
616
  values_str = ", ".join(str(v) for v in allowed_values)
617
617
 
@@ -701,11 +701,12 @@ class ConditionalCheckHandler:
701
701
  # Normalize path for DuckDB (forward slashes work on all platforms)
702
702
  source_path = dataset._source.replace('\\', '/')
703
703
 
704
+ safe_pattern = pattern.replace("'", "''")
704
705
  sql = f"""
705
706
  SELECT COUNT(*) as violations
706
707
  FROM '{source_path}'
707
708
  WHERE ({condition})
708
- AND NOT regexp_matches({column}::VARCHAR, '{pattern}')
709
+ AND NOT regexp_matches({column}::VARCHAR, '{safe_pattern}')
709
710
  """
710
711
 
711
712
  try: