-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-143511: Document sys.remote_exec permissions requirements #143575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Wouldn't it make more sense to add this info to the remote debugging docs? 🤔 |
|
@RafaelWO Well i figured sys.rst or sys.executable here is way more used or gone through by users on a daily basis? Sys.rst is more discoverable for users hitting the error. |
Doc/library/sys.rst
Outdated
| Callers should adjust permissions before calling, for example:: | ||
|
|
||
| import os | ||
| import tempfile | ||
| import sys | ||
|
|
||
| with tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False) as f: | ||
| f.write("print('Hello from remote!')") | ||
| f.flush() | ||
| os.chmod(f.name, 0o644) # Readable by group/other | ||
| sys.remote_exec(pid, f.name) | ||
| os.unlink(f.name) # Cleanup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be put before the audit event descriptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@picnixz Have implemented that yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did so
accidentally named the commit the same as last one but yeah, shouldn't be a problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are almost there: Please move all your content above the audit-event directives - not just the first paragraph 😉
Doc/library/sys.rst
Outdated
| The temporary script file is created with restrictive permissions (typically | ||
| ``0o600``). The target process must be able to read this file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might be misleading since it sounds like remote_exec creates the script (which it does not).
Example suggestion:
Note that the remote process must be able to read this file in terms of permissions. If the caller is running under a different user than the remote process, the caller should adjust permissions (...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright yeah, yours is quite better I have to say, cuz what I've inputted may be misleading.
Thanks I'll use yours:)

sys.remote_exec(pid, script_path)creates a temporary script with restrictivepermissions (typically
0o600). The target process must be able to read thisfile, which fails in cross-user scenarios (e.g. sudo debugging).
Added documentation note with example showing how to
os.chmod()the file to0o644(readable by group/other) before calling.Addresses the PermissionError reported in #143511.
Co-authored-by: @RafaelWO
📚 Documentation preview 📚: https://cpython-previews--143575.org.readthedocs.build/