Repository navigation
API accepts requests without a valid token when authentication is enabled and role-based authorization is disabled - #5982
Merged
Conversation
…disabled (#5979) PermissionPolicyProvider chose between the role-checking policy and an allow-all policy by looking only at Authentication.RoleBasedAuthorizationEnabled. With authentication enabled and RBAC at its default of false, every permission resolved to allow-all. Every controller action carries a permission policy, so the RequireAuthenticatedUser fallback policy never applied. Requests without a token, or with an invalid or expired token, reached the controllers on the error, audit and monitoring instances. The provider now uses both settings: - Authentication disabled: allow-all. RBAC is ignored. - Authentication enabled, RBAC disabled: every permission requires an authenticated user. This is the behavior from before role-based access control was added. - Authentication and RBAC enabled: unchanged. Other changes: - The startup log line for the authentication settings includes the RBAC setting. - The monitoring container health check calls the anonymous root endpoint instead of /connection. /connection requires an authenticated user when authentication is enabled. Tests: - Unit tests evaluate every permission through the real registrations, for each combination of the two settings. - New When_authentication_is_enabled_without_role_based_authorization acceptance fixtures on all three instances. When RBAC was added, the existing fixtures were switched to RBAC enabled only, which removed the coverage for the default configuration. - A request without a token to every route that is not [AllowAnonymous] gets 401. This test fails without the fix. - A valid token without roles is accepted. - The existing When_authentication_is_enabled fixtures (RBAC enabled) also run the every-route test. Co-authored-by: Dennis van der Stelt <dvdstelt@gmail.com> (cherry picked from commit ff995c9)
dvdstelt
approved these changes
Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of:
Which fixes for the
release-6.21branch: