diff --git a/studio/backend/core/inference/tools.py b/studio/backend/core/inference/tools.py index 17031b388d..74dd6ae717 100644 --- a/studio/backend/core/inference/tools.py +++ b/studio/backend/core/inference/tools.py @@ -767,9 +767,7 @@ def _sandbox_python_startup_bypasses_guard( if _python_inline_payload(arguments) is None and _python_reads_program_from_stdin( arguments ): - if _python_payload_launches_startup_bypass( - payload, depth + 1, environment_tainted - ): + if _python_payload_launches_startup_bypass(payload, depth + 1, environment_tainted): return True # Preserve the previous fail-safe for nested shell bodies. if _sandbox_python_startup_bypasses_guard(payload, depth + 1, environment_tainted): diff --git a/studio/backend/tests/test_permission_mode.py b/studio/backend/tests/test_permission_mode.py index bd3a690cac..547d1e8e73 100644 --- a/studio/backend/tests/test_permission_mode.py +++ b/studio/backend/tests/test_permission_mode.py @@ -954,7 +954,9 @@ def test_python_classifier(code, unsafe): def test_python_runtime_safety_blocks_child_startup_guard_bypass(): from core.inference.tools import _check_code_safety - assert _check_code_safety("import subprocess\nsubprocess.run(['python','-c','print(1)'])") is None + assert ( + _check_code_safety("import subprocess\nsubprocess.run(['python','-c','print(1)'])") is None + ) assert ( _check_code_safety( "import os, subprocess\n" @@ -1133,7 +1135,9 @@ def test_render_html_gated_only_when_networked(): assert rh("") is False assert rh("") is True assert ( - rh("") + rh( + "" + ) is False ) assert rh("") is False @@ -1149,7 +1153,9 @@ def test_render_html_gated_only_when_networked(): assert rh("") is True assert rh("") is False assert ( - rh("") + rh( + "" + ) is True ) assert (