How would one programmatically stop an app from reading computer files?
In a language like Python for scripting, how would you stop an app from having access to reading computer files, especially sensitive system-level ones?
Edit: To be clear, I mean set permissions for that app to not have access to computer files, even after the script is done running (setting permissions).
You should run your python script as a non-privileged user and read a file after validating the access
# check readability of the path if os.access("file.txt", os.R_OK): # open txt file as file with open("file.tx") as file: return file.read()