↑↓ to navigate Enter to open "…" all these words ANDOR to combine

Architecture Decision Record

ADR-019: Layered Rate Limiting with an Authenticated-Only Global Limiter

Status

Accepted. Revised 2026-08-01 (the auth-ip per-IP anonymous-authentication limiter, which the shared auth controller applies to login and register by default, is recorded as the third layer; the anonymous-surface trade-off was corrected to match; the edge trust posture behind every IP partition key was made explicit). Revised 2026-08-18 (the hard-coded limits become a bound RateLimitingSettings section, a sliding-window algorithm option joins the fixed window, and the global and UserPolicy partitions gain an optional Redis-backed distributed limiter with a fail-open posture, which partly retires the "in-process counters" trade-off below; auth-ip stays deliberately local. See the Revision (2026-08-18) at the end). Revised 2026-09-07 (the gRPC exemption keys on endpoint metadata and the negotiated protocol instead of a caller-set header; anonymous /hubs traffic is metered per IP; ADC's tighter gateway policy is scoped to the two credential-submission routes; and a trusted-internal-caller exemption generalizes the synthetic-traffic bypass). Revised 2026-09-19 (the Decision is brought in line with the two revisions below and with the current auth-ip surface: the gRPC exemption reads endpoint metadata rather than a content type, anonymous hub traffic is metered before the anonymous exemption applies, the second global partition key is the subject claim, and auth-ip now covers password reset and email confirmation alongside login and register). Revised 2026-09-30 (the global and UserPolicy partitions key on the subject claim first and fall back to identity name, because the name claim carries the non-unique full name, so two users with the same name shared one bucket; MMCA.Common v1.213.0). Revised 2026-09-10 (both gateways scope auth-tight to the two credential routes, and the trusted-caller client half ships in the framework as AddTrustedCallerHeader). Revised 2026-10-01 (the output-cache list reads as a sample, and the auth-ip no-IP rule no longer claims to mirror the global limiter). Revised 2026-10-06: every ADC service binds the RateLimiting section, and the email-confirmation auth-ip decoration is recorded as owned by the framework base rather than by each app. Revised 2026-10-07: the distributed limiter's Redis partition key is qualified by the application namespace (MMCA.Common v1.232.0), so by default two MMCA applications sharing one Redis no longer share counters. Revised 2026-10-19: Store's three services bind the RateLimiting section too, so both apps call the configuration overload in every service. Revised 2026-10-21: the distributed limiter's increment and expiry run as one atomic Lua script, so no fault between them can leave a counter key without a TTL, and the forwarded-header trade-off records that both Bicep templates declare service ingress internal-only. Revised 2026-10-26: anchors refreshed after the source moves since 2026-10-21, and Related names ADR-135 as the record that owns the application-namespace decision the Redis partition key follows. Revised 2026-10-28: anchors refreshed after the Bicep, UI host and Identity service source moves since 2026-10-26. Revised 2026-11-17: the opt-in FixedPolicy and UserPolicy named policies, their partition selector and their PermitLimit, QueueLimit and PerUserPermitLimit settings are removed because no consumer named them, so auth-ip and mcp are the only named policies (MMCA.Common v1.300.0). See the Revision (2026-11-17). Revised 2026-11-23: the auth-ip surface is recorded as twelve framework actions (machine-client token, OAuth discovery, passkey sign-in and sign-in links join the original six), Store's own quote-ip policy is recorded as the one consumer-registered policy, ADC's and Store's services and UI hosts reach AddCommonRateLimiting and AddTrustedCallerHeader through the framework host builders rather than a per-app call (Helpdesk's single web host still calls AddCommonRateLimiting itself), ADC's gateway puts auth-tight on a third route (the machine-client token), and anchors are refreshed. Revised 2026-12-03 (MMCA.Common v1.331.0): every per-IP partition keys on one shared client-address key that treats an IPv6 /64 as one client and unmaps an IPv4-mapped address; the idempotency filter's anonymous subject keeps the raw address. See the Revision (2026-12-03).

Context

Every service exposes read and write endpoints to the public internet through the gateway (ADR-008). Abusive or runaway clients (scrapers, credential stuffing, retry storms, a buggy SPA stuck in a loop) can exhaust a service's threads, database connections, and downstream quotas. ASP.NET Core ships a rate-limiting middleware, but "turn on rate limiting" is not the decision: the load-bearing questions are who gets limited, by what partition key, and what is exempt. A naive per-IP global limiter is actively wrong for this deployment for three reasons:

  • Public read endpoints are output-cached, so legitimate anonymous browsing should be cheap, not throttled.
  • Anonymous server-rendered (Blazor Server) traffic all shares the UI host's outbound IP, so an IP partition would throttle every public visitor as if they were a single abuser.
  • Login and registration brute-force is a distinct threat with a distinct control (account lockout and per-IP registration throttling), not a general request cap.

Decision

Rate limiting is layered, and the always-on global limiter is authenticated-only.

  1. A global limiter that only caps authenticated callers. AddCommonRateLimiting (MMCA.Common.API) installs a GlobalLimiter (active on every request through UseRateLimiter) that:
    • Exempts infrastructure traffic outright (NoLimiter): /health, /alive, JWKS / OIDC discovery (/.well-known/*), and gRPC inter-service calls, recognized from the routed endpoint's gRPC metadata rather than from the caller-set application/grpc content type (see the Revision (2026-09-07)). These are legitimately high-frequency.
    • Exempts anonymous traffic (NoLimiter) for the three reasons above, with one metered exception: an anonymous request to a configured hub path prefix is counted per client IP at AnonymousHubPermitLimit first, and only every other anonymous request falls through to the exemption (see the Revision (2026-09-07)).
    • Caps each authenticated caller to globalPermitLimit (default 300) requests per fixed one-minute window, partitioned by the subject (sub) claim, then identity name, then remote IP, rejecting overage with 429 Too Many Requests.
  2. Anonymous abuse is handled by the right-shaped control, not the global limiter. Public reads are served from the output cache (UseOutputCache; ADC's Conference service defines one public-endpoint policy per public aggregate, among them EventsCache / CategoriesCache / QuestionsCache / RoomsCache, registered in the ConfigureOutputCache callback it hands to AddMmcaServiceHost, MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:136, :175-216), and login/registration brute-force is handled by LoginProtectionService (exponential-backoff account lockout after MaxFailedAttempts failed logins, plus per-IP registration throttling).
  3. A per-IP cap on the anonymous authentication endpoints, on by default. AddCommonRateLimiting also registers the named policy RateLimitPolicyAuthIp ("auth-ip"): a fixed one-minute window keyed on the client IP, authIpPermitLimit (default 30) requests, overage rejected with 429. It is not left to each app to attach. AuthControllerBase (MMCA.Common.API) decorates LoginAsync and RegisterAsync, and PasswordResetAuthControllerBase decorates the forgot-password and reset-password actions, and EmailConfirmationControllerBase decorates the two anonymous email-confirmation actions, send-email-confirmation and confirm-email (MMCA.Common/Source/Presentation/MMCA.Common.API/Controllers/EmailConfirmationControllerBase.cs:81, :109). Six more anonymous credential actions carry it the same way: MachineTokenControllerBase on the machine-client token action (MMCA.Common/Source/Presentation/MMCA.Common.API/Controllers/MachineClients/MachineTokenControllerBase.cs:48), OAuthControllerBase on discover (.../Controllers/OAuthControllerBase.cs:176), PasskeysControllerBase on signin/options and signin (.../Controllers/Passkeys/PasskeysControllerBase.cs:232, :257), and SignInLinkControllerBase on sign-in-link and sign-in-link/redeem (.../Controllers/SignInLinks/SignInLinkControllerBase.cs:83, :111). All twelve carry [EnableRateLimiting(WebApplicationBuilderExtensions.RateLimitPolicyAuthIp)], so any consumer that inherits one of those bases gets them without opting in. The list is not every anonymous credential action: in OAuthControllerBase only discover carries it, so the anonymous exchange POST that redeems a single-use code for an access and refresh token pair (.../Controllers/OAuthControllerBase.cs:289-293), the complete callback (:204-205) and the provider challenge actions (:115-155) carry none. An app may also name the policy on its own anonymous actions: Store's guest-order controller does (MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.API/Controllers/GuestOrdersController.cs:58, :208). Store's and ADC's Identity EmailConfirmationController derive from that base and add no attribute of their own (MMCA.Store/Source/Modules/Identity/MMCA.Store.Identity.API/Controllers/EmailConfirmationController.cs:33, MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.API/Controllers/EmailConfirmationController.cs:32). What an override inherits, settled empirically (2026-08-13): EnableRateLimitingAttribute leaves AttributeUsage.Inherited at its default of true, and a derived override therefore still sees the base attribute through GetCustomAttributes(inherit: true), so a bare override very likely retains the policy rather than silently dropping it. The convention is unchanged regardless: apply the attribute explicitly on every override (ADC always did; Store now does), because endpoint metadata resolution is not something an app should have to reason about per action, and a dropped policy fails silently. Two guards pin it instead of leaving it to argument: a MMCA.Common reflection test that asserts both the base decoration and the inherited-on-an-override case, and a Store integration test that reads the booted host's EndpointDataSource and asserts POST /Auth/register carries the auth-ip policy in its metadata (the only check independent of the reflection question). It exists because the other two layers leave one hole between them: the global limiter no-ops for anonymous traffic outside the hub paths and the lockout is keyed per email, so a password spray (one password, many emails) from a single source was otherwise unthrottled. Three details are deliberate: RefreshAsync is not throttled (renewal is automatic and periodic, and Blazor Server circuits issue it server-side from the UI host's IP); a request with no attributable IP gets NoLimiter rather than sharing one bucket with every other such request (a deliberate difference from the global limiter, which puts an unattributable authenticated request in one shared "authenticated" bucket and an unattributable anonymous hub request in one shared "anonymous-hub" bucket, MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.RateLimiting.cs:187, :96, while auth-ip returns NoLimiter at :345-346); and the default is 30 rather than a tighter 10 for the same shared-IP reason, since every Server-circuit user's login leaves from the UI host's address.
  4. The only other named policy belongs to the MCP endpoint. AddCommonRateLimiting also registers RateLimitPolicyMcp ("mcp", MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.RateLimiting.cs:57, registered at :442), one window per user id, then name, then client IP (:209-225) at McpPermitLimit requests per minute (default 60, MMCA.Common/Source/Presentation/MMCA.Common.API/RateLimiting/RateLimitingSettings.cs:42-43). It is inert until an endpoint names it, and MapCommonMcp is the one caller that does (MMCA.Common/Source/Presentation/MMCA.Common.Mcp/McpHostingExtensions.cs:136, ADR-138). The framework registers no general-purpose tightening policy: an action that needs a tighter cap than the global default needs a policy its host registers. The two opt-in policies that once filled that role were removed because no consumer named them (see the Revision (2026-11-17)). Store's Sales module is the one consumer that registers its own: quote-ip (MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.API/QuoteRateLimiting.cs:26), a fixed one-minute window per client IP at 120 permits (:29, :32) with NoLimiter for an unknown IP (:43-45), added to the host's limiter options by AddQuoteRateLimiting (:55-56) and named by the bag-quote action and the best-sellers action (MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.API/Controllers/OrderQuotesController.cs:36, .../Controllers/BestSellersController.cs:35). It is separate from auth-ip so a busy checkout's repeated re-pricing cannot spend the bucket that guest-order placement also draws on (QuoteRateLimiting.cs:13-21).
  5. The client IP these partitions key on is whatever the edge forwards, and that is trusted from any proxy. Both IP-keyed decisions above (the auth-ip window, and the global limiter's third-choice fallback key) read HttpContext.Connection.RemoteIpAddress, which UseForwardedHeaders has already rewritten from X-Forwarded-For earlier in the same shared pipeline (UseCommonMiddlewarePipeline runs forwarded headers before UseRateLimiter). That middleware is configured to trust any proxy: the pipeline clears both KnownProxies and KnownIPNetworks, because cloud reverse proxies (Azure Container Apps, AWS ALB) front the services from internal addresses that are not in the default allow-lists, and an unlisted proxy means the headers are ignored and every request is attributed to the proxy instead. The decision is to take a caller-supplied IP as canonical rather than to run with no usable client IP at all.
  6. Every per-IP partition keys on one client-address key, not the raw address. ClientAddressKey.For unmaps an IPv4-mapped address (::ffff:a.b.c.d) to plain IPv4 and masks an IPv6 address to its /64 prefix, so a subscriber rotating the low 64 bits of its address, or one client seen through two spellings on a dual-stack hop, stays one partition (MMCA.Common/Source/Build/RateLimiting/ClientAddressKey.cs:42-65, the text overload at :73-77, the reasoning at :13-18). It is one source file linked as an internal type into MMCA.Common.API, MMCA.Common.Infrastructure, MMCA.Common.Aspire, MMCA.Common.UI.Web and MMCA.Common.Gateway, because the Gateway package references no MMCA project (ClientAddressKey.cs:25-28, MMCA.Common/Source/Hosting/MMCA.Common.Gateway/MMCA.Common.Gateway.csproj:23). The callers are the auth-ip window (MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.RateLimiting.cs:322), the anonymous-hub partition (:76), the global limiter's IP fallback (:166), the mcp fallback (MMCA.Common/Source/Presentation/MMCA.Common.API/RateLimiting/McpCallerKey.cs:35), the Blazor host's edge limiter (MMCA.Common/Source/Presentation/MMCA.Common.UI.Web/Hardening/UiRateLimitingExtensions.cs:135), the gateway's per-IP and per-visitor windows (MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Gateway/GatewayRateLimitingExtensions.cs:249, :258; MMCA.Common/Source/Hosting/MMCA.Common.Gateway/GatewaySettings.cs:276), and the registration cap in LoginProtectionService, which normalizes inside the service rather than where the controller reads the address, so the session record behind sign-in history keeps the real address (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Auth/LoginProtectionService.cs:257-267). The idempotency filter's anonymous subject is deliberately not this key: it keeps users' cached replays apart and is not a limiter, so masking it to /64 would let neighbours share each other's replays (ClientAddressKey.cs:21-22; the raw anon:{address} subject at MMCA.Common/Source/Presentation/MMCA.Common.API/Idempotency/IdempotencyFilter.cs:600-601, ADR-017).

Rationale

  • Limit the traffic that is both attributable and expensive. An authenticated request is tied to a principal and usually drives the database; capping per-principal stops a single account from monopolizing a service without punishing the public read path.
  • Do not punish shared-origin anonymous traffic. With Blazor Server fronting public browsing behind one IP, and public reads served from the output cache, an anonymous IP cap would throttle legitimate visitors at scale while barely protecting an already-cached backend.
  • Right control per threat. Brute-force is an auth concern answered by a per-email lockout plus a per-IP cap on the anonymous credential endpoints that carry it (login, register, password reset, email confirmation, the machine-client token, OAuth discovery, passkey sign-in and sign-in links); general overload is a per-user request cap; infrastructure endpoints must never be throttled. A single global IP bucket conflates all three.

Trade-offs

  • The global limiter only protects the authenticated surface. The anonymous surface is covered endpoint by endpoint instead: the anonymous credential endpoints (login, register, password reset, email confirmation, the machine-client token, OAuth discovery, passkey sign-in and sign-in links) carry the auth-ip limiter, with the login-protection service on top of it for login and register; anonymous hub paths are metered per IP by the global limiter itself; and public reads are served from the output cache. An uncached anonymous endpoint added later inherits none of that: it has no global cap and must opt into a named policy or its own control.
  • The per-IP cap keys on a header a caller can set. Trusting forwarded headers from any proxy is what makes the IP usable at all behind a cloud load balancer, but it makes a spoofable input the partition key of a security control. The exposure is bounded rather than absent: ForwardLimit is left at its default of 1, so only the rightmost X-Forwarded-For entry is consumed, and a proxy that appends the real client address wins for any traffic that actually traverses it. A caller that can reach a service without passing through that proxy can name its own IP and mint a fresh auth-ip bucket per request, leaving the per-email lockout (ADR-029, not IP-keyed) as the control still standing in front of a spray. Containing this is a deployment concern, not a limiter one: either the gateway is the only reachable ingress, or the allow-lists carry the real proxy ranges. Neither is enforced in code: no source in Common, ADC or Store sets ForwardLimit or populates KnownProxies (the shared options only clear them, MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/CommonForwardedHeaders.cs:49). The first is declared in infrastructure instead: both Bicep templates give every service container app internal-only ingress (external: false, MMCA.ADC/infra/main.bicep:2146, :2417, :2571, :2719; MMCA.Store/infra/main.bicep:1844, :2043, :2167) and expose only the gateway and the UI host (ADC :2914, :3077; Store :2338, :2467), so traffic from outside the environment reaches a service only through the gateway. A caller already inside the container-apps environment can still reach a service directly.
  • Per-user partitioning depends on the authenticated principal being populated when the limiter partitions the request, so the limiter's placement relative to authentication in the request pipeline is load-bearing: move it and the partition sees a different (or empty) principal.
  • Defaults are deployment-agnostic. 300 requests/min/user is a coarse backstop, not a tuned SLO; a service with heavier legitimate per-user traffic must raise it, and a stricter endpoint needs a policy its host registers, since the framework ships none for that purpose.
  • In-process counters, where a limiter is not distributed. A local limiter's state is per-instance, so across N replicas its effective ceiling is roughly N times the configured limit. This holds for auth-ip (always in-memory, allowDistributed: false at MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.RateLimiting.cs:354), for the gateway limiters, and for the global, hub and mcp windows (allowDistributed: true at :196, :101, :224) in any host that leaves Distributed unset (see the Revision (2026-08-18)). ADC production sets RateLimiting__Distributed=true on all four services (MMCA.ADC/infra/main.bicep:2226, :2482, :2622, :2788). The AppHost does the same only in its opt-in multi-replica run: it reads MmcaReplicas.FromEnvironment("ADC_REPLICAS") and passes distributedRateLimiting: true for the four services and false for the gateway (MMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:446-451), and the framework helper floors the count at 1, changes nothing at 1 or less, and sets Distributed only when that flag is true (MMCA.Common/Source/Hosting/MMCA.Common.Aspire.Hosting/MmcaReplicas.cs:43, :67-76). So there those three windows share one Redis budget across replicas and only auth-ip and the gateway limiters scale with replica count (MMCA.ADC/infra/main.bicep:2220-2225). Store sets no Distributed value, so every Store limiter stays per-instance.

Revision (2026-08-18)

The layering above is unchanged: the global limiter is still authenticated-only, infrastructure and anonymous traffic are still exempt, auth-ip still covers login and register by default, and FixedPolicy / UserPolicy are still opt-in with nothing applying them. Three things below it changed.

  1. The limits are now a validated settings section. RateLimitingSettings (MMCA.Common/Source/Presentation/MMCA.Common.API/RateLimiting/RateLimitingSettings.cs:21) binds the "RateLimiting" section (:24) at MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.cs:307, falling back to a default instance when the section is absent, so an unconfigured host keeps exactly the behavior this record describes. Every figure the Decision quotes now has a named home and a [Range]: GlobalPermitLimit 300 (:38-40), AuthIpPermitLimit 30 (:46-47), PerUserPermitLimit 30 for UserPolicy (:34-36), and PermitLimit 100 plus QueueLimit 2 for FixedPolicy (:26-32).
  2. A sliding window is selectable. Algorithm (:53) takes RateLimitAlgorithm.FixedWindow (the default) or SlidingWindow (.../RateLimiting/RateLimitAlgorithm.cs:15,22), with SegmentsPerWindow defaulting to 4 (:61-62, [Range(1, 60)], ignored under FixedWindow). The window itself stays one minute under both algorithms (RateLimitAlgorithm.cs:5-6), so this is a smoothing choice, not a new cap: a fixed window lets a caller spend a full minute's budget in the last second of one window and again in the first second of the next, and the segmented window removes that doubling at the cost of holding per-segment state.
  3. The global and UserPolicy partitions can be Redis-backed. Distributed (:72, default false) swaps in RedisFixedWindowRateLimiter (.../RateLimiting/RedisFixedWindowRateLimiter.cs:37), which keys on rl:{partitionKey}:{unixMinute} (:129-130), performs a StringIncrementAsync (:135), and sets a 65-second TTL only on the increment that created the key (:137-143, the 5 seconds of slack being deliberate clock skew, :139-141), admitting the request when the returned count is within the permit limit (:145). Three partitions opt in: the global limiter (WebApplicationBuilderExtensions.cs:79-104, Redis scope "global" at :99), UserPolicy (:114-128, scope "user" at :123), and, since the 2026-09-07 revision below, the anonymous hub partition (AnonymousPartition, scope "hub" at MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.cs:96).

auth-ip deliberately stays in-memory (allowDistributed: false, WebApplicationBuilderExtensions.cs:234, rationale at :143-147), as does FixedPolicy (:346-353). The per-IP cap on the anonymous authentication endpoints is a coarse brute-force backstop sitting in front of a control that is already global and stateful, the ADR-029 per-email lockout; making it distributed would put a Redis round trip on the login path to tighten a limit whose per-replica multiplication is already accounted for in its generous default of 30.

The distributed limiter fails open. Any Redis fault other than cancellation is caught and the lease is granted (:147-155), with a warning emitted at most once per window through an Interlocked.Exchange guard on a static field (:149-151, :44). That is the same posture the global limiter already takes for a request with no attributable IP: a rate limiter is a backstop, and a broken backstop must not become an outage. Two consequences are worth naming. The increment and the comparison are not transactional (:26-29), so genuinely concurrent requests can overshoot the limit slightly, which is accepted for a coarse cap. And setting Distributed = true in a host with no IConnectionMultiplexer registered silently degrades to the in-memory limiter rather than failing startup (:150-167, documented at RateLimitingSettings.cs:64-71), so this setting sits outside the ADR-070 fail-fast contract and a misconfiguration looks exactly like success.

The "In-process counters" trade-off above is therefore narrowed rather than removed: the effective ceiling is still roughly N times the configured limit across N replicas for auth-ip and FixedPolicy, and for the global and per-user partitions in any host that has not set Distributed or has no multiplexer. Every other trade-off in this record stands unchanged, including the forwarded-header trust posture, which the Redis partition key inherits verbatim.

Revision (2026-09-07)

The layering is unchanged: the global limiter is still authenticated-only, login and register still carry auth-ip, and infrastructure paths are still exempt. Four things below it moved, all from the 2026-09-07 security review.

  1. The gRPC exemption no longer trusts a request header (SEC-Common-44). IsRateLimitBypassed (MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.cs:75, applied at :171) decides on gRPC endpoint metadata, which routing produces from the server's own MapGrpcService registrations, so stamping Content-Type: application/grpc on an ordinary request no longer switches off the per-user cap. The HTTPS-redirect skip that shared the old test keys on the negotiated protocol instead (MiddlewarePipelineBuilder.IsCleartextHttp2, MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/Pipeline/MiddlewarePipelineBuilder.cs:362, branched at :98).
  2. Anonymous hub traffic is metered rather than exempt (SEC-ADC-25). IsAnonymousHubRequest (WebApplicationBuilderExtensions.cs:111) matches the request path against RateLimitingSettings.HubPathPrefixes (default ["/hubs"], MMCA.Common/Source/Presentation/MMCA.Common.API/RateLimiting/RateLimitingSettings.cs:91) and partitions those requests per client IP at AnonymousHubPermitLimit (default 60 per minute, :99, applied at WebApplicationBuilderExtensions.cs:92-97). This is the one hole the "exempt anonymous traffic" rule left that no edge control reliably covers: a hub path is a long-lived upgrade an edge limiter is usually configured to pass through, and the traffic is anonymous until the connection is established.
  3. A trusted internal caller can be exempted at the gateway. GatewayRateLimitingSettings.TrustedCallerSecret (:151) and TrustedCallerHeaderName (default X-Internal-Caller-Key, :123) (MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Gateway/GatewayRateLimitingSettings.cs) generalize the synthetic-traffic bypass that already sat beside them (:91, :115). It is off unless the secret is configured, the header is single-valued, and the comparison is constant time (CryptographicOperations.FixedTimeEquals, MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Gateway/GatewayRateLimitingExtensions.cs:162, wired at :138-139). It exists for the shared-origin problem this record already names: a server-rendered UI host's own back-end calls, token refresh above all, otherwise collapse into one client-IP partition and throttle every visitor together.
  4. ADC scopes its tighter gateway policy to the credential-submission routes. The gateway's auth-tight policy (MMCA.ADC/Source/Hosts/MMCA.ADC.Gateway/appsettings.json:63) is attached to identity-auth-login (:88-94, the policy at :93) and identity-auth-register (:95-101, the policy at :100) and to nothing else, so /Auth/refresh keeps the exemption this record requires for Blazor Server circuits, whose refreshes all leave from the UI host's address.

Revision (2026-09-10)

Both gateways now scope auth-tight the same way, and the trusted-caller exemption's client half ships in the framework. Two items, both landed.

  1. Store's gateway splits the credential routes out of the /Auth catch-all. Its auth-tight policy (MMCA.Store/Source/Hosts/MMCA.Store.Gateway/appsettings.json:37, the block at :36-43) is attached to identity-auth-login (:78-84, the policy at :83) and identity-auth-register (:85-91, the policy at :90), and the remaining identity-auth route matching /Auth/{**catch-all} (:94-98) carries no RateLimiterPolicy at all, so refresh, logout, forgot-and-reset and the OAuth callbacks sit on the edge global limiter alone. That is the same three-route shape ADC has, and it is what item 4 above requires of any Blazor Server host: a circuit's refreshes all leave from the UI host's single address, so a per-IP cap on /Auth throttles every visitor together. The pin moved with it: CredentialRoutes_CarryTheTightRateLimiterPolicy (MMCA.Store/Tests/Hosts/MMCA.Store.Gateway.Tests/MmcaGatewayTests.cs:150) asserts both directions, that every credential route carries the policy (:161-165) and that the set of routes carrying any policy is exactly that pair (:169-173), so re-attaching it to the catch-all fails the build.
  2. The trusted-caller client half is framework code, not per-app code. The header a UI host sends so its own back-end calls take the exempt partition is registered by AddTrustedCallerHeader, shipped in MMCA.Common.UI.Web 1.191.0 (MMCA.Common/Source/Presentation/MMCA.Common.UI.Web/DependencyInjection.cs:87, in the extension(IServiceCollection services) block at :20). Both UI hosts call it and nothing else does (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI.Web/Program.cs:117, MMCA.Store/Source/Hosts/UI/MMCA.Store.UI.Web/Program.cs:141). The client reads the same GatewayRateLimiting section the gateway side already binds (MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Gateway/GatewayRateLimitingSettings.cs:47), which is now the one section name in both repos: Store's UI host declares GatewayRateLimiting:TrustedCallerHeaderName at MMCA.Store/Source/Hosts/UI/MMCA.Store.UI.Web/appsettings.json:32-34 and ADC's gateway declares the section at MMCA.ADC/Source/Hosts/MMCA.ADC.Gateway/appsettings.json:21-33 (the header name at :32), with the secret injected as GatewayRateLimiting__TrustedCallerSecret by each template (MMCA.Store/infra/main.bicep:1889 and :2006, MMCA.ADC/infra/main.bicep:2223 and :2363). One name on both sides of the boundary is the point: a client sending under one key while the gateway reads another fails open silently, as a plain throttled caller.

Revision (2026-10-01)

No decision or rationale changed. Two current-state statements in the Decision were corrected. The ADC Conference output-cache list now reads as a sample of a larger per-aggregate set (MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:266-295) rather than as the complete set. The auth-ip no-IP rule (NoLimiter, MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.RateLimiting.cs:284-285) no longer claims to mirror the global limiter, because the global limiter does not fail open for unattributable traffic: an authenticated request with no subject, name or IP shares the "authenticated" bucket (:149-152) and an anonymous hub request with no IP shares the "anonymous-hub" bucket (:62); only anonymous non-hub traffic gets NoLimiter (:68), and that is the anonymous exemption, not a no-IP rule. The rate-limiting registration now lives in the partial WebApplicationBuilderExtensions.RateLimiting.cs, so the WebApplicationBuilderExtensions.cs anchors in the Revisions above are historical and are not rewritten.

Revision (2026-10-06)

Every ADC service binds the RateLimiting section. ADC's Identity and Notification services now call the configuration overload, AddCommonRateLimiting(builder.Configuration) (MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/Program.cs:165, MMCA.ADC/Source/Services/MMCA.ADC.Notification.Service/Program.cs:144), so their declared limits bind through RateLimitingSettings instead of being ignored by the int overload. The Bicep key moved to the bound property name, RateLimiting__AuthIpPermitLimit (MMCA.ADC/infra/main.bicep:1836, rationale at :1831). The gateway auth-tight anchors in item 4 and in Revision (2026-09-10) point at the current lines.

  • The email-confirmation auth-ip decoration belongs to the framework, not the apps. Decision item 3 said each app's EmailConfirmationController applied the policy to the two actions the framework bases did not own. EmailConfirmationControllerBase now carries the attribute on both (MMCA.Common/Source/Presentation/MMCA.Common.API/Controllers/EmailConfirmationControllerBase.cs:81, :109) and the Store and ADC controllers are subclasses with no attribute of their own, so the Decision now counts six framework-decorated actions.
  • Current locations of facts recorded in the older Revisions (those sections keep their original anchors). In MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.RateLimiting.cs: IsRateLimitBypassed :46, AnonymousPartition :62 (the "anonymous-hub" key :66, the anonymous NoLimiter :72), IsAnonymousHubRequest :82, the __infra NoLimiter :145, the global partition key chain ending in "authenticated" :153-156, AuthIpRateLimitPartition :305 (__unknown-ip NoLimiter :310, allowDistributed: false :318), and FixedPolicy allowDistributed: false :414. In RedisFixedWindowRateLimiter.cs: StringIncrementAsync :137, the 65-second KeyExpireAsync :144, the fail-open catch :149 and its Interlocked.Exchange warn-once guard :151. MiddlewarePipelineBuilder.IsCleartextHttp2 is defined at MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/Pipeline/MiddlewarePipelineBuilder.cs:350 and used at :86. GatewayRateLimitingSettings.cs: SectionName :51, TrustedCallerHeaderName :126, TrustedCallerSecret :154; GatewayRateLimitingExtensions.cs: FixedTimeEquals :172, wired at :148-149. AddTrustedCallerHeader is at MMCA.Common/Source/Presentation/MMCA.Common.UI.Web/DependencyInjection.cs:121, called from MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI.Web/Program.cs:136 and MMCA.Store/Source/Hosts/UI/MMCA.Store.UI.Web/Program.cs:129; Store's UI section is at MMCA.Store/Source/Hosts/UI/MMCA.Store.UI.Web/appsettings.json:35-36. The trusted-caller secret is injected at MMCA.Store/infra/main.bicep:1959 and :2084 and MMCA.ADC/infra/main.bicep:2444 and :2602.
  • Anchors in the live sections (the Conference output-cache range and the unattributable-bucket anchors in Decision item 3) were re-verified against current source.

Revision (2026-10-07)

Re-verified against current source. The layering, every default, the auth-ip surface, the fail-open posture and both gateways' auth-tight scoping are unchanged. One storage detail of the distributed limiter moved, and the anchors that drifted since the 2026-10-06 audit are re-pointed.

  1. The Redis partition key is namespaced per application (SEC-Common-53, shipped in MMCA.Common v1.232.0). The framework builds each RedisFixedWindowRateLimiter with the partition key {namespace}:{scope}:{partition} (MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.RateLimiting.cs:254, rationale at :247-249), where the namespace is Cache:KeyPrefix with its trailing colon trimmed, or ApplicationNamespace.Resolve when no prefix is set (:199-205). That matches how the distributed cache resolves its own prefix: a configured Cache:KeyPrefix as is, else the application namespace plus : (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Caching/CacheKeyPrefix.cs:73-88). The limiter still prefixes rl: and appends the Unix minute (MMCA.Common/Source/Presentation/MMCA.Common.API/RateLimiting/RedisFixedWindowRateLimiter.cs:132, documented at :24-26), so the stored key is rl:{namespace}:{scope}:{partition}:{unixMinute}. By default, two MMCA applications pointed at one Redis therefore do not share a counter. Two hosts that set the same Cache:KeyPrefix or Application:Namespace share a namespace on purpose (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Caching/CacheKeyPrefix.cs:37-40, MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Configuration/ApplicationNamespace.cs:22-25), and a host with no application name falls back to app (ApplicationNamespace.cs:34, :67). The rl: keyspace the Related section names still holds.
  2. The Conference output-cache range drifted after the 2026-10-06 audit. The range was correct when that audit re-verified it; MMCA.ADC #255 later moved it by two lines through comment edits higher in the file. The AddPublicEndpointPolicy calls now run from ConferencePublicCache (MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:269) to BookmarkCountsCache (:300), and the four sampled names are all present (EventsCache :270, RoomsCache :278, CategoriesCache :279, QuestionsCache :280); Decision item 2 now cites :269-300. The unattributable-bucket anchors in Decision item 3 were and remain correct ("anonymous-hub" :66, "authenticated" :156, __unknown-ip NoLimiter :310 in WebApplicationBuilderExtensions.RateLimiting.cs).
  3. Anchors re-verified against current source: AddTrustedCallerHeader is called from MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI.Web/Program.cs:137 (Store :129 and the definition at MMCA.Common/Source/Presentation/MMCA.Common.UI.Web/DependencyInjection.cs:121 unchanged). CredentialRoutes_CarryTheTightRateLimiterPolicy is declared at MMCA.Store/Tests/Hosts/MMCA.Store.Gateway.Tests/MmcaGatewayTests.cs:144, with the per-route assertion loop at :155-161 and the exact-set BeEquivalentTo assertion at :163-168, still pinning both directions. RateLimiting__AuthIpPermitLimit is at MMCA.ADC/infra/main.bicep:1868 (value '300' inside the conferenceMode block, rationale at :1863-1865), and the ADC GatewayRateLimiting__TrustedCallerSecret injections are at :2491 and :2650 (Store MMCA.Store/infra/main.bicep:1959 and :2084 unchanged).

Revision (2026-10-19)

Store's services bind the RateLimiting section as well. Catalog, Sales and Identity now call AddCommonRateLimiting(builder.Configuration) (MMCA.Store/Source/Services/MMCA.Store.Catalog.Service/Program.cs:141, MMCA.Store/Source/Services/MMCA.Store.Sales.Service/Program.cs:149, MMCA.Store/Source/Services/MMCA.Store.Identity.Service/Program.cs:136) in place of the parameterless int overload, matching ADC's four services (Conference :221, Engagement :151, Identity :165, Notification :144). Store declares no RateLimiting section in its service configuration today, so the bound settings fall back to their defaults and its limits are unchanged; what changes is that per-environment tuning and the distributed Redis limiter (Revision 2026-08-18) are reachable in Store by configuration alone.

Revision (2026-10-21)

Re-verified against current source. The layering, every default, the auth-ip surface, the fail-open posture, the 65-second TTL and both gateways' auth-tight scoping are unchanged. One storage detail of the distributed limiter moved, one trade-off gained its infrastructure context, and the anchors that drifted since the 2026-10-19 revision are re-pointed.

  1. Increment and expiry are one atomic Lua script. RedisFixedWindowRateLimiter no longer issues a StringIncrementAsync followed by a separate KeyExpireAsync (the shape Revision 2026-08-18 records). IncrementScript (MMCA.Common/Source/Presentation/MMCA.Common.API/RateLimiting/RedisFixedWindowRateLimiter.cs:50-53) runs INCRBY and then EXPIRE only when the returned count is no greater than the permits requested, which is the increment that created the key, with KeyTtlSeconds 65 (:60); it is sent through ScriptEvaluateAsync (:166), and the type documents why: no failure between the two commands can leave a key with no expiry (:29-30). The increment and the permit comparison (:172) are still not transactional, so the slight concurrent overshoot accepted in Revision 2026-08-18 stands (:31-33). The fail-open catch (:174) and its warn-once Interlocked.Exchange guard (:176, on the static field at :67) are unchanged. The Related section now names the INCRBY script rather than a raw INCR.
  2. The forwarded-header trade-off records the declared ingress. Its closing statement said neither containment option was enforced. That holds for code (nothing in Common, ADC or Store sets ForwardLimit or populates KnownProxies, MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/CommonForwardedHeaders.cs:49, and the gateway copy only clears too, MMCA.Common/Source/Hosting/MMCA.Common.Gateway/ForwardedHeadersExtensions.cs:62), but both Bicep templates declare every service's ingress internal-only and expose only the gateway and UI host, so the trade-off now says so and names the residual in-environment path.
  3. Anchors re-verified against current source: the Conference output-cache policies run from ConferencePublicCache (MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:270) to BookmarkCountsCache (:301), with EventsCache :271, RoomsCache :279, CategoriesCache :280 and QuestionsCache :281, and Decision item 2 now cites :270-301. ADC Identity calls AddCommonRateLimiting(builder.Configuration) at MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/Program.cs:166 (Conference :221, Engagement :151, Notification :144, and Store's three services unchanged). The Redis key is built at RedisFixedWindowRateLimiter.cs:161 (documented at :24-28). ADC's gateway attaches auth-tight (MMCA.ADC/Source/Hosts/MMCA.ADC.Gateway/appsettings.json:63) to identity-auth-login (:90-96, the policy at :95) and identity-auth-register (:97-103, the policy at :102), and the identity-auth catch-all (:106) carries none, so the Revision (2026-09-07) item 4 anchors are historical. RateLimiting__AuthIpPermitLimit is at MMCA.ADC/infra/main.bicep:2024 (value '300' inside the conferenceMode block, rationale at :2016-2021); the ADC GatewayRateLimiting__TrustedCallerSecret injections are at :2647 and :2806, and Store's at MMCA.Store/infra/main.bicep:2053 and :2178.

Revision (2026-10-26)

Re-verified against current source. The layering, every default, the auth-ip surface, the fail-open posture, the atomic INCRBY script and its 65-second TTL, the application-namespaced Redis key, the declared internal-only service ingress and both gateways' auth-tight scoping are unchanged. No behavior moved; the anchors that drifted since the 2026-10-21 revision are re-pointed, and the Related section gains the record that owns the application namespace.

  1. Related names ADR-135. The Redis partition key's namespace (Revision 2026-10-07) is the application namespace that ADR-135 records as the one isolation rule for shared infrastructure keyspaces, so the Related section now points there for that decision rather than leaving it implied by this record and ADR-026.
  2. The unattributable-bucket anchors in Decision item 3 moved. Revision 2026-10-07 recorded them as unchanged; they have since moved with the file. In MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.RateLimiting.cs the "anonymous-hub" fallback key is at :87, the "authenticated" fallback at :177, and the auth-ip __unknown-ip NoLimiter branch at :330-331 (inside the settings overload of AuthIpRateLimitPartition, :326); Decision item 3 now cites those lines.
  3. Anchors re-verified against current source. In WebApplicationBuilderExtensions.RateLimiting.cs: IsRateLimitBypassed :67, AnonymousPartition :83 (the anonymous NoLimiter :93), IsAnonymousHubRequest :103, the __infra NoLimiter :166, auth-ip allowDistributed: false :339, and FixedPolicy allowDistributed: false :439. The Redis partition key {namespace}:{scope}:{partition} is built at :275 (rationale :268-270), the namespace is resolved by RateLimitKeyNamespace (:220-226, trailing colon trimmed at :225), and with no multiplexer registered the factory falls through to the in-memory limiters (:263, :280-283). In MMCA.Common/Source/Presentation/MMCA.Common.API/RateLimiting/RedisFixedWindowRateLimiter.cs: IncrementScript :50-53, KeyTtlSeconds :60, the static _lastLoggedFailureWindow :67, the rl: key built at :164, ScriptEvaluateAsync :169, the permit comparison :175, the fail-open catch :179 and its Interlocked.Exchange guard :181. MiddlewarePipelineBuilder.IsCleartextHttp2 is defined at MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/Pipeline/MiddlewarePipelineBuilder.cs:349 and used at :85. GatewayRateLimitingSettings.cs keeps SectionName :51, TrustedCallerHeaderName :126 and TrustedCallerSecret :154; in MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Gateway/GatewayRateLimitingExtensions.cs the FixedTimeEquals comparison is at :195 inside the shared PresentsSecret helper (:179), which IsTrustedInternalCaller (:164) calls with the trusted-caller settings (:171-172), applied at :208 (the last term of the IsExemptFromLimiters OR chain, :205-208) and :225. AddTrustedCallerHeader (MMCA.Common/Source/Presentation/MMCA.Common.UI.Web/DependencyInjection.cs:121) is called from MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI.Web/Program.cs:143 and MMCA.Store/Source/Hosts/UI/MMCA.Store.UI.Web/Program.cs:135 and from no other host (outside those two, only MMCA.Common's own tests call it). Every service calls AddCommonRateLimiting(builder.Configuration): ADC Conference MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:227, Engagement :157, Identity :172, Notification :150; Store Catalog MMCA.Store/Source/Services/MMCA.Store.Catalog.Service/Program.cs:147, Sales :155, Identity :142. The Conference output-cache policies run from ConferencePublicCache (MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:276) to BookmarkCountsCache (:307), with EventsCache :277, RoomsCache :285, CategoriesCache :286 and QuestionsCache :287, and Decision item 2 now cites :276-307. In MMCA.ADC/infra/main.bicep RateLimiting__Distributed is set at :1952, :2193, :2330 and :2484 (rationale :1946-1951; the AppHost at MMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:477, only when ADC_REPLICAS is greater than 1, :459-464), RateLimiting__AuthIpPermitLimit '300' at :2060 (rationale :2052-2057), service ingress is internal at :1876, :2129, :2282 and :2417 and the gateway and UI host are external at :2607 and :2770, and the trusted-caller secret is injected at :2683 and :2842. In MMCA.Store/infra/main.bicep service ingress is internal at :1529, :1711 and :1835, the gateway and UI host are external at :1987 and :2116, the trusted-caller secret is injected at :2059 and :2184, and no service-side RateLimiting__ key is set. The Trade-offs anchors now cite these lines.

Revision (2026-10-28)

Re-verified against current source. The layering, every default, the auth-ip surface, the declared internal-only service ingress (only the gateway and the UI host are external in both templates), ADC's Distributed=true on all four services, Store's absence of any service-side RateLimiting__ key, and the two-host scope of AddTrustedCallerHeader are unchanged. No behavior moved; only anchors drifted since the 2026-10-26 revision, and the Trade-offs section now cites the lines below.

  1. Anchors re-verified against current source. In MMCA.ADC/infra/main.bicep service ingress is internal at :1873, :2126, :2279 and :2414 (the external: false at :2425 is Notification's internal gRPC port mapping), the gateway and UI host are external at :2604 and :2767, RateLimiting__Distributed is set at :1949, :2190, :2327 and :2481 (rationale :1943-1948), RateLimiting__AuthIpPermitLimit '300' at :2057 (rationale :2049-2054), and the trusted-caller secret is injected at :2680 and :2839. In MMCA.Store/infra/main.bicep service ingress is internal at :1530, :1712 and :1836 (the external: false at :1849 is Sales' internal gRPC port mapping), the gateway and UI host are external at :1988 and :2117, and the trusted-caller secret is injected at :2060 and :2185; the only rate-limiting keys are GatewayRateLimiting__*. AddTrustedCallerHeader (MMCA.Common/Source/Presentation/MMCA.Common.UI.Web/DependencyInjection.cs:121) is called from MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI.Web/Program.cs:144 and MMCA.Store/Source/Hosts/UI/MMCA.Store.UI.Web/Program.cs:136. ADC Identity calls AddCommonRateLimiting(builder.Configuration) at MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/Program.cs:173. Store's UI GatewayRateLimiting section is at MMCA.Store/Source/Hosts/UI/MMCA.Store.UI.Web/appsettings.json:47, with TrustedCallerHeaderName at :48.

Revision (2026-11-17)

The layering is unchanged: the global limiter is still authenticated-only, infrastructure and anonymous traffic outside the hub paths are still exempt, and auth-ip still covers the anonymous credential endpoints by default. What changed is the set of named policies, removed in the API-projects drift review (MMCA.Common v1.300.0) because no consumer named them.

  1. FixedPolicy and UserPolicy are gone. AddCommonRateLimiting(RateLimitingSettings) registers the global limiter and the mcp policy (MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.RateLimiting.cs:434, :439) plus auth-ip (:449); the UserPolicyRateLimitPartition selector went with them. The int overload is now AddCommonRateLimiting(int globalPermitLimit = 300, int authIpPermitLimit = 30) (:385).
  2. Their settings are gone. RateLimitingSettings no longer carries PermitLimit, QueueLimit or PerUserPermitLimit; it keeps GlobalPermitLimit 300 (MMCA.Common/Source/Presentation/MMCA.Common.API/RateLimiting/RateLimitingSettings.cs:28), AuthIpPermitLimit 30 (:35), McpPermitLimit 60 (:43), Algorithm (:49), SegmentsPerWindow 4 (:58), Distributed (:68) and AnonymousHubPermitLimit 60 (:95).
  3. Distributed now names the windows it actually reaches. It moves the global limiter, the anonymous hub partition and the mcp policy onto RedisFixedWindowRateLimiter (RateLimitingSettings.cs:60-68; MMCA.Common/Source/Presentation/MMCA.Common.API/RateLimiting/RedisFixedWindowRateLimiter.cs:9-14); auth-ip stays in memory (WebApplicationBuilderExtensions.RateLimiting.cs:353).

Decision item 4 and the Trade-offs now describe that set. The FixedPolicy, UserPolicy, PermitLimit, QueueLimit and PerUserPermitLimit statements and anchors in the earlier revisions (2026-08-18 items 1 and 3 and its in-memory paragraphs, and the later anchor lists) are history and are superseded by this revision.

Revision (2026-11-23)

Re-verified against current source. The layering, every default, the authenticated-only global limiter, the fail-open distributed windows, the in-memory auth-ip, the declared internal-only service ingress in both templates, ADC's Distributed=true on its four services and Store's absence of any service-side RateLimiting__ key are unchanged. What moved is the breadth of the auth-ip surface, one consumer-registered policy, the path by which hosts reach the framework registrations, one ADC gateway route, and the anchors.

  1. auth-ip covers twelve framework actions, not six. The original six stand (MMCA.Common/Source/Presentation/MMCA.Common.API/Controllers/AuthControllerBase.cs:78, :103; PasswordResetAuthControllerBase.cs:78, :102; EmailConfirmationControllerBase.cs:81, :109; RefreshAsync still carries none). Six more carry the same attribute: the machine-client token (Controllers/MachineClients/MachineTokenControllerBase.cs:48), OAuth discover (Controllers/OAuthControllerBase.cs:176), passkey signin/options and signin (Controllers/Passkeys/PasskeysControllerBase.cs:232, :257) and sign-in-link and sign-in-link/redeem (Controllers/SignInLinks/SignInLinkControllerBase.cs:83, :111). Store names the policy on two guest-order actions of its own (MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.API/Controllers/GuestOrdersController.cs:58, :208). The OAuth exchange POST (Controllers/OAuthControllerBase.cs:289-293), the complete callback (:204-205) and the provider challenge actions (:115-155) are anonymous but carry no rate-limiting attribute. Decision item 3, the Rationale and the Trade-offs now list that surface.
  2. One consumer registers its own named policy. Store's quote-ip (MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.API/QuoteRateLimiting.cs:26, added at :56, 120 per IP per minute at :29) is applied at Controllers/OrderQuotesController.cs:36 and Controllers/BestSellersController.cs:35. It is the shape Decision item 4 prescribes (a tighter or differently sized cap is a policy the host registers), so item 4 now records it.
  3. No ADC or Store service calls AddCommonRateLimiting directly. The composed service host does it: AddMmcaServiceHost (MMCA.Common/Source/Hosting/MMCA.Common.ServiceHost/ServiceHostBuilderExtensions.cs:63) calls the configuration overload at :108, and every ADC and Store service calls AddMmcaServiceHost (ADC Conference MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:82, Engagement :58, Identity :82, Notification :58; Store Catalog MMCA.Store/Source/Services/MMCA.Store.Catalog.Service/Program.cs:32, Identity :37, Sales :51). Helpdesk's single web host, which is not a composed service host, still calls the int overload itself (MMCA.Helpdesk/Source/Hosts/MMCA.Helpdesk.Web/Program.cs:37). The binding the 2026-10-06 and 2026-10-19 revisions record still holds; the per-Program.cs call sites they and the 2026-10-21, 2026-10-26 and 2026-10-28 revisions cite for ADC and Store are history.
  4. No UI host calls AddTrustedCallerHeader directly. AddMmcaBlazorWebHost (MMCA.Common/Source/Presentation/MMCA.Common.UI.Web/Hosting/BlazorWebHostExtensions.cs:75) calls it at :126 (definition unchanged at MMCA.Common/Source/Presentation/MMCA.Common.UI.Web/DependencyInjection.cs:121), and ADC's and Store's UI hosts call AddMmcaBlazorWebHost (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI.Web/Program.cs:26, MMCA.Store/Source/Hosts/UI/MMCA.Store.UI.Web/Program.cs:30). It is still two hosts in practice, through framework composition rather than a per-app call.
  5. ADC's gateway attaches auth-tight to a third route. identity-auth-token (/Auth/token, the ADR-140 machine-client token, a credential submission like login and register) carries it (MMCA.ADC/Source/Hosts/MMCA.ADC.Gateway/appsettings.json:106-112, the policy at :111), beside identity-auth-login (:90-96, :95) and identity-auth-register (:97-103, :102). The identity-auth catch-all (:115-119) still carries none, so /Auth/refresh keeps its exemption; passkey sign-in rides that catch-all and relies on the service-side auth-ip (:147-149). The "two credential routes and nothing else" statements in the 2026-09-07, 2026-09-10 and 2026-10-21 revisions describe ADC as it was then. Store's gateway keeps the two-route set.
  6. The AppHost's multi-replica switch is framework code. The ADC_REPLICAS gate and the RateLimiting__Distributed=true environment value now live in MMCA.Common/Source/Hosting/MMCA.Common.Aspire.Hosting/MmcaReplicas.cs (:43, :67-76), called from MMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:446-451; the Trade-offs cite them.
  7. Anchors re-verified against current source. In MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.RateLimiting.cs: RateLimitPolicyMcp :57, IsRateLimitBypassed :76, the "anonymous-hub" key :96 and its allowDistributed: true :101, IsAnonymousHubRequest :112, "authenticated" :187, the global allowDistributed: true :196, McpRateLimitPartition :209-225 (allowDistributed: true :224), RateLimitKeyNamespace :233, the Redis key {namespace}:{scope}:{partition} :288, the auth-ip __unknown-ip NoLimiter :345-346 and allowDistributed: false :354, the int overload :388, GlobalLimiter :437, the mcp AddPolicy :442 and the auth-ip AddPolicy :452-453. RequireRateLimiting(RateLimitPolicyMcp) is at MMCA.Common/Source/Presentation/MMCA.Common.Mcp/McpHostingExtensions.cs:136, and McpPermitLimit at RateLimitingSettings.cs:42-43. MiddlewarePipelineBuilder.IsCleartextHttp2 is defined at MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/Pipeline/MiddlewarePipelineBuilder.cs:358 and used at :85, with UseForwardedHeaders :68, UseAuthentication :104 and UseRateLimiter :120. In MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Gateway/GatewayRateLimitingExtensions.cs: IsTrustedInternalCaller :181, PresentsSecret :196, FixedTimeEquals :212, IsExemptFromLimiters :222, called at :270 and :350. The Conference output-cache policies are registered in the ConfigureOutputCache callback (MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:136), with the public-endpoint policies running from EventsCache (:175) to BookmarkCountsCache (:216), all through AddPublicEndpointPolicy except SessionsCache, a plain AddPolicy over a PublicEndpointOutputCachePolicy that also bypasses by permission (:186-192), RoomsCache :194, CategoriesCache :195 and QuestionsCache :196; the name ConferencePublicCache the earlier revisions cite no longer exists (the module-wide ConferenceCache policy, MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Shared/Caching/ConferenceCacheTags.cs:51, is a plain AddPolicy). Decision item 2 now cites :136, :175-216. In MMCA.ADC/infra/main.bicep RateLimiting__Distributed is set at :2226, :2482, :2622 and :2788 (rationale :2220-2225), RateLimiting__AuthIpPermitLimit '300' at :2348 inside conferenceMode (rationale :2340-2345, whose claim that Program.cs calls the configuration overload predates the move into AddMmcaServiceHost; the key it names is still the right one), service ingress is internal at :2146, :2417, :2571 and :2719 (the external: false at :2730 is Notification's gRPC port mapping), the gateway and UI host are external at :2914 and :3077, and the trusted-caller secret is injected at :2990 and :3149. In MMCA.Store/infra/main.bicep service ingress is internal at :1844, :2043 and :2167 (the :2180 entry is Sales' gRPC port mapping), the gateway and UI host are external at :2338 and :2467, the trusted-caller secret is injected at :2410 and :2535, and the only rate-limiting keys are GatewayRateLimiting__*. Store's gateway declares RateLimiterPolicies at MMCA.Store/Source/Hosts/MMCA.Store.Gateway/appsettings.json:37 (auth-tight :38), attached to identity-auth-login (:86-92, :91) and identity-auth-register (:93-99, :98) with the identity-auth catch-all at :102 carrying none; CredentialRoutes_CarryTheTightRateLimiterPolicy is at MMCA.Store/Tests/Hosts/MMCA.Store.Gateway.Tests/MmcaGatewayTests.cs:127, with the per-route loop at :138 and the exact-set BeEquivalentTo at :149. Store's UI GatewayRateLimiting section is at MMCA.Store/Source/Hosts/UI/MMCA.Store.UI.Web/appsettings.json:48, with TrustedCallerHeaderName at :49. The Trade-offs anchors now cite these lines.

Revision (2026-12-03)

MMCA.Common v1.331.0. The layering, every default, the authenticated-only global limiter and the forwarded-header trust posture are unchanged. What is new is the partition key every per-IP limiter uses, now Decision item 6: ClientAddressKey.For masks IPv6 to its /64 and unmaps IPv4-mapped addresses (MMCA.Common/Source/Build/RateLimiting/ClientAddressKey.cs:42-65), one linked source file shared by the API, Infrastructure, Aspire, UI.Web and Gateway packages. The registration cap applies it inside LoginProtectionService (LoginProtectionService.cs:267), so sign-in history still records the real address. The idempotency anonymous key keeps the raw address (ADR-017). The same folder holds RetryAfterRejection.cs, the OnRejected wrapper every MMCA limiter installs so a 429 carries Retry-After when the lease has a hint, linked the same way into the API, Aspire, UI.Web and Gateway packages (MMCA.Common/Source/Build/RateLimiting/RetryAfterRejection.cs:7-18).

ADR-004 (the JWKS/discovery traffic the limiter exempts, and the authenticated principal it keys on), ADR-008 (the gateway edge this protects), ADR-017 (request idempotency, the other inbound-edge safeguard against client retries), ADR-029 (the per-email lockout and registration throttle that sit on the login and register endpoints the auth-ip cap also covers, and the reason auth-ip stays local), ADR-026 (the Redis the distributed limiter reuses, and the IncrementAsync storage-format lesson the INCRBY Lua script here avoids by owning its own rl: keyspace, qualified per application), ADR-070 (the fail-fast configuration contract RateLimitingSettings binds into, and the Distributed degradation that sits outside it), ADR-079 (the shared middleware pipeline that places UseRateLimiter after authentication and after forwarded headers, which is what makes both partition keys resolvable), ADR-135 (the application namespace that qualifies the distributed limiter's Redis partition key, one rule for every shared infrastructure keyspace), ADR-138 (the MCP endpoint that is the one caller of the mcp policy).