11namespace ServiceControl . Infrastructure . WebApi
22{
3- using System ;
43 using System . Linq ;
54 using System . Reflection ;
6- using System . Threading . RateLimiting ;
75 using CompositeViews . Messages ;
86 using Microsoft . AspNetCore . Builder ;
9- using Microsoft . AspNetCore . RateLimiting ;
107 using Microsoft . Extensions . DependencyInjection ;
118 using Microsoft . Extensions . DependencyInjection . Extensions ;
129 using Microsoft . Extensions . Hosting ;
1512
1613 static class HostApplicationBuilderExtensions
1714 {
18- public const string AuthConfigRateLimitPolicy = "AuthConfigRateLimit" ;
19-
2015 public static void AddServiceControlApi ( this IHostApplicationBuilder builder , CorsSettings corsSettings )
2116 {
2217 // This registers concrete classes that implement IApi. Currently it is hard to find out to what
@@ -27,19 +22,6 @@ public static void AddServiceControlApi(this IHostApplicationBuilder builder, Co
2722
2823 builder . Services . AddCors ( options => options . AddDefaultPolicy ( Cors . GetDefaultPolicy ( corsSettings ) ) ) ;
2924
30- // Rate limiting for sensitive endpoints to prevent enumeration attacks
31- builder . Services . AddRateLimiter ( options =>
32- {
33- options . AddFixedWindowLimiter ( AuthConfigRateLimitPolicy , limiterOptions =>
34- {
35- limiterOptions . PermitLimit = 10 ;
36- limiterOptions . Window = TimeSpan . FromMinutes ( 1 ) ;
37- limiterOptions . QueueProcessingOrder = QueueProcessingOrder . OldestFirst ;
38- limiterOptions . QueueLimit = 2 ;
39- } ) ;
40- options . RejectionStatusCode = 429 ;
41- } ) ;
42-
4325 // We're not explicitly adding Gzip here because it's already in the default list of supported compressors
4426 builder . Services . AddResponseCompression ( ) ;
4527 var controllers = builder . Services . AddControllers ( options =>
0 commit comments