|
Bugzilla – Full Text Bug Listing |
| Summary: | The path of the loaded Python plugins can be overwrriten by standard Python search path | ||
|---|---|---|---|
| Product: | Sudo | Reporter: | Jerome <sudo> |
| Component: | Sudo | Assignee: | Todd C. Miller <Todd.Miller> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | low | ||
| Version: | 1.9.10 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
|
Description
Jerome
2022-06-05 11:03:57 MDT
I considered adding it to the front of the path but that could also be problematic. Now you have the possibility of overriding standard Python modules with your own, which is even harder to debug. There is no good solution here but I think that appending to module path is the least bad. Perhaps it is worth suggesting that sudo Python modules use a "Sudo" prefix or something similar to reduce the chance of namespace collisions. I understand your choice but maybe could you change the name /root/audit.py in the documentation and/or add a precision about the search path precedence ? I updated the sudo blog articles and renamed the Python files from, e.g. audit.py to sudo_audit.py and added the following to the sudo_plugin_python manual page: The parent directory of "ModulePath" will be appended to Python's module search path (there is currently no way to force Python to load a module from a fully-qualified path). It is good practice to use a prefix for the module file that is unlikely to conflict with other installed Python modules, for example, "sudo_policy.py". Otherwise, if the there is an installed Python module with the same file name as the sudo Python plugin file (without the directory), the wrong file will be loaded. |