microsoft / microsoft/FeatureManagement-Dotnet
Authorization/authentication errors thrown before feature flag is checked
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:
- A request is made with correct scopes and the feature is turned on ->
200returned (expected) - A request is made with incorrect scopes and the feature is turned on ->
401returned (expected) - A request is made with correct scopes and the feature is turned off ->
404returned (expected) - A request is made with incorrect scopes and the feature is turned off ->
401returned (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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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