
<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>Thu, 09 Apr 2026 17:56:36 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Control content use for AI training with Cloudflare’s managed robots.txt and blocking for monetized content]]></title>
            <link>https://blog.cloudflare.com/control-content-use-for-ai-training/</link>
            <pubDate>Tue, 01 Jul 2025 10:00:00 GMT</pubDate>
            <description><![CDATA[ Cloudflare is making it easier for publishers and content creators of all sizes to prevent their content from being scraped for AI training by managing robots.txt on their behalf.  ]]></description>
            <content:encoded><![CDATA[ <p>Cloudflare is giving all website owners two new tools to easily control whether AI bots are allowed to access their content for model training. First, customers can let Cloudflare <b>create and manage a robots.txt file</b>, creating the appropriate entries to let crawlers know not to access their site for AI training. Second, all customers can choose a new option to <a href="https://www.cloudflare.com/learning/ai/how-to-block-ai-crawlers/">block AI bots</a> <b>only on portions of their site that are monetized through ads</b>.</p>
    <div>
      <h2>The new generation of AI crawlers</h2>
      <a href="#the-new-generation-of-ai-crawlers">
        
      </a>
    </div>
    <p>Creators that monetize their content by showing ads depend on traffic volume. Their livelihood is directly linked to the number of views their content receives. These creators have allowed crawlers on their sites for decades, for a simple reason: search crawlers such as <code>Googlebot</code> made their sites more discoverable, and drove more traffic to their content. Google benefitted from delivering better search results to their customers, and the site owners also benefitted through increased views, and therefore increased revenues.</p><p>But recently, a new generation of crawlers has appeared: bots that crawl sites to gather data for training AI models. While these crawlers operate in the same technical way as search crawlers, the relationship is no longer symbiotic. AI training crawlers use the data they ingest from content sites to answer questions for their own customers directly, within their own apps. They typically send much less traffic back to the site they crawled. Our <a href="https://radar.cloudflare.com/"><u>Radar</u></a> team did an analysis of crawls and referrals for sites behind Cloudflare. As HTML pages are arguably the most valuable content for these crawlers, we <a href="https://blog.cloudflare.com/ai-search-crawl-refer-ratio-on-radar/"><u>calculated crawl ratios</u></a> by dividing the total number of requests from relevant user agents associated with a given search or AI platform where the response was of <code>Content-type: text/html</code> by the total number of requests for HTML content where the <code>Referer</code>: header contained a hostname associated with a given search or AI platform. As of June 2025, we find that Google crawls websites about 14 times for every referral. But for AI companies, the <a href="https://radar.cloudflare.com/ai-insights#crawl-to-refer-ratio"><u>crawl-to-refer ratio</u></a> is orders of magnitude greater. In June 2025, <b>OpenAI’s crawl-to-referral ratio was 1,700:1, Anthropic’s 73,000:1</b>. This clearly breaks the “crawl in exchange for traffic” relationship that previously existed between search crawlers and publishers. (Please note that this calculation reflects our best estimate, recognizing that traffic referred by native apps may not always be attributed to a provider due to a lack of a <code>Referer</code>: header, which may affect the ratio.)</p><p>And while sites can use robots.txt to tell these bots not to crawl their site, most don’t take this first step. We found that only about <a href="https://radar.cloudflare.com/ai-insights#ai-user-agents-found-in-robotstxt"><b><u>37% of the top 10,000 domains currently have a robots.txt file</u></b></a>, showing that robots.txt is underutilized in this age of evolving crawlers.</p><p>That’s where Cloudflare comes in. Our mission is to help build a better Internet, and a better Internet is one with a huge thriving ecosystem of independent publishers. So, we’re taking action to keep that ecosystem alive.</p>
    <div>
      <h2>Giving ALL customers full control</h2>
      <a href="#giving-all-customers-full-control">
        
      </a>
    </div>
    <p>Protecting content creators isn’t new for Cloudflare. In July 2024, we gave everyone on the Cloudflare network a simple way to <a href="https://blog.cloudflare.com/declaring-your-aindependence-block-ai-bots-scrapers-and-crawlers-with-a-single-click/"><u>block all AI scrapers with a single click</u></a> for free. We’ve already seen <b>more than 1 million customers enable this feature</b>, which has given us some interesting data.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2B8KAmaP6DrMEMW5YSjLYP/d9eb0f67a998b730373a27aa707ade9d/image5.png" />
          </figure><p>Since our last update, we can see that <code><b>Bytespider</b></code><b>, our previous top bot, has seen traffic volume decline 71.45% since the first week of July 2024</b>. During the same time, we saw an increased number of <code>Bytespider</code> requests that customers chose to specifically block. In contrast, <code>GPTBot</code> traffic volume has grown significantly as it has become more popular, now even surpassing traffic we see from big traditional tech players like Amazon and ByteDance.</p><p>The share of sites accessed by particular crawlers has gone down across the board since our last update. Previously, <code>Bytespider</code> accessed &gt;40% of websites protected by Cloudflare, but that number has dropped to only 9.37%. <code><b>GPTBot</b></code><b> has taken the top spot for most sites accessed</b>, but while its request volume has grown significantly (noted above), the share of sites it crawls has actually decreased since last year from 35.46% to 28.97%, with an increase in customers blocking.</p><table><tr><td><p>AI Bot</p></td><td><p>Share of Websites Accessed</p></td></tr><tr><td><p>GPTBot</p></td><td><p>28.97%</p></td></tr><tr><td><p>Meta-ExternalAgent</p></td><td><p>22.16%</p></td></tr><tr><td><p>ClaudeBot</p></td><td><p>18.80%</p></td></tr><tr><td><p>Amazonbot</p></td><td><p>14.56%</p></td></tr><tr><td><p>Bytespider</p></td><td><p>9.37%</p></td></tr><tr><td><p>GoogleOther</p></td><td><p>9.31%</p></td></tr><tr><td><p>ImageSiftBot</p></td><td><p>4.45%</p></td></tr><tr><td><p>Applebot</p></td><td><p>3.77%</p></td></tr><tr><td><p>OAI-SearchBot</p></td><td><p>1.66%</p></td></tr><tr><td><p>ChatGPT-User</p></td><td><p>1.06%</p></td></tr></table><p>And while AI Search and AI Assistant crawling related activity has exploded in popularity in the last 6 months, we still see their total traffic pale in comparison to AI training crawl activity, which has seen a <b>65% increase in traffic over the past 6 months</b>.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7nOWMQs8IzgS3RfrXHaVT1/b1b31024a92b70a3f39083b376bb3934/image4.png" />
          </figure><p>To this end, we launched <a href="https://blog.cloudflare.com/cloudflare-ai-audit-control-ai-content-crawlers/"><u>free granular auditing</u></a> in September 2024 to help customers understand which crawlers were accessing their content most often, and created simple templates to block all or specific crawlers. And in December 2024, we made it easy for publishers to automatically block <a href="https://blog.cloudflare.com/ai-audit-enforcing-robots-txt/"><u>crawlers that weren’t respecting robots.txt</u></a>. But we realized many sites didn’t have the time to create or manage their own robots.txt file. Today, we’re going two steps further.</p>
    <div>
      <h2>Step 1: fully managed robots.txt</h2>
      <a href="#step-1-fully-managed-robots-txt">
        
      </a>
    </div>
    <p>When it comes to managing your website’s visibility to search engine crawlers and other bots, the <code>robots.txt</code> file is a key player. This simple text file acts like a traffic controller, signaling to bots which parts of the website they should or should not access. We can think of <a href="https://www.cloudflare.com/learning/bots/what-is-robots-txt/"><u>robots.txt</u></a> as a "Code of Conduct" sign posted at a community pool, listing general dos and don'ts, according to the pool owner’s wishes. While the sign itself does not enforce the listed directives, well-behaved visitors will still read the sign and follow the instructions they see. On the other hand, poorly-behaved visitors who break the rules risk <a href="https://blog.cloudflare.com/ai-audit-enforcing-robots-txt/"><u>getting themselves banned</u></a>. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6oGxSRxy3sU88o4TZP7p42/aea1d7bbf5e57eb133ce8cdfae88dc37/image2.png" />
          </figure><p>What do these files actually look like? Take Google’s as an example, visible to anyone at <a href="https://www.google.com/robots.txt"><u>https://www.google.com/robots.txt</u></a>. Parsing its contents, you'll notice four directives in the set of instructions: <b>User-agent</b>, <b>Disallow</b>, <b>Allow</b>, and <b>Sitemap</b>. In a <code>robots.txt</code> file, the <b>User-agent</b> directive specifies which bots the rules apply to. The <b>Disallow</b> directive tells those bots which parts of the website they should avoid. In contrast, the <b>Allow</b> directive grants specific bots permission to access certain areas. Finally, the<a href="https://www.sitemaps.org/index.html"> <b>Sitemap</b> directive</a> shows a bot which pages it can reach, so that it won’t miss any important pages. The <a href="https://www.ietf.org/"><u>Internet Engineering Task Force (IETF)</u></a> formalized the definition and language for the Robots Exclusion Protocol in <a href="https://datatracker.ietf.org/doc/html/rfc9309"><u>RFC 9309</u></a>, specifying the exact syntax and precedence of these directives. It also outlines how crawlers should handle errors or redirects while stressing that compliance is <i>voluntary</i> and does not constitute access control. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/79JML5EIN1f4NVzRankehO/20a2c99ccaca62e7718c9d66bb8585d5/image10.png" />
          </figure><p>Website owners should have agency over AI bot activity on their websites. We mentioned that only 37% of the top 10,000 domains on Cloudflare even have a robots.txt file. Of those robots files that do exist, few include Disallow directives for the <a href="https://radar.cloudflare.com/ai-insights#ai-bot-crawler-traffic"><i><u>top</u></i><u> AI Bots</u></a> that we see on a daily basis.  For instance, as of publication, <a href="https://radar.cloudflare.com/explorer?dataSet=robots_txt&amp;groupBy=user_agents%2Fdirective&amp;filters=directive%253DDISALLOW"><code><u>GPTBot</u></code><u> is only disallowed in 7.8% of the robots.txt files</u></a> found for the top domains; <code>Google-Extended</code> only shows up in 5.6%; <code>anthropic-ai</code>, <code>PerplexityBot</code>, <code>ClaudeBot</code>, and <code>Bytespider</code> each show up in under 5%. Furthermore, the difference between the 7.8% of Disallow directives for <code>GPTBot</code> and the ~5% of Disallow directives for other major AI crawlers suggests a gap between the desire to <a href="https://www.cloudflare.com/learning/ai/how-to-prevent-web-scraping/">prevent your content from being used for AI model training</a> and the proper configuration that accomplishes this by calling out bots like <code>Google-Extended</code>. (After all, there’s more to stopping AI crawlers than disallowing <code>GPTBot</code>.)</p><p>Along with viewing the most active bots and crawlers, Cloudflare Radar also shares weekly updates on how websites are handling <a href="https://radar.cloudflare.com/ai-insights?cf_target_id=3D982CE3E88C4E32F9D4AA79E7869F7C#ai-user-agents-found-in-robotstxt"><u>AI bots in their robots.txt files</u></a>. We can examine two snapshots below, one from <a href="https://radar.cloudflare.com/ai-insights?dateStart=2025-06-23&amp;dateEnd=2025-06-24"><u>June 2025</u></a> and the other from <a href="https://radar.cloudflare.com/ai-insights?dateStart=2025-01-26&amp;dateEnd=2025-02-01"><u>January 2025</u></a>:</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/30Wc2jLvDqSMBKF5QxU2yc/f18b44d8ba9d11687c0224b40cf12675/image6.png" />
          </figure><p><sub><i>Radar snapshot from the week of June 23, 2025, showing the top AI user agents mentioned in the Disallow directive in robots.txt files across the top 10,000 domains. The 3 bots with the highest number of Disallows are GPTBot, CCBot, and facebookexternalhit.</i></sub></p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/T9krKSMLRud7sYgG7ahei/8632afeba6d22baa304ae9fd901e187a/image9.png" />
          </figure><p><sub><i>Radar snapshot from the week of January 26, 2025, showing the top AI user agents mentioned in the Disallow directive in robots.txt files across the top 10,000 domains. The 3 bots with the highest number of Disallows are GPTBot, CCBot, and anthropic-ai.</i></sub></p><p>From the above data, we also observe that fewer than 100 new robots.txt files have been added among the top domains between January and June. One visually striking change is the ratio of dark blue to light blue: compared to January, there is a steep decrease in “Partially Disallowed” permissions; websites are now flat-out choosing “Fully Disallowed” for the top AI crawlers, including <code>GPTBot</code>, <code>CCBot</code>, and <code>Google-Extended</code>. This underscores the changing landscape of web crawling, particularly the relationship of trust between website owners and AI crawlers.</p>
    <div>
      <h3>Putting up a guardrail with Cloudflare’s managed robots.txt</h3>
      <a href="#putting-up-a-guardrail-with-cloudflares-managed-robots-txt">
        
      </a>
    </div>
    <p>Many website owners have told us they’re in a tricky spot in this new era of AI crawlers. They’ve poured time and effort into creating original content, have published it on their own sites, and naturally want it to reach as many people as possible. To do that, website owners make their sites accessible to search engine crawlers, which index the content and make it discoverable in search results. But with the rise of AI-powered crawlers, that same content is now being scraped not just for indexing, but also to train AI models, often without the creator’s explicit consent. Take <code>Googlebot</code>, for example: it’s an absolute requirement for most website owners to allow for SEO. But Google crawls with user agent <code>Googlebot</code> for both SEO <i>and</i> AI training purposes. Specifically disallowing <a href="https://developers.google.com/search/docs/crawling-indexing/google-common-crawlers#google-extended"><code><u>Google-Extended</u></code></a> (but not <code>Googlebot</code>) in your robots.txt file is what communicates to Google that you do not want your content to be crawled to feed AI training.</p><p>So, what if you don’t want your content to serve as training data for the next AI model, but don’t have the time to manually maintain an up-to-date robots.txt file? <b>Enter Cloudflare’s new managed robots.txt offering.</b> Once enabled, Cloudflare will automatically update your existing robots.txt or create a robots.txt file on your site that includes directives asking popular AI bot operators to not use your content for AI model training. For instance, <b>Cloudflare’s managed robots.txt signals your preference to </b><code><b>Google-Extended</b></code><b> and </b><a href="https://support.apple.com/en-us/119829"><code><b><u>Applebot-Extended</u></b></code></a><b>, amongst others, that they should not crawl your site for AI training,</b> while keeping your domain(s) SEO-friendly.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2SLxL9LMN1IK2WXOIq8ezP/786db3e1cbc24b1cce4c337b8136d3a7/image3.png" />
          </figure><p><sup><i>Cloudflare dashboard snapshot of the new managed robots.txt activation toggle </i></sup></p><p>This feature is available to all customers, meaning anyone can <a href="https://developers.cloudflare.com/bots/additional-configurations/managed-robots-txt/"><u>enable this today</u></a> from the Cloudflare dashboard. Once enabled, website owners who previously had no robots.txt file will now have Cloudflare’s managed bot directives live on their website. What about website owners who already have a robots.txt file? The contents of Cloudflare’s managed robots.txt will be <i>prepended</i> to site owners’ existing file. This way, their existing Block directives – and the time and rationale put into customizing this file – are honored, while still ensuring the website has AI crawler guardrails managed by Cloudflare.</p><p>As the AI bot landscape changes with new bots on the rise, Cloudflare will keep our customers a step ahead by updating the directives on our managed robots.txt, so they don’t have to worry about maintaining things on their own. Once enabled, customers won’t need to take any action in order for any updates of the managed robots.txt content to go live on their site. </p><p>We believe that managing crawling is key to protecting the open Internet, so we’ll also be encouraging every new site that onboards to Cloudflare to enable our managed robots.txt. When you onboard a new site, you’ll see the following options for managing AI crawlers:</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6l4RpmHHf0OGP44XyDnZra/66c30bb8080d3107ab93af55dc6a8c6e/Screenshot_2025-06-30_at_3.59.54%C3%A2__PM.png" />
          </figure><p>This makes it effortless to ensure that <b>every new customer or domain onboarded to Cloudflare gives clear directives to how they want their content used.</b></p>
    <div>
      <h3>Under the hood: technical implementation</h3>
      <a href="#under-the-hood-technical-implementation">
        
      </a>
    </div>
    <p>To implement this feature, we developed a new module that intercepts all inbound HTTP requests for <code>/robots.txt</code>. For all such requests, we’ll check whether the zone has opted in to use Cloudflare’s managed robots.txt by reading a value from our <a href="https://blog.cloudflare.com/introducing-quicksilver-configuration-distribution-at-internet-scale/"><u>distributed key-value store</u></a>. If they have, the module then responds with the Cloudflare’s managed robots.txt directives, prepended to the origin’s robot.txt if there is an existing file. We prepend so we can add a generalized header that instructs all bots on the customers preferences for data use, as defined in the <a href="https://www.ietf.org/archive/id/draft-it-aipref-attachment-00.html#name-introduction"><u>IETF AI preferences proposal</u></a>. Note that in robots.txt, the <a href="https://datatracker.ietf.org/doc/html/rfc9309#section-2.2.2"><u>most specific match</u></a> <i>must</i> always be used, and since our disallow expressions are scoped to cover everything, we can ensure a directive we prepend will never conflict with a more targeted customer directive. If the customer has <i>not</i> enabled this feature, the request is forwarded to the origin server as usual, using whatever the customer has written in their own robots.txt file. (While caching origin's robots.txt could reduce latency by eliminating a round trip to the origin, the impact on overall page load times would be minimal, as robots.txt requests comprise a small fraction of total traffic. Adding cache update/invalidation would introduce complexity with limited benefit, so we prioritized functionality and reliability in our implementation.)</p>
    <div>
      <h2>Step 2: block, but only where you show ads</h2>
      <a href="#step-2-block-but-only-where-you-show-ads">
        
      </a>
    </div>
    <p>Adding an entry to your robots.txt file is the first step to telling AI bots not to crawl you. But robots.txt is an honor system. Nothing forces bots to follow it. That’s why we introduced our <a href="https://blog.cloudflare.com/declaring-your-aindependence-block-ai-bots-scrapers-and-crawlers-with-a-single-click/"><u>one-click managed rule</u></a> to block all AI bots across your zone. However, some customers want AI bots to visit certain pages, like developer or support documentation. For customers who are hesitant to block everywhere, we have a brand-new option: let us detect when ads are shown on a hostname, and we will block AI bots ONLY on that hostname. Here’s how we do it.</p><p>First, we use multiple techniques to identify if a request is coming from an AI bot. The easiest technique is to identify well-behaved crawlers that publicly declare their user agent, and use dedicated IP ranges. Often we work directly with these bot makers to add them to our <a href="https://radar.cloudflare.com/traffic/verified-bots"><u>Verified Bot list</u></a>.</p><p>Many bot operators act in good faith by publicly publishing their user agents, or even <a href="https://blog.cloudflare.com/verified-bots-with-cryptography/"><u>cryptographically verifying their bot requests</u></a> directly with Cloudflare. Unfortunately, some attempt to appear like a real browser by using a spoofed user agent. It's not new for our global machine learning models to recognize this activity as a bot, even when operators lie about their user agent. When bad actors attempt to crawl websites at scale, they generally use tools and frameworks that we’re able to fingerprint, and we use Cloudflare’s network of over 57 million requests per second on average, to understand how much we should trust the fingerprint. We compute global aggregates across many signals, and based on these signals, our models are able to consistently and <a href="https://blog.cloudflare.com/declaring-your-aindependence-block-ai-bots-scrapers-and-crawlers-with-a-single-click/"><u>appropriately flag traffic from evasive AI bots</u></a>.</p><p>When we see a request from an AI bot, our system checks if we have previously identified ads in the response served by the target page. To do this, we inspect the “response body” — the raw HTML code of the web page being sent back.  After parsing the HTML document, we perform a comprehensive scan for code patterns commonly found in <a href="https://support.google.com/adsense/answer/9183549?hl=en#:~:text=An%20ad%20unit%20is%20one,flexibility%20in%20terms%20of%20customization."><u>ad units</u></a>, which signals to us that the page is serving an ad. Examples of such code would be:</p>
            <pre><code>&lt;div class="ui-advert" data-role="advert-unit" data-testid="advert-unit" data-ad-format="takeover" data-type="" data-label="" style=""&gt;
&lt;script&gt;
....
&lt;/script&gt;
&lt;/div&gt;</code></pre>
            <p>Here, the div-container has the <code>ui-advert</code> class commonly used for advertising. Similarly, links to commonly used ad servers like Google Syndication are a good signal as well, such as the following:</p>
            <pre><code>&lt;link rel="dns-prefetch" href="https://pagead2.googlesyndication.com/"&gt;

&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1234567890123456" crossorigin="anonymous"&gt;&lt;/script&gt;</code></pre>
            <p>By streaming and directly parsing small chunks of the response using our ultra-fast <a href="https://blog.cloudflare.com/html-parsing-2/#lol-html"><u>LOL HTML parser</u></a>, we can perform scans without adding any latency to the inspected response.</p><p>So as not to reinvent the wheel, we are adopting techniques similar to those that ad blockers have been using for years. Ad blockers fundamentally perform two separate tasks to block advertisements in a browser. The first is to block the browser from fetching resources from ad servers, and the second is to suppress displaying HTML elements that contain ads. For this, ad blockers rely on large filter lists such as <a href="https://easylist.to/index.html"><u>EasyList</u></a> that contain both so-called URL block filters that match outgoing request URLs against a set of patterns, and block them if they match one of the filters, and CSS selectors that are designed to match HTML ad elements.</p><p>We can use both of these techniques to detect if an HTML response contains ads by checking external resources (e.g. content referenced by HREF or SCRIPT tags) against URL block filters, and the HTML elements themselves against CSS selectors. Because we do not actually need to block every single advertisement on a site, but rather detect the overall presence of ads on a site, we can achieve the same detection efficacy when shrinking the number of CSS and URL filters down from more than 40,000 in EasyList to the 400 most commonly seen ones to increase our computational efficiency.</p><p>Because some sites load ads dynamically rather than directly in the returned HTML (partially to avoid ad blocking), we enrich this first information source with data from <a href="https://developers.cloudflare.com/fundamentals/reference/policies-compliances/content-security-policies/"><u>Content Security Policy (CSP)</u></a> reports. The Content Security Policy standard is a security mechanism that helps web developers control the resources (like scripts, stylesheets, and images) a browser is allowed to load for a specific web page, and browsers send reports about loaded resources to a CSP management system, which for many sites is Cloudflare’s <a href="https://developers.cloudflare.com/page-shield/"><u>Page Shield</u></a> product. These reports allow us to relate scripts loaded from ad servers directly with page URLs. Both of these information sources are consumed by our <a href="https://www.cloudflare.com/en-gb/learning/security/glossary/what-is-endpoint/"><u>endpoint management service</u></a>, which then matches incoming requests against hostnames that we already know are serving ads.</p><p>We do all of this on every request for any customer who opts in, even free customers. </p><p>To enable this feature, simply navigate to the <a href="https://dash.cloudflare.com/?to=/:account/:zone/security/bots/configure"><u>Security &gt; Settings &gt; Bots</u></a> section of the Cloudflare dashboard, and choose either <code>Block on pages with Ads</code> or <code>Block Everywhere</code>.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/yoGKnsD7fuG9K8MysCMHl/91fb4bb69625d8c85a8dcf4cfb21f6de/unnamed__1_.png" />
          </figure>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/64xCpJrlgY1WtsNI0CeeT5/975e6a329b605e11445faafa038181aa/unnamed__2_.png" />
          </figure>
    <div>
      <h2>The AI bot hunt: finding and identifying bots</h2>
      <a href="#the-ai-bot-hunt-finding-and-identifying-bots">
        
      </a>
    </div>
    <p>The AI bot landscape has exploded and continues to grow with an exponential trajectory as more and more operators come online. At Cloudflare, our team of security researchers are constantly identifying and classifying different AI-related crawlers and scrapers across our network. </p><p>There are two major ways in which we track AI bots and identify those that are poorly behaved:</p><p>1. Our customers play a crucial role by directly submitting reports of misbehaved AI bots that may not yet be classified by Cloudflare. (If you have an AI bot that comes to mind here, we’d love for you to let us know through our <a href="https://docs.google.com/forms/d/14bX0RJH_0w17_cAUiihff5b3WLKzfieDO4upRlo5wj8/"><u>bots submission form</u></a> today.) Once such a bot comes to our attention, our security analysts investigate to determine how it should be categorized.</p><p>2. We’re able to derive insights through analysis of the massive scale of our customers’ traffic that we observe. Specifically, we can see which AI agents visit which websites and when, drawing out trends or patterns that might make a website owner want to disallow a given AI bot. This bird’s-eye view on abusive AI bot behavior was paramount as we started to determine the content of a managed robots.txt.</p>
    <div>
      <h2>What’s next?</h2>
      <a href="#whats-next">
        
      </a>
    </div>
    <p>Our new <a href="https://developers.cloudflare.com/bots/additional-configurations/managed-robots-txt/"><u>managed robots.txt</u></a> and blocking AI bots on pages with ads features are available to <i>all Cloudflare customers</i>, including everyone on a Free plan. We encourage customers to start using them today – to take control over how the content on your website gets used. Looking ahead, Cloudflare will monitor the <a href="https://ietf-wg-aipref.github.io/drafts/draft-ietf-aipref-vocab.html"><u>IETF’s pending proposal</u></a> allowing website publishers to control how automated systems use their content and update our managed robots.txt accordingly. We will also continue to provide more granular control around AI bot management and investigate new distinguishing signals as AI bots become more and more precise. And if you’ve seen suspicious behavior from an AI scraper, contribute to the Internet ecosystem by <a href="https://docs.google.com/forms/d/14bX0RJH_0w17_cAUiihff5b3WLKzfieDO4upRlo5wj8/"><u>letting us know</u></a>!</p> ]]></content:encoded>
            <category><![CDATA[Pay Per Crawl]]></category>
            <category><![CDATA[AI]]></category>
            <category><![CDATA[Bots]]></category>
            <category><![CDATA[Impact]]></category>
            <guid isPermaLink="false">44HBJInoaQRMqVRmSaqjg6</guid>
            <dc:creator>Jin-Hee Lee</dc:creator>
            <dc:creator>Dipunj Gupta</dc:creator>
            <dc:creator>Brian Mitchell</dc:creator>
            <dc:creator>Reid Tatoris</dc:creator>
            <dc:creator>Henry Clausen</dc:creator>
        </item>
        <item>
            <title><![CDATA[Automatically discovering API endpoints and generating schemas using machine learning]]></title>
            <link>https://blog.cloudflare.com/ml-api-discovery-and-schema-learning/</link>
            <pubDate>Wed, 15 Mar 2023 13:00:00 GMT</pubDate>
            <description><![CDATA[ Today we’re announcing that Cloudflare can now automatically discover all API endpoints and learn API schemas for all of our API Gateway customers ]]></description>
            <content:encoded><![CDATA[ <p></p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/O4mCKw9fBP5rNhxrGj3NP/e4439b1f3cfd0f4b0674c8be82e494e3/image6-6.png" />
            
            </figure><p>Cloudflare now automatically discovers all API endpoints and learns API schemas for all of our <a href="https://www.cloudflare.com/application-services/products/api-gateway/">API Gateway</a> customers. Customers can use these new features to enforce a positive security model on their API endpoints even if they have little-to-no information about their existing APIs today.</p><p>The first step in <a href="https://www.cloudflare.com/application-services/solutions/api-security/">securing your APIs</a> is knowing your API hostnames and endpoints. We often hear that customers are forced to start their API cataloging and management efforts with something along the lines of “<i>we email around a spreadsheet and ask developers to list all their endpoints</i>”.</p><p>Can you imagine the problems with this approach? Maybe you have seen them first hand. The “email and ask” approach creates a point-in-time inventory that is likely to change with the next code release. It relies on tribal knowledge that may disappear with people leaving the organization. Last but not least, it is susceptible to human error.</p><p>Even if you had an accurate API inventory collected by group effort, validating that API was being used as intended by enforcing an API schema would require even more collective knowledge to build that schema. Now, API Gateway’s new API Discovery and Schema Learning features combine to <a href="https://www.cloudflare.com/learning/security/api/what-is-an-api-gateway/">automatically protect APIs</a> across the Cloudflare global network and remove the need for manual <a href="https://www.cloudflare.com/learning/learning/security/api/what-is-api-discovery/">API discovery</a> and schema building.</p>
    <div>
      <h2>API Gateway discovers and protects APIs</h2>
      <a href="#api-gateway-discovers-and-protects-apis">
        
      </a>
    </div>
    <p>API Gateway discovers <a href="https://www.cloudflare.com/learning/security/api/what-is-an-api/">APIs</a> through a feature called API Discovery. Previously, API Discovery used customer-specific session identifiers (HTTP headers or cookies) to identify API endpoints and display their analytics to our customers.</p><p>Doing discovery in this way worked, but it presented three drawbacks:</p><ol><li><p>Customers had to know which header or cookie they used in order to delineate sessions. While session identifiers are common, finding the proper token to use can take time.</p></li><li><p>Needing a session identifier for API Discovery precluded us from monitoring and reporting on completely unauthenticated APIs. Customers today still want visibility into session-less traffic to ensure all API endpoints are documented and that abuse is at a minimum.</p></li><li><p>Once the session identifier was input into the dashboard, customers had to wait up to 24 hours for the Discovery process to complete. Nobody likes to wait.</p></li></ol><p>While this approach had drawbacks, we knew we could quickly deliver value to customers by starting with a session-based product. As we gained customers and passed more traffic through the system, we knew our new labeled data would be extremely useful to further build out our product. If we could train a <a href="https://www.cloudflare.com/learning/ai/what-is-machine-learning/">machine learning model</a> with our existing API metadata and the new labeled data, we would no longer need a session identifier to pinpoint which endpoints were for APIs. So we decided to build this new approach.</p><p>We took what we learned from the session identifier-based data and built a machine learning model to uncover all API traffic to a domain, regardless of session identifier. With our new Machine Learning-based API Discovery, Cloudflare continually discovers all API traffic routed through our network without any prerequisite customer input. With this release, API Gateway customers will be able to get started with API Discovery faster than ever, and they’ll uncover unauthenticated APIs that they could not discover before.</p><p>Session identifiers are still important to API Gateway, as they form the basis of our volumetric abuse prevention <a href="https://developers.cloudflare.com/api-shield/security/volumetric-abuse-detection/">rate limits</a> as well as our <a href="/api-sequence-analytics/">Sequence Analytics</a>. See more about how the new approach performs in the “How it works” section below.</p>
    <div>
      <h3>API Protection starting from nothing</h3>
      <a href="#api-protection-starting-from-nothing">
        
      </a>
    </div>
    <p>Now that you’ve found new APIs using API Discovery, how do you protect them? To defend against attacks, API developers must know exactly how they expect their APIs to be used. Luckily, developers can programmatically generate an API schema file which codifies acceptable input to an API and upload that into API Gateway’s <a href="https://developers.cloudflare.com/api-shield/security/schema-validation/">Schema Validation</a>.</p><p>However, we already talked about how many customers can't find their APIs as fast as their developers build them. When they do find APIs, it’s very difficult to accurately build a unique OpenAPI schema for each of potentially hundreds of API endpoints, given that security teams seldom see more than the HTTP request method and path in their logs.</p><p>When we looked at API Gateway’s usage patterns, we saw that customers would discover APIs but almost never enforce a schema. When we ask them ‘why not?’ the answer was simple: “<i>Even when I know an API exists, it takes so much time to track down who owns each API so that they can provide a schema. I have trouble prioritizing those tasks higher than other must-do security items.</i>” The lack of time and expertise was the biggest gap in our customers enabling protections.</p><p>So we decided to close that gap. We found that the same learning process we used to discover API endpoints could then be applied to endpoints once they were discovered in order to automatically learn a schema. Using this method <b><i>we can now generate an OpenAPI formatted schema for every single endpoint we discover, in real time</i></b>. We call this new feature Schema Learning. Customers can then upload that Cloudflare-generated schema into Schema Validation to enforce a positive security model.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6VpHCVozyIsmpo7qSr6mTq/6193978955979c057b25a8f42b9d67d6/Schema-Learning-Flow.png" />
            
            </figure>
    <div>
      <h2>How it works</h2>
      <a href="#how-it-works">
        
      </a>
    </div>
    
    <div>
      <h3>Machine learning-based API discovery</h3>
      <a href="#machine-learning-based-api-discovery">
        
      </a>
    </div>
    <p>With RESTful APIs, requests are made up of different HTTP methods and paths. Take for example the <a href="https://developers.cloudflare.com/api/">Cloudflare API</a>. You’ll notice a common trend with the paths that might make requests to this API stand out amongst requests to this blog: API requests all start with /client/v4 and continue with the service name, a unique identifier, and sometimes service feature names and further identifiers.</p><p>How could we easily identify API requests? At first glance, these requests seem easy to programmatically discover with a heuristic like “path starts with /client”, but the core of our new Discovery contains a machine-learned model that powers a classifier that scores HTTP transactions. If API paths are so structured, why does one need machine-learning for this and can’t one just use some simple heuristic?</p><p>The answer boils down to the question: what actually constitutes an API request and how does it differ from a non-API request? Let’s look at two examples.</p><p>Like the Cloudflare API, many of our customers’ APIs follow patterns such as prefixing the path of their API request with an “api” identifier and a version, for example:  <i>/api/v2/user/7f577081-7003-451e-9abe-eb2e8a0f103d.</i></p><p>So just looking for “api” or a version in the path is already a pretty good heuristic that tells us this is very likely part of an API, but it is unfortunately not always as easy.</p><p>Let’s consider two further examples, /<i>users/7f577081-7003-451e-9abe-eb2e8a0f103d.jpg</i> and /<i>users/7f577081-7003-451e-9abe-eb2e8a0f103d,</i> both just differ in a .jpg extension. The first path could just be a static resource like the thumbnail of a user. The second path does not give us a lot of clues just from the path alone.</p><p>Manually crafting such heuristics quickly becomes difficult. While humans are great at finding patterns, building heuristics is challenging considering the scale of the data that Cloudflare sees each day. As such, we use machine learning to automatically derive these heuristics such that we know that they are reproducible and adhere to a certain accuracy.</p><p>Input to the training are features of HTTP request/response samples such as the content-type or file extension that we collected through the session identifiers-based Discovery mentioned earlier. Unfortunately, not everything that we have in this data is clearly an API. Additionally, we also need samples that represent non-API traffic. As such, we started out with the session-identifier Discovery data, manually cleaned it up and derived further samples of non-API traffic. We took great care in trying to not overfit the model to the data. That is, we want that the model generalizes beyond the training data.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/360Ff2sU2vH0xHRTwQ1a1i/9acd901bac12dd2e228f123904e1322d/ML-Discovery-Flow.png" />
            
            </figure><p>To train the model, we’ve used the <a href="/cloudflare-bot-management-machine-learning-and-more/">CatBoost library</a> for which we already have a good chunk of expertise as it also powers our <a href="/machine-learning-mobile-traffic-bots/">Bot Management ML-models</a>. In a simplification, one can regard the resulting model as a flow chart that tells us which conditions we should check after another, for example: if the path contains “api” then also check if there is no file extension and so forth. At the end of this flowchart is a score that tells us the likelihood that a HTTP transaction belongs to an API.</p><p>Given the trained model, we can thus input features of HTTP request/responses that run through the Cloudflare network and calculate the likelihood that this HTTP transaction belongs to an API or not. Feature extraction and model scoring is done in Rust and takes only a couple of microseconds on our global network. Since Discovery sources data from our powerful <a href="/http-analytics-for-6m-requests-per-second-using-clickhouse/">data pipeline</a>, it is not actually necessary to score <i>each</i> transaction. We can reduce the load on our servers by only scoring those transactions that we know will end up in our data pipeline to begin with thus saving CPU time and allowing the feature to be cost effective.</p><p>With the classification results in our data pipeline, we can use the same <a href="/api-abuse-detection/">API Discovery mechanism</a> that we’ve been using for the session identifier-based discovery. This existing system works great and allows us to reuse code efficiently. It also aided us when comparing our results with the session identifier-based Discovery, as the systems are directly comparable.</p><p>For API Discovery results to be useful, Discovery’s first task is to simplify the unique paths we see into variables. We’ve <a href="/api-abuse-detection/">talked about</a> this before. It is not trivial to deduce the various different identifier schemes that we see across the global network, especially when sites use custom identifiers beyond a straightforward GUID or integer format. API Discovery aptly normalizes paths containing variables with the help of a few different variable classifiers and supervised learning.</p><p>Only after normalizing paths are the Discovery results ready for our users to use in a straightforward fashion.</p>
    <div>
      <h3>The results: hundreds of found endpoints per customer</h3>
      <a href="#the-results-hundreds-of-found-endpoints-per-customer">
        
      </a>
    </div>
    <p>So, how does ML Discovery compare to the session identifier-based Discovery which relies on headers or cookies to tag API traffic?</p><p>Our expectation is that it detects a very similar set of endpoints. However, in our data we knew there would be two gaps. First, we sometimes see that customers are not able to cleanly dissect only API traffic using session identifiers. When this happens, Discovery surfaces non-API traffic. Second, since we required session identifiers in the first version of API Discovery, endpoints that are not part of a session (e.g. login endpoints or unauthenticated endpoints) were conceptually not discoverable.</p><p>The following graph shows a histogram of the number of endpoints detected on customer domains for both discovery variants.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2B3SRaTlzY9IeP14TiJmJt/ec42e3ecc5072fc6bd6f839ea6414a18/imageLikeEmbed.png" />
            
            </figure><p>From a bird's eye perspective, the results look very similar, which is a good indicator that ML Discovery performs as it is supposed to. There are some differences already visible in this plot, which is also expected since we’ll also discover endpoints that are conceptually not discoverable with just a session identifier. In fact, if we take a closer look at a domain-by-domain comparison we see that there is no change for roughly ~46% of the domains. The next graph compares the difference (by percent of endpoints) between session-based and ML-based discovery:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5xgilUYXsRSsK0szWTUE4Y/663978d4aa8a919010c024b5d2bea3bb/imageLikeEmbed--1-.png" />
            
            </figure><p>For ~15% of the domains, we see an increase in endpoints between 1 and 50, and for ~9%, we see a similar reduction. For ~28% of the domains, we find more than 50 additional endpoints.</p><p>These results highlight that ML Discovery is able to surface additional endpoints that have previously been flying under the radar, and thus expands the set tools API Gateway offers to help bring order to your API landscape.</p>
    <div>
      <h3>On-the-fly API protection through API schema learning</h3>
      <a href="#on-the-fly-api-protection-through-api-schema-learning">
        
      </a>
    </div>
    <p>With API Discovery taken care of, how can a practitioner protect the newly discovered endpoints? We already looked at the API request metadata, so now let’s look at the API request body. The compilation of all expected formats for all API endpoints of an API is known as an API schema. API Gateway’s Schema Validation is a great way to protect against <a href="https://github.com/OWASP/API-Security">OWASP Top 10 API attacks</a>, ensuring the body, path, and query string of a request contains the expected information for that API endpoint in an expected format. But what if you don’t know the expected format?</p><p>Even if the schema of a specific API is not known to a customer, the clients using this API will have been programmed to mostly send requests that conform to this unknown schema (or they would not be able to successfully query the endpoint). Schema Learning makes use of this fact and will look at successful requests to this API to reconstruct the input schema automatically for the customer. As an example, an API might expect the user-ID parameter in a request to have the form <i>id12345-a</i>. Even if this expectation is not explicitly stated, clients that want to have a successful interaction with the API will send user-IDs in this format.</p><p>Schema Learning first identifies all recent successful requests to an API-endpoint, and then parses the different input parameters for each request according to their position and type. After parsing all requests, Schema Learning looks at the different input values for each position and identifies which characteristics they have in common. After verifying that all observed requests share these commonalities, Schema Learning creates an input schema that restricts input to comply with these commonalities and that can directly be used for Schema Validation.</p><p>To allow for more accurate input schemas, Schema Learning identifies when a parameter can receive different types of input. Let's say you wanted to write an OpenAPIv3 schema file and manually observe in a small sample of requests that a query parameter is a unix timestamp. You write an API schema that forces that query parameter to be an integer greater than the start of last year's unix epoch. If your API also allowed that parameter in ISO 8601 format, your new rule would create false positives when the differently formatted (yet valid) parameter hit the API. Schema Learning automatically does all this heavy lifting for you and catches what manual inspection can't.</p><p>To prevent false positives, Schema Learning performs a statistical test on the distribution of these values and only writes the schema when the distribution is bounded with high confidence.</p><p>So how well does it work? Below are some statistics about the parameter types and values we see:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/76Sum5LAwABwVzNQqAjyIZ/8dfa9adfce34f3d7bdb871d4e17b9fc8/imageLikeEmbed--2-.png" />
            
            </figure><p>Parameter learning classifies slightly more than half of all parameters as strings, followed by integers which make up almost a third. The remaining 17% are made up of arrays, booleans, and number (float) parameters, while object parameters are seen more rarely in the path and query.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4F7YFE3mJGLcJnFo2crtSU/6fba9b4f4cdf54bc17f659e3f2978aa7/imageLikeEmbed--3-.png" />
            
            </figure><p>The number of parameters in the path is usually very low, with 94% of all endpoints seeing at most one parameter in their path.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4z6BUn5ZAabsQqscDeHaUx/d2a883f1eb8255deee3c459d7a5c3891/imageLikeEmbed--4-.png" />
            
            </figure><p>For the query, we do see a lot more parameters, sometimes reaching 50 different parameters for one endpoint!</p><p>Parameter learning is able to estimate numeric constraints with 99.9% confidence for the majority of parameters observed. These constraints can either be a maximum/minimum on the value, length, or size of the parameter, or a limited set of unique values that a parameter has to take.</p>
    <div>
      <h2>Protect your APIs in minutes</h2>
      <a href="#protect-your-apis-in-minutes">
        
      </a>
    </div>
    <p>Starting today, all API Gateway customers can now discover and protect APIs in just a few clicks, even if you're starting with no previous information. In the <a href="https://dash.cloudflare.com/?to=/:account/:zone/security/api-shield">Cloudflare dash</a>, click into API Gateway and on to the <a href="https://developers.cloudflare.com/api-shield/security/api-discovery/">Discovery</a> tab to observe your discovered endpoints. These endpoints will be immediately available with no action required from you. Then, add relevant endpoints from Discovery into <a href="https://developers.cloudflare.com/api-shield/management-and-monitoring/">Endpoint Management</a>. Schema Learning runs automatically for all endpoints added to Endpoint Management. After 24 hours, export your learned schema and upload it into <a href="https://developers.cloudflare.com/api-shield/security/schema-validation/">Schema Validation</a>.</p><p>Enterprise customers that haven’t purchased API Gateway can get started by <a href="https://dash.cloudflare.com/?to=/:account/:zone/security/api-shield">enabling the API Gateway trial</a> inside the Cloudflare Dashboard or contacting their account manager.</p>
    <div>
      <h2>What’s next</h2>
      <a href="#whats-next">
        
      </a>
    </div>
    <p>We plan to enhance Schema Learning by supporting more learned parameters in more formats, like POST body parameters with both JSON and URL-encoded formats as well as header and cookie schemas. In the future, Schema Learning will also notify customers when it detects changes in the identified API schema and present a refreshed schema.</p><p>We’d like to hear your feedback on these new features. Please direct your feedback to your account team so that we can prioritize the right areas of improvement. We look forward to hearing from you!</p> ]]></content:encoded>
            <category><![CDATA[Security Week]]></category>
            <category><![CDATA[API Shield]]></category>
            <category><![CDATA[API Gateway]]></category>
            <category><![CDATA[API Security]]></category>
            <category><![CDATA[AI]]></category>
            <guid isPermaLink="false">32vTIN2aiM5jMf0B8KBeqW</guid>
            <dc:creator>John Cosgrove</dc:creator>
            <dc:creator>Jan Rüth</dc:creator>
            <dc:creator>Henry Clausen</dc:creator>
        </item>
    </channel>
</rss>