microsoft / FeatureManagement-Dotnet

Microsoft.FeatureManagement provides standardized APIs for enabling feature flags within applications. Utilize this library to secure a consistent experience when developing applications that use patterns such as beta access, rollout, dark deployments, and more.
MIT License
1.05k stars 115 forks source link

Add context null check for built-in filters #428

Closed zhiyuanliang-ms closed 7 months ago

zhiyuanliang-ms commented 7 months ago

Why this PR?

Bug fix.

We have null check for FeatureFilterEvaluationContext in EvaluateAsync method of ContextualTargeting and Targeting filters.

We missed that in TimeWindowFilter and PercentageFilter. This could cause potential NPE, since we access context.Settings without check whether context is null.