
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Sun, 12 Apr 2026 05:52:44 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Anonymous credentials: rate-limiting bots and agents without compromising privacy]]></title>
            <link>https://blog.cloudflare.com/private-rate-limiting/</link>
            <pubDate>Thu, 30 Oct 2025 13:00:00 GMT</pubDate>
            <description><![CDATA[ As AI agents change how the Internet is used, they create a challenge for security. We explore how Anonymous Credentials can rate limit agent traffic and block abuse without tracking users or compromising their privacy. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>The way we interact with the Internet is changing. Not long ago, ordering a pizza meant visiting a website, clicking through menus, and entering your payment details. Soon, you might just <a href="https://www.cnet.com/tech/services-and-software/i-had-chatgpt-order-me-a-pizza-this-could-change-everything/"><u>ask your phone</u></a> to order a pizza that matches your preferences. A program on your device or on a remote server, which we call an <a href="https://developers.cloudflare.com/agents/concepts/what-are-agents/"><u>AI agent</u></a>, would visit the website and orchestrate the necessary steps on your behalf.</p><p>Of course, agents can do much more than order pizza. Soon we might use them to buy concert tickets, plan vacations, or even write, review, and merge pull requests. While some of these tasks will eventually run locally, for now, most are powered by massive AI models running in the biggest datacenters in the world. As agentic AI increases in popularity, we expect to see a large increase in traffic from these AI platforms and a corresponding drop in traffic from more conventional sources (like your phone).</p><p>This shift in traffic patterns has prompted us to assess how to keep our customers online and secure in the AI era. On one hand, the nature of requests are changing: Websites optimized for human visitors will have to cope with faster, and potentially greedier, agents. On the other hand, AI platforms may soon become a significant source of attacks, originating from malicious users of the platforms themselves.</p><p>Unfortunately, existing tools for managing such (mis)behavior are likely too coarse-grained to manage this transition. For example, <a href="https://blog.cloudflare.com/per-customer-bot-defenses/"><u>when Cloudflare detects that a request is part of a known attack pattern</u></a>, the best course of action often is to block all subsequent requests from the same source. When the source is an AI agent platform, this could mean inadvertently blocking all users of the same platform, even honest ones who just want to order pizza. We started addressing this problem <a href="https://blog.cloudflare.com/web-bot-auth/"><u>earlier this year</u></a>. But as agentic AI grows in popularity, we think the Internet will need more fine-grained mechanisms of managing agents without impacting honest users.</p><p>At the same time, we firmly believe that any such security mechanism must be designed with user privacy at its core. In this post, we'll describe how to use <b>anonymous credentials (AC)</b> to build these tools. Anonymous credentials help website operators to enforce a wide range of security policies, like rate-limiting users or blocking a specific malicious user, without ever having to identify any user or track them across requests.</p><p>Anonymous credentials are <a href="https://mailarchive.ietf.org/arch/msg/privacy-pass/--JXbGvkHnLq1iHQKJAnfn5eH9A/"><u>under development at IETF</u></a> in order to provide a standard that can work across websites, browsers, platforms. It's still in its early stages, but we believe this work will play a critical role in keeping the Internet secure and private in the AI era. We will be contributing to this process as we work towards real-world deployment. This is still early days. If you work in this space, we hope you will follow along and contribute as well.</p>
    <div>
      <h2>Let’s build a small agent</h2>
      <a href="#lets-build-a-small-agent">
        
      </a>
    </div>
    <p>To help us discuss how AI agents are affecting web servers, let’s build an agent ourselves. Our goal is to have an agent that can order a pizza from a nearby pizzeria. Without an agent, you would open your browser, figure out which pizzeria is nearby, view the menu and make selections, add any extras (double pepperoni), and proceed to checkout with your credit card. With an agent, it’s the same flow —except the agent is opening and orchestrating the browser on your behalf.</p><p>In the traditional flow, there’s a human all along the way, and each step has a clear intent: list all pizzerias within 3 Km of my current location; pick a pizza from the menu; enter my credit card; and so on. An agent, on the other hand, has to infer each of these actions from the prompt "order me a pizza."</p><p>In this section, we’ll build a simple program that takes a prompt and can make outgoing requests. Here’s an example of a simple <a href="https://workers.cloudflare.com/"><u>Worker</u></a> that takes a specific prompt and generates an answer accordingly. You can find the code on <a href="https://github.com/cloudflareresearch/mini-ai-agent-demo"><u>GitHub</u></a>:</p>
            <pre><code>export default {
   async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise&lt;Response&gt; {
       const out = await env.AI.run("@cf/meta/llama-3.1-8b-instruct-fp8", {
           prompt: `I'd like to order a pepperoni pizza with extra cheese.
                    Please deliver it to Cloudflare Austin office.
                    Price should not be more than $20.`,
       });


       return new Response(out.response);
   },
} satisfies ExportedHandler&lt;Env&gt;;</code></pre>
            <p>In this context, the LLM provides its best answer. It gives us a plan and instruction, but does not perform the action on our behalf. You and I are able to take a list of instructions and act upon it because we have agency and can affect the world. To allow our agent to interact with more of the world, we’re going to give it control over a web browser.</p><p>Cloudflare offers a <a href="https://developers.cloudflare.com/browser-rendering"><u>Browser Rendering</u></a> service that can bind directly into our Worker. Let’s do that. The following code uses <a href="https://www.stagehand.dev/"><u>Stagehand</u></a>, an automation framework that makes it simple to control the browser. We pass it an instance of Cloudflare remote browser, as well as a client for <a href="https://developers.cloudflare.com/workers-ai/"><u>Workers AI</u></a>.</p>
            <pre><code>import { Stagehand } from "@browserbasehq/stagehand";
import { endpointURLString } from "@cloudflare/playwright";
import { WorkersAIClient } from "./workersAIClient"; // wrapper to convert cloudflare AI


export default {
   async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise&lt;Response&gt; {
       const stagehand = new Stagehand({
           env: "LOCAL",
           localBrowserLaunchOptions: { cdpUrl: endpointURLString(env.BROWSER) },
           llmClient: new WorkersAIClient(env.AI),
           verbose: 1,
       });
       await stagehand.init();


       const page = stagehand.page;
       await page.goto("https://mini-ai-agent.cloudflareresearch.com/llm");


       const { extraction } = await page.extract("what are the pizza available on the menu?");
       return new Response(extraction);
   },
} satisfies ExportedHandler&lt;Env&gt;;</code></pre>
            <p>You can access that code for yourself on <a href="https://mini-ai-agent.cloudflareresearch.com/llm"><i><u>https://mini-ai-agent.cloudflareresearch.com/llm</u></i></a>. Here’s the response we got on October 10, 2025:</p>
            <pre><code>Margherita Classic: $12.99
Pepperoni Supreme: $14.99
Veggie Garden: $13.99
Meat Lovers: $16.99
Hawaiian Paradise: $15.49</code></pre>
            <p>Using the screenshot API of browser rendering, we can also inspect what the agent is doing. Here's how the browser renders the page in the example above:</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6lXTePCTUORCyyOWNNcwZ8/5978abd1878f78107a2c9606c3a1ef51/image4.png" />
          </figure><p>Stagehand allows us to identify components on the page, such as <code>page.act(“Click on pepperoni pizza”)</code> and <code>page.act(“Click on Pay now”)</code>. This eases interaction between the developer and the browser.</p><p>To go further, and instruct the agent to perform the whole flow autonomously, we have to use the appropriately named <a href="https://docs.stagehand.dev/basics/agent"><u>agent</u></a> mode of Stagehand. This feature is not yet supported by Cloudflare Workers, but is provided below for completeness.</p>
            <pre><code>import { Stagehand } from "@browserbasehq/stagehand";
import { endpointURLString } from "@cloudflare/playwright";
import { WorkersAIClient } from "./workersAIClient";


export default {
   async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise&lt;Response&gt; {
       const stagehand = new Stagehand({
           env: "LOCAL",
           localBrowserLaunchOptions: { cdpUrl: endpointURLString(env.BROWSER) },
           llmClient: new WorkersAIClient(env.AI),
           verbose: 1,
       });
       await stagehand.init();
       
       const agent = stagehand.agent();
       const result = await agent.execute(`I'd like to order a pepperoni pizza with extra cheese.
                                           Please deliver it to Cloudflare Austin office.
                                           Price should not be more than $20.`);


       return new Response(result.message);
   },
} satisfies ExportedHandler&lt;Env&gt;;</code></pre>
            <p>We can see that instead of adding step-by-step instructions, the agent is provided control. To actually pay, it would need access to a payment method such as a <a href="https://en.wikipedia.org/wiki/Controlled_payment_number"><u>virtual credit card</u></a>.</p><p>The prompt had some subtlety in that we’ve scoped the location to Cloudflare’s Austin office. This is because while the agent responds to us, it needs to understand our context. In this case, the agent operates out of Cloudflare edge, a location remote to us. This implies we are unlikely to pick up a pizza from this <a href="https://www.cloudflare.com/learning/cdn/glossary/data-center/"><u>data center</u></a> if it was ever delivered.</p><p>The more capabilities we provide to the agent, the more it has the ability to create some disruption. Instead of someone having to make 5 clicks at a slow rate of 1 request per 10 seconds, they’d have a program running in a data center possibly making all 5 requests in a second.</p><p>This agent is simple, but now imagine many thousands of these — some benign, some not — running at datacenter speeds. This is the challenge origins will face.</p>
    <div>
      <h2>Protecting origins</h2>
      <a href="#protecting-origins">
        
      </a>
    </div>
    <p>For humans to interact with the online world, they need a web browser and some peripherals with which to direct the behavior of that browser. Agents are another way of directing a browser, so it may be tempting to think that not much is actually changing from the origin's point of view. Indeed, the most obvious change from the origin's point of view is merely where traffic comes from:</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/304j2MNDUNwAaipqmH2Jbt/35beb792bda327a6cf0db3b642bbc4d6/unnamed-1.png" />
          </figure><p>The reason this change is significant has to do with the tools the server has to manage traffic. Websites generally try to be as permissive as possible, but they also need to manage finite resources (bandwidth, CPU, memory, storage, and so on). There are a few basic ways to do this:</p><ol><li><p><b>Global security policy</b>: A server may opt to slow down, CAPTCHA, or even temporarily block requests from all users. This policy may be applied to an entire site, a specific resource, or to requests classified as being part of a known or likely attack pattern. Such mechanisms may be deployed in reaction to an observed spike in traffic, as in a DDoS attack, or in anticipation of a spike in legitimate traffic, as in <a href="https://developers.cloudflare.com/waiting-room/"><u>Waiting Room</u></a>.</p></li><li><p><b>Incentives</b>: Servers sometimes try to incentivize users to use the site when more resources are available. For instance, a server price may be lower depending on the location or request time. This could be implemented with a <a href="https://developers.cloudflare.com/rules/snippets/when-to-use/"><u>Cloudflare Snippet</u></a>.</p></li></ol><p>While both tools can be effective, they also sometimes cause significant collateral damage. For example, while rate limiting a website's login endpoint <a href="https://developers.cloudflare.com/waf/rate-limiting-rules/best-practices/#protecting-against-credential-stuffing"><u>can help prevent credential stuffing attacks</u></a>, it also degrades the user experience for non-attackers. Before resorting to such measures, servers will first try to apply the security policy (whether a rate limit, a CAPTCHA, or an outright block) to individual users or groups of users.</p><p>However, in order to apply a security policy to individuals, the server needs some way of identifying them. Historically, this has been done via some combination of IP addresses, <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent"><u>User-Agent</u></a>, an account tied to the user identity (if available), and other fingerprints. Like most cloud service providers, Cloudflare has a <a href="https://developers.cloudflare.com/waf/rate-limiting-rules/best-practices/"><u>dedicated offering</u></a> for per-user rate limits based on such heuristics.</p><p>Fingerprinting works for the most part. However, it's unequitably distributed. On mobile, users <a href="https://blog.cloudflare.com/eliminating-captchas-on-iphones-and-macs-using-new-standard/#captchas-dont-work-in-mobile-environments-pats-remove-the-need-for-them"><u>have an especially difficult time solving CAPTCHA</u></a>s, when using a VPN they’re <a href="https://arstechnica.com/tech-policy/2023/07/meta-blocking-vpn-access-to-threads-in-eu/"><u>more</u></a> <a href="https://help.netflix.com/en/node/277"><u>likely</u></a> <a href="https://www.theregister.com/2015/10/19/bbc_cuts_off_vpn_to_iplayer/"><u>to</u></a> <a href="https://torrentfreak.com/hulu-blocks-vpn-users-over-piracy-concerns-140425/"><u>be</u></a> <a href="https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/warp/troubleshooting/common-issues/"><u>blocked</u></a>, and when using <a href="https://www.peteresnyder.com/static/papers/speedreader-www2019.pdf"><u>reading mode</u></a> they can mess up their fingerprint, preventing rendering of the page.</p><p>Likewise, agentic AI only exacerbates the limitations of fingerprinting. Not only will more traffic be concentrated on a smaller source IP range, the agents themselves will run the same software and hardware platform, making it harder to distinguish honest from malicious users.</p><p>Something that could help is <a href="https://blog.cloudflare.com/web-bot-auth/"><u>Web Bot Auth</u></a>, which would allow agents to identify to the origin which platform they're operated by. However, we wouldn't want to extend this mechanism — intended for identifying the platform itself — to identifying individual users of the platforms, as this would create an unacceptable privacy risk for these users.</p><p>We need some way of implementing security controls for individual users without identifying them. But how? The Privacy Pass protocol provides <a href="https://blog.cloudflare.com/eliminating-captchas-on-iphones-and-macs-using-new-standard/#captchas-dont-work-in-mobile-environments-pats-remove-the-need-for-them"><u>a partial solution</u></a>.</p>
    <div>
      <h2>Privacy Pass and its limitations</h2>
      <a href="#privacy-pass-and-its-limitations">
        
      </a>
    </div>
    <p>Today, one of the most prominent use cases for Privacy Pass is to <a href="https://www.cloudflare.com/learning/bots/what-is-rate-limiting/"><u>rate limit</u></a> requests from a user to an origin, as we have <a href="https://blog.cloudflare.com/privacy-pass-standard/#privacy-pass-protocol"><u>discussed before</u></a>. The protocol works roughly as follows. The client is <b>issued</b> a number of <b>tokens</b>. Each time it wants to make a request, it <b>redeems</b> one of its tokens to the origin; the origin allows the request through only if the token is <b>fresh</b>, i.e., has never been observed before by the origin.</p><p>In order to use Privacy Pass for per-user rate-limiting, it's necessary to limit the number of tokens issued to each user (e.g., 100 tokens per user per hour). To rate limit an AI agent, this role would be fulfilled by the AI platform. To obtain tokens, the user would log in with the platform, and said platform would allow the user to get tokens from the issuer. The AI platform fulfills the <b>attester</b> role in Privacy Pass <a href="https://datatracker.ietf.org/doc/html/rfc9576"><u>parlance</u></a>. The attester is the party guaranteeing the per-user property of the rate limit. The AI platform, as an attester, is incentivized to enforce this token distribution as it stakes its reputation: Should it allow for too many tokens to be issued, the issuer could distrust them.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/62Rz5eS1UMm2pKorpowEGg/4949220bdf2fa3c39ccfa17d4df70fff/token__1_.png" />
          </figure><p>The issuance and redemption protocols are designed to have two properties:</p><ul><li><p>Tokens are <b>unforgeable</b>: only the issuer can issue valid tokens.</p></li><li><p>Tokens are <b>unlinkable: </b>no party, including the issuer, attester, or origin, can tell which user a token was issued to. </p></li></ul><p>These properties can be achieved using a <a href="https://csrc.nist.gov/glossary/term/cryptographic_primitive"><u>cryptographic primitive</u></a> called a <a href="https://blog.cloudflare.com/privacy-pass-the-math/"><u>blind signature</u></a><b> </b>scheme. In a conventional signature scheme, the signer uses its <b>private key</b> to produce a signature for a message. Later on, a verifier can use the signer’s <b>public key</b> to verify the signature. Blind signature schemes work in the same way, except that the message to be signed is blinded such that the signer doesn't know the message it's signing. The client “blinds” the message to be signed and sends it to the server, which then computes a blinded signature over the blinded message. The client obtains the final signature by unblinding the signature.  </p><p>This is exactly how the standardised Privacy Pass issuance protocols are defined by <a href="https://www.rfc-editor.org/rfc/rfc9578"><u>RFC 9578</u></a>:</p><ul>
  <li>
    <strong>Issuance:</strong> The user generates a random message 
    <strong>$k$</strong> 
    which we call the 
    <strong>nullifier</strong>. Concretely, this is just a random, 32-byte string. It then blinds the nullifier and sends it to the issuer. The issuer replies with a blind signature. Finally, the user unblinds the signature to get 
    <strong>$\sigma$</strong>, 
    a signature for the nullifier 
    <strong>$k$</strong>. The token is the pair 
    <strong>$(k, \sigma)$</strong>.
  </li>
  <li>
    <strong>Redemption:</strong> When the user presents 
    <strong>$(k, \sigma)$</strong>, 
    the origin checks that 
    <strong>$\sigma$</strong> 
    is a valid signature for the nullifier 
    <strong>$k$</strong> 
    and that 
    <strong>$k$</strong> 
    is fresh. If both conditions hold, then it accepts and lets the request through.
  </li>
</ul><p>Blind signatures are simple, cheap, and perfectly suited for many applications. However, they have some limitations that make them unsuitable for our use case.</p><p>First, the communication cost of the issuance protocol is too high. For each token issued, the user sends a 256-byte, blinded nullifier and the issuer replies with a 256-byte blind signature (assuming RSA-2048 is used). That's 0.5KB of additional communication per request, or 500KB for every 1,000 requests. This is manageable as we’ve seen in a <a href="https://eprint.iacr.org/2023/414.pdf"><u>previous experiment</u></a> for Privacy Pass, but not ideal. Ideally, the bandwidth would be sublinear in the rate limit we want to enforce. An alternative to blind signatures with lower compute time are Oblivious Pseudorandom Functions (<a href="https://datatracker.ietf.org/doc/rfc9497/"><u>VOPRF</u></a>), but the bandwidth is still asymptotically linear. We’ve <a href="https://blog.cloudflare.com/privacy-pass-the-math/"><u>discussed them in the past</u></a>, as they served as the basis for early deployments of Privacy Pass.</p><p>Second, blind signatures can't be used to rate-limit on a per-origin basis. Ideally, when issuing $N$ tokens to the client, the client would be able to redeem at most $N$ tokens at any origin server that can verify the token's validity. However, the client can't safely redeem the same token at more than one server because it would be possible for the servers to link those redemptions to the same client. What's needed is some mechanism for what we'll call <b>late origin-binding</b>: transforming a token for redemption at a particular origin in a way that's unlinkable to other redemptions of the same token.</p><p>Third, once a token is issued, it can't be revoked: it remains valid as long as the issuer's public key is valid. This makes it impossible for an origin to block a specific user if it detects an attack, or if its tokens are compromised. The origin can block the offending request, but the user can continue to make requests using its remaining token budget.</p>
    <div>
      <h2>Anonymous credentials and the future of Privacy Pass</h2>
      <a href="#anonymous-credentials-and-the-future-of-privacy-pass">
        
      </a>
    </div>
    <p>As noted by <a href="https://dl.acm.org/doi/pdf/10.1145/4372.4373"><u>Chaum</u></a> in 1985, an <b>anonymous credential</b> system allows users to obtain a credential from an issuer, and later prove possession of this credential, in an unlinkable way, without revealing any additional information. Also, it is possible to demonstrate that some attributes are attached to the credential.</p><p>One way to think of an anonymous credential is as a kind of blind signature with some additional capabilities: late-binding (link a token to an origin after issuance), multi-show (generate multiple tokens from a single issuer response), and expiration distinct from key rotation (token validity decoupled of the issuer cryptographic key validity). In the redemption flow for Privacy Pass, the client presents the unblinded message and signature to the server. To accept the redemption, the server needs to verify the signature. In an AC system, the client only presents a <b>part of the message</b>. In order for the server to accept the request, the client needs to prove to the server that it knows a valid signature for the entire message without revealing the whole thing.</p><p>The flow we described above would therefore include this additional <b>presentation</b> step. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7pb3ZDoAHbDLEt0mxtf67T/b6be11710a7df7a4df7d1c89788285a7/credentials__2_.png" />
          </figure><p>Note that the tokens generated through blind signatures or VOPRFs can only be used once, so they can be regarded as <i>single-use tokens</i>. However, there exists a type of anonymous credentials that allows tokens to be used multiple times. For this to work, the issuer grants a <i>credential</i> to the user, who can later derive at most <i>N</i> many single-use tokens for redemption. Therefore, the user can send multiple requests, at the expense of a single issuance session.  </p><p>The table below describes how blind signatures and anonymous credentials provide features of interest to rate limiting.</p><table><tr><td><p><b>Feature</b></p></td><td><p><b>Blind Signature</b></p></td><td><p><b>Anonymous Credential</b></p></td></tr><tr><td><p><b>Issuing Cost</b></p></td><td><p>Linear complexity: issuing 10 signatures is 10x as expensive as issuing one signature</p></td><td><p>Sublinear complexity: signing 10 attributes is cheaper than 10 individual signatures</p></td></tr><tr><td><p><b>Proof Capability</b></p></td><td><p>Only prove that a message has been signed</p></td><td><p>Allow efficient proving of partial statements (i.e., attributes)</p></td></tr><tr><td><p><b>State Management</b></p></td><td><p>Stateless</p></td><td><p>Stateful</p></td></tr><tr><td><p><b>Attributes</b></p></td><td><p>No attributes</p></td><td><p>Public (e.g. expiry time) and private state</p></td></tr></table><p>
  Let's see how a simple anonymous credential scheme works. The client's message consists of the pair 
  <strong>$(k, C)$</strong>, 
  where 
  <strong>$k$</strong> 
  is a 
  <strong>nullifier</strong> and 
  <strong>$C$</strong> 
  is a 
  <strong>counter</strong> representing the remaining number of times the client can access a resource. The value of the counter is controlled by the server: when the client redeems its credential, it presents both the nullifier and the counter. In response, the server checks that signature of the message is valid and that the nullifier is fresh, as before. Additionally, the server also
</p><ol><li><p>checks that the counter is greater than zero; and</p></li><li><p>decrements the counter issuing a new credential for the updated counter and a fresh nullifier.</p></li></ol><p>A blind signature could be used to meet this functionality. However, whereas the nullifier can be blinded as before, it would be necessary to handle the counter in plaintext so that the server can check that the counter is valid (Step 1) and update it (Step 2). This creates an obvious privacy risk since the server, which is in control of the counter, can use it to link multiple presentations by the same client. For example, when you reach out to buy a pepperoni pizza, the origin could assign you a special counter value, which eases fingerprinting when you present it a second time. Fortunately, there exist anonymous credentials designed to close this kind of privacy gap.</p><p>The scheme above is a simplified version of Anonymous Credit Tokens (<a href="https://datatracker.ietf.org/doc/draft-schlesinger-cfrg-act/"><u>ACT</u></a>), one of the anonymous credential schemes being considered for adoption by the <a href="https://datatracker.ietf.org/wg/privacypass/about/"><u>Privacy Pass working group</u></a> at IETF. The key feature of ACT is its <b>statefulness</b>: upon successful redemption, the server re-issues a new credential with updated nullifier and counter values. This creates a feedback loop between the client and server that can be used to express a variety of security policies.</p><p>By design, it's not possible to present ACT credentials multiple times simultaneously: the first presentation must be completed so that the re-issued credential can be presented in the next request. <b>Parallelism </b>is the key feature of Anonymous Rate-limited Credential (<a href="https://datatracker.ietf.org/doc/html/draft-yun-cfrg-arc-00"><u>ARC</u></a>), another scheme under discussion at the Privacy Pass working group. ARCs can be presented across multiple requests in parallel up to the presentation limit determined during issuance.</p><p>Another important feature of ARC is its support for late origin-binding: when a client is issued an ARC with presentation limit $N$, it can safely use its credential to present up to $N$ times to any origin that can verify the credential.</p><p>These are just examples of relevant features of some anonymous credentials. Some applications may benefit from a subset of them; others may need additional features. Fortunately, both ACT and ARC can be constructed from a small set of cryptographic primitives that can be easily adapted for other purposes.</p>
    <div>
      <h2>Building blocks for anonymous credentials</h2>
      <a href="#building-blocks-for-anonymous-credentials">
        
      </a>
    </div>
    <p>ARC and ACT share two primitives in common: <a href="https://eprint.iacr.org/2013/516.pdf"><b><u>algebraic MACs</u></b></a>, which provide for limited computations on the blinded message; and <a href="https://en.wikipedia.org/wiki/Zero-knowledge_proof"><b><u>zero-knowledge proofs (ZKP)</u></b></a> for proving validity of the part of the message not revealed to the server. Let's take a closer look at each.</p>
    <div>
      <h3>Algebraic MACs</h3>
      <a href="#algebraic-macs">
        
      </a>
    </div>
    <p>A Message Authenticated Code (MAC) is a cryptographic tag used to verify a message's authenticity (that it comes from the claimed sender) and integrity (that it has not been altered). Algebraic MACs are built from mathematical structures like <a href="https://en.wikipedia.org/wiki/Group_action"><u>group actions</u></a>. The algebraic structure gives them some additional functionality, one of them being a <i>homomorphism</i> that we can blind easily to conceal the actual value of the MAC. Adding a random value on an algebraic MAC blinds the value.</p><p>Unlike blind signatures, both ACT and ARC are only <i>privately</i> verifiable, meaning the issuer and the origin must both have the issuer's private key. Taking Cloudflare as an example, this means that a credential issued by Cloudflare can only be redeemed by an origin behind Cloudflare. Publicly verifiable variants of both are possible, but at an additional cost.</p>
    <div>
      <h3>Zero-Knowledge Proofs for linear relations</h3>
      <a href="#zero-knowledge-proofs-for-linear-relations">
        
      </a>
    </div>
    <p>Zero knowledge proofs (ZKP) allow us to prove a statement is true without revealing the exact value that makes the statement true. The ZKP is constructed by a prover in such a way that it can only be generated by someone who actually possesses the secret. The verifier can then run a quick mathematical check on this proof. If the check passes, the verifier is convinced that the prover's initial statement is valid. The crucial property is that the proof itself is just data that confirms the statement; it contains no other information that could be used to reconstruct the original secret.</p><p>For ARC and ACT, we want to prove <i>linear relations</i> of secrets. In ARC, a user needs to prove that different tokens are linked to the same original secret credential. For example, a user can generate a proof showing that a <i>request token</i> was derived from a valid <i>issued credential</i>. The system can verify this proof to confirm the tokens are legitimately connected, all without ever learning the underlying secret credential that ties them together. This allows the system to validate user actions while guaranteeing their privacy.</p><p>Proving simple linear relations can be extended to prove a number of powerful statements, for example that a number is in range. For example, this is useful to prove that you have a positive balance on your account. To prove your balance is positive, you prove that you can encode your balance in binary. Let’s say you can at most have 1024 credits in your account. To prove your balance is non-zero when it is, for example, 12, you prove two things simultaneously: first, that you have a set of binary bits, in this case 12=(1100)<sub>2</sub>, and second, that a linear equation using these bits (8*1 + 4*1 + 2*0 + 1*0) correctly adds up to your total committed balance. This convinces the verifier that the number is validly constructed without them learning the exact value. This is how it works for powers of two, but it can <a href="https://github.com/chris-wood/draft-arc/pull/38"><u>easily be extended to arbitrary ranges</u></a>.</p><p>The mathematical structure of algebraic MACs allows easy blinding and evaluation. The structure also allows for an easy proof that a MAC has been evaluated with the private key without revealing the MAC. In addition, ARC could use ZKPs to prove that a nonce has not been spent before. In contrast, ACT uses ZKPs to prove we have enough of a balance left on our token. The balance is subtracted homomorphically using more group structure.</p>
    <div>
      <h2>How much does this all cost?</h2>
      <a href="#how-much-does-this-all-cost">
        
      </a>
    </div>
    <p>Anonymous credentials allow for more flexibility, and have the potential to reduce the communication cost, compared to blind signatures in certain applications. To identify such applications, we need to measure the concrete communication cost of these new protocols. In addition, we need to understand how their CPU usage compares to blind signatures and oblivious pseudorandom functions.</p><p>We measure the time that each participant spends at each stage of some AC schemes. We also report the size of messages transmitted across the network. For ARC, ACT, and VOPRF, we'll use <a href="https://doi.org/10.17487/RFC9496"><u>ristretto255</u></a> as the prime group and SHAKE128 for hashing. For Blind RSA, we'll use a 2048-bit modulus and SHA-384 for hashing.</p><p>Each algorithm was implemented in Go, on top of the <a href="https://github.com/cloudflare/circl"><u>CIRCL</u></a> library. We plan to open source the code once the specifications of ARC and ACT begin to stabilize.</p><p>Let’s take a look at the most widely used deployment in Privacy Pass: Blind RSA. Redemption time is low, and most of the cost lies with the server at issuance time. Communication cost is mostly constant and in the order of 256 bytes.</p>
<div><table><thead>
  <tr>
    <th><span>Blind RSA</span><br /><a href="https://doi.org/10.17487/RFC9474"><span>RFC9474</span></a><span>(RSA-2048+SHA384)</span></th>
    <th><span>1 Token</span></th>
  </tr>
  <tr>
    <th><span>Time</span></th>
    <th><span>Message Size</span></th>
  </tr></thead>
<tbody>
  <tr>
    <td><span>Issuance</span></td>
    <td><span>Client (Blind)</span></td>
    <td><span>63 µs</span></td>
    <td><span>256 B</span></td>
  </tr>
  <tr>
    <td><span>Server (Evaluate)</span></td>
    <td><span>2.69 ms</span></td>
    <td><span>256 B</span></td>
  </tr>
  <tr>
    <td><span>Client (Finalize)</span></td>
    <td><span>37 µs</span></td>
    <td><span>256 B</span></td>
  </tr>
  <tr>
    <td><span>Redemption</span></td>
    <td><span>Client</span></td>
    <td><span> –</span></td>
    <td><span>300 B</span></td>
  </tr>
  <tr>
    <td><span>Server</span></td>
    <td><span>37 µs</span></td>
    <td><span>–</span></td>
  </tr>
</tbody></table></div><p>When looking at VOPRF, verification time on the server is slightly higher than for Blind RSA, but communication cost and issuance are much faster. Evaluation time on the server is 10x faster for 1 token, and more than 25x faster when using <a href="https://datatracker.ietf.org/doc/draft-ietf-privacypass-batched-tokens/"><u>amortized token issuance</u></a>. Communication cost per token is also more appealing, with a message size at least 3x lower.</p>
<div><table><thead>
  <tr>
    <th><span>VOPRF</span><br /><a href="https://doi.org/10.17487/RFC9497"><span>RFC9497</span></a><span>(Ristretto255+SHA512)</span></th>
    <th><span>1 Token</span></th>
    <th><span>1000 Amortized issuances</span></th>
  </tr>
  <tr>
    <th><span>Time</span></th>
    <th><span>Message Size</span></th>
    <th><span>Time </span><br /><span>(per token)</span></th>
    <th><span>Message Size </span><br /><span>(per token)</span></th>
  </tr></thead>
<tbody>
  <tr>
    <td><span>Issuance</span></td>
    <td><span>Client (Blind)</span></td>
    <td><span>54 µs</span></td>
    <td><span>32 B</span></td>
    <td><span>54 µs</span></td>
    <td><span>32 B</span></td>
  </tr>
  <tr>
    <td><span>Server (Evaluate)</span></td>
    <td><span>260 µs</span></td>
    <td><span>96 B</span></td>
    <td><span>99 µs</span></td>
    <td><span>32.064 B</span></td>
  </tr>
  <tr>
    <td><span>Client (Finalize)</span></td>
    <td><span>376 µs</span></td>
    <td><span>64 B</span></td>
    <td><span>173 µs</span></td>
    <td><span>64 B</span></td>
  </tr>
  <tr>
    <td><span>Redemption</span></td>
    <td><span>Client</span></td>
    <td><span> –</span></td>
    <td><span>96 B</span></td>
    <td><span>–</span></td>
  </tr>
  <tr>
    <td><span>Server</span></td>
    <td><span>57 µs</span></td>
    <td><span>–</span></td>
  </tr>
</tbody></table></div><p>This makes VOPRF tokens appealing for applications requiring a lot of tokens that can accept a slightly higher redemption cost, and that don’t need public verifiability.</p><p>Now, let’s take a look at the figures for ARC and ACT anonymous credential schemes. For both schemes we measure the time to issue a credential that can be presented at most $N=1000$ times.</p>
<div><table><thead>
  <tr>
    <th><span>Issuance</span><br /><span>Credential Generation</span></th>
    <th><span>ARC</span></th>
    <th><span>ACT</span></th>
  </tr>
  <tr>
    <th><span>Time</span></th>
    <th><span>Message Size</span></th>
    <th><span>Time</span></th>
    <th><span>Message Size</span></th>
  </tr></thead>
<tbody>
  <tr>
    <td><span>Client (Request)</span></td>
    <td><span>323 µs</span></td>
    <td><span>224 B</span></td>
    <td><span>64 µs</span></td>
    <td><span>141 B</span></td>
  </tr>
  <tr>
    <td><span>Server (Response)</span></td>
    <td><span>1349 µs</span></td>
    <td><span>448 B</span></td>
    <td><span>251 µs</span></td>
    <td><span>176 B</span></td>
  </tr>
  <tr>
    <td><span>Client (Finalize)</span></td>
    <td><span>1293 µs</span></td>
    <td><span>128 B</span></td>
    <td><span>204 µs</span></td>
    <td><span>176 B</span></td>
  </tr>
  <tr>
    <td></td>
  </tr>
  <tr>
    <td><span>Redemption</span><br /><span>Credential Presentation</span></td>
    <td><span>ARC</span></td>
    <td><span>ACT</span></td>
  </tr>
  <tr>
    <td><span>Time</span></td>
    <td><span>Message Size</span></td>
    <td><span>Time</span></td>
    <td><span>Message Size</span></td>
  </tr>
  <tr>
    <td><span>Client (Present)</span></td>
    <td><span>735 µs</span></td>
    <td><span>288 B</span></td>
    <td><span> 1740 µs</span></td>
    <td><span>1867 B</span></td>
  </tr>
  <tr>
    <td><span>Server (Verify/Refund)</span></td>
    <td><span>740 µs</span></td>
    <td><span>–</span></td>
    <td><span>1785 µs</span></td>
    <td><span>141 B</span></td>
  </tr>
  <tr>
    <td><span>Client (Update)</span></td>
    <td><span>–</span></td>
    <td><span>–</span></td>
    <td><span>508 µs</span></td>
    <td><span>176 B</span></td>
  </tr>
</tbody></table></div><p>As we would hope, the communication cost and the server’s runtime is much lower than a batched issuance with either Blind RSA or VOPRF. For example, a VOPRF issuance of 1000 tokens takes 99 ms (99 µs per token) <i>vs</i> 1.35 ms for issuing one ARC credential that allows for 1000 presentations. This is about 70x faster. The trade-off is that presentation is more expensive, both for the client and server.</p><p>How about ACT? Like ARC, we would expect the communication cost of issuance grows much slower with respect to the credits issued. Our implementation bears this out. However, there are some interesting performance differences between ARC and ACT: issuance is much cheaper for ACT than it is for ARC, but redemption is the opposite.</p><p>What's going on? The answer has largely to do with what each party needs to prove with ZKPs at each step. For example, during ACT redemption, the client proves to the server (in zero-knowledge) that its counter $C$ is in the desired range, i.e., $0 \leq C \leq N$. The proof size is on the order of $\log_{2} N$, which accounts for the larger message size. In the current version, ARC redemption does not involve range proofs, but a range proof may be added in a <a href="http://mailarchive.ietf.org/arch/msg/privacy-pass/A3VHUdHqhslwBzYEQjcaXzYQAxQ/"><u>future version</u></a>. Meanwhile, the statements the client and server need to prove during ARC issuance are a bit more complicated than for ARC presentation, which accounts for the difference in runtime there.</p><p>The advantage of anonymous credentials, as discussed in the previous sections, is that issuance only has to be performed once. When a server evaluates its cost, it takes into account the cost of all issuances and the cost of all verifications. At present, only accounting for credentials costs, it’s cheaper for a server to issue and verify tokens than verify an anonymous credential presentation.</p><p>The advantage of multiple-use anonymous credentials is that instead of the issuer generating $N$ tokens, the bulk of computation is offloaded to the clients. This is more scoped. Late origin binding allows them to work for multiple origins/namespace, range proof to decorrelate expiration from key rotation, and refund to provide a dynamic rate limit. Their current applications are dictated by the limitation of single-use token based schemes, more than by the added efficiency they provide. This seems to be an exciting area to explore, and see if closing the gap is possible.</p>
    <div>
      <h2>Managing agents with anonymous credentials</h2>
      <a href="#managing-agents-with-anonymous-credentials">
        
      </a>
    </div>
    <p>Managing agents will likely require features from both ARC and ACT.</p><p>ARC already has much of the functionality we need: it supports rate limiting, is communication-efficient, and it supports late origin-binding. Its main downside is that, once an ARC credential is issued, it can't be revoked. A malicious user can always make up to <i>N</i> requests to any origin it wants.</p><p>We can allow for a limited form of revocation by pairing ARC with blind signatures (or VOPRF). Each presentation of the ARC credential is accompanied by a Privacy Pass token: upon successful presentation, the client is issued another Privacy Pass token it can use during the next presentation. To revoke a credential, the server would simply not re-issue the token:</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6EiHmkbLef6kXsQU473fcX/d1d4018eaf2abd42b9690ae5d01494dc/image1.png" />
          </figure><p>This scheme is already quite useful. However, it has some important limitations:</p><ul><li><p>Parallel presentation across origins is not possible: the client must wait for the request to one origin to succeed before it can initiate a request to a second origin.</p></li><li><p>Revocation is <i>global</i> rather than per-origin, meaning the credential is not only revoked for the origin to whom it was presented, but for every origin it can be presented to. We suspect this will be undesirable in some cases. For example, an origin may want to revoke if a request violates its <code>robots.txt</code> policy; but the same request may have been accepted by other origins.  </p></li></ul><p>A more fundamental limitation of this design is that the decision to revoke can only be made on the basis of a single request — the one in which the credential was presented. It may be risky to decide to block a user on the basis of a single request; in practice, attack patterns may only emerge across many requests. ACT's statefulness enables at least a rudimentary form of this kind of defense. Consider the following scheme:</p><ul><li><p><b>Issuance: </b>The client is issued an ARC with presentation limit $N=1$.</p></li><li><p><b>Presentation:</b></p><ul><li><p>When the client presents its ARC credential to an origin for the first time, the server issues an ACT credential with a valid initial state.</p></li><li><p>When the client presents an ACT with valid state (e.g., credit counter greater than 0), the origin either:</p><ul><li><p>refuses to issue a new ACT, thereby revoking the credential. It would only do so if it had high confidence that the request was part of an attack; or</p></li><li><p>issues a new ACT with state updated to reduce the ACT credit by the amount of resources consumed while processing the request.</p></li></ul></li></ul></li></ul><p>Benign requests wouldn't change the state by much (if at all), but suspicious requests might impact the state in a way that gets the user closer to their rate limit much faster.</p>
    <div>
      <h2>Demo</h2>
      <a href="#demo">
        
      </a>
    </div>
    <p>To see how this idea works in practice, let's look at a working example that uses the <a href="https://developers.cloudflare.com/agents/model-context-protocol/"><u>Model Context Protocol</u></a>. The demo below is built using<a href="https://developers.cloudflare.com/agents/model-context-protocol/tools/"> <u>MCP Tools</u></a>. <a href="https://modelcontextprotocol.info/tools/"><u>Tools</u></a> are extensions the AI agent can call to extend its capabilities. They don't need to be integrated at release time within the MCP client. This provides a nice and easy prototyping avenue for anonymous credentials.</p><p>Tools are offered by the server via an MCP compatible interface. You can see details on how to build such MCP servers in a <a href="https://blog.cloudflare.com/remote-model-context-protocol-servers-mcp/"><u>previous blog</u></a>.</p><p>In our pizza context, this could look like a pizzeria that offers you a voucher. Each voucher gets you 3 pizza slices. Mocking a design, an integration within a chat application could look as follows:</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5WD5MYoSMYGyRW2biwe6j4/bde101967276a72d48d9e494a23db5fa/image5.png" />
          </figure>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5SEqaVpwFxS1D21oyjjbN8/80dde2484f43c15e206ecfda991c286a/image9.png" />
          </figure><p>The first panel presents all tools exposed by the MCP server. The second one showcases an interaction performed by the agent calling these tools.</p><p>To look into how such a flow would be implemented, let’s write the MCP tools, offer them in an MCP server, and manually orchestrate the calls with the <a href="https://modelcontextprotocol.io/docs/tools/inspector"><u>MCP Inspector</u></a>.</p><p>The MCP server should provide two tools:</p><ul><li><p><code>act-issue </code>which issues an ACT credential valid for 3 requests. The code used here is an earlier version of the IETF draft which has some limitations.</p></li><li><p><code>act-redeem</code> makes a presentation of the local credential, and fetches our pizza menu.</p></li></ul><p>First, we run <code>act-issue</code>. At this stage, we could ask the agent to run an<a href="https://modelcontextprotocol.info/specification/draft/basic/authorization/"> <u>OAuth flow</u></a>, fetch an internal authentication endpoint, or to compute a proof of work.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6sLS7jMfTHPjVW5vMvsTWX/2d2b10fdb12c64f0e33fee89e09eab85/image10.png" />
          </figure><p>This gives us 3 credits to spend against an origin. Then, we run <code>act-redeem</code></p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1YTc0Wohrsqw3hizAOmJjU/4534cccbc490ad0aa09522a3875693af/image8.png" />
          </figure><p>Et voilà. If we run <code>act-redeem</code> once more, we see we have one fewer credit.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/a0zmBfl46hX33hWoXyGyX/86649d9f435562c95a85ec72fbf33022/image3.png" />
          </figure><p>You can test it yourself, here are the <a href="https://github.com/cloudflareresearch/anonymous-credentials-agent-demo"><u>source codes</u></a> available. The MCP server is written in<a href="https://github.com/modelcontextprotocol/rust-sdk/"> <u>Rust</u></a> to integrate with the <a href="https://github.com/SamuelSchlesinger/anonymous-credit-tokens/stargazers"><u>ACT rust</u></a> library. The <a href="https://act-client-demo.cloudflareresearch.com/"><u>browser-based client</u></a> works similarly, check it out.</p>
    <div>
      <h2>Moving further</h2>
      <a href="#moving-further">
        
      </a>
    </div>
    <p>In this post, we’ve presented a concrete approach to rate limit agent traffic. It is in full control of the client, and is built to protect the user's privacy. It uses emerging standards for anonymous credentials, integrates with MCP, and can be readily deployed on Cloudflare Workers.</p><p>We're on the right track, but there are still questions that remain. As we touched on before, a notable limitation of both ARC and ACT is that they are only <i>privately verifiable</i>. This means that the issuer and origin need to share a private key, for issuing and verifying the credential respectively. There are likely to be deployment scenarios for which this isn't possible. Fortunately, there may be a path forward for these cases using<i> pairing-</i>based cryptography, as in the <a href="https://datatracker.ietf.org/doc/draft-irtf-cfrg-bbs-signatures/"><u>BBS signature specification</u></a> making its way through IETF. We’re also exploring post-quantum implications in a <a href="https://blog.cloudflare.com/pq-anonymous-credentials/"><u>concurrent post</u></a>.</p><p>If you are an agent platform, an agent developer, or a browser, all our code is available on <a href="https://github.com/cloudflareresearch/anonymous-credentials-agent-demo"><u>GitHub</u></a> for you to experiment. Cloudflare is actively working on vetting this approach for real-world use cases.</p><p>The specification and discussion are happening within the IETF and W3C. This ensures the protocols are built in the open, and receive participation from experts. Improvements are still to be made to clarify the right performance-to-privacy tradeoff, or even the story to deploy on the open web.</p><p>If you’d like to help us, <a href="https://blog.cloudflare.com/cloudflare-1111-intern-program/"><u>we’re hiring 1,111 interns</u></a> over the course of next year, and have <a href="https://www.cloudflare.com/careers/early-talent/"><u>open positions</u></a>.</p> ]]></content:encoded>
            <category><![CDATA[Research]]></category>
            <category><![CDATA[Rate Limiting]]></category>
            <guid isPermaLink="false">1znqOjDHsm8kxWujPMhsgA</guid>
            <dc:creator>Thibault Meunier</dc:creator>
            <dc:creator>Christopher Patton</dc:creator>
            <dc:creator>Lena Heimberger</dc:creator>
            <dc:creator>Armando Faz-Hernández</dc:creator>
        </item>
        <item>
            <title><![CDATA[Developer Week 2024 wrap-up]]></title>
            <link>https://blog.cloudflare.com/developer-week-2024-wrap-up/</link>
            <pubDate>Mon, 08 Apr 2024 13:00:02 GMT</pubDate>
            <description><![CDATA[ Developer Week 2024 has officially come to a close. Here’s a quick recap of the announcements and in-depth technical explorations that went out last week ]]></description>
            <content:encoded><![CDATA[ <p></p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7fwPu75tSubJgSS8nJ5gOt/6e2fd9b7cc6f9dcd7b86d73988a6e5fb/Dev-week-wrap-up-1.jpg" />
            
            </figure><p>Developer Week 2024 has officially come to a close. Each day last week, we shipped new products and functionality geared towards giving developers the components they need to build full-stack applications on Cloudflare.</p><p>Even though Developer Week is now over, we are continuing to innovate with the over two million developers who build on our platform. Building a platform is only as exciting as seeing what developers build on it. Before we dive into a recap of the announcements, to send off the week, we wanted to share how a couple of companies are using Cloudflare to power their applications:</p><blockquote><p><i>We have been using Workers for image delivery using R2 and have been able to maintain stable operations for a year after implementation. The speed of deployment and the flexibility of detailed configurations have greatly reduced the time and effort required for traditional server management. In particular, we have seen a noticeable cost savings and are deeply appreciative of the support we have received from Cloudflare Workers.</i>- <a href="http://www.fancs.com/">FAN Communications</a></p></blockquote><blockquote><p><i>Milkshake helps creators, influencers, and business owners create engaging web pages directly from their phone, to simply and creatively promote their projects and passions. Cloudflare has helped us migrate data quickly and affordably with R2. We use Workers as a routing layer between our users' websites and their images and assets, and to build a personalized analytics offering affordably. Cloudflare’s innovations have consistently allowed us to run infrastructure at a fraction of the cost of other developer platforms and we have been eagerly awaiting updates to D1 and Queues to sustainably scale Milkshake as the product continues to grow.</i>- <a href="https://milkshake.app/">Milkshake</a></p></blockquote><p>In case you missed anything, here’s a quick recap of the announcements and in-depth technical explorations that went out last week:</p>
    <div>
      <h2>Summary of announcements</h2>
      <a href="#summary-of-announcements">
        
      </a>
    </div>
    
    <div>
      <h3>Monday</h3>
      <a href="#monday">
        
      </a>
    </div>
    
<table>
<thead>
  <tr>
    <th><span>Announcement</span></th>
    <th><span>Summary</span></th>
  </tr>
</thead>
<tbody>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/making-full-stack-easier-d1-ga-hyperdrive-queues"><span>Making state easy with D1 GA, Hyperdrive, Queues and Workers Analytics Engine updates</span></a></td>
    <td><span>A core part of any full-stack application is storing and persisting data! We kicked off the week with announcements that help developers build stateful applications on top of Cloudflare, including making D1, Cloudflare’s SQL database and Hyperdrive, our database accelerating service, generally available.</span></td>
  </tr>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/building-d1-a-global-database"><span>Building D1: a Global Database</span></a></td>
    <td><span>D1, Cloudflare’s SQL database, is now generally available. With new support for 10GB databases, data export, and enhanced query debugging, we empower developers to build production-ready applications with D1 to meet all their relational SQL needs. To support Workers in global applications, we’re sharing a sneak peek of our design and API for D1 global read replication to demonstrate how developers scale their workloads with D1.</span></td>
  </tr>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/workers-environment-live-object-bindings"><span>Why Workers environment variables contain live objects</span></a></td>
    <td><span>Bindings don't just reduce boilerplate. They are a core design feature of the Workers platform which simultaneously improve developer experience and application security in several ways. Usually these two goals are in opposition to each other, but bindings elegantly solve for both at the same time.</span></td>
  </tr>
</tbody>
</table>
    <div>
      <h3>Tuesday</h3>
      <a href="#tuesday">
        
      </a>
    </div>
    
<table>
<thead>
  <tr>
    <th><span>Announcement</span></th>
    <th><span>Summary</span></th>
  </tr>
</thead>
<tbody>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/workers-ai-ga-huggingface-loras-python-support"><span>Leveling up Workers AI: General Availability and more new capabilities</span></a></td>
    <td><span>We made a series of AI-related announcements, including Workers AI, Cloudflare’s inference platform becoming GA, support for fine-tuned models with LoRAs, one-click deploys from HuggingFace, Python support for Cloudflare Workers, and more.</span></td>
  </tr>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/fine-tuned-inference-with-loras"><span>Running fine-tuned models on Workers AI with LoRAs</span></a></td>
    <td><span>Workers AI now supports fine-tuned models using LoRAs. But what is a LoRA and how does it work? In this post, we dive into fine-tuning, LoRAs and even some math to share the details of how it all works under the hood.</span></td>
  </tr>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/python-workers"><span>Bringing Python to Workers using Pyodide and WebAssembly</span></a></td>
    <td><span>We introduced Python support for Cloudflare Workers, now in open beta. We've revamped our systems to support Python, from the Workers runtime itself to the way Workers are deployed to Cloudflare’s network. Learn about a Python Worker's lifecycle, Pyodide, dynamic linking, and memory snapshots in this post.</span></td>
  </tr>
</tbody>
</table>
    <div>
      <h3>Wednesday</h3>
      <a href="#wednesday">
        
      </a>
    </div>
    
<table>
<thead>
  <tr>
    <th><span>Announcement</span></th>
    <th><span>Summary</span></th>
  </tr>
</thead>
<tbody>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/r2-events-gcs-migration-infrequent-access"><span>R2 adds event notifications, support for migrations from Google Cloud Storage, and an infrequent access storage tier</span></a></td>
    <td><span>We announced three new features for Cloudflare R2: event notifications, support for migrations from Google Cloud Storage, and an infrequent access storage tier.</span></td>
  </tr>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/data-anywhere-events-pipelines-durable-execution-workflows"><span>Data Anywhere with Pipelines, Event Notifications, and Workflows</span></a></td>
    <td><span>We’re making it easier to build scalable, reliable, data-driven applications on top of our global network, and so we announced a new Event Notifications framework; our take on durable execution, Workflows; and an upcoming streaming ingestion service, Pipelines.</span></td>
  </tr>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/prisma-orm-and-d1"><span>Improving Cloudflare Workers and D1 developer experience with Prisma ORM</span></a></td>
    <td><span>Together, Cloudflare and Prisma make it easier than ever to deploy globally available apps with a focus on developer experience. To further that goal, Prisma ORM now natively supports Cloudflare Workers and D1 in Preview. With version 5.12.0 of Prisma ORM you can now interact with your data stored in D1 from your Cloudflare Workers with the convenience of the Prisma Client API. Learn more and try it out now.</span></td>
  </tr>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/picsart-move-to-workers-huge-performance-gains"><span>How Picsart leverages Cloudflare's Developer Platform to build globally performant services</span></a></td>
    <td><span>Picsart, one of the world’s largest digital creation platforms, encountered performance challenges in catering to its global audience. Adopting Cloudflare's global-by-default Developer Platform emerged as the optimal solution, empowering Picsart to enhance performance and scalability substantially.</span></td>
  </tr>
</tbody>
</table>
    <div>
      <h3>Thursday</h3>
      <a href="#thursday">
        
      </a>
    </div>
    
<table>
<thead>
  <tr>
    <th><span>Announcement</span></th>
    <th><span>Summary</span></th>
  </tr>
</thead>
<tbody>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/pages-workers-integrations-monorepos-nextjs-wrangler"><span>Announcing Pages support for monorepos, wrangler.toml, database integrations and more!</span></a></td>
    <td><span>We launched four improvements to Pages that bring functionality previously restricted to Workers, with the goal of unifying the development experience between the two. Support for monorepos, wrangler.toml, new additions to Next.js support and database integrations!</span></td>
  </tr>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/workers-production-safety"><span>New tools for production safety — Gradual Deployments, Stack Traces, Rate Limiting, and API SDKs</span></a></td>
    <td><span>Production readiness isn’t just about scale and reliability of the services you build with. We announced five updates that put more power in your hands – Gradual Deployments, Source mapped stack traces in Tail Workers, a new Rate Limiting API, brand-new API SDKs, and updates to Durable Objects – each built with mission-critical production services in mind.</span></td>
  </tr>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/whats-next-for-cloudflare-media"><span>What’s new with Cloudflare Media: updates for Calls, Stream, and Images</span></a></td>
    <td><span>With Cloudflare Calls in open beta, you can build real-time, serverless video and audio applications. Cloudflare Stream lets your viewers instantly clip from ongoing streams. Finally, Cloudflare Images now supports automatic face cropping and has an upload widget that lets you easily integrate into your application.</span></td>
  </tr>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/cloudflare-calls-anycast-webrtc"><span>Cloudflare Calls: millions of cascading trees all the way down</span></a></td>
    <td><span>Cloudflare Calls is a serverless SFU and TURN service running at Cloudflare’s edge. It’s now in open beta and costs $0.05/ real-time GB. It’s 100% anycast WebRTC.</span></td>
  </tr>
</tbody>
</table>
    <div>
      <h3>Friday</h3>
      <a href="#friday">
        
      </a>
    </div>
    
<table>
<thead>
  <tr>
    <th><span>Announcement</span></th>
    <th><span>Summary</span></th>
  </tr>
</thead>
<tbody>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/browser-rendering-api-ga-rolling-out-cloudflare-snippets-swr-and-bringing-workers-for-platforms-to-our-paygo-plans"><span>Browser Rendering API GA, rolling out Cloudflare Snippets, SWR, and bringing Workers for Platforms to all users</span></a></td>
    <td><span>Browser Rendering API is now available to all paid Workers customers with improved session management.</span></td>
  </tr>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/cloudflare-acquires-baselime-expands-observability-capabilities"><span>Cloudflare acquires Baselime to expand serverless application observability capabilities</span></a></td>
    <td><span>We announced that Cloudflare has acquired Baselime, a serverless observability company.</span></td>
  </tr>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/cloudflare-acquires-partykit"><span>Cloudflare acquires PartyKit to allow developers to build real-time multi-user applications</span></a></td>
    <td><span>We announced that PartyKit, a trailblazer in enabling developers to craft ambitious real-time, collaborative, multiplayer applications, is now a part of Cloudflare. This acquisition marks a significant milestone in our journey to redefine the boundaries of serverless computing, making it more dynamic, interactive, and, importantly, stateful.</span></td>
  </tr>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/blazing-fast-development-with-full-stack-frameworks-and-cloudflare"><span>Blazing fast development with full-stack frameworks and Cloudflare</span></a></td>
    <td><span>Full-stack web development with Cloudflare is now faster and easier! You can now use your framework’s development server while accessing D1 databases, R2 object stores, AI models, and more. Iterate locally in milliseconds to build sophisticated web apps that run on Cloudflare. Let’s dev together!</span></td>
  </tr>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/javascript-native-rpc"><span>We've added JavaScript-native RPC to Cloudflare Workers</span></a></td>
    <td><span>Cloudflare Workers now features a built-in RPC (Remote Procedure Call) system for use in Worker-to-Worker and Worker-to-Durable Object communication, with absolutely minimal boilerplate. We've designed an RPC system so expressive that calling a remote service can feel like using a library.</span></td>
  </tr>
  <tr>
    <td><a href="http://staging.blog.mrk.cfdata.org/2024-community-update"><span>Community Update: empowering startups building on Cloudflare and creating an inclusive community</span></a></td>
    <td><span>We closed out Developer Week by sharing updates on our Workers Launchpad program, our latest Developer Challenge, and the work we’re doing to ensure our community spaces – like our Discord and Community forums – are safe and inclusive for all developers.</span></td>
  </tr>
</tbody>
</table><p>Here's a video summary, by Craig Dennis, Developer Educator, AI:</p><blockquote><p>🏃<a href="https://twitter.com/CloudflareDev?ref_src=twsrc%5Etfw">@CloudflareDev</a> Developer Week 2024 🧡 ICYMI 🧡 Speed run <a href="https://t.co/0uzPJshC93">pic.twitter.com/0uzPJshC93</a></p>— Craig Dennis (@craigsdennis) <a href="https://twitter.com/craigsdennis/status/1778875721575989734?ref_src=twsrc%5Etfw">April 12, 2024</a></blockquote> 
    <div>
      <h3>Continue the conversation</h3>
      <a href="#continue-the-conversation">
        
      </a>
    </div>
    <p>Thank you for being a part of Developer Week! Want to continue the conversation and share what you’re building? Join us on <a href="https://discord.com/invite/cloudflaredev">Discord</a>. To get started building on Workers, check out our <a href="https://developers.cloudflare.com/workers/">developer documentation</a>.</p> ]]></content:encoded>
            <category><![CDATA[Developer Week]]></category>
            <category><![CDATA[Developers]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[Cloudflare Pages]]></category>
            <category><![CDATA[Rate Limiting]]></category>
            <category><![CDATA[API]]></category>
            <category><![CDATA[D1]]></category>
            <category><![CDATA[Connectivity Cloud]]></category>
            <guid isPermaLink="false">VNnYecAmN7CpST4nBbas0</guid>
            <dc:creator>Phillip Jones</dc:creator>
        </item>
        <item>
            <title><![CDATA[New tools for production safety — Gradual deployments, Source maps, Rate Limiting, and new SDKs]]></title>
            <link>https://blog.cloudflare.com/workers-production-safety/</link>
            <pubDate>Thu, 04 Apr 2024 13:05:00 GMT</pubDate>
            <description><![CDATA[ Today we are announcing five updates that put more power in your hands – Gradual Deployments, Source mapped stack traces in Tail Workers, a new Rate Limiting API, brand-new API SDKs, and updates to Durable Objects – each built with mission-critical production services in mind ]]></description>
            <content:encoded><![CDATA[ <p></p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6HeyqozVOGygo2RCNnunIq/b429dc5b9f81c9fed6dfc0d200d296e5/image4-7.png" />
            
            </figure><p>2024’s Developer Week is all about production readiness. On Monday. April 1, we <a href="/making-full-stack-easier-d1-ga-hyperdrive-queues/">announced</a> that <a href="https://developers.cloudflare.com/d1/">D1</a>, <a href="https://developers.cloudflare.com/queues/">Queues</a>, <a href="https://developers.cloudflare.com/hyperdrive/">Hyperdrive</a>, and <a href="https://developers.cloudflare.com/analytics/analytics-engine/">Workers Analytics Engine</a> are ready for production scale and generally available. On Tuesday, April 2, we <a href="/workers-ai-ga-huggingface-loras-python-support">announced</a> the same about our inference platform, <a href="https://developers.cloudflare.com/workers-ai/">Workers AI</a>. And we’re not nearly done yet.</p><p>However, production readiness isn’t just about the scale and reliability of the services you build with. You also need tools to make changes safely and reliably. You depend not just on what Cloudflare provides, but on being able to precisely control and tailor how Cloudflare behaves to the needs of your application.</p><p>Today we are announcing five updates that put more power in your hands – Gradual Deployments, source mapped stack traces in Tail Workers, a new Rate Limiting API, brand-new API SDKs, and updates to Durable Objects – each built with mission-critical production services in mind. We build our own products using Workers, including <a href="https://developers.cloudflare.com/cloudflare-one/policies/access/">Access</a>, <a href="https://developers.cloudflare.com/r2/">R2</a>, <a href="https://developers.cloudflare.com/kv/">KV</a>, <a href="https://developers.cloudflare.com/waiting-room/">Waiting Room</a>, <a href="https://developers.cloudflare.com/vectorize/">Vectorize</a>, <a href="https://developers.cloudflare.com/queues/">Queues</a>, <a href="https://developers.cloudflare.com/stream/">Stream</a>, and more. We rely on each of these new features ourselves to ensure that we are production ready – and now we’re excited to bring them to everyone.</p>
    <div>
      <h3>Gradually deploy changes to Workers and Durable Objects</h3>
      <a href="#gradually-deploy-changes-to-workers-and-durable-objects">
        
      </a>
    </div>
    <p>Deploying a Worker is nearly instantaneous – a few seconds and your change is live <a href="https://www.cloudflare.com/network/">everywhere</a>.</p><p>When you reach production scale, each change you make carries greater risk, both in terms of volume and expectations. You need to meet your 99.99% availability SLA, or have an ambitious P90 latency SLO. A bad deployment that’s live for 100% of traffic for 45 seconds could mean millions of failed requests. A subtle code change could cause a thundering herd of retries to an overwhelmed backend, if rolled out all at once. These are the kinds of risks we consider and mitigate ourselves for our own services built on Workers.</p><p>The way to mitigate these risks is to deploy changes gradually – commonly called rolling deployments:</p><ol><li><p>The current version of your application runs in production.</p></li><li><p>You deploy the new version of your application to production, but only route a small percentage of traffic to this new version, and wait for it to “soak” in production, monitoring for regressions and bugs. If something bad happens, you’ve caught it early at a small percentage (e.g. 1%) of traffic and can revert quickly.</p></li><li><p>You gradually increment the percentage of traffic until the new version receives 100%, at which point it is fully rolled out.</p></li></ol><p>Today we’re opening up a first-class way to deploy code changes gradually to Workers and Durable Objects via the <a href="https://developers.cloudflare.com/api/operations/worker-deployments-list-deployments">Cloudflare API</a>, the <a href="https://developers.cloudflare.com/workers/configuration/versions-and-deployments/gradual-deployments/#via-wrangler">Wrangler CLI</a>, or the <a href="https://developers.cloudflare.com/workers/configuration/versions-and-deployments/gradual-deployments/#via-the-cloudflare-dashboard">Workers dashboard</a>. Gradual Deployments is entering open beta – you can use Gradual Deployments with any Cloudflare account that is on the <a href="https://developers.cloudflare.com/workers/platform/pricing/#workers">Workers Free plan</a>, and very soon you’ll be able to start using Gradual Deployments with Cloudflare accounts on the <a href="https://developers.cloudflare.com/workers/platform/pricing/#workers">Workers Paid</a> and Enterprise plans. You’ll see a banner on the Workers dashboard once your account has access.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5C2hc1EtfppDeWWDxJBh3K/3235bfa198e136bfac793f877415011d/pasted-image-0.png" />
            
            </figure><p>When you have two versions of your Worker or Durable Object running concurrently in production, you almost certainly want to be able to filter your metrics, exceptions, and logs by version. This can help you spot production issues early, when the new version is only rolled out to a small percentage of traffic, or compare performance metrics when splitting traffic 50/50. We’ve also added <a href="https://www.cloudflare.com/learning/performance/what-is-observability/">observability</a> at a version level across our platform:</p><ul><li><p>You can filter analytics in the Workers dashboard and via the <a href="https://developers.cloudflare.com/analytics/graphql-api/">GraphQL Analytics API</a> by version.</p></li><li><p><a href="https://developers.cloudflare.com/workers/observability/logging/logpush/">Workers Trace Events</a> and <a href="https://developers.cloudflare.com/workers/observability/logging/tail-workers/">Tail Worker</a> events include the version ID of your Worker, along with optional version message and version tag fields.</p></li><li><p>When using <a href="https://developers.cloudflare.com/workers/wrangler/commands/#tail">wrangler tail</a> to view live logs, you can view logs for a specific version.</p></li><li><p>You can access version ID, message, and tag from within your Worker’s code, by configuring the <a href="https://developers.cloudflare.com/workers/runtime-apis/bindings/version-metadata/">Version Metadata binding</a>.</p></li></ul><p>You may also want to make sure that each client or user only sees a consistent version of your Worker. We’ve added <a href="https://developers.cloudflare.com/workers/configuration/versions-and-deployments/gradual-deployments/#version-keys-and-session-affinity">Version Affinity</a> so that requests associated with a particular identifier (such as user, session, or any unique ID) are always handled by a consistent version of your Worker. <a href="https://developers.cloudflare.com/workers/configuration/versions-and-deployments/gradual-deployments/#version-keys-and-session-affinity">Session Affinity</a>, when used with <a href="https://developers.cloudflare.com/workers/configuration/versions-and-deployments/gradual-deployments/#setting-cloudflare-workers-version-key-using-ruleset-engine">Ruleset Engine</a>, gives you full control over both the mechanism and identifier used to ensure “stickiness”.</p><p>Gradual Deployments is entering open beta. As we move towards GA, we’re working to support:</p><ul><li><p><b>Version Overrides.</b> Invoke a specific version of your Worker in order to test before it serves any production traffic. This will allow you to create Blue-Green Deployments.</p></li><li><p><b>Cloudflare Pages.</b> Let the <a href="https://www.cloudflare.com/learning/serverless/glossary/what-is-ci-cd/">CI/CD system</a> in Pages automatically progress the deployments on your behalf.</p></li><li><p><b>Automatic rollbacks.</b> Roll back deployments automatically when the error rate spikes for a new version of your Worker.</p></li></ul><p>We’re looking forward to hearing your feedback! Let us know what you think through <a href="https://www.cloudflare.com/lp/developer-week-deployments/">this</a> feedback form or reach out in our <a href="https://discord.gg/HJvPcPcN">Developer Discord</a> in the #workers-gradual-deployments-beta channel.</p>
    <div>
      <h3>Source mapped stack traces in Tail Workers</h3>
      <a href="#source-mapped-stack-traces-in-tail-workers">
        
      </a>
    </div>
    <p>Production readiness means tracking errors and exceptions, and trying to drive them down to zero. When an error occurs, the first thing you typically want to look at is the error’s <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/stack">stack trace</a> – the specific functions that were called, in what order, from which line and file, and with what arguments.</p><p>Most JavaScript code – not just on Workers, but across platforms – is first bundled, often transpiled, and then minified before being deployed to production. This is done behind the scenes to create smaller bundles to optimize performance and convert from Typescript to JavaScript if needed.</p><p>If you’ve ever seen an exception return a stack trace like: /src/index.js:1:342,it means the error occurred on the 342nd character of your function’s minified code. This is clearly not very helpful for debugging.</p><p><a href="https://web.dev/articles/source-maps">Source maps</a> solve this – they map compiled and minified code back to the original code that you wrote. Source maps are combined with the stack trace returned by the JavaScript runtime in order to present you with a human-readable stack trace. For example, the following stack trace shows that the Worker received an unexpected null value on line 30 of the down.ts file. This is a useful starting point for debugging, and you can move down the stack trace to understand the functions that were called that were set that resulted in the null value.</p>
            <pre><code>Unexpected input value: null
  at parseBytes (src/down.ts:30:8)
  at down_default (src/down.ts:10:19)
  at Object.fetch (src/index.ts:11:12)</code></pre>
            <p>Here’s how it works:</p><ol><li><p>When you set upload_source_maps = true in your <a href="https://developers.cloudflare.com/workers/wrangler/configuration/">wrangler.toml</a>, Wrangler will automatically generate and upload any source map files when you run <a href="https://developers.cloudflare.com/workers/wrangler/commands/#deploy">wrangler deploy</a> or <a href="https://developers.cloudflare.com/workers/wrangler/commands/#versions">wrangler versions upload</a>.</p></li><li><p>When your Worker throws an uncaught exception, we fetch the source map and use it to map the stack trace of the exception back to lines of your Worker’s original source code.</p></li><li><p>You can then view this deobfuscated stack trace in <a href="https://developers.cloudflare.com/workers/observability/logging/real-time-logs/">real-time logs</a> or in <a href="https://developers.cloudflare.com/workers/observability/logging/tail-workers/">Tail Workers</a>.</p></li></ol><p>Starting today, in open beta, you can upload source maps to Cloudflare when you deploy your Worker – <a href="https://developers.cloudflare.com/workers/observability/source-maps">get started by reading the docs</a>. And starting on April 15th , the Workers runtime will start using source maps to deobfuscate stack traces. We’ll post a notification in the Cloudflare dashboard and post on our <a href="https://twitter.com/CloudflareDev?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor">Cloudflare Developers X account</a> when source mapped stack traces are available.</p>
    <div>
      <h3>New Rate Limiting API in Workers</h3>
      <a href="#new-rate-limiting-api-in-workers">
        
      </a>
    </div>
    <p>An API is only production ready if it has a sensible <a href="https://www.cloudflare.com/learning/bots/what-is-rate-limiting/">rate limit</a>. And as you grow, so does the complexity and diversity of limits that you need to enforce in order to balance the needs of specific customers, protect the health of your service, or enforce and adjust limits in specific scenarios. Cloudflare’s own API has this challenge – each of our dozens of products, each with many API endpoints, may need to enforce different rate limits.</p><p>You’ve been able to configure <a href="https://developers.cloudflare.com/waf/rate-limiting-rules/">Rate Limiting rules</a> on Cloudflare since 2017. But until today, the only way to control this was in the Cloudflare dashboard or via the Cloudflare API. It hasn’t been possible to define behavior at <i>runtime</i>, or write code in a Worker that interacts directly with rate limits – you could only control whether a request is rate limited or not before it hits your Worker.</p><p>Today we’re introducing a new API, in open beta, that gives you direct access to rate limits from your Worker. It’s lightning fast, backed by memcached, and dead simple to add to your Worker. For example, the following configuration defines a rate limit of 100 requests within a 60-second period:</p>
            <pre><code>[[unsafe.bindings]]
name = "RATE_LIMITER"
type = "ratelimit"
namespace_id = "1001" # An identifier unique to your Cloudflare account

# Limit: the number of tokens allowed within a given period, in a single Cloudflare location
# Period: the duration of the period, in seconds. Must be either 60 or 10
simple = { limit = 100, period = 60 } </code></pre>
            <p>Then, in your Worker, you can call the limit method on the RATE_LIMITER binding, providing a key of your choosing. Given the configuration above, this code will return a <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429">HTTP 429</a> response status code once more than 100 requests to a specific path are made within a 60-second period:</p>
            <pre><code>export default {
  async fetch(request, env) {
    const { pathname } = new URL(request.url)

    const { success } = await env.RATE_LIMITER.limit({ key: pathname })
    if (!success) {
      return new Response(`429 Failure – rate limit exceeded for ${pathname}`, { status: 429 })
    }

    return new Response(`Success!`)
  }
}</code></pre>
            <p>Now that Workers can connect directly to a data store like memcached, what else could we provide? Counters? Locks? An <a href="https://github.com/cloudflare/workerd/pull/1666">in-memory cache</a>? Rate limiting is the first of many primitives that we’re exploring providing in Workers that address questions we’ve gotten for years about where a temporary shared state that spans many Worker <a href="https://developers.cloudflare.com/workers/reference/how-workers-works/#isolates">isolates</a> should live. If you rely on putting state in the global scope of your Worker today, we’re working on better primitives that are purpose-built for specific use cases.</p><p>The Rate Limiting API in Workers is in open beta, and you can get started by <a href="https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit">reading the docs</a>.</p>
    <div>
      <h3>New auto-generated SDKs for Cloudflare’s API</h3>
      <a href="#new-auto-generated-sdks-for-cloudflares-api">
        
      </a>
    </div>
    <p>Production readiness means going from making changes by clicking buttons in a dashboard to making changes programmatically, using an infrastructure-as-code approach like <a href="https://github.com/cloudflare/terraform-provider-cloudflare">Terraform</a> or <a href="https://github.com/pulumi/pulumi-cloudflare">Pulumi</a>, or by making API requests directly, either on your own or via an SDK.</p><p>The <a href="https://developers.cloudflare.com/api/">Cloudflare API</a> is massive, and constantly adding new capabilities – on average we <a href="https://github.com/cloudflare/api-schemas/activity">update our API schemas between 20 and 30 times per day</a>. But to date, our API SDKs have been built and maintained manually, so we had a burning need to automate this.</p><p>We’ve done that, and today we’re announcing new client SDKs for the Cloudflare API in three languages – <a href="https://github.com/cloudflare/cloudflare-typescript">Typescript</a>, <a href="https://github.com/cloudflare/cloudflare-python">Python</a> and <a href="https://github.com/cloudflare/cloudflare-go">Go</a> – with more languages on the way.</p><p>Each SDK is generated automatically using <a href="https://www.stainlessapi.com/">Stainless API</a>, based on the <a href="https://github.com/cloudflare/api-schemas">OpenAPI schemas</a> that define the structure and capabilities of each of our API endpoints. This means that when we add any new functionality to the Cloudflare API, across any Cloudflare product, these API SDKs are automatically regenerated, and new versions are published, ensuring that they are correct and up-to-date.</p><p>You can install the SDKs by running one of the following commands:</p>
            <pre><code>// Typescript
npm install cloudflare

// Python
pip install cloudflare

// Go
go get -u github.com/cloudflare/cloudflare-go/v2</code></pre>
            <p>If you use Terraform or Pulumi, under the hood, Cloudflare’s Terraform Provider currently uses the existing, non-automated <a href="https://github.com/cloudflare/cloudflare-go">Go SDK</a>. When you run terraform apply, the Cloudflare Terraform Provider determines which API requests to make in what order, and executes these using the Go SDK.</p><p>The new, auto-generated Go SDK clears a path towards more comprehensive Terraform support for all Cloudflare products, providing a base set of tools that can be relied upon to be both correct and up-to-date with the latest API changes. We’re building towards a future where any time a product team at Cloudflare builds a new feature that is exposed via the Cloudflare API, it is automatically supported by the SDKs. Expect more updates on this throughout 2024.</p>
    <div>
      <h3>Durable Object namespace analytics and WebSocket Hibernation GA</h3>
      <a href="#durable-object-namespace-analytics-and-websocket-hibernation-ga">
        
      </a>
    </div>
    <p>Many of our own products, including <a href="https://developers.cloudflare.com/waiting-room/">Waiting Room</a>, <a href="https://developers.cloudflare.com/r2/">R2</a>, and <a href="https://developers.cloudflare.com/queues/">Queues</a>, as well as platforms like <a href="https://www.partykit.io/">PartyKit</a>, are built using <a href="https://developers.cloudflare.com/durable-objects/">Durable Objects</a>. Deployed globally, including newly added support for Oceania, you can think of Durable Objects like singleton Workers that can provide a single point of coordination and <a href="https://developers.cloudflare.com/durable-objects/api/transactional-storage-api/">persist state</a>. They’re perfect for applications that need real-time user coordination, like interactive chat or collaborative editing. Take Atlassian’s word for it:</p><blockquote><p><i>One of our new capabilities is</i> <a href="https://www.atlassian.com/software/confluence/whiteboards"><i>Confluence whiteboards</i></a><i>, which provides a freeform way to capture unstructured work like brainstorming and early planning before teams document it more formally. The team considered many options for real-time collaboration and ultimately decided to use Cloudflare’s Durable Objects. Durable Objects have proven to be a fantastic fit for this problem space, with a unique combination of functionalities that has allowed us to greatly simplify our infrastructure and easily scale to a large number of users. -</i> <a href="https://www.atlassian.com/software/confluence/whiteboards"><i>Atlassian</i></a></p></blockquote><p>We haven’t previously exposed associated analytical trends in the dashboard, making it hard to understand the usage patterns and error rates within a <a href="https://developers.cloudflare.com/durable-objects/configuration/access-durable-object-from-a-worker/#generate-ids-randomly">Durable Objects namespace</a> unless you used the <a href="https://developers.cloudflare.com/analytics/graphql-api/">GraphQL Analytics API</a> directly. The <a href="https://dash.cloudflare.com/?to=/:account/workers/durable-objects">Durable Objects dashboard</a> has now been revamped, letting you drill down into metrics, and go as deep as you need.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2wFlllqLKz9G1J7ZU4cAfp/67b84ff52331c449bfbbb291fec01ffa/pasted-image-0--1-.png" />
            
            </figure><p>From <a href="/introducing-workers-durable-objects">day one</a>, Durable Objects have supported <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSocket">WebSockets</a>, allowing many clients to directly connect to a Durable Object to send and receive messages.</p><p>However, sometimes client applications open a WebSocket connection and then eventually stop doing...anything. Think about that tab you’ve had sitting open in your browser for the last 5 hours, but haven’t touched. If it uses WebSockets to send and receive messages, it effectively has a long-lived TCP connection that isn’t being used for anything. If this connection is to a Durable Object, the Durable Object must stay running, waiting for something to happen, consuming memory, and costing you money.</p><p>We first <a href="/workers-pricing-scale-to-zero">introduced WebSocket Hibernation</a> to solve this problem, and today we’re announcing that this feature is out of beta and is Generally Available. With WebSocket Hibernation, you set an automatic response to be used while hibernating and serialize state such that it survives hibernation. This gives Cloudflare the inputs we need in order to maintain open WebSocket connections from clients while “hibernating” the Durable Object such that it is not actively running, and you are not billed for idle time. The result is that your state is always available in-memory when you actually need it, but isn’t unnecessarily kept around when it’s not. As long as your Durable Object is hibernating, even if there are active clients still connected over a WebSocket, you won’t be billed for duration.</p><p>In addition, we’ve heard developer feedback on the costs of incoming WebSocket messages to Durable Objects, which favor smaller, more frequent messages for real-time communication. Starting today incoming WebSocket messages will be billed at the equivalent of 1/20th of a request (as opposed to 1 message being the equivalent of 1 request as it has been up until now). Following a <a href="https://developers.cloudflare.com/durable-objects/platform/pricing/#example-4">pricing example</a>:</p>
<table>
<thead>
  <tr>
    <th></th>
    <th><span>WebSocket Connection Requests</span></th>
    <th><span>Incoming WebSocket Messages</span></th>
    <th><span>Billed Requests</span></th>
    <th><span>Request Billing</span></th>
  </tr>
</thead>
<tbody>
  <tr>
    <td><span>Before</span></td>
    <td><span>10K</span></td>
    <td><span>432M</span></td>
    <td><span>432,010,000</span></td>
    <td><span>$64.65</span></td>
  </tr>
  <tr>
    <td><span>After</span></td>
    <td><span>10K</span></td>
    <td><span>432M</span></td>
    <td><span>21,610,000</span></td>
    <td><span>$3.09</span></td>
  </tr>
</tbody>
</table>
    <div>
      <h3>Production ready, without production complexity</h3>
      <a href="#production-ready-without-production-complexity">
        
      </a>
    </div>
    <p>Becoming production ready on the last generation of cloud platforms meant slowing down how fast you shipped. It meant stitching together many disconnected tools or standing up whole teams to work on internal platforms. You had to retrofit your own productivity layers onto platforms that put up roadblocks.</p><p>The Cloudflare Developer Platform is grown up and production ready, and committed to being an integrated platform where products intuitively work together and where there aren’t 10 ways to do the same thing, with no need for a compatibility matrix to help understand what works together. Each of these updates shows this in action, integrating new functionality across products and parts of Cloudflare’s platform.</p><p>To that end, we want to hear from you about not only what you want to see next, but where you think we could be even simpler, or where you think our products could work better together. Tell us where you think we could do more – the <a href="https://discord.cloudflare.com/">Cloudflare Developers Discord</a> is always open.</p> ]]></content:encoded>
            <category><![CDATA[Developer Week]]></category>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[Rate Limiting]]></category>
            <category><![CDATA[SDK]]></category>
            <category><![CDATA[Observability]]></category>
            <guid isPermaLink="false">2IHoIDHRhxpNxOfd1ihQ0Y</guid>
            <dc:creator>Tanushree Sharma</dc:creator>
            <dc:creator>Jacob Bednarz</dc:creator>
        </item>
        <item>
            <title><![CDATA[New! Rate Limiting analytics and throttling]]></title>
            <link>https://blog.cloudflare.com/new-rate-limiting-analytics-and-throttling/</link>
            <pubDate>Tue, 19 Sep 2023 13:00:41 GMT</pubDate>
            <description><![CDATA[ Cloudflare Analytics can now suggest rate limiting threshold based on historic traffic patterns. Rate Limiting also supports a throttle behavior ]]></description>
            <content:encoded><![CDATA[ <p></p><p><a href="https://www.cloudflare.com/application-services/products/rate-limiting/">Rate Limiting</a> rules are essential in the toolbox of security professionals as they are very effective in managing targeted volumetric attacks, <a href="https://www.cloudflare.com/learning/access-management/account-takeover/">takeover attempts</a>, <a href="https://www.cloudflare.com/learning/bots/what-is-data-scraping/">scraping bots</a>, or API abuse. Over the years we have received a lot of feature requests from users, but two stand out: suggesting rate limiting thresholds and implementing a throttle behavior. Today we released both to Enterprise customers!</p><p>When creating a rate limit rule, one of the common questions is “what rate should I put in to block malicious traffic without affecting legitimate users?”. If your traffic is authenticated, <a href="https://www.cloudflare.com/application-services/products/api-gateway/">API Gateway</a> will suggest thresholds based on auth IDs (such a session-id, cookie, or API key). However, when you don’t have authentication headers, you will need to create IP-based rules (like for a ‘/login’ endpoint) and you are left guessing the threshold. From today, we provide analytics tools to determine what rate of requests can be used for your rule.</p><p>So far, a rate limit rule could be created with log, challenge, or block action. When ‘block’ is selected, all requests from the same source (for example, IP) were blocked for the timeout period. Sometimes this is not ideal, as you would rather selectively block/allow requests to enforce a maximum rate of requests without an outright temporary ban. When using throttle, a rule lets through enough requests to keep the request rate from individual clients below a customer-defined threshold.</p><p>Continue reading to learn more about each feature.</p>
    <div>
      <h2>Introducing Rate Limit Analysis in Security Analytics</h2>
      <a href="#introducing-rate-limit-analysis-in-security-analytics">
        
      </a>
    </div>
    <p>The <a href="https://developers.cloudflare.com/waf/security-analytics/">Security Analytics</a> view was designed with the intention of offering complete visibility on HTTP traffic while adding an extra layer of security on top. It's proven a great value when it comes to crafting custom rules. Nevertheless, when it comes to creating rate limiting rules, relying solely on Security Analytics can be somewhat challenging.</p><p>To create a rate limiting rule you can leverage Security Analytics to determine the filter — what requests are evaluated by the rule (for example, by filtering on mitigated traffic, or selecting other security signals like Bot scores). However, you’ll also need to determine what’s the maximum rate you want to enforce and that depends on the specific application, traffic pattern, time of day, endpoint, etc. What’s the typical rate of legitimate users trying to access the login page at peak time? What’s the rate of requests generated by a botnet with the same JA3 fingerprint scraping prices from an ecommerce site? Until today, you couldn’t answer these questions from the analytics view.</p><p>That’s why we made the decision to integrate a rate limit helper into Security Analytics as a new tab called "Rate Limit Analysis," which concentrates on providing a tool to answer rate-related questions.</p>
    <div>
      <h3>High level top statistics vs. granular Rate Limit Analysis</h3>
      <a href="#high-level-top-statistics-vs-granular-rate-limit-analysis">
        
      </a>
    </div>
    <p>In Security Analytics, users can analyze traffic data by creating filters combining what we call <i>top statistics.</i> These statistics reveal the total volume of requests associated with a specific attribute of the <a href="https://www.cloudflare.com/learning/ddos/glossary/hypertext-transfer-protocol-http/">HTTP requests</a>. For example, you can filter the traffic from the <a href="https://www.cloudflare.com/learning/network-layer/what-is-an-autonomous-system/">ASNs</a> that generated more requests in the last 24 hours, or you slice the data to look only at traffic reaching the most popular paths of your application. This tool is handy when creating rules based on traffic analysis.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3QmpAIl5PaDpDvc6eLBNeK/15d3af5e819eb89bb749b58eb43f24c7/image3-5.png" />
            
            </figure><p>However, for rate limits, a more detailed approach is required.</p><p>The new <i>Rate limit analysis</i> tab now displays data on request rate for traffic matching the selected filter and time period. You can select a rate defined on different time intervals, like one or five minutes, and the attribute of the request used to identify the rate, such as IP address, JA3 fingerprint, or a combination of both as this often improves accuracy. Once the attributes are selected, the chart displays the distribution of request rates for the top 50 unique clients (identified as unique IPs or JA3s) observed during the chosen time interval in descending order.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7iXu3aai6ibY25UWhtYUT1/9bef2b03e884668efbba3d8251cd4882/image2-1.png" />
            
            </figure><p>You can use the slider to determine the impact of a rule with different thresholds. How many clients would have been caught by the rule and rate limited? Can I visually identify abusers with above-average rate vs. the long tail of average users? This information will guide you in assessing what’s the most appropriate rate for the selected filter.</p>
    <div>
      <h3>Using Rate Limit Analysis to define rate thresholds</h3>
      <a href="#using-rate-limit-analysis-to-define-rate-thresholds">
        
      </a>
    </div>
    <p>It takes a few minutes to build your rate limit rule now. Let’s apply this to one of the common use cases where we identify /login endpoint and create a rate limit rule based on the IP with a logging action.</p><p><b>Define a scope and rate.</b></p><ul><li><p>In the <i>HTTP requests</i> tab (the default view), start by selecting a specific time period. If you’re looking for the normal rate distribution you can specify a period with non-peak traffic. Alternatively, you can analyze the rate of offending users by selecting a period when an attack was carried out.</p></li></ul><div>
  
</div>
<p></p><ul><li><p>Using the filters in the top statistics, select a specific endpoint (e.g., <i>/login</i>). We can also focus on non-automated/human traffic using the bot score quick filter on the right sidebar or the filter button on top of the chart. In the <i>Rate limiting Analysis</i> tab, you can choose the characteristic (JA3, IP, or both) and duration (1 min, 5 mins, or 1 hour) for your rate limit rule. At this point, moving the dotted line up and down can help you choose an appropriate rate for the rule. JA3 is only available to customers using Bot Management.</p></li></ul>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6ZC9jNROj5C5X6mHImu8zf/88b11e610fafe2504665dad8c22b3da6/image5-2.png" />
            
            </figure><ul><li><p>Looking at the distribution, we can exclude any IPs or ASNs that might be known to us, to have a better visual on end user traffic. One way to do this is to filter out the outliers right before the long tail begins. A rule with this setting will block the IPs/JA3 with a higher rate of requests.</p></li></ul><p><b>Validate your rate.</b> You can validate the rate by repeating this process but selecting a portion of traffic where you know there was an attack or traffic peak. The rate you've chosen should block the outliers during the attack and allow traffic during normal times. In addition to that, looking at the sampled logs can be helpful in verifying the fingerprints and filters chosen.</p><p><b>Create a rule.</b> Selecting “Create rate limit rule” will take you to the rate limiting tab in the WAF with your filters pre-populated.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7bxY562ESZk6pzJYrPBvuF/35d5d626a4ee5b286dd0c087c74d756e/image7-2.png" />
            
            </figure><p><b>Choose your action and behavior in the rule.</b> Depending on your needs you can choose to log, challenge, or block requests exceeding the selected threshold. It’s often a good idea to first deploy the rule with a log action to validate the threshold and then change the action to block or challenge when you are confident with the result. With every action, you can also choose between two behaviors: fixed action or throttle. Learn more about the difference in the next section.</p>
    <div>
      <h2>Introducing the new throttle behavior</h2>
      <a href="#introducing-the-new-throttle-behavior">
        
      </a>
    </div>
    <p>Until today, the only available behavior for Rate Limiting has been <i>fixed action,</i> where an action is triggered for a selected time period (also known as timeout). For example, did the IP 192.0.2.23 exceed the rate of 20 requests per minute? Then block (or log) all requests from this IP for, let’s say, 10 minutes.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2VKfUoWJSGACGOz50fEsof/00da159c12b659159a2f883b81988a4d/Screenshot-2023-09-19-at-11.16.42.png" />
            
            </figure><p>In some situations, this type of penalty is too severe and risks affecting legitimate traffic. For example, if a device in a corporate network (think about NAT) exceeds the threshold, all devices sharing the same IP will be blocked outright.</p><p>With <i>throttling</i>, rate limiting selectively drops requests to maintain the rate within the specified threshold. It’s like a leaky bucket behavior (with the only difference that we do not implement a queuing system). For example, throttling a client to 20 requests per minute means that when a request comes from this client, we look at the last 60 seconds and see if (on average) we have received less than 20 requests. If this is true, the rule won’t perform any action. If the average is already at 20 requests then we will take action on that request. When another request comes in, we will check again. Since some time has passed the average rate might have dropped, making room for more requests.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5nguPmj1apYY1lehsrbybF/3b954929b65a06a4e509ddc67689a874/Screenshot-2023-09-19-at-11.17.18.png" />
            
            </figure><p>Throttling can be used with all actions: block, log, or challenge. When creating a rule, you can select the behavior after choosing the action.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/19vPKFMr4S8VXOGtUkUXTK/822e2c7b704fa0f03fa86c6044bfd288/Screenshot-2023-09-19-at-11.17.42.png" />
            
            </figure><p>When using any challenge action, we recommend using the <i>fixed</i> <i>action</i> behavior. As a result, when a client exceeds the threshold we will challenge all requests until a challenge is passed. The client will then be able to reach the origin again until the threshold is breached again.</p><p>Throttle behavior is available to Enterprise rate limiting <a href="https://developers.cloudflare.com/waf/rate-limiting-rules/#availability">plans</a>.</p>
    <div>
      <h2>Try it out!</h2>
      <a href="#try-it-out">
        
      </a>
    </div>
    <p>Today we are introducing a new Rate Limiting analytics experience along with the throttle behavior for all Rate Limiting users on Enterprise plans. We will continue to work actively on providing a better experience to save our customers' time. Log in to the dashboard, try out the new experience, and let us know your feedback using the feedback button located on the top right side of the Analytics page or by reaching out to your account team directly.</p> ]]></content:encoded>
            <category><![CDATA[WAF]]></category>
            <category><![CDATA[Rate Limiting]]></category>
            <category><![CDATA[Analytics]]></category>
            <guid isPermaLink="false">CZ5Zxo3gP0GccJdEtAmcY</guid>
            <dc:creator>Radwa Radwan</dc:creator>
            <dc:creator>Daniele Molteni</dc:creator>
        </item>
        <item>
            <title><![CDATA[Back in 2017 we gave you Unmetered DDoS Mitigation, here's a birthday gift: Unmetered Rate Limiting for Self Serve customers]]></title>
            <link>https://blog.cloudflare.com/unmetered-ratelimiting/</link>
            <pubDate>Thu, 29 Sep 2022 13:00:00 GMT</pubDate>
            <description><![CDATA[ Starting today, Free, Pro and Business plans include Rate Limiting rules without additional charges. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>In 2017, we made <a href="/unmetered-mitigation/">unmetered DDoS protection</a> available to all our customers, regardless of their size or whether they were on a Free or paid plan. Today we are doing the same for Rate Limiting, one of the most successful products of the WAF family.</p><p>Rate Limiting is a very effective tool to manage targeted volumetric attacks, takeover attempts, bots scraping sensitive data, attempts to overload computationally expensive API endpoints and more. To manage these threats, customers deploy rules that limit the maximum rate of requests from individual visitors on specific paths or portions of their applications.</p><p>Until today, customers on a Free, Pro or Business plan were able to purchase Rate Limiting as an add-on with usage-based cost of $5 per million requests. However, we believe that an essential security tool like Rate Limiting should be available to all customers without restrictions.</p><p>Since we launched unmetered DDoS, we have mitigated huge attacks, like a <a href="/cloudflare-blocks-an-almost-2-tbps-multi-vector-ddos-attack/">2 Tbps multi-vector attack</a> or the most recent <a href="/26m-rps-ddos/">26 million requests per second attack</a>. We believe that releasing an unmetered version of Rate Limiting will increase the overall security posture of millions of applications protected by Cloudflare.</p><p>Today, we are announcing that Free, Pro and Business plans include Rate Limiting rules without extra charges.</p><p>…and we are not just dropping any Rate Limiting extra charges, we are also releasing an updated version of the product which is built on the powerful ruleset engine and allows building rules like in Custom Rules. This is the same engine which powers the enterprise-grade <a href="/advanced-rate-limiting/">Advanced Rate Limiting</a>. The new ‘Rate limiting rules’ will appear in your dashboard starting this week.</p><p>No more usage-based charges, just rate limiting when you need and how much you need it.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5H36mS0NDzLbE3sJfa8xnF/95f9f42210e0a725ab8d489be64eb892/image2-63.png" />
            
            </figure><p>New Rate Limiting is in everyone's dashboard under the WAF tab.</p><p>Note: starting today, September 29th, Pro and Business customers have the new product available in their dashboard. Free customers will get their rules enabled during the week starting on October 3rd 2022.</p>
    <div>
      <h3>End of usage-based charges</h3>
      <a href="#end-of-usage-based-charges">
        
      </a>
    </div>
    <p>New customers get new Rate Limiting by default while existing customers will be able to run both products in parallel: new and previous version.</p><p>For new customers, new Rate Limiting rules will be included in each plan according to the following table:</p><table>
<thead>
  <tr>
    <th></th>
    <th>FREE</th>
    <th>PRO</th>
    <th>BUSINESS</th>
  </tr>
</thead>
<tbody>
  <tr>
    <td>Number of rules</td>
    <td>1</td>
    <td>2</td>
    <td>5</td>
  </tr>
</tbody>
</table><p>When using these rules, no additional charges will be added to your account. No matter how much traffic these rules handle.</p><p>Existing customers will be granted the same amount of rules in the new, unmetered, system as the rules they’re currently using in the previous version (as of September 20, 2022). For example, if you are a Business customer with nine active rules in the previous version, you will get nine rules in the new system as well.</p><p><i>The previous version of Rate Limiting will still be subject to charges when in use</i>. If you want to take advantage of the unmetered option, we recommend rewriting your rules in the new engine. As outlined below, new Rate Limiting offers all the capabilities of the previous version of Rate Limiting and more. In the future, the previous version of Rate Limiting will be deprecated, however we will give plenty of time to self-migrate rules.</p>
    <div>
      <h3>New rate limiting engine for all</h3>
      <a href="#new-rate-limiting-engine-for-all">
        
      </a>
    </div>
    <p>A couple of weeks ago, <a href="/cloudflare-waap-named-leader-gartner-magic-quadrant-2022/">we announced</a> that Cloudflare was named a Leader in the Gartner® Magic Quadrant™ for Web Application and API Protection (WAAP). One of the key services offered in our WAAP portfolio is Advanced Rate Limiting.</p><p>The recent <a href="/advanced-rate-limiting/">Advanced Rate Limiting</a> has shown great success among our Enterprise customers. Advanced Rate Limiting allows an unprecedented level of control on how to manage incoming traffic rate. We decided to give the same rule-building experience to all of our customers as well as some of its new features.</p><p>A summary of the feature set is outlined in the following table:</p>
<table>
<thead>
  <tr>
    <th></th>
    <th><span>FREE</span></th>
    <th><span>PRO</span></th>
    <th><span>BUSINESS</span></th>
    <th><span>ENT</span><br /><span><br />with WAF Essential</span></th>
    <th><span>ENT</span><span><br />with Advanced Rate Limiting</span></th>
  </tr>
</thead>
<tbody>
  <tr>
    <td><span>Fields available (request)</span></td>
    <td><span>Path</span></td>
    <td><span>Host</span><br /><span>URI</span><br /><span>Path</span><br /><span>Full URI</span><br /><span>Query</span></td>
    <td><span>Host</span><br /><span>URI</span><br /><span>Path</span><br /><span>Full URI</span><br /><span>Query</span><br /><span>Method</span><br /><span>Source IP</span><br /><span>User Agent</span></td>
    <td><a href="https://developers.cloudflare.com/ruleset-engine/rules-language/fields/"><span>All fields available in Custom Rules</span></a><span>: Including  request metadata</span>(1)<span>.</span></td>
    <td><span>Same WAF Essential. Request Bot score</span>(1)<span> and body fields</span>(2)</td>
  </tr>
  <tr>
    <td><span>Counting expression</span></td>
    <td><span>Not available</span></td>
    <td><span>Not available</span></td>
    <td><span>Available with access to response headers and response status code</span></td>
    <td><span>Available with access to response headers and response status code</span></td>
    <td><span>Available with access to response headers and response status code</span></td>
  </tr>
  <tr>
    <td><span>Counting characteristics</span></td>
    <td><span>IP</span></td>
    <td><span>IP</span></td>
    <td><span>IP</span></td>
    <td><span>IP</span><br /><span>IP with NAT awareness</span></td>
    <td><span>IP</span><br /><span>IP with NAT awareness</span><br /><span>Query</span><br /><span>Host</span><br /><span>Headers</span><br /><span>Cookie</span><br /><span>ASN</span><br /><span>Country</span><br /><span>Path</span><br /><span>JA3</span>(2)<span> </span><br /><span>JSON field (New!)</span></td>
  </tr>
  <tr>
    <td><span>Max Counting period</span></td>
    <td><span>10 seconds</span></td>
    <td><span>60 seconds</span></td>
    <td><span>10 minutes</span></td>
    <td><span>10 minutes</span></td>
    <td><span>1 hour</span></td>
  </tr>
  <tr>
    <td><span>Price</span></td>
    <td><span>Free</span></td>
    <td><span>Included in monthly subscription</span></td>
    <td><span>Included in monthly subscription</span></td>
    <td><span>Included in contracted plan</span></td>
    <td><span>Included in contracted plan</span></td>
  </tr>
</tbody>
</table><p>(1): Requires Bots Management add-on(2): Requires specific plan</p><p><b>Leveraging the ruleset engine.</b> Previous version of Rate Limiting allows customers to scope the rule based on a single path and method of the request. Thanks to the ruleset engine, customers can now write rules like they do in Custom Rules and combine multiple parameters of the HTTP request.</p><p>For example, Pro domains can combine multiple paths in the same rule using the OR or AND operators. Business domains can also write rules using Source IP or User Agent. This allows enforcing different rates for specific User Agents. Furthermore, Business customers can now scope Rate Limiting to specific IPs (using IP List, for example) or exclude IPs where no attack is expected.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4vdGtCHgu4JHuWZsCiNU8u/135e670450e10416f8fa3cecce28f3ed/image1-77.png" />
            
            </figure><p>Both Rate Limiting products can be found under WAF→ Rate Limiting rules. Previous version of Rate Limiting (left) allows filtering traffic for one URL. New Rate Limiting (right) allows you to combine fields like in Custom Rules.</p><p><b>Counting and mitigation expressions are now separate.</b> A feature request we often heard about was the ability to track the rate of requests on a specific path (such as ‘/login’) and, when an IP exceeds the threshold, block every request from the same IP hitting anywhere on your domain. Business and Enterprise customers can now achieve this by using the <i>counting</i> expression which is separate from the <i>mitigation</i>. The former defines what requests are used to compute the rate while the letter defines what requests are mitigated once the threshold has been reached.</p><p>Another use case for using the counting expression is when you need to use Origin Status Code or HTTP Response Headers. If you need to use these fields, we recommend creating a counting expression that includes response parameters and explicitly writing a filter that defines what the request parameters that will trigger a block action.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/60pUzmYow1zkwkvkYJrTww/bf9fced9a08884164a4fbf56232b1ac7/image3-46.png" />
            
            </figure><p>You can now separate the expression used to compute the rate from the expression used for blocking traffic once the rate is exceeded. In this example, all traffic to example.com will be blocked (see mitigation expression at the top) if more than 3 POST requests to ‘/login’ in 1 minute have returned 429 (defined by the counting expression at the bottom).</p><p><b>Counting dimensions.</b> Similarly to the previous version, Free, Pro and Business customers will get the IP-based Rate Limiting. When we say IP-based we refer to the way we group (or count) requests. You can set a rule that enforces a maximum rate of request from the same IPs. If you set a rule to limit 10 requests over one minute, we will count requests from individual IPs until they reach the limit and then block for a period of time.</p><p>Advanced Rate Limiting users are able to group requests based on additional characteristics, such as API keys, cookies, session headers, ASN, query parameters, a JSON body field (e.g. the username value of a login request) and more.</p><p><b>What do Enterprise customers get?</b> Enterprise customers do not get Rate Limiting as part of their contract by default. Rate Limiting is part of application security offering which needs to be contracted based on traffic volume. When WAF with Rate Limiting is included in their contract, they get access to 100 rules, a more comprehensive list of fields available in the rule builder, and they get to upgrade to <a href="/advanced-rate-limiting/">Advanced Rate Limiting</a>. Please reach out to your account team to learn more.</p><p>More information on how to use new Rate Limiting can be found in the <a href="https://developers.cloudflare.com/waf/rate-limiting-rules/">documentation</a>.</p>
    <div>
      <h3>Additional information for existing customers</h3>
      <a href="#additional-information-for-existing-customers">
        
      </a>
    </div>
    <p>If you are a Free, Pro or Business customer, you will automatically get the new product in the dashboard. We will entitle you with as many unmetered Rate Limiting rules as you are using in the previous version.</p><p>If you are an Enterprise customer using the previous version of Rate Limiting, please reach out to the account team to discuss the options to move to new Rate Limiting.</p><p>To take advantage of the unmetered functionality, you will need to migrate your rules to the new system. The previous version will keep working as usual, and you might be charged based on the traffic that its rules evaluate.</p><p>Long term, the previous version of Rate Limiting will be deprecated and when this happens all rules still running on the old system will cease to run.</p>
    <div>
      <h3>What’s next?</h3>
      <a href="#whats-next">
        
      </a>
    </div>
    <p>The WAF team has plans to further expand our Rate Limiting capabilities. Features we are considering include better analytics to support the rule creation. Furthermore, new Rate Limiting can now benefit from new fields made available in the WAF as soon as they are released. For example, Enterprise customers can combine Bot Score or the new <a href="/waf-ml/">WAF Attack Score</a> to create a more fine grain security posture.</p> ]]></content:encoded>
            <category><![CDATA[Birthday Week]]></category>
            <category><![CDATA[Rate Limiting]]></category>
            <category><![CDATA[DDoS]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Security]]></category>
            <guid isPermaLink="false">3A3SkA9H2jGIesmoPPmqQE</guid>
            <dc:creator>Daniele Molteni</dc:creator>
        </item>
        <item>
            <title><![CDATA[Introducing Advanced Rate Limiting]]></title>
            <link>https://blog.cloudflare.com/advanced-rate-limiting/</link>
            <pubDate>Wed, 16 Mar 2022 12:58:53 GMT</pubDate>
            <description><![CDATA[ Advance Rate Limiting allows counting requests based on virtually any characteristics of the HTTP request, regardless of its source IP ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Still relying solely on IP firewalling? It’s time to change that.</p><p>While the IP address might still be one of the core technologies allowing networks to function, its value for security is long gone. IPs are rarely static; nowadays, mobile operators use carrier-grade network address translation (CGNAT) to share the same IP amongst thousands of individual devices or users. Bots then carry out distributed attacks with low request volume from different IPs to elude throttling. Furthermore, many countries consider IP addresses to be personal data, and it would be a great advancement for privacy if a replacement could be found for elements of security that currently rely on IP addresses to function. A product that is affected by this trend is rate limiting.</p><p>Rate limiting is designed to stop requests from overloading a server. It relies on rules. A rate limiting rule is defined by a filter (which typically is a path, like <code>/login</code>) and the maximum number of requests allowed from each user over a period of time. When this threshold is exceeded, an action is triggered (usually a block) for subsequent requests from the same user for a period of time (known as a timeout). Traditional throttling solutions bucket together requests with the same IP since they follow the logic “requests from the same IP equals requests from the same user”. However, we hear from customers how not effective it is to use IP-based rate limiting to protect traffic, especially for authenticated APIs.</p><p>We are excited to launch Advanced Rate Limiting, a leap forward for throttling technologies. It allows counting requests based on virtually any characteristics of the HTTP request, regardless of its source IP. Rate Limiting is a great defense against brute force, <a href="https://www.cloudflare.com/learning/ai/how-to-prevent-web-scraping/">scraping</a>, or targeted DDoS attacks. Consequences of these attacks include leaking of sensitive data, <a href="https://www.cloudflare.com/zero-trust/solutions/account-takeover-prevention/">account takeover</a> or exhausting back-end resources. Keeping the rate of requests under control is especially crucial for <a href="https://www.cloudflare.com/learning/security/api/what-is-an-api/">APIs</a> where each call can trigger costly computation on the server origin.</p>
    <div>
      <h2>A step-change innovation for throttling</h2>
      <a href="#a-step-change-innovation-for-throttling">
        
      </a>
    </div>
    <p>Advanced Rate Limiting is now part of the <a href="/new-waf-experience/">Web Application Firewall</a> (WAF). It’s integrated with Firewall Rules and allows counting requests based on characteristics other than IP.</p><p>With Advanced Rate Limiting, you can:</p><ol><li><p>Define the rule filter using all HTTP request characteristics, such as URI, method, headers, cookies and body fields. Customers on a Bot Management plan get access to the bot score dynamic field too. You can also use two characteristics of the HTTP response to trigger rate limiting: status code and response headers.</p></li><li><p>Choose to count requests based on: IP, country, header, cookie, AS Number (ASN), value of a query parameter, or bots fingerprint (JA3). You can use any of these fields individually or by combining them, so that requests are bucketed when these values are the same. It can also set the threshold as the maximum complexity your origin can handle, rather than the maximum number of requests you want to allow.</p></li><li><p>Use it on all your traffic. As an Enterprise customer, Rate Limiting could be bought on a portion of your total traffic. With Advanced Rate Limiting, you can use the product on all of your traffic without having to worry about caps. Finally, Advanced Rate Limiting is available on the entire Cloudflare network, including in China.</p></li></ol>
    <div>
      <h2>Designed to integrate with your application</h2>
      <a href="#designed-to-integrate-with-your-application">
        
      </a>
    </div>
    <p>In this section, we discuss a few common use cases for using Advanced Rate Limiting to <a href="https://www.cloudflare.com/application-services/solutions/api-security/">protect your web or API traffic</a>. You can mix and match all these configurations to better suit your security needs and your application. All these use cases can be achieved via dashboard, API and Terraform.</p>
    <div>
      <h3>Use case - Protect web traffic with more granular rules</h3>
      <a href="#use-case-protect-web-traffic-with-more-granular-rules">
        
      </a>
    </div>
    <p><b>Flexible filters.</b> You can now write rate limiting rules using all the fields of the HTTP request. For example, you can trigger a rule for requests with specific headers (such as User Agent) or throttle traffic from bots sharing the same ASN.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6jlTSXDikimPc7kIb8Yj5z/1e8498567d467a2310891306ffef1d4f/image3-19.png" />
            
            </figure><p><b>Separate mitigation expression.</b> You can now separate the mitigation expression from the counting expression. This allows you to define on what part of your website you want to block users once the threshold is reached, and what conditions the request (and response) needs to meet in order to increase the counter. For example, you can count requests to your <code>/login</code> endpoint and then block the same user on the whole site. This is especially useful when you want to include response fields in your counting expression, for example, by counting only requests that return a specific response code but then block a larger portion of traffic.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/p43VNOCn2MV2I1xJmOAM2/69dc9fbf784c1bc33a76fc3ff79e686c/image2-40.png" />
            
            </figure><p><b>Use dynamic fields.</b> Customers can now combine Rate Limiting with rules detecting known vulnerabilities, such as <a href="/waf-ml/">WAF machine learning score</a>. For example, you can block eyeballs after a number of consecutive requests flagged as SQLi have hit your site. Another use case is to trigger a throttling rule only for requests likely originated from bots (by using the bot score in the rule filter) or after a number of login attempts with stolen credentials have been performed (<a href="https://developers.cloudflare.com/waf/managed-rulesets/exposed-credentials-check">link</a>). You can also use the JA3 fingerprint as a counting dimension, so that you leverage our Bot Machine Learning algorithm to bucket traffic from bots with the same fingerprint.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/28PgBzrw0RSnTEBdPRazR8/ed289896eccaf20b68385208081ae528/image4-4.png" />
            
            </figure>
    <div>
      <h3>Use case - Protect APIs by integrating Rate Limiting with your application</h3>
      <a href="#use-case-protect-apis-by-integrating-rate-limiting-with-your-application">
        
      </a>
    </div>
    <p><b>Count requests based on session ID.</b> API traffic is often authenticated, and the session can be tracked with a cookie, header (such as <code>x-api-key</code>) or query value. Advanced Rate Limiting allows you to define where the ID is in the request and track the number of requests relative to the same session, regardless of the IP. This can be an effective way to fend off distributed bot attacks that scrape sensitive data, such as product prices or airline passenger data.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2TWf8VzKMQTdl3DIQvCbpw/3505e5b768af0506ffc0a30028dcfc32/image5-5.png" />
            
            </figure><p><b>Trigger rule based on a request body content.</b> The rule filter gives access to the raw body and the JSON-parsed body. You can count requests where a body JSON field has a specific value using the function <code>lookup_json_string</code> available in the rule filter. This can be useful for GraphQL APIs, where different calls (or mutations) can be performed through the same endpoint but specifying different operations in the request body.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1R8vFFvmCerK66QUvqq5ti/f7c7c139682643a175157078ea0dafdc/image6-1.png" />
            
            </figure><p><b>Rate Limiting based on complexity (coming soon in beta available now via API)</b>. Some API calls are more complex to serve than others, so counting on the number of requests doesn’t really reflect the actual cost to serve. GraphQL APIs are an example: each call complexity can vary widely based on how much processing the server needs to carry out to serve the request. Your origin can estimate the complexity of each request and return it along with the response, and rate limiting can increment the counter by the complexity estimate provided by the origin. You can then set a complexity threshold in the rule and, when it’s exceeded, subsequent requests will trigger an action, such as block.</p>
    <div>
      <h2>Packaging</h2>
      <a href="#packaging">
        
      </a>
    </div>
    <p>Advanced Rate Limiting is generally available for Enterprise customers on the new Advanced plan. See below for more details on what’s included in each plan. Reach out to your Cloudflare account team or Customer Success Manager (CSM) to learn more. If you are a Pro or Biz customer, you won’t be able to use Advanced Rate Limiting, but we are planning to give some advantages to Pro and Biz plans as well.</p><table><tr><td><p><b></b></p></td><td><p><b>Enterprise Core</b></p></td><td><p><b>Enterprise Advanced</b></p></td></tr><tr><td><p>Available request fields in filter</p></td><td><p>Selected standard fields:
URL
Method
Headers
Source IP</p></td><td><p>All standard fields
Body fields
Account takeover fields
Dynamic fields (including Bot Score*)</p></td></tr><tr><td><p>Available response fields in counting filter</p></td><td><p>Response code
Response Headers</p></td><td><p>Response code
Response Headers</p></td></tr><tr><td><p>Counting characteristics</p></td><td><p>IP</p></td><td><p>IP
IP with NAT awareness
ASN
Country
Headers
Cookie
Query
JA3*</p></td></tr><tr><td><p>Complexity</p></td><td><p>No</p></td><td><p>Yes</p></td></tr><tr><td><p>Maximum sampling period</p></td><td><p>10 minutes</p></td><td><p>1 hour</p></td></tr></table><p>*requires Bot Management plan</p>
    <div>
      <h2>What’s next for Rate Limiting</h2>
      <a href="#whats-next-for-rate-limiting">
        
      </a>
    </div>
    <p>In the coming months, we are going to collect feedback from our customers to decide what additional features we should include in Advanced Rate Limiting. We have already a few ideas we are exploring, including automatically profiling your traffic and recommending thresholds for your rules.</p> ]]></content:encoded>
            <category><![CDATA[Security Week]]></category>
            <category><![CDATA[Rate Limiting]]></category>
            <guid isPermaLink="false">4nxAgcAukSta8FUP81RKVB</guid>
            <dc:creator>Daniele Molteni</dc:creator>
        </item>
        <item>
            <title><![CDATA[Rate Limiting: Delivering more rules, and greater control]]></title>
            <link>https://blog.cloudflare.com/rate-limiting-delivering-more-rules-and-greater-control/</link>
            <pubDate>Mon, 21 May 2018 20:41:37 GMT</pubDate>
            <description><![CDATA[ With more platforms adopting DDoS safeguards like integrating mitigation services and enhancing bandwidth at vulnerable points, Layer 3 and 4 attacks are becoming far less effective than before. ]]></description>
            <content:encoded><![CDATA[ <p>With more and more platforms taking the <a href="https://www.cloudflare.com/learning/ddos/how-to-prevent-ddos-attacks/">necessary precautions against DDoS attacks</a> like integrating DDoS mitigation services and increasing bandwidth at weak points, Layer 3 and 4 attacks are just not as effective anymore. For Cloudflare, we have fully automated Layer 3/4 based protections with our internal platform, <a href="/meet-gatebot-a-bot-that-allows-us-to-sleep/">Gatebot</a>. In the last 6 months we have seen a large upward trend of Layer 7 based DDoS attacks. The key difference to these attacks is they are no longer focused on using huge payloads (volumetric attacks), but based on Requests per Second to exhaust server resources (CPU, Disk and Memory). On a regular basis we see attacks that are over 1 million requests per second. The graph below shows the number of Layer 7 attacks Cloudflare has monitored, which is trending up. On average seeing around 160 attacks a day, with some days spiking up to over 1000 attacks.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2KCzsb3VI9QyzaxYXWfPlW/bff6e0c18354270863ab8b5626f7dff1/Screen-Shot-2018-05-21-at-10.36.27-AM.png" />
            
            </figure><p>A year ago, Cloudflare released <a href="/rate-limiting/">Rate Limiting</a>, and it is proving to be a hugely effective tool for customers to protect their web applications and <a href="https://www.cloudflare.com/learning/security/api/what-is-an-api/">APIs</a> from all sorts of attacks, from “low and slow” DDoS attacks, through to bot-based attacks, such as credential stuffing and content scraping. We’re pleased about the success our customers are seeing with Rate Limiting and are excited to announce additional capabilities to give our customers further control.</p>
    <div>
      <h3>So what’s changing?</h3>
      <a href="#so-whats-changing">
        
      </a>
    </div>
    <p>There are times when you clearly know that traffic is malicious. In cases like this, our existing Block action is proving effective for our customers. But there are times when it is not the best option, and causes a negative user experience. Rather than risk a false negative, customers often want to challenge a client to ensure they are who they represent themselves to be, which is in most situations, human not a bot.</p><p><b>Firstly</b>, to help customers more accurately identify the traffic, we are adding Cloudflare JavaScript Challenge, and Google reCAPTCHA (Challenge) mitigation actions to the UI and API for Pro and Business plans. The existing Block and Simulate actions still exist. As a reminder, to test any rule, deploying in Simulate means that you will not be charged for any requests. This is a great way to test your new rules to make sure they have been configured correctly.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6wD9AHZXCrufghkJPOcrDR/912893206456995a98bf003226cfac6e/Screen-Shot-2018-05-21-at-10.36.39-AM.png" />
            
            </figure><p><b>Secondly</b>, we’re making Rate Limiting more dynamically scalable. A new feature has been added which allows Rate Limiting to count on Origin Response Headers for Business and Enterprise customers. The way this feature works is by matching attributes which are returned by the Origin to Cloudflare.</p>
    <div>
      <h3>The new capabilities - in action!</h3>
      <a href="#the-new-capabilities-in-action">
        
      </a>
    </div>
    <p>One of the things that really drives our innovation is solving the real problems we hear from customers every day. With that, we wanted to provide some real world examples of these new capabilities in action.</p><p>Each of the use cases have Basic and Advanced implementation options. After some testing, we found that tiering rate limits is an extremely effective solution against repeat offenders.</p><p><b>Credential Stuffing Protection</b> for Login Pages and APIs. The best way to build applications is to utilise the standardized Status Codes. For example, if I fail to authenticate against an endpoint or a website, I should receive a “401” or “403”. Generally speaking a user to a website will often get their password wrong three times before selecting the “I forgot my password” option. Most Credential Stuff bots will try thousands of times cycling through many usernames and password combinations to see what works.</p><p>Here are some example rate limits which you can configure to protect your application from credential stuffing.</p><p><b>Basic</b>:Cloudflare offers a “Protect My Login” feature out the box. Enter the URL for your login page and Cloudflare will create a rule such that clients that attempt to log in more than 5 times in 5 minutes will be blocked for 15 minutes.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4FhmlH6WeVwOhm3pyHjo9w/b5647d44c77165d7da31d69422c322a6/Screen-Shot-2018-05-21-at-10.36.47-AM.png" />
            
            </figure><p>With the new Challenge capabilities of Rate Limiting, you can customize the response parameters for log in to more closely match the behavior pattern for bots you see on your site through a custom-built rule.</p><p>Logging in four times in one minute is hard - I type fast, but couldn’t even do this. If I’m seeing this pattern in my logs, it is likely a bot. I can now create a Rate Limiting rule based on the following criteria:</p><table><tr><td><p><b>RuleID</b></p></td><td><p><b>URL</b></p></td><td><p><b>Count</b></p></td><td><p><b>Timeframe</b></p></td><td><p><b>Matching Criteria</b></p></td><td><p><b>Action</b></p></td></tr><tr><td><p>1</p></td><td><p>/login</p></td><td><p>4</p></td><td><p>1 minute</p></td><td><p>Method: POST
Status Code: 401,403</p></td><td><p>Challenge</p></td></tr></table><p>With this new rule, if someone tries to log in four times within a minute, they will be thrown a challenge. My regular human users will likely never hit it, but if they do - the challenge insures they can still access the site.</p><p><b>Advanced</b>:
And sometimes bots are just super persistent in their attacks. We can tier rules together to tackle repeat offenders. For example, instead of creating just a single rule, we can create a series of rules which can be tiered to protect against persistent threats:</p><table><tr><td><p><b>RuleID</b></p></td><td><p><b>URL</b></p></td><td><p><b>Count</b></p></td><td><p><b>Timeframe</b></p></td><td><p><b>Matching Criteria</b></p></td><td><p><b>Action</b></p></td></tr><tr><td><p>1</p></td><td><p>/login</p></td><td><p>4</p></td><td><p>1 minute</p></td><td><p>Method: POST
Status Code: 401,403</p></td><td><p>JavaScript Challenge</p></td></tr><tr><td><p>2</p></td><td><p>/login</p></td><td><p>10</p></td><td><p>5 minutes</p></td><td><p>Method: POST
Status Code: 401,403</p></td><td><p>Challenge</p></td></tr><tr><td><p>3</p></td><td><p>/login</p></td><td><p>20</p></td><td><p>1 hour</p></td><td><p>Method: POST
Status Code: 401,403</p></td><td><p>Block for 1 day</p></td></tr></table><p>With this type of tiering, any genuine users that are just having a hard time remembering their login details whilst also being extremely fast typers will not be fully blocked. Instead, they will first be given out automated JavaScript challenge followed by a traditional CAPTCHA if they hit the next limit. This is a much more user-friendly approach while still securing your login endpoints.</p>
    <div>
      <h4>Time-based Firewall</h4>
      <a href="#time-based-firewall">
        
      </a>
    </div>
    <p>Our IP Firewall is a powerful feature to block problematic IP addresses from accessing your app. Particularly this is related to repeated abuse, or based on IP Reputation or Threat Intelligence feeds that are integrated at the origin level.</p><p>While the IP firewall is powerful, maintaining and managing a list of IP addresses which are currently being blocked can be cumbersome. It becomes more complicated if you want to allow blocked IP addresses to “age out” if bad behavior stops after a period of time. This often requires authoring and managing a script and multiple API calls to Cloudflare.</p><p>The new Rate Limiting Origin Headers feature makes this all so much easier. You can now configure your origin to respond with a Header to trigger a Rate-Limit. To make this happen, we need to generate a Header at the Origin, which is then added to the response to Cloudflare. As we are matching on a static header, we can set a severity level based on the content of the Header. For example, if it was a repeat offender, you could respond with High as the Header value, which could Block for a longer period.</p><p>Create a Rate Limiting rule based on the following criteria:</p><table><tr><td><p><b>RuleID</b></p></td><td><p><b>URL</b></p></td><td><p><b>Count</b></p></td><td><p><b>Timeframe</b></p></td><td><p><b>Matching Criteria</b></p></td><td><p><b>Action</b></p></td></tr><tr><td><p>1</p></td><td><p>*</p></td><td><p>1</p></td><td><p>1 second</p></td><td><p>Method: _ALL_
Header: X-CF-Block = low</p></td><td><p>Block for 5 minutes</p></td></tr><tr><td><p>2</p></td><td><p>*</p></td><td><p>1</p></td><td><p>1 second</p></td><td><p>Method: _ALL_
Header: X-CF-Block = medium</p></td><td><p>Block for 15 minutes</p></td></tr><tr><td><p>3</p></td><td><p>*</p></td><td><p>1</p></td><td><p>1 second</p></td><td><p>Method: _ALL_
Header: X-CF-Block = high</p></td><td><p>Block for 60 minutes</p></td></tr></table><p>Once that Rate-Limit has been created, Cloudflare’s Rate-Limiting will then kick-in immediately when that Header is received.</p>
    <div>
      <h4>Enumeration Attacks</h4>
      <a href="#enumeration-attacks">
        
      </a>
    </div>
    <p>Enumeration attacks are proving to be increasingly popular and pesky to mitigate. With enumeration attacks, attackers identify an expensive operation in your app and hammer at it to tie up resources and slow or crash your app. For example, an app that offers the ability to look up a user profile requires a database lookup to validate whether the user exists. In an enumeration attack, attackers will send a random set of characters to that endpoint in quick succession, causing the database to ground to a halt.</p><p>Rate Limiting to the rescue!</p><p>One of our customers was hit with a huge enumeration attack on their platform earlier this year, where the aggressors were trying to do exactly what we described above, in an attempt to overload their database platform. Their Rate Limiting configuration blocked over 100,000,000 bad requests during the 6-hour attack.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1pwVBMpUcd368swYqwG5BY/497e8e574ff8d71d03ce7f44ed46c65c/Screen-Shot-2018-05-21-at-10.36.57-AM.png" />
            
            </figure><p>When a query is sent to the app, and the user is not found, the app serves a 404 (page not found). A very basic approach is to set a rate limit for 404s. If a user crosses a threshold of 404’s in a period of time, set the app to challenge the user to prove themselves to be a real person.</p><table><tr><td><p><b>RuleID</b></p></td><td><p><b>URL</b></p></td><td><p><b>Count</b></p></td><td><p><b>Timeframe</b></p></td><td><p><b>Matching Criteria</b></p></td><td><p><b>Action</b></p></td></tr><tr><td><p>1</p></td><td><p>*</p></td><td><p>10</p></td><td><p>1 minute</p></td><td><p>Method: GET
Status Code: 404</p></td><td><p>Challenge</p></td></tr></table><p>To catch repeat offenders, you can tier the tier Rate Limits:</p><table><tr><td><p><b>RuleID</b></p></td><td><p><b>URL</b></p></td><td><p><b>Count</b></p></td><td><p><b>Timeframe</b></p></td><td><p><b>Matching Criteria</b></p></td><td><p><b>Action</b></p></td></tr><tr><td><p>1</p></td><td><p>/public/profile*</p></td><td><p>10</p></td><td><p>1 minute</p></td><td><p>Method: GET
Status Code: 404</p></td><td><p>JavaScript Challenge</p></td></tr><tr><td><p>2</p></td><td><p>/public/profile*</p></td><td><p>25</p></td><td><p>1 minute</p></td><td><p>Method: GET
Status Code: 200</p></td><td><p>Challenge</p></td></tr><tr><td><p>3</p></td><td><p>/public/profile*</p></td><td><p>50</p></td><td><p>10 minutes</p></td><td><p>Method: GET
Status Code: 200, 404</p></td><td><p>Block for 4 hours</p></td></tr></table><p>With this type of tiered defense in place, it means that you can “caution” an offender with a JavaScript challenge or Challenge (Google Captcha), and then “block” them if they continue.</p>
    <div>
      <h4>Content Scraping</h4>
      <a href="#content-scraping">
        
      </a>
    </div>
    <p>Increasingly, content owners are wrestling with content scraping - malicious bots copying copyrighted images or assets and redistributing or reusing them. For example, we work with an <a href="https://www.cloudflare.com/ecommerce/">eCommerce store</a> that uses copyrighted images and their images are appearing elsewhere on the web without their consent. Rate Limiting can help!</p><p>In their app, each page displays 4 copyrighted images, 1 which is actual size, and 3 which are thumbnails. By looking at logs and user patterns, they determined that most users, at a stretch, would never view more than 10–15 products in a minute, which would equate to 40–60 loads from the images store.</p><p>They chose to tier their Rate Limiting rules to prevent end users from getting unnecessarily blocked when they were browsing heavily. To <a href="https://www.cloudflare.com/learning/ai/how-to-prevent-web-scraping/">block malicious attempts at content scraping</a> can be quite simple, however it does require some forward planning. Placing the rate limit on the right URL is key to insure you are placing the rule on exactly what you are trying to protect and not the broader content. Here’s an example set of rate limits this customer set to protect their images:</p><table><tr><td><p><b>RuleID</b></p></td><td><p><b>URL</b></p></td><td><p><b>Count</b></p></td><td><p><b>Timeframe</b></p></td><td><p><b>Matching Criteria</b></p></td><td><p><b>Action</b></p></td></tr><tr><td><p>1</p></td><td><p>/img/thumbs/*</p></td><td><p>10</p></td><td><p>1 minute</p></td><td><p>Method: GET
Status Code: 404</p></td><td><p>Challenge</p></td></tr><tr><td><p>2</p></td><td><p>/img/thumbs/*</p></td><td><p>25</p></td><td><p>1 minute</p></td><td><p>Method: GET
Status Code: 200</p></td><td><p>Challenge</p></td></tr><tr><td><p>3</p></td><td><p>/img/*</p></td><td><p>75</p></td><td><p>1 minute</p></td><td><p>Method: GET
Status Code: 200</p></td><td><p>Block for 4 hours</p></td></tr><tr><td><p>4</p></td><td><p>/img/*</p></td><td><p>5</p></td><td><p>1 minute</p></td><td><p>Method: GET
Status Code: 403, 404</p></td><td><p>Challenge</p></td></tr></table><p>As we can see here, rules 1 and 2 are counting based on the number of requests to each endpoint. Rule 3 is counting based on all hits to the image store, and if it gets above 75 requests, the user will be blocked for 4 hours. Finally, to avoid any enumeration or bots guessing image names and numbers, we are counting on 404 and 403s and challenging if we see unusual spikes.</p>
    <div>
      <h3>One more thing ... more rules, <i>totally rules!</i></h3>
      <a href="#one-more-thing-more-rules-totally-rules">
        
      </a>
    </div>
    <p>We want to ensure you have the rules you need to secure your app. To do that, we are increasing the number of available rules for Pro and Business, for no additional charge.</p><ul><li><p>Pro plans increase from 3 to 10 rules</p></li><li><p>Business plans increase from 3 to 15 rules</p></li></ul><p>As always, Cloudflare only charges for good traffic - requests that are allowed through Rate Limiting, not blocked. For more information click <a href="https://support.cloudflare.com/hc/en-us/articles/115000272247-Billing-for-Cloudflare-Rate-Limiting">here</a>.</p><p>The Rate-Limiting feature can be enabled within the Firewall tab on the Dashboard, or by visiting: <a href="https://www.cloudflare.com/a/firewall/">cloudflare.com/a/firewall</a></p> ]]></content:encoded>
            <category><![CDATA[Rate Limiting]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Reliability]]></category>
            <category><![CDATA[Speed & Reliability]]></category>
            <category><![CDATA[Attacks]]></category>
            <category><![CDATA[DDoS]]></category>
            <category><![CDATA[Mitigation]]></category>
            <guid isPermaLink="false">l8ac1fSE0Q5tV7W36HzV1</guid>
            <dc:creator>Alex Cruz Farmer</dc:creator>
        </item>
        <item>
            <title><![CDATA[How we built rate limiting capable of scaling to millions of domains]]></title>
            <link>https://blog.cloudflare.com/counting-things-a-lot-of-different-things/</link>
            <pubDate>Wed, 07 Jun 2017 12:47:51 GMT</pubDate>
            <description><![CDATA[ Back in April we announced Rate Limiting of requests for every Cloudflare customer. Being able to rate limit at the edge of the network has many advantages: it’s easier for customers to set up and operate, their origin servers are not bothered by excessive traffic or layer 7 attacks. ]]></description>
            <content:encoded><![CDATA[ <p>Back in April we announced <a href="/rate-limiting/">Rate Limiting</a> of requests for every Cloudflare customer. Being able to rate limit at the edge of the network has many advantages: it’s easier for customers to set up and operate, their origin servers are not bothered by excessive traffic or layer 7 attacks, the performance and memory cost of rate limiting is offloaded to the edge, and more.</p><p>In a nutshell, <a href="https://www.cloudflare.com/learning/bots/what-is-rate-limiting/">rate limiting</a> works like this:</p><ul><li><p>Customers can define one or more rate limit rules that match particular HTTP requests (failed login attempts, expensive API calls, etc.)</p></li><li><p>Every request that matches the rule is counted per client IP address</p></li><li><p>Once that counter exceeds a threshold, further requests are not allowed to reach the origin server and an error page is returned to the client instead</p></li></ul><p>This is a simple yet effective protection against brute force attacks on login pages and other sorts of abusive traffic like <a href="https://www.cloudflare.com/learning/ddos/application-layer-ddos-attack/">L7 DoS attacks</a>.</p><p>Doing this with possibly millions of domains and even more millions of rules immediately becomes a bit more complicated. This article is a look at how we implemented a rate limiter able to run quickly and accurately at the edge of the network which is able to cope with the colossal volume of traffic we see at Cloudflare.</p>
    <div>
      <h3>Let’s just do this locally!</h3>
      <a href="#lets-just-do-this-locally">
        
      </a>
    </div>
    <p>As the Cloudflare edge servers are running NGINX, let’s first see how the stock <a href="https://nginx.org/en/docs/http/ngx_http_limit_req_module.html">rate limiting</a> module works:</p>
            <pre><code>http {
    limit_req_zone $binary_remote_addr zone=ratelimitzone:10m rate=15r/m;
    ...
    server {
        ...
        location /api/expensive_endpoint {
            limit_req zone=ratelimitzone;
        }
    }
}</code></pre>
            <p>This module works great: it is reasonably simple to use (but requires a config reload for each change), and very efficient. The only problem is that if the incoming requests are spread across a large number of servers, this doesn’t work any more. The obvious alternative is to use some kind of centralized data store. Thanks to NGINX’s Lua scripting module, that we already use extensively, we could easily implement similar logic using any kind of central data backend.</p><p>But then another problem arises: how to make this fast and efficient?</p>
    <div>
      <h3>All roads lead to Rome? Not with anycast!</h3>
      <a href="#all-roads-lead-to-rome-not-with-anycast">
        
      </a>
    </div>
    <p>Since Cloudflare has a vast and diverse network, reporting all counters to a single central point is not a realistic solution as the latency is far too high and guaranteeing the availability of the central service causes more challenges.</p><p>First let’s take a look at how the traffic is routed in the Cloudflare network. All the traffic going to our edge servers is <a href="https://en.wikipedia.org/wiki/Anycast">anycast</a> traffic. This means that we announce the same IP address for a given web application, site or API worldwide, and traffic will be automatically and consistently routed to the closest live data center.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3MXm1hRKiJKtqZuSG8Ie0j/9b1869712dd6b0538cf7e3615fe4136d/world.png" />
            
            </figure><p>This property is extremely valuable: we are sure that, under normal conditions<a href="#fn1">[1]</a>, the traffic from a single IP address will always reach the same PoP. Unfortunately each new TCP connection might hit a different server inside that PoP. But we can still narrow down our problem: we can actually create an isolated counting system inside each PoP. This mostly solves the latency problem and greatly improves the availability as well.</p>
    <div>
      <h3>Storing counters</h3>
      <a href="#storing-counters">
        
      </a>
    </div>
    <p>At Cloudflare, each server in our edge network is as independent as possible to make their administration simple. Unfortunately for rate limiting, we saw that we do need to share data across many different servers.</p><p>We actually had a similar problem in the past with <a href="https://en.wikipedia.org/wiki/Transport_Layer_Security#Session_IDs">SSL session IDs</a>: each server needed to fetch TLS connection data about past connections. To solve that problem we created a <a href="https://github.com/twitter/twemproxy">Twemproxy</a> cluster inside each of our PoPs: this allows us to split a memcache<a href="#fn2">[2]</a> database across many servers. A <a href="https://en.wikipedia.org/wiki/Consistent_hashing">consistent hashing</a> algorithm ensures that when the cluster is resized, only a few number of keys are hashed differently.</p><p>In our architecture, each server hosts a shard of the database. As we already had experience with this system, we wanted to leverage it for the rate limit as well.</p>
    <div>
      <h3>Algorithms</h3>
      <a href="#algorithms">
        
      </a>
    </div>
    <p>Now let’s take a deeper look at how the different rate limit algorithms work. What we call the <i>sampling period</i> in the next paragraph is the reference unit of time for the counter (1 second for a 10 req/sec rule, 1 minute for a 600 req/min rule, ...).</p><p>The most naive implementation is to simply increment a counter that we reset at the start of each sampling period. This works but is not terribly accurate as the counter will be arbitrarily reset at regular intervals, allowing regular traffic spikes to go through the rate limiter. This can be a problem for resource intensive endpoints.</p><p>Another solution is to store the timestamp of every request and count how many were received during the last sampling period. This is more accurate, but has huge processing and memory requirements as checking the state of the counter require reading and processing a lot of data, especially if you want to rate limit over long period of time (for instance 5,000 req per hour).</p><p>The <a href="https://en.wikipedia.org/wiki/Leaky_bucket">leaky bucket</a> algorithm allows a great level of accuracy while being nicer on resources (this is what the stock NGINX module is using). Conceptually, it works by incrementing a counter when each request comes in. That same counter is also decremented over time based on the allowed rate of requests until it reaches zero. The capacity of the bucket is what you are ready to accept as “burst” traffic (important given that legitimate traffic is not always perfectly regular). If the bucket is full despite its decay, further requests are mitigated.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/nur2wjEAyjE0S6VYblkr3/080ad1cbb09aa1bf6a294ffb4955e9e0/leakybucket.svg.png" />
            
            </figure><p>However, in our case, this approach has two drawbacks:</p><ul><li><p>It has two parameters (average rate and burst) that are not always easy to tune properly</p></li><li><p>We were constrained to use the memcached protocol and this algorithm requires multiple distinct operations that we cannot do atomically<a href="#fn3">[3]</a></p></li></ul><p>So the situation was that the only operations available were <code>GET</code>, <code>SET</code> and <code>INCR</code> (atomic increment).</p>
    <div>
      <h3>Sliding windows to the rescue</h3>
      <a href="#sliding-windows-to-the-rescue">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2gvU2RabELQEWsauNMm8cu/ac296e8bf4e122f18935500ef0bd1c2e/14247536929_1a6315311d_z.jpg" />
            
            </figure><p><a href="https://creativecommons.org/licenses/by-sa/2.0/">CC BY-SA 2.0</a> <a href="https://www.flickr.com/photos/halfrain/14247536929/">image</a> by <a href="https://www.flickr.com/photos/halfrain/">halfrain</a></p><p>The naive fixed window algorithm is actually not that bad: we just have to solve the problem of completely resetting the counter for each sampling period. But actually, can’t we just use the information from the previous counter in order to extrapolate an accurate approximation of the request rate?</p><p>Let’s say I set a limit of 50 requests per minute on an API endpoint. The counter can be thought of like this:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4SfLGYqNjjjxfJo0C9rU4H/e000ba22680e27910c8963a7111a97c8/sliding.svg.png" />
            
            </figure><p>In this situation, I did 18 requests during the current minute, which started 15 seconds ago, and 42 requests during the entire previous minute. Based on this information, the rate approximation is calculated like this:</p>
            <pre><code>rate = 42 * ((60-15)/60) + 18
     = 42 * 0.75 + 18
     = 49.5 requests</code></pre>
            <p>One more request during the next second and the rate limiter will start being very angry!</p><p>This algorithm assumes a constant rate of requests during the previous sampling period (which can be any time span), this is why the result is only an approximation of the actual rate. This algorithm can be improved, but in practice it proved to be good enough:</p><ul><li><p>It smoothes the traffic spike issue that the fixed window method has</p></li><li><p>It very easy to understand and configure: no average vs. burst traffic, longer sampling periods can be used to achieve the same effect</p></li><li><p>It is still very accurate, as an analysis on 400 million requests from 270,000 distinct sources shown:</p><ul><li><p>0.003% of requests have been wrongly allowed or rate limited</p></li><li><p>An average difference of 6% between real rate and the approximate rate</p></li><li><p>3 sources have been allowed despite generating traffic slightly above the threshold (false negatives), the actual rate was less than 15% above the threshold rate</p></li><li><p>None of the mitigated sources was below the threshold (false positives)</p></li></ul></li></ul><p>Moreover, it offers interesting properties in our case:</p><ul><li><p>Tiny memory usage: only two numbers per counter</p></li><li><p>Incrementing a counter can be done by sending a single <code>INCR</code> command</p></li><li><p>Calculating the rate is reasonably easy: one GET command<a href="#fn4">[4]</a> and some very simple, fast math</p></li></ul><p>So here we are: we can finally implement a good counting system using only a few memcache primitives and without much contention. Still we were not happy with that: it requires a memcached query to get the rate. At Cloudflare we’ve seen a few of the largest L7 attacks ever. We knew that large scale attacks would have crushed the memcached cluster like this. More importantly, such operations would slow down legitimate requests a little, even under normal conditions. This is not acceptable.</p><p>This is why the increment jobs are run asynchronously without slowing down the requests. If the request rate is above the threshold, another piece of data is stored asking all servers in the PoP to start applying the mitigation for that client. Only this bit of information is checked during request processing.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3pCPtEGvM5WPv1vUPzc0MH/ba54eae2f0aeaa2ae960c84bfe32be8c/el-sequence.svg.png" />
            
            </figure><p>Even more interesting: once a mitigation has started, we know exactly when it will end. This means that we can cache that information in the server memory itself. Once a server starts to mitigate a client, it will not even run another query for the subsequent requests it might see from that source!</p><p>This last tweak allowed us to efficiently mitigate large L7 attacks without noticeably penalizing legitimate requests.</p>
    <div>
      <h3>Conclusion</h3>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>Despite being a young product, the rate limiter is already being used by many customers to control the rate of requests that their origin servers receive. The rate limiter already handles several billion requests per day and we recently mitigated attacks with as many as 400,000 requests per second to a single domain without degrading service for legitimate users.</p><p>We just started to explore how we can efficiently protect our customers with this new tool. We are looking into more advanced optimizations and create new features on the top of the existing work.</p><p>Interested in working on high-performance code running on thousands of servers at the edge of the network? Consider <a href="https://www.cloudflare.com/careers/">applying</a> to one of our open positions!</p><hr /><hr /><ol><li><p>The inner workings of anycast route changes are outside of the scope of this article, but we can assume that they are rare enough in this case. <a href="#fnref1">↩︎</a></p></li><li><p>Twemproxy also supports Redis, but our existing infrastructure was backed by <a href="https://github.com/twitter/twemcache">Twemcache</a> (a Memcached fork) <a href="#fnref2">↩︎</a></p></li><li><p>Memcache does support <a href="https://github.com/memcached/memcached/wiki/Commands#cas">CAS</a> (Compare-And-Set) operations and so optimistic transactions are possible, but it is hard to use in our case: during attacks, we will have a lot of requests, creating a lot of contention, in turn resulting in a lot of CAS transactions failing. <a href="#fnref3">↩︎</a></p></li><li><p>The counters for the previous and current minute can be retrieved with a single GET command <a href="#fnref4">↩︎</a></p></li></ol> ]]></content:encoded>
            <category><![CDATA[Attacks]]></category>
            <category><![CDATA[Rate Limiting]]></category>
            <category><![CDATA[Optimization]]></category>
            <category><![CDATA[Network]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Reliability]]></category>
            <guid isPermaLink="false">3zVAZ4bZB7IdYAVjbqN8RP</guid>
            <dc:creator>Julien Desgats</dc:creator>
        </item>
        <item>
            <title><![CDATA[Cloudflare Rate Limiting - Insight, Control, and Mitigation against Layer 7 DDoS Attacks]]></title>
            <link>https://blog.cloudflare.com/rate-limiting/</link>
            <pubDate>Thu, 13 Apr 2017 20:34:00 GMT</pubDate>
            <description><![CDATA[ Today, Cloudflare is extending its Rate Limiting service by allowing any of our customers to sign up. Our Enterprise customers have enjoyed the benefits of Cloudflare’s Rate Limiting offering for the past several months.  ]]></description>
            <content:encoded><![CDATA[ <p>Today, Cloudflare is extending its <a href="https://www.cloudflare.com/rate-limiting/">Rate Limiting</a> service by allowing any of our customers to sign up. Our Enterprise customers have enjoyed the benefits of Cloudflare’s Rate Limiting offering for the past several months. As part of our mission to build a better internet, we believe that everyone should have the ability to sign up for the service to protect their websites and <a href="https://www.cloudflare.com/learning/security/api/what-is-an-api/">APIs</a>.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/XnkcibsLLCJF6rpgPqksN/083f6b9aca04a2f0129a862cea15c263/benjamin-child-16017.jpg" />
            
            </figure><p><a href="https://creativecommons.org/licenses/by/2.0/">CC-BY 2.0</a> <a href="https://unsplash.com/photos/IGqMKnl6LNE">image</a> by <a href="https://unsplash.com/@bchild311">Benjamin Child</a></p><p>Rate Limiting is one more feature in our arsenal of tools that help to protect our customers against denial-of-service attacks, brute-force password attempts, and other types of abusive behavior targeting the application layer. Application layer attacks are usually a barrage of HTTP/S requests which may look like they originate from real users, but are typically generated by machines (or bots). As a result, application layer attacks are often harder to detect and can more easily bring down a site, application, or API. Rate Limiting complements our existing DDoS protection services by providing control and insight into Layer 7 DDoS attacks.</p><p>Rate Limiting is now available to all customers across <a href="https://www.cloudflare.com/plans/">all plans</a> as an optional paid feature. The first 10,000 qualifying requests are free, which allows customers to start using the feature without any cost .</p>
    <div>
      <h4>Real world examples of how Rate Limiting helped Cloudflare customers</h4>
      <a href="#real-world-examples-of-how-rate-limiting-helped-cloudflare-customers">
        
      </a>
    </div>
    <p>Over the past few months, Cloudflare customers ranging from <a href="https://www.cloudflare.com/ecommerce/">e-commerce companies</a> to high-profile, ad-driven platforms have been using this service to mitigate malicious attacks. It made a big difference to their business: they’ve stopped revenue loss, reduced infrastructure costs, and protected valuable information, such as intellectual property and/or customer data.</p><p>Several common themes have emerged for customers who have been successfully using Rate Limiting during the past couple months. The following are examples of some of the issues those customers have faced and how Rate Limiting addressed them.</p>
    <div>
      <h4>High-volume attacks designed to bring down e-commerce sites</h4>
      <a href="#high-volume-attacks-designed-to-bring-down-e-commerce-sites">
        
      </a>
    </div>
    <p>Buycraft, <a href="https://www.cloudflare.com/case-studies/buycraft/">a Minecraft e-commerce platform</a>, was subjected to denial-of-service attacks which could have brought down the e-commerce stores of its 500,000+ customers. Rate Limiting addresses this common attack type by blocking offending IP addresses at its network edge, so the malicious traffic doesn’t reach the origin servers and impact customers.</p>
    <div>
      <h4>Attacks against API endpoints</h4>
      <a href="#attacks-against-api-endpoints">
        
      </a>
    </div>
    <p>Haveibeenpwned.com <a href="https://www.cloudflare.com/case-studies/troy-hunt/">provides an API</a> that surfaces accounts that have been hacked to help potential victims identify whether their credentials have been compromised. Troy Hunt (the service’s creator), decided to use Cloudflare’s Rate Limiting to protect his API from malicious traffic, leading to <a href="https://www.cloudflare.com/solutions/ecommerce/optimization/">improved performance</a> and reduced infrastructure costs.</p>
    <div>
      <h4>Brute-force login attacks</h4>
      <a href="#brute-force-login-attacks">
        
      </a>
    </div>
    <p>After IT consulting firm 2600 Solutions, which manages Wordpress sites for clients, was brute-forced over 200 times in a month, owner Jeff Williams decided to use Cloudflare Rate Limiting. By blocking excessive failed login attempts, they were able to not only protect their clients’ sites from being compromised, they also ensured legitimate users were not impacted by slower application performance.</p>
    <div>
      <h4>Bots scraping the site for content</h4>
      <a href="#bots-scraping-the-site-for-content">
        
      </a>
    </div>
    <p>Another Cloudflare customer saw valuable content being scraped from their site by competitors using bots. Competitors then used this scraped content to boost their own search engine ranking at the expense of the targeted site. Our customer lost tens of thousands of dollars before using Cloudflare’s Rate Limiting to <a href="https://www.cloudflare.com/learning/ai/how-to-prevent-web-scraping/">prevent the bots from scraping content</a>.</p>
    <div>
      <h4>How do I get started with Rate Limiting?</h4>
      <a href="#how-do-i-get-started-with-rate-limiting">
        
      </a>
    </div>
    <p>Anyone can start utilizing the benefits of Cloudflare’s Rate Limiting. With the Cloudflare Dashboard, go to the Firewall tab, and within the Rate Limiting card, click on “Enable Rate Limiting.”</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6QLMfHzGF2J1ju4dLTmP6C/a6826edb544bb1a66b6a0cde5bd0a2d4/Screen-Shot-2017-04-13-at-1.17.47-PM.png" />
            
            </figure><p>Even though you will be prompted to enter a payment method to start using the service, you will not be charged for <a href="https://support.cloudflare.com/hc/en-us/articles/115000272247-Billing-for-Cloudflare-Rate-Limiting">the first 10,000 qualifying requests</a>. Once done, <a href="https://support.cloudflare.com/hc/en-us/articles/115001635128-Configuring-Rate-Limiting-from-UI">you’ll be able to create rules</a>.</p><p>If you are on an Enterprise plan, contact your Cloudflare Customer Success Manager to enable Rate Limiting.</p>
    <div>
      <h4>Tighter control over the type of traffic to rate limit</h4>
      <a href="#tighter-control-over-the-type-of-traffic-to-rate-limit">
        
      </a>
    </div>
    <p>As customers begin to understand attack patterns and their own application’s potential vulnerabilities, they can tighten criteria. All customers can create path-specific rules, using wildcards (for example: <a href="http://www.example.com/login/\">www.example.com/login/\</a>* or <a href="http://www.example.com/\*/checkout.php">www.example.com/\*/checkout.php</a>). Customers on a Business or higher plan can specify to rate limit only certain HTTP request methods.</p>
    <div>
      <h4>Simulate traffic to tune your rules</h4>
      <a href="#simulate-traffic-to-tune-your-rules">
        
      </a>
    </div>
    <p>Customers on the Pro and higher plans will be able to ‘simulate’ rules. A rule in simulate mode will not actually block malicious traffic, but will allow you to understand what traffic will be blocked if you were to setup a ‘live’ rule. All Customers will have analytics (coming soon) to let them gain insights into the traffic patterns to their site, and the efficacy of their rules.</p>
    <div>
      <h4>Next Steps</h4>
      <a href="#next-steps">
        
      </a>
    </div>
    <ul><li><p>If you haven’t enabled Rate Limiting yet, go to the <a href="https://www.cloudflare.com/a/firewall/">Firewall App</a> and enable Rate Limiting</p></li><li><p><a href="https://support.cloudflare.com/hc/en-us/articles/115001635128-Configuring-Rate-Limiting-from-UI">Create your first rule</a></p></li><li><p>For more information, including a demo of Rate Limiting in action, visit <a href="http://www.cloudflare.com/rate-limiting/">www.cloudflare.com/rate-limiting/</a>.</p></li></ul><p></p> ]]></content:encoded>
            <category><![CDATA[Rate Limiting]]></category>
            <category><![CDATA[Reliability]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[DDoS]]></category>
            <category><![CDATA[Attacks]]></category>
            <category><![CDATA[Mitigation]]></category>
            <category><![CDATA[Security]]></category>
            <guid isPermaLink="false">3jJX6AKmlz33ZH8YTcMMpa</guid>
            <dc:creator>Timothy Fong</dc:creator>
        </item>
        <item>
            <title><![CDATA[Rate Limiting: Live Demo]]></title>
            <link>https://blog.cloudflare.com/traffic-control-live-demo/</link>
            <pubDate>Fri, 30 Sep 2016 19:56:00 GMT</pubDate>
            <description><![CDATA[ Cloudflare helps customers control their own traffic at the edge. One of two products that we introduced to empower customers to do so is Cloudflare Rate Limiting. ]]></description>
            <content:encoded><![CDATA[ <p>Cloudflare helps customers control their own traffic at the edge. One of two <a href="/cloudflare-traffic/">products that we introduced</a> to empower customers to do so is <a href="https://www.cloudflare.com/traffic-control/">Cloudflare Rate Limiting</a>*.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4NtFQrwczwJFS6c5ko0bUk/08f0544ed11c6d802aa08ad234d79a71/speed-limit-10.jpg" />
            
            </figure><p><a href="https://creativecommons.org/licenses/by/2.0/">CC BY 2.0</a> <a href="https://www.flickr.com/photos/brhefele/6553028503/">image</a> by <a href="https://www.flickr.com/photos/brhefele/">Brian Hefele</a></p><p>Rate Limiting allows a customer to rate limit, shape or block traffic based on the rate of requests per client IP address, cookie, authentication token, or other attributes of the request. Traffic can be controlled on a per-URI (with wildcards for greater flexibility) basis giving pinpoint control over a website, application, or API.</p><p>Cloudflare has been <a href="https://en.wikipedia.org/wiki/Eating_your_own_dog_food">dogfooding</a> Rate Limiting to add more granular controls against Layer 7 DOS and brute-force attacks. For example, we've experienced attacks on cloudflare.com from more than 4,000 IP addresses sending 600,000+ requests in 5 minutes to the same URL but with random parameters. These types of attacks send large volumes of HTTP requests intended to bring down our site or to crack login passwords.</p><p>Rate Limiting protects websites and APIs from similar types of bad traffic. By leveraging our massive network, we are able to process and enforce rate limiting near the client, shielding the customer's application from unnecessary load.</p><p>To make this more concrete, let's look at a live demonstration rule for cloudflare.com. Multiple rules may be used and combined to great effect -- this is just a limited example.</p><p>Read on, and then test it yourself.</p>
    <div>
      <h3>Creating the rule</h3>
      <a href="#creating-the-rule">
        
      </a>
    </div>
    <p>Imagine an endpoint that is resource intensive. To maintain availability, we want to protect it from high-volume request rates - like those from an aggressive bot or attacker.</p><p><b>URL</b> <code>*.cloudflare.com/rate-limit-test</code></p><p>Rate Limiting allows for * wildcards to give more flexibility. An API with multiple endpoints might use a pattern of <code>api.example.com/v2/*</code></p><p>With that pattern, all resources under <code>/v2</code> would be protected by the same rule.</p><p><b>Threshold</b>We set this demonstration rule to 10 requests per minute, which is too sensitive for a real web application, but allows a curious user refreshing their browser ten times to see Rate Limiting in action.</p><p><b>Action</b>We set this value to <code>block</code> which means that once an IP addresses triggers a rule, all traffic from that IP address will be blocked at the edge and served with a default 429 HTTP error code.</p><p>Other possible choices include <code>simulate</code> which means no action taken, but analytics would indicate which requests would have been mitigated to help customers evaluate the potential impact of a given rule.</p><p><b>Timeout</b></p><p>This is the duration of the mitigation once the rule has been triggered. In this example, an offending IP address will be blocked for 1 minute.</p><p><b>Response body type</b></p><p>This type was set to <code>HTML</code> in the demo so that Rate Limiting returns a web page to mitigated requests. For an API endpoint, the response body type could return JSON.</p><p><b>Response body</b></p><p>The response body can be anything you want. Refresh the link below 10 times very quickly to see our choice for this demonstration rule.</p><p><a href="https://www.cloudflare.com/rate-limit-test"><b>https://www.cloudflare.com/rate-limit-test</b></a></p>
    <div>
      <h3>Other possible configurations</h3>
      <a href="#other-possible-configurations">
        
      </a>
    </div>
    <p>We could have specified a <b>Method</b>. If we only cared to rate limit POST requests, we could adjust the rule to do so. This rule could be used for a login page where high frequency of POSTs by the same IP is potentially suspicious.</p><p>We also could have specified a <b>Response Code</b>. If we only wanted to rate limit IPs which were consistently failing to authenticate, we could create the rule to trigger only after a certain threshold of 403’s have been served. Once an IP is flagged, perhaps because it was pounding a login endpoint with incorrect credentials, that client IP could be blocked from hitting either that endpoint or the whole site.</p><p>We will expand the matching criteria, such as adding headers or cookies. We will also extend the mitigation options to include CAPTCHA or other challenges. This will give our users even more flexibility and power to protect their websites and API endpoints.</p>
    <div>
      <h3>Early Access</h3>
      <a href="#early-access">
        
      </a>
    </div>
    <p>We'd love to have you try Rate Limiting. Read more and <a href="https://www.cloudflare.com/traffic-control">sign up for Early Access</a>.</p><p>**Note: This post was updated 4/13/17 to reflect the current product name. All references to Traffic Control have been changed to Rate Limiting.*</p> ]]></content:encoded>
            <category><![CDATA[Traffic]]></category>
            <category><![CDATA[Rate Limiting]]></category>
            <category><![CDATA[Reliability]]></category>
            <category><![CDATA[DDoS]]></category>
            <category><![CDATA[Mitigation]]></category>
            <category><![CDATA[Security]]></category>
            <guid isPermaLink="false">5jRNF30iNz47tFcZ7hvNoY</guid>
            <dc:creator>Timothy Fong</dc:creator>
        </item>
        <item>
            <title><![CDATA[Control your traffic at the edge with Cloudflare]]></title>
            <link>https://blog.cloudflare.com/cloudflare-traffic/</link>
            <pubDate>Thu, 29 Sep 2016 14:04:00 GMT</pubDate>
            <description><![CDATA[ Today, we're introducing two new Cloudflare Traffic products to give customers control over how Cloudflare’s edge network handles their traffic, allowing them to shape and direct it for their specific needs. ]]></description>
            <content:encoded><![CDATA[ <p>Today, we're introducing two new Cloudflare Traffic products to give customers control over how Cloudflare’s edge network handles their traffic, allowing them to shape and direct it for their specific needs.</p><p>More than 10 trillion requests flow through Cloudflare every month. More than 4 million customers and 10% of internet requests benefit from our global network. Cloudflare's virtual backbone gives every packet <a href="https://www.cloudflare.com/solutions/ecommerce/optimization/">improved performance</a>, security, and reliability.</p><p>That's the macro picture.</p><p>What's more interesting is keeping each individual customer globally available. While every customer benefits from the network effect of Cloudflare, each customer is (appropriately) focused on <i>their</i> application uptime, security and performance.</p>
    <div>
      <h3>Rate Limiting*</h3>
      <a href="#rate-limiting">
        
      </a>
    </div>
    <p>Cloudflare’s new <a href="https://www.cloudflare.com/traffic-control/">Rate Limiting</a> allows a customer to rate limit, shape or block traffic based on the number of requests per second per IP, cookie, or authentication token. Traffic can be controlled on a per-URI (with wildcards for greater flexibility) basis giving pinpoint control over a website, application, or API.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/z0czXftPrSgtKMQSA6caM/e5886353b3ae53ea88fa6ee63b041acf/traffic-control-graph.png" />
            
            </figure><p>Customers seek reliability and availability in the face of popularity or unexpected traffic such as slow brute force attacks on a <a href="https://www.cloudflare.com/learning/security/how-to-improve-wordpress-security/">WordPress site</a>, Denial of Service against dynamic pages, or the stampede of requests that comes with success. We are the leader at stopping significant <a href="https://www.cloudflare.com/ddos/">DDoS attacks</a> and offer a comprehensive <a href="https://www.cloudflare.com/waf/">WAF</a> to target specific application-level attacks.</p><p>Now we are adding the capability to give each customer fine-grained control over the traffic that reaches their origin servers.</p><p>Even well-engineered applications have a resource limit. Any dynamic endpoint either has a hard system limit or an economic limit on the number of servers you can afford. Those expensive endpoints need additional protection against floods of traffic, including legitimate visitors. You can provision for the worst case...but when you find a new Pokémon Go on your hands, the best case hurts, too.</p><p>To shield origins from attack and preserve uptime, Cloudflare Rate Limiting lets you throttle, block, and otherwise control the flow of traffic to maintain availability, limit economic impact and preserve performance. All of which can be done with thoughtful configuration, testing rules to measure their impact, and applying changes globally within seconds.</p><p>That solves several problems. Rate Limiting protects APIs as well as web pages. Different version of your APIs can not only have different rate limit triggers, but they can return custom JSON responses or response codes if, for instance, you want to obfuscate the standard 429 HTTP error code.</p><p>Static pages are easy to cache at Cloudflare's edge, so high traffic on a home page is welcome. But a competitor scraping your search results is different, and may cause economic pain in server resources in addition to disrupting business as usual. So Rate Limiting lets you define specific URLs with lower limits and different policies.</p><p>Similarly, rules designed to protect a login endpoint enables real users to still access your application while defending yourself from brute-force attacks designed to break into your system or simply exhaust your resources. Rate Limiting gives customers this power, in part, by distinguishing between POSTs versus GETs and identifying authentication failures through the server response code.</p><p>From rate limiting within your applications to replacing hardware capabilities at the top of your rack, Rate Limiting solves a problem that otherwise requires several tools and custom development to solve. In the future, Rate Limiting will become even more intelligent, automatically enabling caching on your marketing site on a product launch, queueing customers on Black Friday to ensure your <a href="https://www.cloudflare.com/ecommerce/">e-commerce system</a> handles the demand, and helping to maximize the return on your IT investments by protecting them from damaging spikes and traffic patterns.</p>
    <div>
      <h3>Traffic Manager</h3>
      <a href="#traffic-manager">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1BMtHV6Vr8mhIuoeGSvGFC/5323ce9a39fbd9586a5b8772ee75717e/traffic-manager-failover.png" />
            
            </figure><p>For many customers, gone are the days of running a single server for their web application. Two scenarios are common: a single datacenter or cloud provider running multiple load-balanced servers, and replication of that infrastructure across multiple geographies.</p><p>Customers have moved to load balanced infrastructure to provide reliability, handle traffic spikes, and handle traffic locally in different regions of the world.</p><p>The beauty of the single server approach was that it was simple to manage: all traffic from everywhere on the Internet hit the same server. Unfortunately, that doesn’t scale to today’s Internet and so controls are needed to handle load balancing across servers and locations.</p><p>Cloudflare’s new <a href="https://www.cloudflare.com/traffic-manager/">Traffic Manager</a> enables a customer to keep their application running during a failure or better handle unexpected spikes in traffic by load balancing across multiple servers, datacenters, and geographies.</p><p>Traffic Manager has four major features: health checks, load balancing, failover and geo-steering.</p><p>Health checks automatically test the availability of individual origin servers so that Traffic Manager has a real-time view of the health of your origin servers. This information is used for failover and load balancing.</p><p>Load balancing automatically shares traffic across a collection of origin servers; if an origin server fails a health check it is automatically removed and load is shared across the remaining servers. For more complex environments an entire collection of origin servers can be removed from receiving traffic if the number of failed servers in the collection falls below some safe threshold.</p><p>Geo-steering allows a customer to configure traffic delivery to specific origin server groups based on the physical location of the visitor.</p><p>Health checks, load balancing, failover, and geo-steering work together to give customers fine grained control over their traffic.</p><p>Cloudflare Traffic Manager checks the health of applications from <a href="/amsterdam-to-zhuzhou-cloudflare-global-network/">100+ locations</a> around the world, taking automatic action to route around failure, based on policies crafted by each customer.</p><p>Fiber cut in Malaysia? Host not responding for customers in Minneapolis? Checking from every location on a network with <a href="http://bgp.he.net/report/exchanges#_participants">more public internet exchanges than any other company</a> means you get localized, specific decision making. When a problem crops up on the network path to one of our customers' servers, we'll route that traffic instantly to another healthy, available server -- without changing the policy for other, healthy routes.</p><p>Sometimes, it's not the network. With Traffic Manager, you may load balance across individual hosts and across multiple hosts. Application down on AWS? Send those visitors to your Rackspace-hosted application in seconds. Failover from a cloud provider to your own datacenter, and back again as soon as your primary location is healthy again.</p><p>Other times, customers run different instances to account for the speed of light, and be as close as possible to their customers -- much as Cloudflare does. With Traffic Manager, you can route visitors to your site to the nearest host, based on their region. Choose to send visitors in Munich to your datacenter in Amsterdam, and visitors from Kansas City to your St. Louis datacenter. These policies can be combined, so if your European datacenter is down, then and only then send that traffic to your United States datacenter.</p><p>Many of our customers put significant investment into the availability of their infrastructure. Traffic Manager extends that investment across Cloudflare's ever-growing global network.</p>
    <div>
      <h3>Early Access</h3>
      <a href="#early-access">
        
      </a>
    </div>
    <p>CloudFlare Traffic is now available in Early Access for all customers, and will be available publicly before the end of the year. Read more about <a href="https://www.cloudflare.com/traffic-manager">Traffic Manager</a> and <a href="https://www.cloudflare.com/traffic-control">Rate Limiting</a> and request access in your Cloudflare dashboard, in the Traffic app.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/pNVbDcRjNrafnHVaZNfbm/53fb6fba32137af1fd2aa1e6d65132b5/traffic-app-in-cloudflare-dashboard-1.png" />
            
            </figure><p>**Note: This post was updated 4/13/17 to reflect the current product name. All references to Traffic Control have been changed to Rate Limiting.*</p> ]]></content:encoded>
            <category><![CDATA[Traffic]]></category>
            <category><![CDATA[Load Balancing]]></category>
            <category><![CDATA[Rate Limiting]]></category>
            <category><![CDATA[API]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Reliability]]></category>
            <guid isPermaLink="false">7tyAnRN4dGdrJNn2xiHPKs</guid>
            <dc:creator>John Roberts</dc:creator>
        </item>
    </channel>
</rss>