summaryrefslogtreecommitdiffstats
path: root/genvmop.txr
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-07-26 07:07:34 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-07-26 07:07:34 -0700
commitafe568e3eb40e3a6cf91bccd3d4565e9e9f5c540 (patch)
tree95b0a0e2f8834f9873edf721534a07f51f9edb05 /genvmop.txr
parenta0ef252c17b51f73543c2cc76ecf7ce813a5ca9d (diff)
downloadtxr-afe568e3eb40e3a6cf91bccd3d4565e9e9f5c540.tar.gz
txr-afe568e3eb40e3a6cf91bccd3d4565e9e9f5c540.tar.bz2
txr-afe568e3eb40e3a6cf91bccd3d4565e9e9f5c540.zip
repl: revise security checks.
Summary: we now check the entire path of .txr_history and .txr_profile files for security issues; we enforce that these files must not be readable to other users, not just not writable. And there is a bugfix: we do not load the history if it has a permission problem, instead of loading it anyway and just issuing a diagnostic. * repl.c (report_security_problem): Rename to report_file_perm_problem. Drop the umask check, because we are going to be checking for files that are not readable for others, which would require a stricter umask than the usual 022. (report_path_perm_problem): New static function. (load_rcfile): Take the needed function symbols as arguments, because the only caller is repl and it has them; it can pass them down. Check the path using path-components-safe function, and bail with an error message if it is bad. Then check the file using path-strictly-private-to-me-p, rather than path-private-to-me-p as previously. This requires the file not to be readable to others too. (repl): path_private_to_me_p variable renamed to ppriv_s for brevity and holds a different symbol: path-strictly-private-to-me-p, the function which checks that other users cannot read the file, not just write. Also capture the path-components-safe symbol as psafe_s. ppriv_s and psafe_s are passed down to load_rcfile so it can do checks. Like in the case of the rcfile, we now check the history file using both functions, validating the path not just the file's own permissions. Bugfix: we now check the history file's path before loading the history file, and avoid loading it if the check fails. We use the path-exists-p function now to check that the history and rc files exist. That leaves a small flaw: an attacker could be in control of the paths to these files and manipulate these paths such that these files appear not to exist; we will then not report on such a situation. * txr.1: Documented.
Diffstat (limited to 'genvmop.txr')
0 files changed, 0 insertions, 0 deletions