tinyagent-py 0.0.13__py3-none-any.whl → 0.0.16__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.
@@ -295,7 +295,8 @@ def _detect_string_obfuscation(tree: ast.AST) -> bool:
295
295
 
296
296
 
297
297
  def validate_code_safety(code: str, *, authorized_imports: Sequence[str] | None = None,
298
- authorized_functions: Sequence[str] | None = None, trusted_code: bool = False) -> None:
298
+ authorized_functions: Sequence[str] | None = None, trusted_code: bool = False,
299
+ check_string_obfuscation: bool = True) -> None:
299
300
  """Static validation of user code.
300
301
 
301
302
  Parameters
@@ -312,6 +313,9 @@ def validate_code_safety(code: str, *, authorized_imports: Sequence[str] | None
312
313
  trusted_code
313
314
  If True, skip security checks. This should only be used for code that is part of the
314
315
  framework, developer-provided tools, or default executed code.
316
+ check_string_obfuscation
317
+ If True (default), check for string obfuscation techniques. Set to False to allow
318
+ legitimate use of base64 encoding and other string manipulations.
315
319
  """
316
320
  # Skip security checks for trusted code
317
321
  if trusted_code:
@@ -384,7 +388,7 @@ def validate_code_safety(code: str, *, authorized_imports: Sequence[str] | None
384
388
  # ------------------------------------------------------------------
385
389
  # Detect string obfuscation techniques that might be used to bypass security
386
390
  # ------------------------------------------------------------------
387
- if _detect_string_obfuscation(tree):
391
+ if check_string_obfuscation and _detect_string_obfuscation(tree):
388
392
  raise ValueError("SECURITY VIOLATION: Suspicious string manipulation detected that could be used to bypass security.")
389
393
 
390
394
  if blocked: