<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>langui.sh</title>
		<description></description>
		<link>/</link>
		<atom:link href="/feed.xml" rel="self" type="application/rss+xml" />
		
			<item>
				<title>Ten Years of Frinkiac</title>
				<description>&lt;h1 id=&quot;ten-years-of-frinkiac-a-few-months-of-modernization-with-ai&quot;&gt;Ten Years of Frinkiac: A Few Months of Modernization with AI&lt;/h1&gt;

&lt;p&gt;It’s been just over ten years (February 2, 2016) since we launched &lt;a href=&quot;https://frinkiac.com&quot;&gt;Frinkiac&lt;/a&gt; to the public. In those first few months after release we added GIF support, some new sites (hello &lt;a href=&quot;https://morbotron.com&quot;&gt;Morbotron&lt;/a&gt;), and then we mostly stopped working on it. Everything worked well enough for us and the code sat unchanged on the same architecture we’d built in 2015.&lt;/p&gt;

&lt;p&gt;In February 2026 it occurred to us that maybe we should point those AI coding tools we’ve been using at the Frinkiac codebase. The result of that work is live now and you can go see it on both &lt;a href=&quot;https://frinkiac.com&quot;&gt;Frinkiac&lt;/a&gt; and &lt;a href=&quot;https://morbotron.com&quot;&gt;Morbotron&lt;/a&gt;, but we’ve also documented a subset of the experience in this post.&lt;/p&gt;

&lt;h2 id=&quot;modernizing-the-stack&quot;&gt;Modernizing the Stack&lt;/h2&gt;

&lt;p&gt;Before we worked on new features we had to drag the project forward a decade. The Go backend was on 1.8 and used a vendored &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GOPATH&lt;/code&gt; tree. We moved it to the latest Go release and converted everything to Go modules, which let us actually see/prune the dependency graph for the first time in years.&lt;/p&gt;

&lt;p&gt;The frontend also needed attention: Webpack 4, an out of date Babel config, Google Analytics, and some social media SDKs for sharing. We migrated webpack 4 → 5 → Vite 8, upgraded to React 18, and replaced the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;superagent&lt;/code&gt; HTTP library with native &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fetch&lt;/code&gt;. All third party JS gone. The share experience was rebuilt around copy-to-clipboard, copy-URL, and the Web Share API for mobile.&lt;/p&gt;

&lt;p&gt;With that work done we could now look at actual improvements.&lt;/p&gt;

&lt;h1 id=&quot;site-improvements&quot;&gt;Site Improvements&lt;/h1&gt;

&lt;h2 id=&quot;what-users-see&quot;&gt;What Users See&lt;/h2&gt;

&lt;h3 id=&quot;new-search-system&quot;&gt;New Search System&lt;/h3&gt;

&lt;p&gt;Frinkiac’s original search was a custom prefix-index system that did basic substring matching against subtitle text. It worked well enough for simple queries, but it had no concept of relevance ranking, couldn’t handle multi-word queries gracefully, and returned a lot of near-duplicate results from the same scene.&lt;/p&gt;

&lt;p&gt;We’ve now rebuilt search on PostgreSQL’s full-text search engine — tsvector/tsquery with proper linguistic stemming, a GIN index for fast lookups, and a relevance ranking system. The new search uses a two-tier matching strategy: we OR all the search terms together for recall (so “steamed hams” finds subtitles containing either word), but rank results using an AND query so subtitles matching &lt;em&gt;all&lt;/em&gt; terms float to the top. There’s also a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;window_content&lt;/code&gt; column that concatenates neighboring subtitles, so queries that span a sentence break across two subtitle lines still match.&lt;/p&gt;

&lt;p&gt;Update: Today (May 4, 2026) we transitioned from GIN to RUM indices and tuned PostgreSQL for a 4-5x speed up in search queries after noticing significant performance issues during the launch. Surprisingly, we needed to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;plan_cache_mode=force_custom_plan&lt;/code&gt; to prevent PostgreSQL from choosing incorrect query plans for the searches that excluded our indices.&lt;/p&gt;

&lt;p&gt;On top of the core FTS engine, we built a deduplication layer. Without it, searching for a common phrase returns a wall of nearly identical screenshots from the same few seconds of the same scene. The dedup system groups results into proximity windows (frames within 10 seconds of each other in the same episode) and caps how many results can come from each window. Strong matches (where the subtitle itself contains all query terms) get more generous limits than weak matches (where the terms only appear in the neighboring subtitle window). We went through several rounds of tuning the constants — window size, max frames per scene, max frames per subtitle — before the results felt right.&lt;/p&gt;

&lt;p&gt;We also added season filtering via a compact popover with a grid of season pills — click one to select it, click a second to select a range, or drag across multiple seasons. There are preset buttons (like “Classic” for seasons 3–9 on Frinkiac), and you can save up to two favorite season ranges as your own presets. Search result thumbnails now show subtitle text overlays so you can see the quote without clicking through, plus episode title badges on each result.&lt;/p&gt;

&lt;h3 id=&quot;new-screenshots-and-subtitles&quot;&gt;New Screenshots and Subtitles&lt;/h3&gt;

&lt;p&gt;The original Frinkiac dataset had some data quality issues that had bugged us for years. Subtitle timing was slightly offset from when characters actually said the lines, which meant search results would sometimes land on a frame a second or two away from the moment you wanted. We re-did the subtitle extraction from scratch to fix the timing alignment.&lt;/p&gt;

&lt;p&gt;While we were at it, we re-extracted all the screenshots at higher resolution. The original frames were 640x480; the new ones are sharper and hold up better when used in GIFs and comics, especially on high-DPI displays. This isn’t a perfect solution as the original SD presentation avoids some upscaling artifacts (especially over-sharpening), but overall we think it’s an improvement.&lt;/p&gt;

&lt;p&gt;Oh, and we put up every episode now that they can be easily filtered. This gives us a current count of 4,990,964 frames across 802 episodes and the movie.&lt;/p&gt;

&lt;h3 id=&quot;a-real-gif-editor&quot;&gt;A Real GIF Editor&lt;/h3&gt;

&lt;p&gt;The new GIF maker is built around an NLE-style timeline with a filmstrip showing actual frame thumbnails, yellow trim handles for setting the clip range, and a draggable playhead for scrubbing. Above the filmstrip sit overlay track bars — one per text overlay — that you can drag and resize to control exactly when each piece of text appears and disappears during the clip. The whole thing renders live on a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element: fonts are loaded via the FontFace API, text is drawn with the same sizing and outline logic as the server-side Go renderer, and every edit updates the preview instantly with no server round-trips.&lt;/p&gt;

&lt;p&gt;There’s live video preview too. The base clip (without overlays) renders once as an MP4, and a requestAnimationFrame loop composites each frame with the active overlay text drawn on top. You can hit Space to play/pause and watch your GIF with text timing before you commit to rendering. The render itself streams NDJSON progress events back to the client, so you get a real progress bar instead of a spinner.&lt;/p&gt;

&lt;p&gt;Text overlays are directly draggable on the canvas with hit-test divs. Each overlay has its own properties panel with font selection, size slider, color picker, and alignment controls. Subtitles from the caption page are automatically prepopulated as overlay tracks with sensible timing. We added smart loop detection that analyzes frame similarity to find natural loop points for seamless GIFs, and undo/redo with intelligent coalescing — dragging a slider doesn’t create 47 undo entries, but releasing it does create one. The toolbar itself went through several redesign iterations to get pan arrows on the filmstrip, a centered play button, and controls that wrap properly on mobile instead of overlapping.&lt;/p&gt;

&lt;p&gt;The GIF maker now redirects to a dedicated shareable result page with proper OG meta tags — og:image, og:video, and Twitter card tags — so links shared in iMessage, Slack, and other apps show an inline preview again. Getting iMessage previews to work correctly required some specific workarounds: iMessage caches og:image at the domain level, so we had to add per-page cache busters, and it won’t linkify URLs with very long path segments, so we moved overlay data from the URL path into query parameters.&lt;/p&gt;

&lt;h3 id=&quot;comic-maker&quot;&gt;Comic Maker&lt;/h3&gt;

&lt;p&gt;The old meme maker let you write text on a single image. We replaced it with a multi-panel comic strip builder.&lt;/p&gt;

&lt;p&gt;You start by picking frames from any episode and arranging them as panels. Clicking “Make Comic” from a caption with multiple subtitle lines now creates a multi-panel comic by default — one panel per subtitle, each using that line’s representative frame so you get a ready-made comic strip in one click. The comic maker supports multiple layouts — horizontal strips, vertical strips, grid arrangements like 1-over-2 for three panels, and a “single” layout that collapses everything back into one panel with stacked text. Switching to single is undoable, so you can freely experiment. Panels are re-orderable with a drag and each panel has its own filmstrip scrubber so you can dial in exactly the right frame.&lt;/p&gt;

&lt;p&gt;Each subtitle gets its own overlay track, and overlays are directly draggable on the canvas with contrast-aware drag handles that switch between light and dark depending on what’s behind them. You can add multiple text overlays per panel with independent font, size, color, and alignment settings. The canvas preview renders at native resolution with text sizing that matches the server-side Go renderer pixel-for-pixel — we went through several rounds of getting the bounding boxes, outline widths, and line heights to match exactly.&lt;/p&gt;

&lt;p&gt;There’s also multi-select support for bulk operations on overlays (Shift-click on desktop, long-press on mobile), undo/redo, and the entire editor state is serialized into the URL so you can share a work-in-progress or refresh without losing anything.&lt;/p&gt;

&lt;p&gt;Both the GIF maker and comic maker share extracted utility code for undo/redo, text dragging, and common UI components — as the two editors evolved in parallel, we periodically pulled shared logic into common modules to prevent drift.&lt;/p&gt;

&lt;h3 id=&quot;browsing-and-navigation&quot;&gt;Browsing and Navigation&lt;/h3&gt;

&lt;p&gt;The old episode view was a clunky paginated table. We replaced it with a full-episode storyboard grid that loads every frame at once. Each card shows the thumbnail with a timestamp and subtitle overlay, images lazy-load as you scroll, and clicking a card selects it (highlighting it in the grid and updating the URL) while a second click takes you to the caption view. There’s also a floating search box that filters the storyboard by subtitle text, so you can quickly find a specific moment within an episode.&lt;/p&gt;

&lt;p&gt;We also added a navigator — a new top-level page for browsing by season and episode. Each episode tile shows a rotating selection of frames with fade transitions, and hovering previews additional frames. Much like random, it’s intended to help you find something interesting when your mind is blank.&lt;/p&gt;

&lt;p&gt;On the caption page itself, the old grid of nearby thumbnails was replaced with a horizontal filmstrip scrubber. Click to jump or drag to scrub. During a drag, the filmstrip holds its frame list steady while the main image, URL, and subtitles update in real-time. Dragging near either edge of the filmstrip auto-pans to load adjacent frames, so you can scrub continuously through an episode without lifting your finger. And episode titles now link to their Wikipedia pages for quick reference.&lt;/p&gt;

&lt;p&gt;Finally, the static subtitle display on caption pages was replaced with a scrollable transcript showing ±30 seconds of surrounding dialogue. The current line is highlighted and the view auto-scrolls to keep it centered. Clicking any line jumps to that frame. When the current timestamp falls in a gap between subtitle lines, a blue divider marks the position. The transcript follows the filmstrip during drag, so scrubbing through the filmstrip also scrubs through the dialogue — you can see exactly where you are in the conversation at all times. On mobile, the transcript compacts to about three visible lines to save vertical space while keeping the current line centered.&lt;/p&gt;

&lt;h3 id=&quot;explore-similar&quot;&gt;Explore Similar&lt;/h3&gt;

&lt;p&gt;We added a new “Explore Similar” link on the caption page. When clicked, it checks the current frame’s CLIP embedding against the HNSW index and returns visually similar frames from across the entire series, deduplicated within 10-second proximity windows so you don’t get a wall of sequential frames from the same shot.&lt;/p&gt;

&lt;h3 id=&quot;search-history&quot;&gt;Search History&lt;/h3&gt;

&lt;p&gt;We added client-side search history backed by localStorage. When you press Enter or click a search result, the term is saved. Focus the search box and your recent searches appear as a dropdown — click one to re-run it instantly. Only intentional actions (pressing Enter or clicking through to a result) save to history, not debounce-triggered searches, so the list stays clean and useful.&lt;/p&gt;

&lt;h3 id=&quot;small-stuff&quot;&gt;Small Stuff&lt;/h3&gt;

&lt;p&gt;We rounded things out with a set of small features that address the biggest friction points for daily users — all client-side, no accounts required.&lt;/p&gt;

&lt;p&gt;First, we extracted the one-off copy-confirmation toast from the share buttons into a reusable notification system. A single &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;Toast /&amp;gt;&lt;/code&gt; component lives at the root of the app, and any feature can call &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;showToast(&quot;message&quot;)&lt;/code&gt; to trigger it. This gave us a consistent feedback pattern for every subsequent feature.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Favorites&lt;/strong&gt; lets you bookmark frames. A heart icon on every caption page toggles the frame in and out of a localStorage-backed favorites list (up to 50 entries). There’s a dedicated &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/favorites&lt;/code&gt; page that shows your saved frames in the same grid layout as search results. Favorited frames also get a subtle heart indicator when they appear in search results, so you can spot your bookmarks at a glance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recent Creations&lt;/strong&gt; solves the “I just spent five minutes making a GIF and then closed the tab” problem. Every time you generate a GIF or comic, the URL is saved to localStorage (up to 50 entries). A dedicated &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/creations&lt;/code&gt; page shows thumbnail cards with type badges (GIF/Comic) and relative timestamps, so you can get back to your work with one click.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Embed Codes&lt;/strong&gt; adds a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt; &amp;gt;&lt;/code&gt; button to the share row on every caption page. Click it and a popover offers ready-to-paste snippets in four formats — HTML, Markdown, BBCode, and a direct image URL — with one-click copy for each. The popover dismisses on Escape or click-outside, matching the existing UI patterns.&lt;/p&gt;

&lt;p&gt;All four features use the same versioned-envelope localStorage pattern as search history, with migration support so the storage format can evolve without breaking existing users’ data.&lt;/p&gt;

&lt;h3 id=&quot;keyboard-shortcuts&quot;&gt;Keyboard Shortcuts&lt;/h3&gt;

&lt;p&gt;We added them:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/&lt;/code&gt; focuses the search bar from any page&lt;/li&gt;
  &lt;li&gt;Arrow keys navigate search results and scrub through frames on the caption page&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Enter&lt;/code&gt; triggers an instant search, bypassing the debounce&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Escape&lt;/code&gt; goes back&lt;/li&gt;
  &lt;li&gt;In the GIF maker: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Space&lt;/code&gt; for play/pause, arrow keys for frame-by-frame navigation&lt;/li&gt;
  &lt;li&gt;In the comic maker: all the same, plus shortcuts for multi-select operations&lt;/li&gt;
  &lt;li&gt;A &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;?&lt;/code&gt; icon in the header opens a keyboard shortcuts popover so you can actually discover all of this&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;under-the-hood&quot;&gt;Under the Hood&lt;/h2&gt;

&lt;p&gt;The database layer got a major overhaul: we migrated from gorp + lib/pq to pgx v5 with native pgvector support, dropping 7 transitive dependencies (including drivers for MySQL, SQLite, and Cassandra that gorp pulled in but we never used). We also split the single connection pool into separate read and search pools so expensive full-text and pgvector queries can’t starve cheap caption/nearby/transcript lookups of connections.&lt;/p&gt;

&lt;p&gt;We also packed all frame images into flat &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.pack&lt;/code&gt; files — one per episode — with an embedded interpolation-searchable index, served via mmap for zero-copy reads. This eliminated millions of individual files on disk and made frame serving faster by avoiding filesystem metadata overhead. The pack format itself went through a v2 redesign: a 24-byte header with magic number, version, and size group boundaries replaced per-entry size codes, shrinking index entries from 32 to 16 bytes.&lt;/p&gt;

&lt;p&gt;For the S3 object cache (where generated GIFs and MP4s are stored), we added access tracking via a buffered channel that flushes to PostgreSQL in batches, and an hourly scrubber that evicts objects not accessed within 90 days. This keeps storage from growing unbounded without affecting request latency. The fire-and-forget upload goroutines were replaced with a bounded worker pool — 4 workers draining a 64-slot channel — so an S3 outage can’t cause unbounded goroutine and memory growth. If the queue fills, uploads are dropped (the content remains in groupcache) and a Prometheus counter tracks the drops for alerting.&lt;/p&gt;

&lt;p&gt;The original schema had accumulated redundant indices as well as some missing ones. We audited the full set, dropped single-column indices that were subsumed by composite or unique indices, and added new ones where queries needed them.&lt;/p&gt;

&lt;p&gt;So, so much more. Eliminating cgo in favor of subprocesses with pipes, optimizing GIF/MP4 generation, moving to native Go HTTP routing, the list goes on.&lt;/p&gt;

&lt;h2 id=&quot;hosting&quot;&gt;Hosting&lt;/h2&gt;

&lt;p&gt;We’ve hosted Frinkiac on Digital Ocean since 2018, but with this upgrade we’re transitioning to a more radical setup. We now run the entire stack in-house (literally, in a home) and connect to our CDN via cloudflared. This makes things more fun, but less highly available on a few axes. Will the negatives outweigh the positives? No idea, but we’ll have fun finding out.&lt;/p&gt;

&lt;h2 id=&quot;the-future&quot;&gt;The Future&lt;/h2&gt;

&lt;p&gt;Visual search! We’ve been working on this for a while, but we’re not happy with the results yet so it’s feature flagged off. The biggest challenge is that the visual models which describe scenes are not good at identifying characters. We need to improve character recognition and integrate it with scene descriptions to provide acceptable visual search results and that remains a work in progress. For example, it is not enough to know that Homer, Bart, and Moe are in a scene, we need the textual description to correctly identify which characters are performing which actions. We make no promises on dates (we did neglect this site for nearly ten years after all), but keep an eye out.&lt;/p&gt;

&lt;p&gt;We’re also sure the community will come up with new ideas we want to try, and we’re excited to see what happens.&lt;/p&gt;

&lt;h2 id=&quot;working-with-ai&quot;&gt;Working with AI&lt;/h2&gt;

&lt;p&gt;Almost every one of the commits was co-authored with an AI coding tool. For a codebase that had been sitting largely untouched for years, having an AI collaborator that could quickly understand the existing architecture and propose changes across the full stack was incredibly useful. We had forgotten more than we remembered about the Go backend, React frontend, SQL migrations, Docker configuration, shell scripts, etc. And as we added newer features it was invaluable to rapidly iterate with Python ML pipelines and rapidly generate new data sets with minimal effort.&lt;/p&gt;

&lt;p&gt;The cgo-to-subprocess migration is a good example. That’s the kind of change we’d been vaguely meaning to do for years but never got around to because it touched so many parts of the system. With AI, it went from “we should really do this someday” to “done in an afternoon.”&lt;/p&gt;

&lt;p&gt;Despite the assistance, we still poured an immense number of hours into the modernization and enhancements. Rather than taking less time, our ambitions grew.&lt;/p&gt;

&lt;p&gt;We think we’re just getting started, but maybe we’ll be content with this for another ten years. I guess we’ll see. Happy 10th birthday Frinkiac. Here’s to many more.&lt;/p&gt;
</description>
				<pubDate>Mon, 04 May 2026 00:00:00 +0000</pubDate>
				<link>/2026/05/04/ten-years-of-frinkiac/</link>
				<guid isPermaLink="true">/2026/05/04/ten-years-of-frinkiac/</guid>
			</item>
		
			<item>
				<title>Ephemeral GHA Apple Silicon Runners with CiderMill</title>
				<description>&lt;p&gt;In the &lt;a href=&quot;https://github.com/pyca/cryptography&quot;&gt;pyca/cryptography&lt;/a&gt; project we ostensibly write Python (and Rust), but in reality we are CI engineers doomed to spend 90% of all our development time &lt;a href=&quot;https://frinkiac.com/meme/S08E25/1251900/m/IFlPVVIgRFVUWSBJUyBDTEVBUi0tIFRPCiBCVUlMRCBBTkQgTUFJTlRBSU4gVEhPU0UKIFJPQk9UUy4=&quot;&gt;building and maintaining&lt;/a&gt; our annoyingly &lt;a href=&quot;https://github.com/pyca/cryptography/blob/fcaca61e7e64ce9848a5eb356cabe272c9ef3051/.github/workflows&quot;&gt;large&lt;/a&gt; CI&lt;sup id=&quot;fnref:11&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:11&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. As part of that unwanted work we possess a self-hosted runner for macOS arm64 builds&lt;sup id=&quot;fnref:7&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:7&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;Self-hosted runners have one big drawback&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt; – they lack build isolation. In the typical security model of GitHub Actions every job runs in an isolated environment. At the end of a run that environment is destroyed&lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt; and future runs are not exposed to any products of a previous run. In a self-hosted runner, &lt;strong&gt;this is not true&lt;/strong&gt;. Instead, each invocation of the runner is running on the same state-filled system that you built, with whatever mutations the last job performed still present. In some cases (e.g. closed source development using GHA) this represents an annoyance (you can’t treat all your GHA runners the same!), but can be worked around. However, in the open source world&lt;sup id=&quot;fnref:3&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;5&lt;/a&gt;&lt;/sup&gt; this represents an unacceptable security problem. CI systems run arbitrary code&lt;sup id=&quot;fnref:4&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:4&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;6&lt;/a&gt;&lt;/sup&gt; and trivial persistence on a CI runner is clearly undesirable.&lt;/p&gt;

&lt;p&gt;For this reason, we have constrained our M1 runner to only pushes to main since we installed it, but, &lt;a href=&quot;https://frinkiac.com/meme/S05E16/479261/m/UFJPRkVTU0lPTkFMIEFUSExFVEVTLS0gCkFMV0FZUyBXQU5USU4nIE1PUkUu&quot;&gt;like professional athletes&lt;/a&gt;, we always want more.&lt;/p&gt;

&lt;h2 id=&quot;cidermill-ephemeral-macos-vm-runners-for-gha&quot;&gt;&lt;a href=&quot;https://github.com/reaperhulk/cidermill&quot;&gt;CiderMill&lt;/a&gt;, ephemeral macOS VM runners for GHA&lt;/h2&gt;

&lt;p&gt;We created &lt;a href=&quot;https://github.com/reaperhulk/cidermill&quot;&gt;CiderMill&lt;/a&gt; to get the ephemeral macOS arm64&lt;sup id=&quot;fnref:14&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:14&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;7&lt;/a&gt;&lt;/sup&gt; bliss we craved but &lt;a href=&quot;https://github.com/github/roadmap/issues/528&quot;&gt;didn’t want to wait for&lt;/a&gt;. CiderMill uses &lt;a href=&quot;https://github.com/cirruslabs/tart&quot;&gt;tart&lt;/a&gt; and &lt;a href=&quot;https://github.blog/changelog/2021-09-20-github-actions-ephemeral-self-hosted-runners-new-webhooks-for-auto-scaling/&quot;&gt;GHA’s ephemeral runner support&lt;/a&gt; to provide build isolation while integrating extremely well with the GitHub Actions ecosystem. Simply put it does the following:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Boots one or more&lt;sup id=&quot;fnref:10&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:10&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;8&lt;/a&gt;&lt;/sup&gt; fresh macOS VMs set up via your own custom Packer scripts using tart (which, in turn, leverages Apple’s Virtualization.framework).&lt;/li&gt;
  &lt;li&gt;Installs and registers an ephemeral action runner within the VM.&lt;/li&gt;
  &lt;li&gt;Waits until the runner exits (upon completion of a job) and then does it all again.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In pyca/cryptography’s case thanks to &lt;a href=&quot;https://github.com/reaperhulk/cidermill&quot;&gt;CiderMill&lt;/a&gt; we can relax our constraints and &lt;a href=&quot;https://github.com/pyca/cryptography/pull/8066/files&quot;&gt;integrate our macOS arm64 job into our primary CI&lt;/a&gt;! Less lines of nested bash and YAML plus pre-merge testing on an important architecture, seems good.&lt;/p&gt;

&lt;p&gt;We run this on a single 16GB M1 Mini, but projects with more resources can simply run more instances of &lt;a href=&quot;https://github.com/reaperhulk/cidermill&quot;&gt;CiderMill&lt;/a&gt; as needed&lt;sup id=&quot;fnref:13&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:13&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;9&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;Head on over to &lt;a href=&quot;https://github.com/reaperhulk/cidermill&quot;&gt;CiderMill&lt;/a&gt; to check out the documentation&lt;sup id=&quot;fnref:6&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:6&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;10&lt;/a&gt;&lt;/sup&gt;, try it out, and see if it fits your needs.&lt;/p&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:11&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;We run over 70 separate jobs per PR, and this is despite aggressively limiting our combinatorial behavior. There are challenges with a matrix this large, mostly around CI cycle time, tail latency issues, and ephemeral problems with networking or other parts of the underlying infrastructure. Also we run a k8s for ephemeral arm64 Linux runners, but that’s a story for another time. &lt;a href=&quot;#fnref:11&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:7&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;An M1 kindly donated by MacStadium’s &lt;a href=&quot;https://www.macstadium.com/opensource&quot;&gt;Open Source Program&lt;/a&gt;. &lt;a href=&quot;#fnref:7&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Beyond the &lt;strong&gt;really&lt;/strong&gt; big one where you have to operate your own infrastructure. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Modulo whatever caching you may have chosen to do via actions/cache, etc. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Specifically, open source projects that allow anyone to submit PRs. &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;First-time contributor approval workflows and other things exist to mitigate a variety of CI abuse (e.g. crypto miner), but self-hosted runners have significantly more challenges that are not fully addressable via these mechanisms. &lt;a href=&quot;#fnref:4&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:14&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Apple Silicon, arm64, AArch64, M1, M2…sigh, too many names. &lt;a href=&quot;#fnref:14&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:10&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Apple’s godawful rules about macOS virtualization &lt;a href=&quot;https://eclecticlight.co/2022/08/04/virtualisation-on-apple-silicon-macs-8-how-apple-limits-vms/&quot;&gt;limit us&lt;/a&gt; to 2 VMs. &lt;a href=&quot;#fnref:10&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:13&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Just remember, there’s no advantage to running this on an M1 Pro/Max/Ultra machine unless you need more RAM since you’re constrained to 2 VMs&lt;sup id=&quot;fnref:10:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:10&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;8&lt;/a&gt;&lt;/sup&gt; per physical machine. &lt;a href=&quot;#fnref:13&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:6&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;This project was built for our own use so there are some documented missing features (e.g. no PATs, only GH Apps). Will we add them? Maybe. Could you add them? Yes! &lt;a href=&quot;#fnref:6&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
				<pubDate>Sun, 15 Jan 2023 00:00:00 +0000</pubDate>
				<link>/2023/01/15/ephemeral-gha-m1-runners-with-cidermill/</link>
				<guid isPermaLink="true">/2023/01/15/ephemeral-gha-m1-runners-with-cidermill/</guid>
			</item>
		
			<item>
				<title>2021 in Memory Unsafety - Apple&apos;s Operating Systems</title>
				<description>&lt;p&gt;In &lt;a href=&quot;/2019/07/23/apple-memory-safety/&quot;&gt;2019&lt;/a&gt; and &lt;a href=&quot;/2020/07/24/apple-memory-safety/&quot;&gt;2020&lt;/a&gt; we did an analysis of memory unsafety bugs in Apple’s iOS and macOS releases. Another year has passed, so let’s run the numbers again&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;sup id=&quot;fnref:6&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:6&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;. If you’re interested in a deeper dive on what memory unsafety is and why it is Fish in a Barrel’s mission to rid the world of its scourge please read through the previous posts for more details. And, of course, follow &lt;a href=&quot;https://twitter.com/lazyfishbarrel&quot;&gt;@LazyFishBarrel&lt;/a&gt; on Twitter where we’ve been tweeting statistics about the proportion of memory unsafety related vulnerabilities in various software for over three years.&lt;/p&gt;

&lt;h2 id=&quot;iosipados&quot;&gt;iOS/iPadOS&lt;/h2&gt;

&lt;p&gt;iOS 14 was released September 16, 2020 and has subsequently had a total of 15 feature and point releases. One significant change from last year is Apple’s new policy of providing limited security patching to the N-1 version of their OS after N is released. This has resulted in version 14.8.1 after the release of 15.x. It is, however, important to note that Apple has not committed to patching all security bugs and that in general security is not just bug fixes, it’s also fundamental software architecture choices that cannot be backported. The best security policy is always to run the latest version.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Release&lt;/th&gt;
      &lt;th&gt;Memory Unsafety Bugs&lt;/th&gt;
      &lt;th&gt;Total CVE Count&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212868&quot;&gt;14.8.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;10&lt;/td&gt;
      &lt;td&gt;12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212807&quot;&gt;14.8&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;12&lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/td&gt;
      &lt;td&gt;19&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212623&quot;&gt;14.7.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212601&quot;&gt;14.7&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;26&lt;sup id=&quot;fnref:2:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/td&gt;
      &lt;td&gt;38&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212528&quot;&gt;14.6&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;28&lt;sup id=&quot;fnref:2:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/td&gt;
      &lt;td&gt;48&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212336&quot;&gt;14.5.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212317&quot;&gt;14.5&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;32&lt;sup id=&quot;fnref:2:3&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/td&gt;
      &lt;td&gt;63&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212256&quot;&gt;14.4.2&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212221&quot;&gt;14.4.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212146&quot;&gt;14.4&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;28&lt;sup id=&quot;fnref:2:4&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/td&gt;
      &lt;td&gt;56&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212003&quot;&gt;14.3&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;15&lt;/td&gt;
      &lt;td&gt;18&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;14.2.1&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT211929&quot;&gt;14.2&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;23&lt;/td&gt;
      &lt;td&gt;32&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;14.1&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;14.0.1&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT211850&quot;&gt;14.0&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;31&lt;/td&gt;
      &lt;td&gt;55&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;This totals 209 out of 346 vulnerabilities, for a &lt;strong&gt;60.4%&lt;/strong&gt; rate.&lt;/p&gt;

&lt;h3 id=&quot;in-the-wild&quot;&gt;In the wild&lt;/h3&gt;

&lt;p&gt;A new feature this year was Apple’s willingness to mark vulnerabilities that were being actively exploited in the wild.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Release&lt;/th&gt;
      &lt;th&gt;Memory Unsafety&lt;/th&gt;
      &lt;th&gt;Total&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;14.8.1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;14.8&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;14.7.1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;14.5.1&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;14.5&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;14.4.2&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;14.4&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;This totals 8 out of 11 vulnerabilities, for a &lt;strong&gt;72.7%&lt;/strong&gt; rate.&lt;/p&gt;

&lt;h3 id=&quot;aggregated-stats&quot;&gt;Aggregated Stats&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Release&lt;/th&gt;
      &lt;th&gt;Memory Unsafety Bugs&lt;/th&gt;
      &lt;th&gt;Total CVE Count&lt;/th&gt;
      &lt;th&gt;Percentage&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;iOS 14&lt;/td&gt;
      &lt;td&gt;209&lt;/td&gt;
      &lt;td&gt;346&lt;/td&gt;
      &lt;td&gt;60.4%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;iOS 13&lt;/td&gt;
      &lt;td&gt;107&lt;/td&gt;
      &lt;td&gt;180&lt;sup id=&quot;fnref:3&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;&lt;/td&gt;
      &lt;td&gt;59.4%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;iOS 12&lt;/td&gt;
      &lt;td&gt;173&lt;/td&gt;
      &lt;td&gt;261&lt;/td&gt;
      &lt;td&gt;66.3%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;iOS 11&lt;/td&gt;
      &lt;td&gt;187&lt;/td&gt;
      &lt;td&gt;309&lt;/td&gt;
      &lt;td&gt;60.5%&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;There has been no meaningful change in the prevalence of memory unsafety bugs in the window analyzed. Apple has begun to use memory safe constructions in some components of their OS (see: &lt;a href=&quot;https://googleprojectzero.blogspot.com/2021/01/a-look-at-imessage-in-ios-14.html&quot;&gt;BlastDoor&lt;/a&gt;), but huge surface area remains accessible (looking at you ImageIO).&lt;/p&gt;

&lt;h2 id=&quot;macos&quot;&gt;macOS&lt;/h2&gt;

&lt;p&gt;Apple released macOS 11 (Big Sur) on November 12, 2020. Version 11.0 was preinstalled on some M1 machines, but 11.0.1 was actually released to customers first and contains all the relevant CVE information.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Release&lt;/th&gt;
      &lt;th&gt;Memory Unsafety Bugs&lt;/th&gt;
      &lt;th&gt;Total CVE Count&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212872&quot;&gt;11.6.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;18&lt;/td&gt;
      &lt;td&gt;24&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212804&quot;&gt;11.6&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;12&lt;/td&gt;
      &lt;td&gt;21&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;11.5.2&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212622&quot;&gt;11.5.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212602&quot;&gt;11.5&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;19&lt;sup id=&quot;fnref:2:5&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/td&gt;
      &lt;td&gt;40&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212529&quot;&gt;11.4&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;34&lt;sup id=&quot;fnref:2:6&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/td&gt;
      &lt;td&gt;82&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212335&quot;&gt;11.3.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212325&quot;&gt;11.3&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;30 &lt;sup id=&quot;fnref:2:7&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/td&gt;
      &lt;td&gt;65&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212220&quot;&gt;11.2.3&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;11.2.2&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212177&quot;&gt;11.2.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212147&quot;&gt;11.2&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;29&lt;sup id=&quot;fnref:2:8&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;sup id=&quot;fnref:5&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:5&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;5&lt;/a&gt;&lt;/sup&gt;&lt;/td&gt;
      &lt;td&gt;57&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT212011&quot;&gt;11.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;21&lt;sup id=&quot;fnref:5:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:5&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;5&lt;/a&gt;&lt;/sup&gt;&lt;/td&gt;
      &lt;td&gt;27&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT211931&quot;&gt;11.0.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;55&lt;/td&gt;
      &lt;td&gt;102&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;This totals 225 out of 425 vulnerabilities, for a &lt;strong&gt;52.9%&lt;/strong&gt; rate. Please see the footnotes in the table for some caveats.&lt;/p&gt;

&lt;p&gt;Despite these limitations, let’s aggregate the data again.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Release&lt;/th&gt;
      &lt;th&gt;Memory Unsafety Bugs&lt;/th&gt;
      &lt;th&gt;Total CVE Count&lt;/th&gt;
      &lt;th&gt;Percentage&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;macOS 11&lt;/td&gt;
      &lt;td&gt;225&lt;/td&gt;
      &lt;td&gt;425&lt;/td&gt;
      &lt;td&gt;52.9%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;macOS 10.15&lt;/td&gt;
      &lt;td&gt;154&lt;/td&gt;
      &lt;td&gt;228&lt;/td&gt;
      &lt;td&gt;67.5%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;macOS 10.14&lt;/td&gt;
      &lt;td&gt;213&lt;/td&gt;
      &lt;td&gt;298&lt;/td&gt;
      &lt;td&gt;71.5%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;macOS 10.13&lt;/td&gt;
      &lt;td&gt;256&lt;/td&gt;
      &lt;td&gt;458&lt;/td&gt;
      &lt;td&gt;55.9%&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;These numbers are significantly more volatile, but the average over the past 4 years is ~60%, in line with iOS.&lt;/p&gt;

&lt;h3 id=&quot;in-the-wild-1&quot;&gt;In the wild&lt;/h3&gt;

&lt;p&gt;Much like iOS, for Big Sur Apple now notes vulnerabilities that were being actively exploited in the wild.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Release&lt;/th&gt;
      &lt;th&gt;Memory Unsafety&lt;/th&gt;
      &lt;th&gt;Total&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;11.6&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;11.5.1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;11.4&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;11.3.1&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;11.3.1&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;11.3&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;11.2&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;11.0.1&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;This totals 11 out of 15 vulnerabilities, for a &lt;strong&gt;73.3%&lt;/strong&gt; rate.&lt;/p&gt;

&lt;h3 id=&quot;xnu-macos-only&quot;&gt;XNU (macOS only)&lt;/h3&gt;

&lt;p&gt;The above statistics are for any code that ships with macOS or iOS (including the kernel), but what if we counted just kernel (and kernel extension) issues in macOS&lt;sup id=&quot;fnref:4&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:4&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;6&lt;/a&gt;&lt;/sup&gt;?&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Release&lt;/th&gt;
      &lt;th&gt;Memory Unsafety Bugs&lt;/th&gt;
      &lt;th&gt;Total CVE Count&lt;/th&gt;
      &lt;th&gt;Percentage&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;macOS 11&lt;/td&gt;
      &lt;td&gt;48&lt;/td&gt;
      &lt;td&gt;69&lt;/td&gt;
      &lt;td&gt;69.6%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;macOS 10.15&lt;/td&gt;
      &lt;td&gt;58&lt;/td&gt;
      &lt;td&gt;65&lt;/td&gt;
      &lt;td&gt;89.2%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;macOS 10.14&lt;/td&gt;
      &lt;td&gt;67&lt;/td&gt;
      &lt;td&gt;76&lt;/td&gt;
      &lt;td&gt;88.2%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;macOS 10.13&lt;/td&gt;
      &lt;td&gt;65&lt;/td&gt;
      &lt;td&gt;88&lt;/td&gt;
      &lt;td&gt;73.9%&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The vast majority of kernel-related CVEs continue to be memory unsafety related, although there is a drop with macOS 11. Hopefully that’s the beginning of a trend…&lt;/p&gt;

&lt;h2 id=&quot;analysis-bugs-vs-security-architecture-yearly-statement&quot;&gt;Analysis (Bugs vs Security Architecture Yearly Statement)&lt;/h2&gt;

&lt;p&gt;Memory unsafety continues to dominate the total percentage of security bugs on Apple’s platforms. Engineers there should &lt;strong&gt;strenuously lobby management&lt;/strong&gt; to prioritize migration of code that parses untrusted input to memory safe languages. Doing so would drastically cut the number of security vulnerabilities. In some cases this work appears to have begun (e.g. BlastDoor), but extensive use of memory unsafe libraries like ImageIO weaken the protections. Migrations must be done incrementally, so Apple should continue to identify their most vulnerable surface area and systematically harden it. Might we suggest ImageIO as a candidate?&lt;/p&gt;

&lt;p&gt;Major investment should also be undertaken in determining how to migrate XNU itself. Moving kernel extensions to a C++ userland (via the &lt;a href=&quot;https://developer.apple.com/system-extensions/&quot;&gt;system extension&lt;/a&gt; concept) will mitigate the severity of vulnerabilities in some cases, but is ultimately a poor substitute for a memory safe solution. The &lt;a href=&quot;https://github.com/Rust-for-Linux&quot;&gt;Rust for Linux&lt;/a&gt; project, while nascent itself, is demonstrating the potential viability of memory safe languages in a kernel.&lt;/p&gt;

&lt;p&gt;As we note every year, &lt;a href=&quot;https://twitter.com/i41nbeer&quot;&gt;Ian Beer&lt;/a&gt; once said:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;given sufficient bug density, security design is irrelevant&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Apple creates robust security architectures, but their systematic under-investment in memory safety (and even some mitigations like pervasive fuzzing) remains their single biggest weakness.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;No blog post discussing another company’s vulnerabilities would be complete without a discussion of the limitations. Apple provides reasonably well-written descriptions of bugs and these allow us to generally bucket the vulnerabilities into our two categories of interest. However, occasionally a bug will defy easy categorization or we will make a mistake. For WebKit issues Apple &lt;strong&gt;does not distinguish between JIT compiler induced memory unsafety and C/C++ induced&lt;/strong&gt;. Apple also occasionally releases fixes that are still embargoed. When this happens they release their security notes, but update them at a later date with additional fixes. They denote these additional entries with an “Entry added on &lt;strong&gt;date&lt;/strong&gt;” subscript, but we have typically long-since tweeted about it and won’t catch the additional entries. This blog post performed a recount as part of the analysis rather than relying on past data. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:6&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Since a significant amount of code is shared across Apple’s operating systems (especially at the kernel level) many of these CVEs are duplicates across macOS and iOS. This means you cannot sum iOS and macOS bugs together to get a total across Apple’s platforms without significantly miscounting. Finally, Apple typically does not document security bugs they find and fix internally. Thus, you should not treat these numbers as &lt;strong&gt;exact&lt;/strong&gt; but instead as reasonably accurate estimates of the relative percentage of memory unsafety issues Apple has seen in its products in this time range. &lt;a href=&quot;#fnref:6&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Apple’s information about several vulnerabilities is insufficient to categorize memory unsafety. The biggest offender are the ImageIO vulnerabilities. Some of them are clearly labeled, but many fall into a “This issue was addressed with improved checks” bucket which tells us nothing about the underlying issue. When we do not have enough information we generally do &lt;strong&gt;not&lt;/strong&gt; count them as memory unsafety, even if it seems likely that they are. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt; &lt;a href=&quot;#fnref:2:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt; &lt;a href=&quot;#fnref:2:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;sup&gt;3&lt;/sup&gt;&lt;/a&gt; &lt;a href=&quot;#fnref:2:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;sup&gt;4&lt;/sup&gt;&lt;/a&gt; &lt;a href=&quot;#fnref:2:4&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;sup&gt;5&lt;/sup&gt;&lt;/a&gt; &lt;a href=&quot;#fnref:2:5&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;sup&gt;6&lt;/sup&gt;&lt;/a&gt; &lt;a href=&quot;#fnref:2:6&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;sup&gt;7&lt;/sup&gt;&lt;/a&gt; &lt;a href=&quot;#fnref:2:7&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;sup&gt;8&lt;/sup&gt;&lt;/a&gt; &lt;a href=&quot;#fnref:2:8&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;sup&gt;9&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;These numbers are low as they have not been recomputed with Apple’s updated documents. &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:5&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;In macOS Big Sur 11.1 and 11.2 Apple listed both Catalina and Mojave security updates within the same document. These numbers are just for bugs affecting Big Sur. &lt;a href=&quot;#fnref:5&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt; &lt;a href=&quot;#fnref:5:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;iOS and macOS use the same kernel, but since it’s a different target the set of vulnerabilities may not entirely overlap. Counting iOS kernel vulnerabilities is left as an exercise for the reader. Our counting methodology here is to use Apple’s own information about whether kernel memory is affected (which generally covers kernel extensions like IOMobileFrameBuffer, even though they are not directly labeled kernel). &lt;a href=&quot;#fnref:4&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
				<pubDate>Mon, 13 Dec 2021 00:00:00 +0000</pubDate>
				<link>/2021/12/13/apple-memory-safety/</link>
				<guid isPermaLink="true">/2021/12/13/apple-memory-safety/</guid>
			</item>
		
			<item>
				<title>2020 in Memory Unsafety - Apple&apos;s Operating Systems</title>
				<description>&lt;p&gt;&lt;a href=&quot;/2019/07/23/apple-memory-safety/&quot;&gt;Last year&lt;/a&gt; we did an analysis of memory unsafety bugs in Apple’s iOS 12.x and macOS 10.14.x releases. We’re now at (nearly) the same point in the release cycle of iOS 13/macOS 10.15 so let’s run the numbers again&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. If you’re interested in a deeper dive on what memory unsafety is and why it is Fish in a Barrel’s mission to rid the world of its scourge please read through last year’s post for the details. And, of course, follow &lt;a href=&quot;https://twitter.com/lazyfishbarrel&quot;&gt;@LazyFishBarrel&lt;/a&gt; on Twitter where we’ve been tweeting statistics about the proportion of memory unsafety related vulnerabilities in various software for over two years.&lt;/p&gt;

&lt;h2 id=&quot;iosipados&quot;&gt;iOS/iPadOS&lt;/h2&gt;

&lt;p&gt;iOS 13 was released September 19, 2019 and has subsequently had a total of 15 feature and point releases. Unlike macOS, the iOS 13 series has several small bugfix releases that did not correct security issues. These are marked as N/A for bugs/CVEs but remain present in the list below.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Release&lt;/th&gt;
      &lt;th&gt;Memory Unsafety Bugs&lt;/th&gt;
      &lt;th&gt;Total CVE Count&lt;/th&gt;
      &lt;th&gt;Percentage&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT211288&quot;&gt;13.6&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;15&lt;/td&gt;
      &lt;td&gt;29&lt;/td&gt;
      &lt;td&gt;51.7%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT211214&quot;&gt;13.5.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;100%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT211168&quot;&gt;13.5&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;28&lt;/td&gt;
      &lt;td&gt;45&lt;/td&gt;
      &lt;td&gt;62.2%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;13.4.1&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT211102&quot;&gt;13.4&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;14&lt;/td&gt;
      &lt;td&gt;30&lt;/td&gt;
      &lt;td&gt;46.7%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT210918&quot;&gt;13.3.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;15&lt;/td&gt;
      &lt;td&gt;23&lt;/td&gt;
      &lt;td&gt;65.2%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT210785&quot;&gt;13.3&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;11&lt;/td&gt;
      &lt;td&gt;14&lt;/td&gt;
      &lt;td&gt;78.6%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;13.2.3&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;13.2.2&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;13.2.1&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT210721&quot;&gt;13.2&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;21&lt;/td&gt;
      &lt;td&gt;28&lt;/td&gt;
      &lt;td&gt;75%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;13.1.3&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;13.1.2&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;13.1.1&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT210603&quot;&gt;13.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT210606&quot;&gt;13.0&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;9&lt;/td&gt;
      &lt;td&gt;22.2%&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;It would be interesting to aggregate statistics across major versions, but we only have data for iOS 12&lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; and 13. Let’s fix that by going back through Apple’s security docs and running the numbers for iOS 11 (we did not run the Fish in a Barrel Twitter account back then).&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Release&lt;/th&gt;
      &lt;th&gt;Memory Unsafety Bugs&lt;/th&gt;
      &lt;th&gt;Total CVE Count&lt;/th&gt;
      &lt;th&gt;Percentage&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208938&quot;&gt;11.4.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;16&lt;/td&gt;
      &lt;td&gt;24&lt;/td&gt;
      &lt;td&gt;66.7%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208848&quot;&gt;11.4&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;16&lt;/td&gt;
      &lt;td&gt;39&lt;/td&gt;
      &lt;td&gt;41.0%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208743&quot;&gt;11.3.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;75.0%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208693&quot;&gt;11.3&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;31&lt;/td&gt;
      &lt;td&gt;60&lt;/td&gt;
      &lt;td&gt;51.7%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208534&quot;&gt;11.2.6&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;100%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208463&quot;&gt;11.2.5&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;13&lt;/td&gt;
      &lt;td&gt;17&lt;/td&gt;
      &lt;td&gt;76.5%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208401&quot;&gt;11.2.2&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;0%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208357&quot;&gt;11.2.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208334&quot;&gt;11.2&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;26&lt;/td&gt;
      &lt;td&gt;38&lt;/td&gt;
      &lt;td&gt;68.4%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;11.1.2&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;11.1.1&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208222&quot;&gt;11.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;16&lt;/td&gt;
      &lt;td&gt;24&lt;/td&gt;
      &lt;td&gt;66.7%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;11.0.3&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;11.0.2&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;11.0.1&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208112&quot;&gt;11.0&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;65&lt;/td&gt;
      &lt;td&gt;99&lt;/td&gt;
      &lt;td&gt;65.7%&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Let’s look at this aggregated for all of iOS 13 (with iOS 12 for a limited historical perspective).&lt;/p&gt;

&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Release&lt;/td&gt;
      &lt;td&gt;Memory Unsafety Bugs&lt;/td&gt;
      &lt;td&gt;Total CVE Count&lt;/td&gt;
      &lt;td&gt;Percentage&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;iOS 13&lt;/td&gt;
      &lt;td&gt;107&lt;/td&gt;
      &lt;td&gt;180&lt;/td&gt;
      &lt;td&gt;59.4%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;iOS 12&lt;/td&gt;
      &lt;td&gt;173&lt;/td&gt;
      &lt;td&gt;261&lt;/td&gt;
      &lt;td&gt;66.3%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;iOS 11&lt;/td&gt;
      &lt;td&gt;187&lt;/td&gt;
      &lt;td&gt;309&lt;/td&gt;
      &lt;td&gt;60.5%&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;To date, Apple has had substantially fewer bugs with a lower (although unlkely to be statistically significant) percentage of memory unsafety related issues. This, intriguingly, does not align with the general belief that iOS 13 is a buggier release, but security bugs and user-facing bugs (which are what create that sort of reputation) are not necessarily an overlapping set.&lt;/p&gt;

&lt;h2 id=&quot;macos&quot;&gt;macOS&lt;/h2&gt;

&lt;p&gt;Apple released macOS 10.15 (Catalina) on October 7, 2019 and subsequently has issued 6 point releases.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Release&lt;/th&gt;
      &lt;th&gt;Memory Unsafety Bugs&lt;/th&gt;
      &lt;th&gt;Total CVE Count&lt;/th&gt;
      &lt;th&gt;Percentage&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT211289&quot;&gt;10.15.6&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;11&lt;/td&gt;
      &lt;td&gt;19&lt;/td&gt;
      &lt;td&gt;57.9%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT211215&quot;&gt;10.15.5 Supplemental Update&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;100%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT211170&quot;&gt;10.15.5&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;29&lt;/td&gt;
      &lt;td&gt;48&lt;/td&gt;
      &lt;td&gt;60.4%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT211100&quot;&gt;10.15.4&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;17&lt;/td&gt;
      &lt;td&gt;27&lt;/td&gt;
      &lt;td&gt;63.0%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT210919&quot;&gt;10.15.3&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;27&lt;/td&gt;
      &lt;td&gt;32&lt;/td&gt;
      &lt;td&gt;84.4%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT210788&quot;&gt;10.15.2&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;41&lt;/td&gt;
      &lt;td&gt;52&lt;/td&gt;
      &lt;td&gt;78.8%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT210722&quot;&gt;10.15.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;21&lt;/td&gt;
      &lt;td&gt;33&lt;/td&gt;
      &lt;td&gt;63.6%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT210634&quot;&gt;10.15&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;7&lt;/td&gt;
      &lt;td&gt;16&lt;/td&gt;
      &lt;td&gt;43.8%&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;One interesting data point in these numbers is that 10.15.2 had the unusual distinction of having 27/32 memory unsafety vulnerabilities be in tcpdump alone.&lt;/p&gt;

&lt;p&gt;Let’s run the macOS 10.13 (High Sierra) numbers as well so we have three generations of data available to us.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Release&lt;/th&gt;
      &lt;th&gt;Memory Unsafety Bugs&lt;/th&gt;
      &lt;th&gt;Total CVE Count&lt;/th&gt;
      &lt;th&gt;Percentage&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208937&quot;&gt;10.13.6&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;20&lt;/td&gt;
      &lt;td&gt;33&lt;/td&gt;
      &lt;td&gt;60.6%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208849&quot;&gt;10.13.5&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;20&lt;/td&gt;
      &lt;td&gt;47&lt;/td&gt;
      &lt;td&gt;42.6%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208692&quot;&gt;10.13.4&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;11&lt;/td&gt;
      &lt;td&gt;44&lt;/td&gt;
      &lt;td&gt;25.0%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208535&quot;&gt;10.13.3 Supplemental Update&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;100%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208465&quot;&gt;10.13.3&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;18&lt;/td&gt;
      &lt;td&gt;27&lt;/td&gt;
      &lt;td&gt;66.7%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208397&quot;&gt;10.13.2 Supplemental Update&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208331&quot;&gt;10.13.2&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;26&lt;/td&gt;
      &lt;td&gt;39&lt;/td&gt;
      &lt;td&gt;66.7%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208221&quot;&gt;10.13.1&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;104&lt;/td&gt;
      &lt;td&gt;161&lt;/td&gt;
      &lt;td&gt;64.6%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208165&quot;&gt;10.13 Supplemental Update&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT208144&quot;&gt;10.13&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;56&lt;/td&gt;
      &lt;td&gt;102&lt;/td&gt;
      &lt;td&gt;54.9%&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Since we conducted the macOS 10.13 analysis years after the fact the numbers include more third party libraries. Apple has a tendency to update their security notes weeks or even months later to include the CVEs of projects (like Apache, tcpdump, et cetera) that were not necessarily public when they shipped the updated version. In macOS 10.13.1, for example, tcpdump had 60 (!!) memory unsafety vulnerabilities.&lt;/p&gt;

&lt;p&gt;Despite these limitations, let’s aggregate the data again.&lt;/p&gt;

&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Release&lt;/td&gt;
      &lt;td&gt;Memory Unsafety Bugs&lt;/td&gt;
      &lt;td&gt;Total CVE Count&lt;/td&gt;
      &lt;td&gt;Percentage&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;macOS 10.15&lt;/td&gt;
      &lt;td&gt;154&lt;/td&gt;
      &lt;td&gt;228&lt;/td&gt;
      &lt;td&gt;67.5%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;macOS 10.14&lt;/td&gt;
      &lt;td&gt;213&lt;/td&gt;
      &lt;td&gt;298&lt;/td&gt;
      &lt;td&gt;71.5%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;macOS 10.13&lt;/td&gt;
      &lt;td&gt;256&lt;/td&gt;
      &lt;td&gt;458&lt;/td&gt;
      &lt;td&gt;55.9%&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;xnu-macos-only&quot;&gt;XNU (macOS only)&lt;/h2&gt;

&lt;p&gt;The above statistics are for any code that ships with macOS or iOS (including the kernel), but what if we counted just kernel (and kernel extension) issues in macOS&lt;sup id=&quot;fnref:3&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;?&lt;/p&gt;

&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Release&lt;/td&gt;
      &lt;td&gt;Memory Unsafety Bugs&lt;/td&gt;
      &lt;td&gt;Total CVE Count&lt;/td&gt;
      &lt;td&gt;Percentage&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;macOS 10.15&lt;/td&gt;
      &lt;td&gt;58&lt;/td&gt;
      &lt;td&gt;65&lt;/td&gt;
      &lt;td&gt;89.2%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;macOS 10.14&lt;/td&gt;
      &lt;td&gt;67&lt;/td&gt;
      &lt;td&gt;76&lt;/td&gt;
      &lt;td&gt;88.2%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;macOS 10.13&lt;/td&gt;
      &lt;td&gt;65&lt;/td&gt;
      &lt;td&gt;88&lt;/td&gt;
      &lt;td&gt;73.9%&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The vast majority of kernel-related CVEs continue to be memory unsafety related.&lt;/p&gt;

&lt;h2 id=&quot;analysis-bugs-vs-security-architecture-redux&quot;&gt;Analysis (Bugs vs Security Architecture Redux)&lt;/h2&gt;

&lt;p&gt;Memory unsafety continues to dominate the total percentage of security bugs on Apple’s platforms. Engineers there should &lt;strong&gt;strenuously encourage management&lt;/strong&gt; to prioritize migration of system daemons and other sensitive binaries to memory safe languages. Doing so would drastically cut the number of security vulnerabilities. Major investment should also be undertaken in determining how to migrate XNU itself. Moving kernel extensions to a C++ userland (via the &lt;a href=&quot;https://developer.apple.com/system-extensions/&quot;&gt;system extension&lt;/a&gt; concept) will mitigate the severity of vulnerabilities in some cases, but is ultimately a poor substitute for a memory safe solution. As we noted last year, &lt;a href=&quot;https://twitter.com/i41nbeer&quot;&gt;Ian Beer&lt;/a&gt; once said:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;given sufficient bug density, security design is irrelevant&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Apple creates robust security architectures, but their systematic under-investment in memory safety (and even some mitigations like pervasive fuzzing) remain a sore spot for 2020.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h4 id=&quot;evangelism&quot;&gt;Evangelism!&lt;/h4&gt;

&lt;p&gt;Need some swag to help convince your coworkers that memory unsafety is the real villain? You’re in luck! We just commissioned some artwork and you, the reader, can buy it! Check out the &lt;a href=&quot;/2020/07/16/fiab-posters/&quot;&gt;blog post&lt;/a&gt; and buy some for the C/C++ lover in your life. And always…&lt;/p&gt;

&lt;div style=&quot;margin:0 auto;width:100%;text-align:center&quot;&gt;
  &lt;a href=&quot;https://www.redbubble.com/shop/ap/52556167&quot;&gt;&lt;img src=&quot;/assets/media/2020/vote.jpg&quot; style=&quot;width:280px&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;No blog post discussing another company’s vulnerabilities would be complete without a discussion of the limitations. Apple provides reasonably well-written descriptions of bugs and these allow us to generally bucket the vulnerabilities into our two categories of interest. However, occasionally a bug will defy easy categorization. For WebKit issues Apple does not distinguish between JIT compiler induced memory unsafety and C/C++ induced. Apple also occasionally releases fixes that are still embargoed. When this happens they release their security notes, but update them at a later date with additional fixes. They denote these additional entries with an “Entry added on &lt;strong&gt;date&lt;/strong&gt;” subscript, but we have typically long-since tweeted about it and won’t catch the additional entries. Since a significant amount of code is shared across Apple’s operating systems (especially at the kernel level) many of these CVEs are duplicates across macOS and iOS. This means you cannot sum iOS and macOS bugs together to get a total across Apple’s platforms without significantly miscounting. Finally, Apple typically does not document security bugs they find and fix internally. Thus, you should not treat these numbers as &lt;strong&gt;exact&lt;/strong&gt; but instead as reasonably accurate estimates of the relative percentage of memory unsafety issues Apple has seen in its products in this time range. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;See &lt;a href=&quot;/2019/07/23/apple-memory-safety/&quot;&gt;Last year’s blog post&lt;/a&gt; for iOS 12 and macOS 10.14 numbers. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;iOS and macOS use the same kernel, but since it’s a different target the set of vulnerabilities may not entirely overlap. Counting iOS kernel vulnerabilities is left as an exercise for the reader. &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
				<pubDate>Fri, 24 Jul 2020 00:00:00 +0000</pubDate>
				<link>/2020/07/24/apple-memory-safety/</link>
				<guid isPermaLink="true">/2020/07/24/apple-memory-safety/</guid>
			</item>
		
			<item>
				<title>Announcing Fish in a Barrel Unsafety Swag</title>
				<description>&lt;h1 style=&quot;text-align:center&quot;&gt;&lt;a href=&quot;https://www.redbubble.com/people/LazyFishBarrel/explore&quot;&gt;Buy Now!&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;&lt;a href=&quot;https://fishinabarrel.github.io&quot;&gt;Fish in a Barrel&lt;/a&gt; (&lt;a href=&quot;https://twitter.com/LazyFishBarrel&quot;&gt;@LazyFishBarrel&lt;/a&gt;) is committed to ending the scourge of memory unsafety. It’s a well-known fact in the security engineering community that branded vulnerabilities are a key contributor to security. However, for too long, people who play defense have suffered from a dearth of quality signage. As part of our efforts, we set out to correct that.&lt;/p&gt;

&lt;div style=&quot;margin:0 auto;width:100%;text-align:center&quot;&gt;
  &lt;a href=&quot;https://www.redbubble.com/shop/ap/52556167&quot;&gt;&lt;img src=&quot;/assets/media/2020/vote.jpg&quot; style=&quot;width:280px;right-padding:20px&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;https://www.redbubble.com/shop/ap/52555285&quot;&gt;&lt;img src=&quot;/assets/media/2020/blackboard.jpg&quot; style=&quot;width:280px&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;Fish in a Barrel has considerately commissioned six compositions cunningly crafted to remind both you and the people you are socially distancing with of the importance of memory safety. As with all great art, these posters (and stickers!) enthusiastically ape the NSA’s own declassified security posters.&lt;/p&gt;

&lt;p&gt;Help spur foundational change in your software engineering organization and the broader world by plastering your home, your possessions, and perhaps one day your office with our incredible art.&lt;/p&gt;

&lt;p&gt;All products are sold at cost, because outside of memory unsafety the thing we hate most is effort. After all, we’re just shooting fish in a barrel.&lt;/p&gt;

&lt;p&gt;Don’t delay, &lt;a href=&quot;https://www.redbubble.com/people/LazyFishBarrel/explore&quot; style=&quot;font-weight:bold&quot;&gt;buy today!&lt;/a&gt; We may or may not add new designs over time, no promises.&lt;/p&gt;

&lt;div style=&quot;margin:0 auto;width:100%;text-align:center&quot;&gt;
  &lt;a href=&quot;https://www.redbubble.com/shop/ap/52555927&quot;&gt;&lt;img src=&quot;/assets/media/2020/upsidedown.jpg&quot; style=&quot;width:280px;right-padding:10px&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;https://www.redbubble.com/shop/ap/52555713&quot;&gt;&lt;img src=&quot;/assets/media/2020/fumble.jpg&quot; style=&quot;width:280px;left-padding:10px&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;https://www.redbubble.com/shop/ap/52555511&quot;&gt;&lt;img src=&quot;/assets/media/2020/complicated.jpg&quot; style=&quot;width:280px;left-padding:10px&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;https://www.redbubble.com/shop/ap/52554659&quot;&gt;&lt;img src=&quot;/assets/media/2020/bird.jpg&quot; style=&quot;width:280px;left-padding:10px&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;h1 style=&quot;text-align:center&quot;&gt;&lt;a href=&quot;https://www.redbubble.com/people/LazyFishBarrel/explore&quot;&gt;Buy Now!&lt;/a&gt;&lt;/h1&gt;
</description>
				<pubDate>Thu, 16 Jul 2020 00:00:00 +0000</pubDate>
				<link>/2020/07/16/fiab-posters/</link>
				<guid isPermaLink="true">/2020/07/16/fiab-posters/</guid>
			</item>
		
			<item>
				<title>Memory Unsafety in Apple&apos;s Operating Systems</title>
				<description>&lt;p&gt;Over at &lt;a href=&quot;https://twitter.com/lazyfishbarrel&quot;&gt;@LazyFishBarrel&lt;/a&gt; we’ve been tweeting statistics about the proportion of memory unsafety related vulnerabilities in various software for a little over a year&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. However, while Twitter is a great medium for dispensing this information on a per release basis, it’s not great for deeper analysis. Rather than just talking about a single release, what if we aggregated the total memory unsafety-related vulnerability statistics in Apple’s two flagship operating systems: iOS and macOS?&lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;h2 id=&quot;what-is-memory-unsafety-and-why-should-i-care&quot;&gt;What is memory unsafety and why should I care?&lt;/h2&gt;

&lt;p&gt;Memory unsafety&lt;sup id=&quot;fnref:3&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt; is a property of a programming language that allows the creation of bugs and security vulnerabilities related to memory access. Languages like C and C++&lt;sup id=&quot;fnref:4&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:4&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt; are memory unsafe because they allow memory violations such as use of uninitialized memory, double free, buffer overflow, use after free, etc. To avoid these the programmer must perfectly allocate, write, read, and deallocate memory or else serious vulnerabilities can easily occur. These bugs are especially frustrating because they represent an class of issues that can be &lt;strong&gt;entirely fixed&lt;/strong&gt; by moving to languages that do not suffer from these limitations&lt;sup id=&quot;fnref:5&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:5&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;5&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;h2 id=&quot;ios-12&quot;&gt;iOS 12&lt;/h2&gt;

&lt;p&gt;iOS 12 was released September 17, 2018 and has subsequently had a total of 11 feature and point releases. Unlike macOS, the iOS 12 series has several small bugfix releases that did not correct security issues. These are marked as N/A for bugs/CVEs but remain present in the list below.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Total CVE Count&lt;/th&gt;
      &lt;th&gt;Memory Unsafety Bugs&lt;/th&gt;
      &lt;th&gt;Percentage&lt;/th&gt;
      &lt;th&gt;Release&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;37&lt;/td&gt;
      &lt;td&gt;28&lt;/td&gt;
      &lt;td&gt;75.7%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT210346&quot;&gt;12.4&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;12.3.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;12.3.1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;42&lt;/td&gt;
      &lt;td&gt;34&lt;/td&gt;
      &lt;td&gt;81%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT210118&quot;&gt;12.3&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;51&lt;/td&gt;
      &lt;td&gt;29&lt;/td&gt;
      &lt;td&gt;56.9%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT209599&quot;&gt;12.2&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;50%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT209520&quot;&gt;12.1.4&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;31&lt;/td&gt;
      &lt;td&gt;27&lt;/td&gt;
      &lt;td&gt;87.1%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT209443&quot;&gt;12.1.3&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;N/A&lt;/td&gt;
      &lt;td&gt;12.1.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;24&lt;/td&gt;
      &lt;td&gt;13&lt;/td&gt;
      &lt;td&gt;54.2%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT209340&quot;&gt;12.1.1&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;32&lt;/td&gt;
      &lt;td&gt;20&lt;/td&gt;
      &lt;td&gt;62.5%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT209192&quot;&gt;12.1&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT209162&quot;&gt;12.0.1&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;38&lt;/td&gt;
      &lt;td&gt;20&lt;/td&gt;
      &lt;td&gt;52.6%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT209106&quot;&gt;12.0&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Across the entirety of iOS 12 Apple has fixed &lt;strong&gt;261&lt;/strong&gt; CVEs, &lt;strong&gt;173&lt;/strong&gt; of which were memory unsafety. That’s &lt;strong&gt;66.3%&lt;/strong&gt; of all vulnerabilities.&lt;/p&gt;

&lt;h2 id=&quot;mojave-aka-macos-1014&quot;&gt;Mojave (aka macOS 10.14)&lt;/h2&gt;

&lt;p&gt;Apple released macOS 10.14 Mojave on September 24, 2018 and subsequently has issued 6 point releases.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Total CVE Count&lt;/th&gt;
      &lt;th&gt;Memory Unsafety Bugs&lt;/th&gt;
      &lt;th&gt;Percentage&lt;/th&gt;
      &lt;th&gt;Release&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;44&lt;/td&gt;
      &lt;td&gt;36&lt;/td&gt;
      &lt;td&gt;81.8%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT210348&quot;&gt;10.14.6&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;45&lt;/td&gt;
      &lt;td&gt;40&lt;/td&gt;
      &lt;td&gt;88.9%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT210119&quot;&gt;10.14.5&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;38&lt;/td&gt;
      &lt;td&gt;20&lt;/td&gt;
      &lt;td&gt;52.6%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT209600&quot;&gt;10.14.4&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;23&lt;/td&gt;
      &lt;td&gt;22&lt;/td&gt;
      &lt;td&gt;95.7%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT209446&quot;&gt;10.14.3&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;13&lt;/td&gt;
      &lt;td&gt;11&lt;/td&gt;
      &lt;td&gt;84.6%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT209341&quot;&gt;10.14.2&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;71&lt;/td&gt;
      &lt;td&gt;40&lt;/td&gt;
      &lt;td&gt;56.3%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT209193&quot;&gt;10.14.1&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;64&lt;/td&gt;
      &lt;td&gt;44&lt;/td&gt;
      &lt;td&gt;68.8%&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://support.apple.com/en-us/HT209139&quot;&gt;10.14&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Across the entirety of Mojave Apple has fixed &lt;strong&gt;298&lt;/strong&gt; CVEs, &lt;strong&gt;213&lt;/strong&gt; of which were memory unsafety. That’s &lt;strong&gt;71.5%&lt;/strong&gt; of all vulnerabilities.&lt;/p&gt;

&lt;h2 id=&quot;xnu-macos-only&quot;&gt;XNU (macOS only)&lt;/h2&gt;

&lt;p&gt;The above statistics are for any code that ships with macOS or iOS (including the kernel), but what if we counted just kernel (and kernel extension) issues in macOS&lt;sup id=&quot;fnref:6&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:6&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;6&lt;/a&gt;&lt;/sup&gt;?&lt;/p&gt;

&lt;p&gt;By slicing the numbers this way we find that &lt;strong&gt;67&lt;/strong&gt; out of &lt;strong&gt;76&lt;/strong&gt; vulnerabilities, a whopping &lt;strong&gt;88.2%&lt;/strong&gt;, were attributable directly to memory unsafety.&lt;/p&gt;

&lt;h2 id=&quot;bugs-vs-security-architecture&quot;&gt;Bugs vs Security Architecture&lt;/h2&gt;

&lt;p&gt;At BlackHat USA 2018 &lt;a href=&quot;https://twitter.com/i41nbeer&quot;&gt;Ian Beer&lt;/a&gt; gave a talk called &lt;a href=&quot;https://docs.google.com/presentation/d/16LZ6T-tcjgp3T8_N3m0pa5kNA1DwIsuMcQYDhpMU7uU/edit?usp=sharing&quot;&gt;the path to EL1 in iOS 11&lt;/a&gt;. In it, he discusses Apple’s approach to security design and contends that&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;security systems design is making promises which poor software development practises cannot keep&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;He goes on to state that&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;given sufficient bug density, security design is irrelevant&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As you can see from the above statistics, writing software in memory unsafe languages like C and C++ is providing at least two thirds of that bug density. Additionally, although we have not conducted a specific analysis to this effect, it is relatively rare for logical vulnerabilities to cause code execution (with the exception of JIT bugs), while this is a common outcome for memory corruption. Thus, not only is memory unsafety causing the majority of all security bugs, but those bugs are also more likely to be severe.&lt;/p&gt;

&lt;p&gt;Switching languages can’t be done overnight, but incremental conversion to a memory safe world needs to be a top priority. Improving the memory safe toolchains, training programmers in new idioms, and phasing out legacy memory unsafe codebases is not a luxury, it’s a necessity.&lt;/p&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;And we’ve been &lt;a href=&quot;https://alexgaynor.net/2017/nov/20/a-vulnerability-by-any-other-name/&quot;&gt;harping on it&lt;/a&gt; for longer than that. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;No blog post discussing another company’s vulnerabilities would be complete without a discussion of the limitations.  Apple provides reasonably well-written descriptions of bugs and these allow us to generally bucket the vulnerabilities into our two categories of interest. However, occasionally a bug will defy easy categorization. For WebKit issues Apple does not distinguish between JIT compiler induced memory unsafety and C/C++ induced.  Apple also occasionally releases fixes that are still embargoed. When this happens they release their security notes, but update them at a later date with additional fixes. They denote these additional entries with an “Entry added on &lt;strong&gt;date&lt;/strong&gt;” subscript, but we have typically long-since tweeted about it and won’t catch the additional entries.  Since a significant amount of code is shared across Apple’s operating systems (especially at the kernel level) many of these CVEs are duplicates across macOS and iOS. This means you cannot sum iOS and macOS bugs together to get a total across Apple’s platforms without significantly miscounting.  For the above reasons you should not treat these numbers as &lt;strong&gt;exact&lt;/strong&gt; but instead as reasonably accurate estimates of the relative percentage of memory unsafety issues Apple has seen in its products in this time range. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;We say memory unsafety instead of “not memory safe” because we want to emphasize the fact that these languages are &lt;a href=&quot;https://en.wikipedia.org/wiki/Unsafe_at_Any_Speed&quot;&gt;unsafe at any speed&lt;/a&gt;. You can learn more about how modern languages achieve memory safety with little to no performance penalty in Mozilla’s &lt;a href=&quot;https://hacks.mozilla.org/2019/01/fearless-security-memory-safety/&quot;&gt;Fearless Security: Memory Safety&lt;/a&gt; blog post. &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;See &lt;a href=&quot;https://alexgaynor.net/2019/apr/21/modern-c++-wont-save-us/&quot;&gt;Modern C++ Won’t Save Us&lt;/a&gt;. &lt;a href=&quot;#fnref:4&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:5&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Yes, of course migration is difficult! Any company doing it will need to retrain people, make toolchain changes, and undoubtedly invest in improving both the compiler and language itself. If only there was some enormous company with vast resources and a commitment to privacy and security who could embark on a journey like this… &lt;a href=&quot;#fnref:5&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:6&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;iOS and macOS use the same kernel, but since it’s a different target the set of vulnerabilities may not entirely overlap. Counting iOS kernel vulnerabilities is left as an exercise for the reader. &lt;a href=&quot;#fnref:6&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
				<pubDate>Tue, 23 Jul 2019 00:00:00 +0000</pubDate>
				<link>/2019/07/23/apple-memory-safety/</link>
				<guid isPermaLink="true">/2019/07/23/apple-memory-safety/</guid>
			</item>
		
			<item>
				<title>Apple Censoring the News+</title>
				<description>&lt;p&gt;Yesterday Apple announced News+, “&lt;a href=&quot;https://www.apple.com/newsroom/2019/03/apple-launches-apple-news-plus-an-immersive-magazine-and-news-reading-experience/&quot;&gt;an immersive magazine and news reading experience&lt;/a&gt;”. This immersive experience is, for now, a US/Canada only product, with Apple noting: “Available in the US and Canada, Apple News+ presents the best and most relevant articles to meet any range of interests from renowned publications such as Vogue, National Geographic Magazine, People, ELLE, The Wall Street Journal and Los Angeles Times.”&lt;/p&gt;

&lt;p&gt;Starting with the US is understandable for a variety of reasons, but in the modern world people travel between countries. So, now that Apple accepts money to act as the distributor of news content, what users is it available to?&lt;/p&gt;

&lt;h3 id=&quot;a-brief-digression-about-feature-gating&quot;&gt;A Brief Digression About Feature Gating&lt;/h3&gt;

&lt;p&gt;Apple sells its products in many jurisdictions and those products have myriad features. Sometimes those features need local regulatory approval (like heart rate variability or ECG/EKG on Apple Watch) and on occasion countries decide specific features are unacceptable (like FaceTime in the UAE, FaceTime Audio (but not video!) in China, etc). To enforce these restrictions Apple uses hardware identifiers in phones sold within these regions. If the phone comes from that region then the prohibited features will be disabled &lt;em&gt;even if the operating system is set to a region where the feature is available&lt;/em&gt;. In my experience this is a surprising fact to many people. So, an Apple Watch Series 4 sold in France will not allow ECG/EKG readings even if you set the region to US, an iPhone sold in China will not support FaceTime Audio with any region setting, and an iPhone sold in the UAE will not support FaceTime Video with any region setting.&lt;/p&gt;

&lt;p&gt;Conversely, a Series 4 watch sold in the US will continue to support ECG features even when physically taken to another country and a US-based iPhone is perfectly capable of using FaceTime Audio (without a VPN) inside mainland China.&lt;/p&gt;

&lt;h3 id=&quot;china-and-the-news&quot;&gt;China and the News&lt;/h3&gt;

&lt;p&gt;Apple only shows the News app on phones that are within the appropriate region. However, this region enforcement is not accomplished via the hardware feature gating described above. Rather, it is a pure software region block that can be bypassed by setting your operating system’s region setting to a supported one. Since the launch of News in iOS 9 the set of supported regions has slowly expanded to the following: US, Canada, UK, and Australia. So to see the News app you can change your region and once you have it downloaded traveling to other countries will not disable News and you’ll be able to use all of its features…with one exception.&lt;/p&gt;

&lt;p&gt;News content is a sensitive topic in China. The government exercises a significant degree of control over information sources so it is unsurprising that Apple would choose to not support News there. However, instead of simply being locked behind a hardware feature gate, Apple chose to disable it much more forcefully. If you enter China with a US iPhone (e.g. one purchased in the US from a US carrier or at a US Apple Store), using a US carrier, with your phone set to the US region, and with location services disabled for the News app, you will still receive this message upon opening News:&lt;/p&gt;

&lt;div style=&quot;margin:0 auto;width:281px;text-align:center&quot;&gt;
  &lt;img src=&quot;/assets/media/2019/feed-unavailable.png&quot; style=&quot;width:281px&quot; /&gt;
  &lt;br /&gt;
  &lt;span style=&quot;font-size:smaller;font-style:italic&quot;&gt;Figure A: Some Bullshit&lt;/span&gt;
  &lt;br /&gt;
&lt;/div&gt;

&lt;p&gt;To accomplish this censorship Apple is using a form of location fingerprinting that is not available to normal applications on iOS. It works like this: despite the fact that your phone uses a SIM from a US carrier it must connect to a Chinese cellular network. Apple is using private APIs to identify that you are in mainland China based on the name of the underlying cellular network and blocking access to the News app. This information is not available via public APIs in iOS&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; specifically to improve privacy for users.&lt;/p&gt;

&lt;p&gt;This censorship occurs despite the fact that when in China a cell phone using a foreign SIM is not subject to the firewall restrictions (all traffic is tunneled back to your provider first), so Google, Twitter, Facebook, et al all work fine on a non-mainland China SIM even though you’re connected via China Mobile or China Unicom’s network.&lt;/p&gt;

&lt;p&gt;All of the above has been true since 2015 when News launched and it was even covered at the time by a &lt;a href=&quot;https://www.nytimes.com/2015/10/12/technology/apple-is-said-to-deactivate-its-news-app-in-china.html&quot;&gt;variety&lt;/a&gt; &lt;a href=&quot;https://qz.com/521871/apple-is-blocking-its-news-app-from-everyone-in-china-even-if-their-phone-is-registered-in-the-us/&quot;&gt;of&lt;/a&gt; &lt;a href=&quot;http://money.cnn.com/2015/10/12/technology/apple-news-blocked-china/&quot;&gt;outlets&lt;/a&gt;. What makes this even uglier now is that Apple has chosen to start &lt;strong&gt;selling news subscriptions while simultaneously censoring access for their customers on a low-level regional basis&lt;/strong&gt;. A US citizen in China can (without resorting to an “illegal” VPN) load webpages like the Washington Post&lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; , New York Times, or WSJ on their (non-Chinese SIM card) phone but they can’t access Apple News. I find it profoundly worrying that Apple is seemingly willing to use technology only available to the platform holder to censor far above and beyond typical feature gating when it comes to news.&lt;/p&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;There is an API for querying the cellular network, but it will only return your carrier, not the network you may be roaming on. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Incidentally, WaPo isn’t blocked by the firewall at all. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
				<pubDate>Tue, 26 Mar 2019 00:00:00 +0000</pubDate>
				<link>/2019/03/26/apple-censoring-the-news-plus/</link>
				<guid isPermaLink="true">/2019/03/26/apple-censoring-the-news-plus/</guid>
			</item>
		
			<item>
				<title>Master of All Science - Rick &amp; Morty</title>
				<description>&lt;p&gt;We’ve been quiet on the &lt;a href=&quot;https://frinkiac.com&quot;&gt;Frinkiac&lt;/a&gt; and &lt;a href=&quot;https://morbotron.com&quot;&gt;Morbotron&lt;/a&gt; front for awhile, but today we’re introducing the newest member of the CompuGlobalHyperMegaCap family: &lt;a href=&quot;https://masterofallscience.com&quot;&gt;Master of All Science&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;GIF and meme your way to happiness&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; with all the tools you’ve come to expect from our sites, but now with Rick &amp;amp; Morty! We’ve got every episode aired to date conveniently indexed so even an idiot like Jerry can find what they’re looking for. Learn important facts like &lt;a href=&quot;https://masterofallscience.com/?q=pluto%20is%20a%20cold%20celestial%20dwarf&quot;&gt;Pluto is a cold, cold celestial dwarf&lt;/a&gt;, buy some &lt;a href=&quot;https://masterofallscience.com/?q=turbulent%20juice&quot;&gt;turbulent juice&lt;/a&gt; while watching &lt;a href=&quot;https://masterofallscience.com/?q=ball%20fondlers&quot;&gt;ball fondlers&lt;/a&gt;, or just listen to it &lt;a href=&quot;https://masterofallscience.com/?q=feels%20good&quot;&gt;feels good&lt;/a&gt; while you purge! You’ll be like a god, the &lt;a href=&quot;https://masterofallscience.com/?q=infinite%20rick&quot;&gt;infinite Rick&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Of course, we’d be remiss if we didn’t mention that this project is all about that &lt;a href=&quot;https://masterofallscience.com/?q=szechuan%20sauce&quot;&gt;Szechuan sauce&lt;/a&gt;. We’re driven by finding that McNugget sauce. If it takes nine years, we want it &lt;a href=&quot;https://twitter.com/JustinRoiland/status/891521911460470784&quot;&gt;Justin&lt;/a&gt;! Nine years of &lt;a href=&quot;https://masterofallscience.com&quot;&gt;Master of All Science&lt;/a&gt;, Justin, just for that sauce!&lt;/p&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Not a guarantee. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
				<pubDate>Sun, 30 Jul 2017 00:00:00 +0000</pubDate>
				<link>/2017/07/30/master-of-all-science-rick-and-morty/</link>
				<guid isPermaLink="true">/2017/07/30/master-of-all-science-rick-and-morty/</guid>
			</item>
		
			<item>
				<title>PyCA cryptography 2.0</title>
				<description>&lt;p&gt;&lt;a href=&quot;https://github.com/pyca/cryptography&quot;&gt;pyca/cryptography&lt;/a&gt; 2.0 was been released today! This sounds like a big release, but it’s really just the 20th feature release we’ve done since starting the project&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;But if it’s just a typical feature release then why the blog post? Well, coincidentally 2.0 actually is a huge release! In addition to adding support for ChaCha20Poly1305, AES-CCM, X25519 key exchange, Diffie-Hellman improvements, and various X.509 additions, we’re also shipping a &lt;a href=&quot;https://www.python.org/dev/peps/pep-0513/&quot;&gt;manylinux1&lt;/a&gt; wheel. This means users on manylinux1 compatible distributions (basically any Linux using glibc and running on x86 or x86_64) will no longer need a compiler (or even OpenSSL) when installing cryptography. Just &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pip install cryptography&lt;/code&gt; and you’re ready to go without worrying about whether or not your OpenSSL is recent enough to support ChaCha20Poly1305 or if X25519 will be available.&lt;/p&gt;

&lt;p&gt;Of course, nothing is perfect and this magical new world of Linux binaries comes with a few caveats:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;You need to be on pip 8.1+ to get the wheel. Otherwise pip doesn’t know about manylinux1 and will continue to download the sdist and compile.&lt;/li&gt;
  &lt;li&gt;Your distribution has to use glibc. Sorry Alpine Linux users.&lt;/li&gt;
  &lt;li&gt;Your system must be x86 or x86-64 based. Raspberry Pis or other ARM systems can’t use these wheels&lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/li&gt;
  &lt;li&gt;Since we’re bundling OpenSSL with the wheel, merely updating OpenSSL on your system is insufficient! This means you will need to upgrade cryptography whenever a new OpenSSL release occurs. Be sure to let your ops people know about this! If this is not something you can do at this time then we have documentation explaining &lt;a href=&quot;https://cryptography.io/en/latest/installation/#building&quot;&gt;how to avoid the prebuilt wheel&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, this change has an interesting cascading effect on pyOpenSSL. OpenSSL sets default values at compile-time for the path to trusted root certificates. This path is used when a user calls pyOpenSSL’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Context.set_default_verify_paths()&lt;/code&gt; and then subsequent TLS connections using that context are verified with those roots. With a manylinux1 wheel the default path does not match the system’s path. This causes validation failures on TLS connections since it is unable to find the system root store. To avoid this we released pyOpenSSL 17.1.0 last month, so be sure to upgrade pyOpenSSL when you upgrade cryptography!&lt;/p&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Maybe we should switch to &lt;a href=&quot;http://calver.org&quot;&gt;calver&lt;/a&gt;, but that’s a debate for another time. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;If you want to help define a specification for ARM wheels you might want to join the &lt;a href=&quot;https://mail.python.org/mailman/listinfo/wheel-builders&quot;&gt;wheel builders&lt;/a&gt; mailing list. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
				<pubDate>Mon, 17 Jul 2017 00:00:00 +0000</pubDate>
				<link>/2017/07/17/cryptography-2.0/</link>
				<guid isPermaLink="true">/2017/07/17/cryptography-2.0/</guid>
			</item>
		
			<item>
				<title>Data Driven Decisions Using PyPI Download Statistics</title>
				<description>&lt;p&gt;What platform do my users run on? How many users do I have? Is it okay to drop support for &lt;em&gt;something&lt;/em&gt;?&lt;/p&gt;

&lt;p&gt;Open source library developers have an analytics problem. How do you answer questions like this when people are embedding your software as a component of their own product?&lt;/p&gt;

&lt;p&gt;For example, you, the developer of the library &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;frinkiac-iac&lt;/code&gt; would like to drop support for Python 2.6 because it is old, unsupported by upstream, and restricting your use of newer Python features. Is it okay to do this? Since you don’t have any data you may attempt to compensate for this lack of insight in a variety of ways:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Reach out through your community (mailing lists, bug trackers, IRC channels) to tentatively suggest the idea.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Do a release with a deprecation warning with a timeline for removal that will potentially be massively pushed back as users complain.&lt;sup id=&quot;fnref:3&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Just remove it and see if anybody complains.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Wait for a major package to do it and follow their lead.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these choices can work, but frequently result in major breakage for users or an unacceptably long timeline for removal resulting in significant maintenance burden&lt;sup id=&quot;fnref:4&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:4&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;. You need data, but it’s so hard to collect it. &lt;a href=&quot;https://frinkiac.com/caption/S09E22/750715&quot;&gt;Can’t someone else do it?&lt;/a&gt;&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;h2 id=&quot;bigquery&quot;&gt;BigQuery&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://mail.python.org/pipermail/distutils-sig/2016-May/028986.html&quot;&gt;Quietly announced&lt;/a&gt; back in May 2016, PyPI download statistics are the most powerful tool a Python developer can use to inform their decision making. To unleash its &lt;a href=&quot;https://frinkiac.com/caption/S09E23/465781&quot;&gt;awesome power&lt;/a&gt; start by loading the &lt;a href=&quot;https://bigquery.cloud.google.com/dataset/the-psf:pypi&quot;&gt;dataset&lt;/a&gt;. &lt;strong&gt;Preemptive apology:&lt;/strong&gt; If you are a new Google Cloud user you may be confronted with an unpleasant set of modals asking you to agree to various things and create a new project. What you actually need to do is get to billing and start a free trial&lt;sup id=&quot;fnref:5&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:5&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;. Once you’ve got the BigQuery console available you should be able to click that link again and access the page. Now you can click Compose Query!&lt;/p&gt;

&lt;p&gt;BigQuery uses a SQL-like language. A &lt;a href=&quot;https://cloud.google.com/bigquery/docs/reference/legacy-sql&quot;&gt;query reference&lt;/a&gt; is available to help you write your own queries. Additionally, you can see the set of available fields you can query against by clicking &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;downloads&lt;/code&gt; on the left pane and looking at the schema. One note: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;file.project&lt;/code&gt; is the &lt;a href=&quot;https://www.python.org/dev/peps/pep-0503/#normalized-names&quot;&gt;normalized name&lt;/a&gt; of the project.&lt;/p&gt;

&lt;p&gt;With this robust data set we can make substantially more informed decisions, but here are some examples to help you out. All the examples here use what Google references as “legacy SQL”. Despite the name this is the default for queries, but feel free to use the &lt;a href=&quot;https://cloud.google.com/bigquery/docs/reference/standard-sql/&quot;&gt;standard SQL&lt;/a&gt; if you’d like!&lt;/p&gt;

&lt;h3 id=&quot;query-python-versions&quot;&gt;Query: Python Versions&lt;/h3&gt;

&lt;p&gt;In the original scenario we were curious if we could drop support for Python 2.6. What does that query look like? For the following examples we’ll be using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cryptography&lt;/code&gt; since that’s my primary project and the one I run queries on most commonly.&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;REGEXP_EXTRACT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;^([^&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;]+&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;[^&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;]+)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;python_version&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;download_count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;TABLE_DATE_RANGE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;psf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pypi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;project&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;cryptography&apos;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GROUP&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;python_version&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;download_count&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DESC&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;LIMIT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And our results (as of 2016-12-09):&lt;/p&gt;

&lt;table style=&quot;width:100%&quot;&gt;
  &lt;tr&gt;&lt;th&gt;Row&lt;/th&gt;&lt;th&gt;python_version&lt;/th&gt;&lt;th&gt;download_count&lt;/th&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;2.7&lt;/td&gt;&lt;td&gt;2208835&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;3.5&lt;/td&gt;&lt;td&gt;202515&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;2.6&lt;/td&gt;&lt;td&gt;109134&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;null&lt;/td&gt;&lt;td&gt;91076&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;3.4&lt;/td&gt;&lt;td&gt;87837&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;6&lt;/td&gt;&lt;td&gt;3.3&lt;/td&gt;&lt;td&gt;5623&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;7&lt;/td&gt;&lt;td&gt;3.6&lt;/td&gt;&lt;td&gt;1354&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;8&lt;/td&gt;&lt;td&gt;3.7&lt;/td&gt;&lt;td&gt;643&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;9&lt;/td&gt;&lt;td&gt;1.17&lt;/td&gt;&lt;td&gt;341&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;10&lt;/td&gt;&lt;td&gt;3.2&lt;/td&gt;&lt;td&gt;270&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;11&lt;/td&gt;&lt;td&gt;3.1&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;12&lt;/td&gt;&lt;td&gt;2.4&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;13&lt;/td&gt;&lt;td&gt;2.5&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;As you can see, Python 2.6 makes up 109,134 out of 2,707,632 downloads in the
past 30 days. This represents roughly 4% of downloads. Is that low enough to
drop support?&lt;sup id=&quot;fnref:6&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:6&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;5&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;null&lt;/code&gt; also makes up approximately 3.4% of downloads. These
are downloads from PyPI using clients that do not support sending the statistics
we’re querying against. This can be an older version of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pip&lt;/code&gt; or alternate
clients. You also see 341 downloads from 1.17, which is…who knows!
When making maintenance decisions you should factor these unknowns as you
feel appropriate.&lt;/p&gt;

&lt;h3 id=&quot;query-openssl-versions&quot;&gt;Query: OpenSSL versions&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cryptography&lt;/code&gt; supports a wide variety of OpenSSL versions. However, supporting
0.9.8 and 1.0.0 are a significant challenge since they are missing many of the
features we need (and are no longer supported by upstream). Let’s craft a
query to see what versions of OpenSSL are in use:&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;system&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;REGEXP_EXTRACT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;openssl_version&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;^OpenSSL ([^ ]+) &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;openssl_version&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;download_count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;TABLE_DATE_RANGE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;psf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pypi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;openssl_version&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;IS&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GROUP&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;system&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;openssl_version&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;HAVING&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;download_count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;download_count&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DESC&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;LIMIT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This gives us a view of what OpenSSL is linked against Python broken down by platform:&lt;/p&gt;

&lt;table style=&quot;width:100%&quot;&gt;
  &lt;tr&gt;&lt;th&gt;Row&lt;/th&gt;&lt;th&gt;details_system_name&lt;/th&gt;&lt;th&gt;openssl_version&lt;/th&gt;&lt;th&gt;download_count&lt;/th&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;Linux&lt;/td&gt;&lt;td&gt;1.0.1f&lt;/td&gt;&lt;td&gt;56152115&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;Linux&lt;/td&gt;&lt;td&gt;1.0.1t&lt;/td&gt;&lt;td&gt;26301089&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;Linux&lt;/td&gt;&lt;td&gt;1.0.2g&lt;/td&gt;&lt;td&gt;25892721&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;Linux&lt;/td&gt;&lt;td&gt;1.0.1e-fips&lt;/td&gt;&lt;td&gt;24082526&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;Linux&lt;/td&gt;&lt;td&gt;1.0.1&lt;/td&gt;&lt;td&gt;19199858&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;6&lt;/td&gt;&lt;td&gt;Darwin&lt;/td&gt;&lt;td&gt;0.9.8zh&lt;/td&gt;&lt;td&gt;15528451&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;7&lt;/td&gt;&lt;td&gt;Linux&lt;/td&gt;&lt;td&gt;1.0.1k-fips&lt;/td&gt;&lt;td&gt;9029119&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;8&lt;/td&gt;&lt;td&gt;Linux&lt;/td&gt;&lt;td&gt;1.0.2j&lt;/td&gt;&lt;td&gt;8499043&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;9&lt;/td&gt;&lt;td&gt;Windows&lt;/td&gt;&lt;td&gt;1.0.2h&lt;/td&gt;&lt;td&gt;5037984&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;10&lt;/td&gt;&lt;td&gt;Darwin&lt;/td&gt;&lt;td&gt;1.0.2j&lt;/td&gt;&lt;td&gt;3077958&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;While I haven’t provided the entire set of results it turns out less than 100,000
downloads out of 210,063,137 were made using OpenSSL 1.0.0. 0.9.8 holds a much
greater share, but only due to Darwin (aka macOS…aka OS X). In cryptography’s
case we statically link wheels on Mac and Windows so we can ignore the OpenSSL
version on those platforms. Looks like dropping 0.9.8 and 1.0.0 is probably safe!&lt;sup id=&quot;fnref:7&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:7&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;6&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;h3 id=&quot;query-most-popular-projects&quot;&gt;Query: Most Popular Projects&lt;/h3&gt;

&lt;p&gt;Maybe you just want to know how popular your package is relative to others in
the past 30 days.&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;project&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;total_downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;TABLE_DATE_RANGE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;psf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pypi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GROUP&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;project&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;total_downloads&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DESC&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;LIMIT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;query-how-many-downloads-did-my-project-get&quot;&gt;Query: How Many Downloads Did My Project Get?&lt;/h3&gt;

&lt;p&gt;Or maybe just your package:&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;total_downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;TABLE_DATE_RANGE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;psf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pypi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;project&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;cryptography&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;query-downloads-by-filename-filtered-by-project-and-version&quot;&gt;Query: Downloads By Filename Filtered By Project and Version&lt;/h3&gt;

&lt;p&gt;If you ship multiple release artifacts (platform/version specific wheels as
well as sdist) this query can show you their popularity.&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;total_downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;TABLE_DATE_RANGE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;psf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pypi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;project&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;cryptography&apos;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;AND&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filename&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;like&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;%1.6%&apos;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GROUP&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filename&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;total_downloads&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DESC&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;LIMIT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;query-python-2-vs-3-for-a-single-project&quot;&gt;Query: Python 2 vs 3 For A Single Project&lt;/h3&gt;

&lt;p&gt;We broke it down by Python release previously, but what if you just want to know 2 vs 3?&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;ROUND&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CASE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHEN&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;REGEXP_EXTRACT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;^([^&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;]+)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;3&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;THEN&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ELSE&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AS&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;percent_3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;download_count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;TABLE_DATE_RANGE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;psf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pypi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;project&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;cryptography&apos;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;download_count&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DESC&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;LIMIT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In cryptography’s case Python 3 currently makes up 11% of downloads&lt;sup id=&quot;fnref:8&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:8&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;7&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;h3 id=&quot;query-percentage-of-downloads-by-python-3-in-the-top-100&quot;&gt;Query: Percentage of Downloads By Python 3 In The Top 100&lt;/h3&gt;

&lt;p&gt;Of course, a trivial modification and we can see the Python 3 percentage in the top 100 packages:&lt;/p&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;project&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;ROUND&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CASE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHEN&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;REGEXP_EXTRACT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;^([^&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;]+)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;3&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;THEN&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ELSE&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AS&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;percent_3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;download_count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;TABLE_DATE_RANGE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;psf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pypi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;by&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;project&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;download_count&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DESC&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;LIMIT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;query-highest-python-3-usage-with-more-than-100000-downloads-per-30-days&quot;&gt;Query: Highest Python 3 Usage With More Than 100,000 Downloads Per 30 Days&lt;/h3&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;project&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;ROUND&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CASE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHEN&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;REGEXP_EXTRACT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;^([^&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;]+)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;3&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;THEN&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ELSE&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AS&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;percent_3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;download_count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;TABLE_DATE_RANGE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;psf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pypi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;by&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;project&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;HAVING&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;download_count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100000&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;percent_3&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DESC&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;LIMIT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The top 10 is interesting here:&lt;/p&gt;

&lt;table style=&quot;width:100%&quot;&gt;
  &lt;tr&gt;&lt;th&gt;Row&lt;/th&gt;&lt;th&gt;Date&lt;/th&gt;&lt;th&gt;Percentage&lt;/th&gt;&lt;th&gt;Total Downloads&lt;/th&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;async-timeout&lt;/td&gt;&lt;td&gt;98.8&lt;/td&gt;&lt;td&gt;117724&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;multidict&lt;/td&gt;&lt;td&gt;89.4&lt;/td&gt;&lt;td&gt;157661&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;yarl&lt;/td&gt;&lt;td&gt;82.1&lt;/td&gt;&lt;td&gt;118081&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;aiohttp&lt;/td&gt;&lt;td&gt;74.6&lt;/td&gt;&lt;td&gt;209035&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;azure-servicebus&lt;/td&gt;&lt;td&gt;72.3&lt;/td&gt;&lt;td&gt;151706&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;6&lt;/td&gt;&lt;td&gt;plumbum&lt;/td&gt;&lt;td&gt;60.1&lt;/td&gt;&lt;td&gt;131295&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;7&lt;/td&gt;&lt;td&gt;mysqlclient&lt;/td&gt;&lt;td&gt;57.9&lt;/td&gt;&lt;td&gt;140905&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;8&lt;/td&gt;&lt;td&gt;pkginfo&lt;/td&gt;&lt;td&gt;56.2&lt;/td&gt;&lt;td&gt;102214&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;9&lt;/td&gt;&lt;td&gt;azure-nspkg&lt;/td&gt;&lt;td&gt;55.2&lt;/td&gt;&lt;td&gt;214821&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;10&lt;/td&gt;&lt;td&gt;azure-storage&lt;/td&gt;&lt;td&gt;54.7&lt;/td&gt;&lt;td&gt;213129&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;query-which-packages-by-percentage-are-downloaded-most-often-via-python-26&quot;&gt;Query: Which Packages By Percentage Are Downloaded Most Often Via Python 2.6?&lt;/h3&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;project&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;ROUND&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CASE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHEN&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;REGEXP_EXTRACT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;^([^&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;]+&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;[^&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;]+)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;2.6&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;THEN&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ELSE&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AS&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;percent_26&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CASE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHEN&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;REGEXP_EXTRACT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;^([^&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;]+&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;[^&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;]+)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;2.6&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;THEN&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ELSE&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;total_26_downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;total_downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;TABLE_DATE_RANGE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;psf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pypi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;IS&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AND&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Exclude&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;things&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;which&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;are&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stdlib&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;backports&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Python&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;project&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;IN&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;argparse&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;ordereddict&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GROUP&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;project&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;HAVING&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;total_downloads&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5000&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;percent_26&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DESC&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;LIMIT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;250&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;query-most-used-installersversions&quot;&gt;Query: Most Used Installers/Versions&lt;/h3&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;installer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;installer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;total_downloads&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;TABLE_DATE_RANGE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;psf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pypi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GROUP&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;installer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;installer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;version&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;total_downloads&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DESC&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;LIMIT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;query-downloads-by-country&quot;&gt;Query: Downloads By Country&lt;/h3&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;country_code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;TABLE_DATE_RANGE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;psf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pypi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;day&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GROUP&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;country_code&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;downloads&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DESC&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;LIMIT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;query-python-3-download-percentage-across-pypi-grouped-by-month&quot;&gt;Query: Python 3 Download Percentage Across PyPI Grouped By Month&lt;/h3&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;STRFTIME_UTC_USEC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;timestamp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;%Y-%m&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AS&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;yyyymm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;ROUND&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CASE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHEN&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;REGEXP_EXTRACT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;^([^&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;]+)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;3&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;THEN&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ELSE&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AS&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;percent_3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;download_count&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;TABLE_DATE_RANGE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;psf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pypi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;downloads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DATE_ADD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;year&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;by&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;yyyymm&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;yyyymm&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DESC&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;LIMIT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is an interesting query for obvious reasons&lt;sup id=&quot;fnref:10&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:10&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;8&lt;/a&gt;&lt;/sup&gt;, but also one that processes quite a bit of data. Here are the results through January 2017:&lt;/p&gt;

&lt;table style=&quot;width:100%&quot;&gt;
  &lt;tr&gt;&lt;th&gt;Date&lt;/th&gt;&lt;th&gt;Percentage&lt;/th&gt;&lt;th&gt;Total Downloads&lt;/th&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;2017-01&lt;/td&gt;&lt;td&gt;10.3&lt;/td&gt;&lt;td&gt;619254519&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;2016-12&lt;/td&gt;&lt;td&gt;9.6&lt;/td&gt;&lt;td&gt;537529176&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;2016-11&lt;/td&gt;&lt;td&gt;9.2&lt;/td&gt;&lt;td&gt;563208796&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;2016-10&lt;/td&gt;&lt;td&gt;8.9&lt;/td&gt;&lt;td&gt;528112583&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;2016-09&lt;/td&gt;&lt;td&gt;7.9&lt;/td&gt;&lt;td&gt;538323554&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;2016-08&lt;/td&gt;&lt;td&gt;7.4&lt;/td&gt;&lt;td&gt;542956355&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;2016-07&lt;/td&gt;&lt;td&gt;7.1&lt;/td&gt;&lt;td&gt;483143293&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;2016-06&lt;/td&gt;&lt;td&gt;7.1&lt;/td&gt;&lt;td&gt;428402893&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;2016-05&lt;/td&gt;&lt;td&gt;7.1&lt;/td&gt;&lt;td&gt;137138123&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;2016-03&lt;/td&gt;&lt;td&gt;6.6&lt;/td&gt;&lt;td&gt;63615708&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;2016-02&lt;/td&gt;&lt;td&gt;6.5&lt;/td&gt;&lt;td&gt;314275153&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;2016-01&lt;/td&gt;&lt;td&gt;6.4&lt;/td&gt;&lt;td&gt;98290315&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;Data ingestion into the BigQuery data set was spotty prior to June 2016&lt;sup id=&quot;fnref:9&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:9&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;9&lt;/a&gt;&lt;/sup&gt;, but you can see a significant uptick in Python 3 based downloads over 2016.
&lt;a href=&quot;https://frinkiac.com/caption/S08E11/289555&quot;&gt;If these trends continue…&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;decisions&quot;&gt;Decisions&lt;/h2&gt;

&lt;p&gt;These queries just scratch the surface of the data you can get about the Python ecosystem at large and your project in particular. Write your own queries and make your decisions about platform, version, and implementation with real information.&lt;/p&gt;

&lt;p&gt;Of course, this doesn’t address more granular usage, exception tracking, and other analytics web and mobile devs frequently take for granted, but that’s a &lt;a href=&quot;https://alexgaynor.net/2015/sep/03/telemetry-for-open-source/&quot;&gt;separate blog post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks to &lt;a href=&quot;https://twitter.com/dstufft&quot;&gt;Donald Stufft&lt;/a&gt; for his tireless efforts on PyPI, &lt;a href=&quot;https://alexgaynor.net&quot;&gt;Alex Gaynor&lt;/a&gt; for several of the queries in this blog post, and Google for generously donating capacity on BigQuery for PyPI data.&lt;/p&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:3&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Or worse, don’t complain until after you’ve done the removal. &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;…which can contribute significantly to project burnout. &lt;a href=&quot;#fnref:4&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;I am legally obligated to link &lt;a href=&quot;https://frinkiac.com&quot;&gt;Frinkiac&lt;/a&gt; in every blog post. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:5&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Queries are charged against your account, but you get 1TB free per month and cached queries won’t count against it. &lt;a href=&quot;#fnref:5&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:6&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;It’s not for cryptography. We have a deprecation warning in place but an indefinite timeline for removal of support. &lt;a href=&quot;#fnref:6&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:7&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Issues for &lt;a href=&quot;https://github.com/pyca/cryptography/issues/3002&quot;&gt;1.0.0 removal&lt;/a&gt; and &lt;a href=&quot;https://github.com/pyca/cryptography/issues/2836&quot;&gt;0.9.8 removal&lt;/a&gt;. &lt;a href=&quot;#fnref:7&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:8&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;requests is at 14%, bcrypt 29%, django 32.9%, and jupyter 33.3%. Packages can vary wildly! &lt;a href=&quot;#fnref:8&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:10&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;To my knowledge no one has posted this information previously, so we’re accidentally breaking new ground with our queries! &lt;a href=&quot;#fnref:10&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:9&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;But it shouldn’t be biased, so these percentages are likely to be accurate. &lt;a href=&quot;#fnref:9&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
				<pubDate>Fri, 09 Dec 2016 00:00:00 +0000</pubDate>
				<link>/2016/12/09/data-driven-decisions/</link>
				<guid isPermaLink="true">/2016/12/09/data-driven-decisions/</guid>
			</item>
		
	</channel>
</rss>
