Repository navigation
fix: return 403 when non-admin tries to do admin requests - #6945
Conversation
|
Kudos, SonarCloud Quality Gate passed! |
|
@saw-jan Still a thing? or close? |
I there can be a clarification on the following query, then it would be helpful to decide whether to work on it or close.
Sorry, I totally forgot about this PR |
6dcb51b to
ec4bf13
Compare
| } | ||
|
|
||
| errorcode.AccessDenied.Render(w, r, http.StatusUnauthorized, "Unauthorized") | ||
| errorcode.AccessDenied.Render(w, r, http.StatusForbidden, "Forbidden") |
There was a problem hiding this comment.
I agree with that in the current context. So 403 is the way to go.
Needs to be reviewed by dev team if this is correct and right place to do it
|
|
ec4bf13 to
3cf671e
Compare
564d0a9 to
4fbef3c
Compare
|
|
The other thing that we need to check is that these status codes should not "leak" information about what exists and does not exist. When a user with not enough privileges tries to modify or delete something (user, group, space...) that exists, they get a 403 "forbidden" - good. If they try the same modify or delete to a non-existent user, group, space, then they should also get a 403 "forbidden". If they get 404 "not found" then they will know that the item really does not exist, and that "403" indicates that the item exists (and they do not have permission). Similarly for "create" requests - if a 403 "forbidden"is given when trying to create a new user that does not already exist, then 403 should also be given if "create" is attempted for a user that already exists. |
|
@saw-jan is there an issue about testing the cases where 403 and/or 404 status responses might leak information? |
fix: return 403 when non-admin tries to do admin requests
There are some tests like this one ocis/tests/acceptance/features/apiGraphUserGroup/deleteUser.feature Lines 78 to 82 in 775913c |
Good. If there are the same sort of test scenarios for non-existent group, non-existent space... for trying to delete and trying to modify then we are good. |
I will check for other test cases |











Description
With this PR, all the graph
admin requestsif done by thenon-adminusers will respond with403 Forbiddeninstead of401 Unauthorized.Motivation: #5742 (comment)
403in some test scenarios.But the above comment doesn't describe more about
401 Unauthorizedvs403 Forbidden. It is agreeable to respond with403when non-admin users do admin requests but the standard/policy and also from a security point of view, it could be different in oCIS.The main motive of the PR is to have some conclusion and if agreed upon then hopefully merge the fix, if not then change the test expectation.
**Non-admin scenarios: should they respond with
403,401or404❓ **Related Issue
Motivation and Context
How Has This Been Tested?
Types of changes
Checklist: