snare icon indicating copy to clipboard operation
snare copied to clipboard

Fix assertion error for superuser

Open lordlabuckdas opened this issue 4 years ago • 2 comments

In test_snare_helpers_check_privileges.py, since a superuser would have (write) permissions for the root directory, 2 of the assertions fail.

So, I have used os.geteuid() to get the effective user ID and set self.privileges accordingly.

I have also removed the executable permissions for snare_helpers.py as it is not required.

lordlabuckdas avatar Apr 12 '21 06:04 lordlabuckdas

I find this test a bit confusing. Are we testing here if we could run Snare on this system?

glaslos avatar Jun 12 '21 09:06 glaslos

Yes, we're testing the check_privileges function which is used to create a directory for Snare and handle cases where the user does not have sufficient permissions to do so. I believe this makes Snare more non-root-user-friendly. I agree that this test does not make much sense if Snare is intended to only be run as root.

lordlabuckdas avatar Jun 12 '21 10:06 lordlabuckdas