Skip to content

API accepts requests without a valid token when authentication is enabled and role-based authorization is disabled #5986

Closed

Description

@ramonsmits

Symptoms

When authentication is enabled and role-based authorization is disabled, the ServiceControl error, audit and monitoring instances accept API requests without a bearer token, with an invalid token, or with an expired token. The request runs as if a signed-in user sent it.

Who's affected

Users of ServiceControl 6.18.0 to 6.21.1 who have Authentication.Enabled set to true and Authentication.RoleBasedAuthorizationEnabled set to false (the default).

Instances with authentication disabled are not affected. These instances do not require a token by design. Instances with role-based authorization enabled are not affected.

Root cause

Every API action has a permission policy. With role-based authorization disabled, each permission policy allowed every request and did not require an authenticated user. ASP.NET Core only applies the fallback policy, which requires an authenticated user, to endpoints without a policy. So no policy required authentication on the API actions.

Confirmed workarounds

Enable role-based authorization on every instance. Before you enable it, make sure that the identity provider assigns a role to every user. Users without a role are denied access.

Backported to

Original bug report

Describe the bug

With authentication enabled and role-based authorization disabled, a request without an Authorization header gets 200 OK and the response data. The same happens with an invalid or expired token. Expected: 401 Unauthorized on every endpoint that is not anonymous.

Additional information

  • Affected versions: 6.18.0 to 6.21.1. Versions 6.11.0 to 6.17.x are not affected.
  • Introduced in 6.18.0 by Add role-based access control #5518.
  • The monitoring container health check called /connection. That endpoint requires an authenticated user when authentication is enabled, and only worked because of this bug. From 6.21.2, the health check calls the root endpoint (/).

Activity

  1. ramonsmits commented on Oct 9, 2026

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions