docs: complete XML-doc coverage and strip internal tracking IDs from code comments
Resolve all CommentChecker findings across the gateway server, worker, tests, and .NET client (314 -> 0 real issues): add missing <returns>/<summary>/<param> on public and test members, convert Stream/interface overrides to <inheritdoc/>, and remove internal task/issue tracking IDs (SEC-*, IPC-*, WRK-*, GWC-*, TST-*, Client.Dotnet-*) from shipped code documentation while preserving the design rationale prose. Shipped comments should not carry internal bookkeeping, and complete XML docs keep the analyzer/TreatWarningsAsErrors gate and generated API docs clean. The 6 remaining flags are heuristic false positives (MD5, UTC-4, capacity-1, near-1601) left intact so real documentation is not corrupted. Claude-Session: https://claude.ai/code/session_01DMXXvNuPekkkrTEyPNxEkW
This commit is contained in:
@@ -4,7 +4,7 @@ using ZB.MOM.WW.MxGateway.Server.Configuration;
|
||||
namespace ZB.MOM.WW.MxGateway.Server.Security.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Cheap, in-process per-peer sliding-window failure counter for the gRPC auth path (SEC-11). It is
|
||||
/// Cheap, in-process per-peer sliding-window failure counter for the gRPC auth path. It is
|
||||
/// checked BEFORE the API-key verification store read and short-circuits a peer that has exceeded
|
||||
/// <see cref="SecurityOptions.ApiKeyFailureLimit"/> failed attempts within
|
||||
/// <see cref="SecurityOptions.ApiKeyFailureWindowSeconds"/>; a successful verification resets the
|
||||
@@ -45,7 +45,11 @@ public sealed class ApiKeyFailureLimiter
|
||||
{
|
||||
}
|
||||
|
||||
// Test/explicit seam.
|
||||
/// <summary>Initializes a new instance of the <see cref="ApiKeyFailureLimiter"/> class. Test/explicit seam.</summary>
|
||||
/// <param name="limit">The maximum number of failures allowed within <paramref name="window"/>.</param>
|
||||
/// <param name="window">The sliding window over which failures are counted.</param>
|
||||
/// <param name="maxPeers">The maximum number of tracked peers before least-recently-active eviction kicks in.</param>
|
||||
/// <param name="clock">The time provider.</param>
|
||||
internal ApiKeyFailureLimiter(int limit, TimeSpan window, int maxPeers, TimeProvider clock)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(clock);
|
||||
@@ -145,6 +149,7 @@ public sealed class ApiKeyFailureLimiter
|
||||
|
||||
private sealed class PeerState
|
||||
{
|
||||
/// <summary>Timestamps (in ticks) of failures still within the sliding window.</summary>
|
||||
public Queue<long> FailureTicks { get; } = new();
|
||||
|
||||
public long LastActivityTicks;
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public sealed class GatewayGrpcAuthorizationInterceptor(
|
||||
|
||||
string? authorizationHeader = context.RequestHeaders.GetValue("authorization");
|
||||
|
||||
// SEC-11: short-circuit a peer that has already failed too many times inside the sliding
|
||||
// Short-circuit a peer that has already failed too many times inside the sliding
|
||||
// window BEFORE the verification store read, so online guessing cannot spend a SQLite read
|
||||
// per attempt. The peer key prefers the presented key id over the transport address (NAT
|
||||
// caveat). ResourceExhausted signals throttling without revealing whether any particular
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ public static class GrpcAuthorizationServiceCollectionExtensions
|
||||
services.AddSingleton<GatewayGrpcScopeResolver>();
|
||||
services.AddSingleton<IGatewayRequestIdentityAccessor, GatewayRequestIdentityAccessor>();
|
||||
services.AddSingleton<IConstraintEnforcer, ConstraintEnforcer>();
|
||||
// SEC-11 per-peer failure counter, checked before the verification store read. Bind the knobs
|
||||
// Per-peer failure counter, checked before the verification store read. Bind the knobs
|
||||
// from IConfiguration directly (not IOptions<GatewayOptions>) to avoid coupling this
|
||||
// registration to the whole-options validation pipeline.
|
||||
services.AddSingleton(sp => new ApiKeyFailureLimiter(
|
||||
|
||||
Reference in New Issue
Block a user