-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
need better testing around minimum privileges #1374
Comments
I'm starting from the assumption that we want to leverage our existing happy-path tests to verify the minimum privileges required. That is: given that we're already writing happy-path tests that verify the behavior of endpoints when users are authorized, we may as well update those tests to verify what we want around authz rather than writing a whole separate battery of tests. (Tangentially: it's a fair question whether we should automatically generate happy-path tests from the definitions in endpoints.rs -- see #784. I think that's a great idea to explore. I'm not sure whether it makes sense to couple that project to this one though.) So how do we do this? One idea would be to provide a way for Nexus to return the list of privileges that were checked, either directly in the response or through a test-only side channel. Then the test suite could verify these privileges matched what we expected. This is very precise -- we'd be verifying that, say, deleting a project checked whether someone had permission to [edit: the following is a bad idea, but keeping it here to preserve the thinking]: |
We've had a number of issues where certain operations checked the wrong privileges and this was not identified by the test suite.
The "unauthorized.rs" test verifies that totally unauthenticated or unprivileged users are not able to do things. And the happy path tests verify that superusers are able to do everything. We don't have tests for anything in between. I'll record more thoughts on this below.
The text was updated successfully, but these errors were encountered: