| 1 | // Package bansuid provides a function to prevent processes from reacquiring privileges. |
| 2 | package bansuid |
| 3 | |
| 4 | import "errors" |
| 5 | |
| 6 | // On Linux, uses prctl() SECUREBITS and NO_NEW_PRIVS to prevent the process or its descendants |
| 7 | // from ever obtaining privileges by execing a suid/sgid/cap xattr binary. Returns ErrNotSupported |
| 8 | // if platform is not supported. May return other errors. |
| 9 | func BanSuid() error { |
| 10 | return banSuid() |
| 11 | } |
| 12 | |
| 13 | // Returned by BanSuid if it is not supported on the current platform. |
| 14 | var ErrNotSupported = errors.New("bansuid not supported") |