Specifically, I'm asking about the safety of Python's print
function. I have a python script that generates passwords and before exiting, prints the password to the terminal's output using print()
. I have some questions about the safety of this:
Can an unprivileged process (process running in user space) access the output by:
reading the terminal screen's content or GUI? From my limited research (1, 2) this seems to be possible in systems utilizing X windows system, but not Wayland.
reading into the file descriptor or through some similar method? I tried
cat /dev/pts/14
andtail -f /proc/<pid>/fd/1
, but neither of them worked from my experiments, and I'm not sure why.reading into terminal output logs or some output history stored somewhere (when I have not deliberately installed/activated any such thing)?
reading the memory location of the released process? I.e. when my python script finishes running, does it leave the password's value in the block of memory where it was stored when the process was running?
by reading into Python specific logs of what it prints?
through some other method?