aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Be sure to root directory from absolute symlink.Kaz Kylheku2022-07-251-1/+12
| | | | | | | | * safepath.c (safepath_check): If we are checking a relative directory, and an absolute symlink shows up, then we have to check the root directory; we have not checked it before. It could have bad permissions. We ensure we do this at most once.
* README: add Known Caveats section.Kaz Kylheku2022-07-251-0/+15
| | | | | * README: There is an issue with the trust in the current working direcory when relative paths are used.
* Typo in README.Kaz Kylheku2022-07-251-1/+1
|
* Correctly handle readlink overflow.Kaz Kylheku2022-07-242-2/+9
| | | | | | | | | | * safepath.h (SAFEPATH_TOOLONG): New enum constant. * safepath.c (safepatch_check): Don't ignore the truncation situation from readlink. Use the full buffer length, and if readlink returns 256, then diagnose overflow using the new SAFEPATH_TOOLONG error code and bail. (safepath_strerr): Map SAFEPATH_TOOLONG.
* Add SAFEPATH_NOTIDIR error code.Kaz Kylheku2022-07-242-0/+7
| | | | | | | | * safepath.h (SAFEPATH_NOTDIR): New enum. * safepath.c (safepath_err, set_errno): Handle conversion between SAFEPATH_NOTDIR and ENOTDIR. (safepath_strerr): Map SAFEPATH_NOTDIR to message.
* Add GCC sanitizer debugging.Kaz Kylheku2022-07-241-1/+2
| | | | | * Makefile (DIAG_FLAGS): Sanitize for memory misuse and undefined behavior.
* Map safepath errors to strings.Kaz Kylheku2022-07-233-1/+23
| | | | | | | * safepath.[ch]: New function, safepath_strerr. * testsp.c (main): Use new function to print message, rather than integer code.
* Check using effective UID, not real.Kaz Kylheku2022-07-232-4/+4
| | | | | | | | | | | | | | | | | | | We don't want to behave like the access function, which is intended for use in setuid programs to determine what the original user can access. The purpose of safepath_check is to check whether the filesystem can harm the caller. For that, the effective identity that is being wielded should be used. A setuid executable might have a real user ID bob, but effective root. Root does not trust bob; root doesn't want to follow a symlink controlled by bob. * safepath.c (safe_group, tamper_proof): Replace getuid calls with geteuid. * README.md: Updated text.
* Fix some inaccurate comments.Kaz Kylheku2022-07-231-11/+10
| | | | | * safepath.c (tamper_proof, safepath_check): Reword outdated comments.
* safepath: new project.Kaz Kylheku2022-07-225-0/+561
|
* NILKaz Kylheku2022-07-220-0/+0