mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-135543: Emit sys.remote_exec audit event when sys.remote_exec is called (GH-135544)
This commit is contained in:
parent
bb9596fcfa
commit
1ddfe59320
8 changed files with 79 additions and 20 deletions
|
@ -1220,7 +1220,7 @@ static inline int run_remote_debugger_source(PyObject *source)
|
|||
// that would be an easy target for a ROP gadget.
|
||||
static inline void run_remote_debugger_script(PyObject *path)
|
||||
{
|
||||
if (0 != PySys_Audit("remote_debugger_script", "O", path)) {
|
||||
if (0 != PySys_Audit("cpython.remote_debugger_script", "O", path)) {
|
||||
PyErr_FormatUnraisable(
|
||||
"Audit hook failed for remote debugger script %U", path);
|
||||
return;
|
||||
|
|
|
@ -2488,6 +2488,11 @@ sys_remote_exec_impl(PyObject *module, int pid, PyObject *script)
|
|||
if (PyUnicode_FSConverter(script, &path) == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (PySys_Audit("sys.remote_exec", "iO", pid, script) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
debugger_script_path = PyBytes_AS_STRING(path);
|
||||
#ifdef MS_WINDOWS
|
||||
PyObject *unicode_path;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue