microsoft / microsoft/FeatureManagement-Dotnet

Authorization/authentication errors thrown before feature flag is checked

Open
#42 6 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1.2k
Forks
129
Avg merge
1d 1h
Merged PRs (30d)
5

Description

If you have a ASP.Net Core app with a controller with the following method:

[HttpGet]
[FeatureGate(FeatureFlags.Foo)]
[Authorize]
public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }

Currently if:

  1. A request is made with correct scopes and the feature is turned on -> 200 returned (expected)
  2. A request is made with incorrect scopes and the feature is turned on -> 401 returned (expected)
  3. A request is made with correct scopes and the feature is turned off -> 404 returned (expected)
  4. A request is made with incorrect scopes and the feature is turned off -> 401 returned (unexpected)

In scenario 4 (or any scenario when the feature is turned off) I would have imagined that it would always return a 404 so that a client wouldn't be made aware of new features it doesn't have access to.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ASP.NET Core controller example and reproduce the four combinations of feature state and authorization scopes. Inspect how [FeatureGate] and [Authorize] are evaluated, then verify that a disabled feature returns 404 regardless of scopes while the enabled-feature cases retain their expected responses.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
authorization, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.