is_safe_environment function

Check if running in a safe environment