Skip to content
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

Determine what endpoints should return 404 when permission is denied #515

Open
hasan7n opened this issue Dec 1, 2023 · 1 comment
Open

Comments

@hasan7n
Copy link
Contributor

hasan7n commented Dec 1, 2023

Some endpoints (e.g., GET /benchmarks/<bid>/datasets/<did>) should return 404 (or an empty response) if hit by an unauthorized user

@hasan7n
Copy link
Contributor Author

hasan7n commented Dec 1, 2023

This will involve refactoring of how permissions are checked.
Currently, database hits are being doubled for permission checks. Better practices can be:

  1. when possible, passing database objects to permission classes instead of calling the database from inside the permission class
  2. checking permissions inside serializers, for POST requests
  3. filtering querysets instead of denying access, for GET requests that return lists

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

No branches or pull requests

1 participant