<?xml version="1.0" encoding="UTF-8"?><rss 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" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Lucas Parry on Medium]]></title>
        <description><![CDATA[Stories by Lucas Parry on Medium]]></description>
        <link>https://medium.com/@lucas.parry?source=rss-9e739e928a88------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*U8R-gjOFNO-k2qccdnkCeg.jpeg</url>
            <title>Stories by Lucas Parry on Medium</title>
            <link>https://medium.com/@lucas.parry?source=rss-9e739e928a88------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 04:09:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lucas.parry/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[From Freeform to Fort Knox: Locking Down Our GraphQL API Without Anyone Noticing]]></title>
            <link>https://engineering.ferocia.com.au/from-freeform-to-fort-knox-locking-down-our-graphql-api-without-anyone-noticing-d0ef9804909d?source=rss-9e739e928a88------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0ef9804909d</guid>
            <category><![CDATA[graphql-queries]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Lucas Parry]]></dc:creator>
            <pubDate>Wed, 16 Jul 2025 01:15:29 GMT</pubDate>
            <atom:updated>2025-07-16T01:15:29.124Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y44nIhVGxUvwQfFxGLs4lw.jpeg" /><figcaption>You’re not on the list, expected operations only. — Credit Google Gemini Image Creation</figcaption></figure><p>There’s a classic engineering trade-off: agility vs. stability. For years, Ferocia leaned hard into agility, empowering our developers with a freeform GraphQL API that let them ship features faster than ever. It was the right call for a growing product, and it paid massive dividends in velocity. But that agility came at a cost: without an exhaustive list of operations (or GraphQL Requests) out in the wild, we lacked some of the insight and control needed to scale. We were effectively blind about what requests our customers could make to our API, we didn’t have confidence around introducing breaking changes, and we couldn’t easily block malicious requests, or prevent potential denial-of-service via complicated operations that had the potential to slow our servers to a halt.</p><p>We had reached an inflection point where the initial trade-off was no longer serving us. The task was clear, if daunting: take an actively used GraphQL API, lock it down by requiring every single operation be known and authorised by us, and do it all without breaking any of our supported mobile apps.</p><h3>Every Operation Has a Fingerprint (or Two)</h3><p>Our first challenge was moving from a system of trust to one of verification. We needed a way to uniquely identify every incoming operation, but this presented two competing goals: the lookup had to be incredibly fast as we’d be doing it for every single request, but we also needed to be able to know when two textually different operations were functionally the same which involved a bit more computation to normalise.</p><p>We solved this with a two-signature system.</p><p>First, for pure lookup speed, we created a client-specific signature. This was a simple SHA256 hash of the raw operation string exactly as it arrived from the client, whitespace and all. This gave us a key for an immediate, indexed database lookup.</p><p>But to fully understand our API usage, we needed a canonical signature. For this, we generated a standardised form of each operation body. This process strips away superficial differences like spacing or the order of fields, giving us the operation’s true structural identity. We hashed this canonical form to create the second signature. By linking the fast, client-specific signature to the canonical one, we could easily recognise that ten different-looking operations were, in fact, all the same. This two-hash system became the key to our operation store: If a GraphQL request’s operation signature wasn’t already known to the store, it could be rejected.</p><h3>The Dry Run: Cataloging the Wild</h3><p>With our operation store built, we couldn’t just flip the switch straight to rejection; that would have instantly broken every existing client. Instead, we initially shipped it in a passive “learning mode”. The system didn’t block anything, it simply checked each incoming operation’s signature against our new operation store. If there was a match, it tracked a hit on a Datadog metric. If not, it logged a miss and added the unknown operation to the operation store.</p><p>Simultaneously, we updated our release pipeline so that every new version of our app automatically added all of its operation signatures to the store as a required step before release. This dry run quickly confirmed that for newly minted clients, our system was working perfectly, but the chart of operation store misses revealed the true scale of our challenge: a very long tail of older, but still supported clients active in the wild. We had to catalogue all of their operations, which led us to our next step.</p><h3>Git Archaeology</h3><p>To tackle this long tail, monitoring live traffic would not be enough; we would miss the operations for rarely-used features, and for the rarer old clients used by the stubborn I-will-never-upgrade-until-you-make-me crowd.</p><p>Another option would have been to wait until we’d sunset the last version that we shipped before we started recording operations as part of the release process, but this would mean we’d be waiting a year or more before we’d get the true benefit.</p><p>We had a better idea. The code for every client we had ever released was still accessible, tagged in our git repo. We wrote a script that programmatically checked out every release tag still within our support window. For each version, it would bootstrap the app just enough to produce an operation manifest and add it to our collection, allowing us to do a massive backfill of these manifests into our operation store. It was a beautifully simple solution, a brute force approach allowing us to retroactively collect every operation for every support client, whether or not we were seeing much traffic from them. And it worked fantastically! When we checked our chart of operation store hits vs. misses, we could see that we had accounted for well over 99% of all operations.</p><h3>The Last 1%</h3><p>With our operation store now nearly complete, we entered the final phase of monitoring. For several weeks, we let the system run, closely monitoring the logs for the sources of that last ~1% of operation store misses. This is where we started to find the obscure edge cases.</p><p>One was our “sunset” screen: the screen telling our customers when their app was too old and must be updated. It turned out we needed to make a GraphQL request before we could know if we should show this screen, resulting in a slow but steady trickle of operation misses from some truly ancient clients. The fix was to go back even <em>further</em> in our git history back to the very beginning of our release tags, and add just that single operation to the store for each long-sunsetted client, ensuring even the oldest apps failed gracefully.</p><p>Another unexpected source was old smart watch apps. Versions outside our support window would continue trying to make requests well after their paired mobile version was sunset, creating a much broader collection of unique operation misses. We made a pragmatic call: as long as the main mobile app correctly prompted customers to upgrade, we could accept the unsupported watch app failing. After these final tweaks, the miss rate dropped to virtually zero. We were finally ready.</p><h3>Flipping the Switch</h3><p>Now came the moment of truth. With dashboards up and the team on standby, we switched our “reject unknown operations” feature flag from staff-only to 50% of customer traffic. We watched anxiously, fingers hovering over the feature toggle ready to flip it back off, but the alerts never came. There was only the steady, quiet hum of successful requests. After a few hours, we flipped it to 100% of customers and the job was done. Our API was locked down and would no longer accept any unknown requests.</p><h3>The Icing on the Cake</h3><p>Having the operation store in place enabled us to make a change that had the potential to improve customer experience. Since we now had every operation available to our server, there was no need for customers to send us the (sometimes very large) operation bodies anymore.</p><p>This was a rather small change for each of our apps, a simple boolean flag to omit the operation in the easiest cases, but the effects were profound. <strong>Our inbound GraphQL traffic charts have dropped by an average of 85% compared to 8 months ago, while our volume of requests has continued to climb over the same period.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BNHQRc4XBjBkCNOHz3ogag.png" /></figure><p>This isn’t just a win for our servers; it has the potential to be a massive improvement for customers on slow or unreliable mobile networks. When connections are spotty, the app being able to send through smaller requests means that more of those requests succeed, instead of suffering from dropped packets and endless retries trying to send through the previously massive operations.</p><p>Our time-shifted inbound traffic charts show the impact best. Our <em>lowest</em> points of daily traffic 8 months ago are still higher than our <em>peak</em> traffic today.</p><p>This project wasn’t just about securing our API and improving performance; it’s a solid foundation for us to continue to build upon. With a reliable operation store in place, we’re now exploring even more ambitious ideas, like an in-memory cache of our hottest operations, pre-parsed to their AST and ready to be served instantly. But that’s a story for another day.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0ef9804909d" width="1" height="1" alt=""><hr><p><a href="https://engineering.ferocia.com.au/from-freeform-to-fort-knox-locking-down-our-graphql-api-without-anyone-noticing-d0ef9804909d">From Freeform to Fort Knox: Locking Down Our GraphQL API Without Anyone Noticing</a> was originally published in <a href="https://engineering.ferocia.com.au/">Ferocia Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>