Skip to content

Fix assertion error for superuser#289

Open
lordlabuckdas wants to merge 1 commit intomushorg:mainfrom
lordlabuckdas:check_priv_test_fix
Open

Fix assertion error for superuser#289
lordlabuckdas wants to merge 1 commit intomushorg:mainfrom
lordlabuckdas:check_priv_test_fix

Conversation

@lordlabuckdas
Copy link
Contributor

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.

@glaslos
Copy link
Member

glaslos commented Jun 12, 2021

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

@lordlabuckdas
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants