diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 93d8a53a..764fa90b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,8 +57,6 @@ jobs: -D CMAKE_INSTALL_LIBDIR=lib \ -D PYTHON_EXECUTABLE=`which python` \ -D XPYT_BUILD_TESTS=ON \ - -D CMAKE_C_COMPILER=$CC \ - -D CMAKE_CXX_COMPILER=$CXX \ ${{ env.CMAKE_EXTRA_ARGS }} working-directory: build diff --git a/environment-dev.yml b/environment-dev.yml index eb273d25..f3925418 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -16,7 +16,7 @@ dependencies: # of a spurious bug in debugpy - python <3.13 - pip - - xeus-python-shell>=0.7.0,<0.8 + - xeus-python-shell>=0.8.0,<0.9 - debugpy>=1.6.5 - ipython # Test dependencies diff --git a/environment-wasm-host.yml b/environment-wasm-host.yml index afdc4e0f..efd13000 100644 --- a/environment-wasm-host.yml +++ b/environment-wasm-host.yml @@ -15,7 +15,7 @@ dependencies: - pyjs >=4,<5 - libpython - zstd - - openssl + - openssl <4 - xz - ipywidgets - xeus-python-shell>=0.7.0,<0.8 diff --git a/src/xdebugger.cpp b/src/xdebugger.cpp index 9bbe8f1c..c123eb3a 100644 --- a/src/xdebugger.cpp +++ b/src/xdebugger.cpp @@ -212,9 +212,30 @@ namespace xpyt std::string src_var_name = message["arguments"]["srcVariableName"].get(); std::string dst_var_name = message["arguments"]["dstVariableName"].get(); - int src_frame_id = message["arguments"]["srcFrameId"].get(); + bool valid = false; + { + py::gil_scoped_acquire acquire; + py::str py_src_var_name = py::str(src_var_name); + py::str py_dst_var_name = py::str(dst_var_name); + bool valid_src_name = PyUnicode_IsIdentifier(py_src_var_name.ptr()) == 1; + bool valid_dst_name = PyUnicode_IsIdentifier(py_dst_var_name.ptr()) == 1; + valid = valid_src_name && valid_dst_name; + } + + if (!valid) + { + nl::json reply = { + {"type", "response"}, + {"request_seq", message["seq"]}, + {"success", false}, + {"command", message["command"]}, + {"message", "dstVariableName and srcVariableName must be valid identifiers"} + }; + return reply; + } // It basically runs a setExpression in the globals dictionary of Python. + int src_frame_id = message["arguments"]["srcFrameId"].get(); int seq = message["seq"].get(); std::string expression = "globals()['" + dst_var_name + "']"; nl::json request = {