Skip to content

Use middleware to check administrator status#1447

Merged
williamjallen merged 1 commit into
Kitware:masterfrom
williamjallen:admin-middleware
Jun 1, 2023
Merged

Use middleware to check administrator status#1447
williamjallen merged 1 commit into
Kitware:masterfrom
williamjallen:admin-middleware

Conversation

@williamjallen
Copy link
Copy Markdown
Collaborator

We currently verify that the current user is an administrator before proceeding in multiple places throughout the codebase. This leads to the potential for authorization to go awry in some cases since each location performs the authorization differently.

This PR moves all of the administrator-checking logic to a dedicated middleware class. The downside of this change is that the administrator-checking code is separated from the "business" logic for admin-only pages. This means that. it is easy to accidentally introduce security vulnerabilities if our routing configuration gets messed up. To counter this possibility, I have added a test which verifies that each of the routes can only be accessed by administrators.

Once this PR is merged, I plan to go through each of the auth routes and remove unnecessary authentication-checking code.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants