Method ValidateCode
Namespace: Belay.Core.Security
Assembly: Belay.Core.dll
ValidateCode(string, bool, bool)
Validates Python code input for security risks and injection attempts.
public static InputValidator.ValidationResult ValidateCode(string code, bool allowFileOperations = false, bool allowNetworking = false)
Parameters
code
string
The Python code to validate.
allowFileOperations
bool
Whether to allow file operations (default: false).
allowNetworking
bool
Whether to allow networking operations (default: false).
Returns
InputValidator.ValidationResult
A validation result indicating whether the code is safe to execute.
Exceptions
Thrown when code is null.
ValidateCode(string, SecurityConfiguration)
Validates Python code input for security risks and injection attempts using a security configuration.
public static InputValidator.ValidationResult ValidateCode(string code, SecurityConfiguration config)
Parameters
code
string
The Python code to validate.
config
SecurityConfiguration
The security configuration to use for validation.
Returns
InputValidator.ValidationResult
A validation result indicating whether the code is safe to execute.
Exceptions
Thrown when code or config is null.