惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Vulnerabilities – Threatpost
P
Proofpoint News Feed
The Hacker News
The Hacker News
Know Your Adversary
Know Your Adversary
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tenable Blog
AWS News Blog
AWS News Blog
S
Securelist
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
IT之家
IT之家
腾讯CDC
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
C
Check Point Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Engineering at Meta
Engineering at Meta
Latest news
Latest news
A
About on SuperTechFans
The Register - Security
The Register - Security
L
LINUX DO - 热门话题
T
The Exploit Database - CXSecurity.com
C
Cisco Blogs
T
Tailwind CSS Blog
Simon Willison's Weblog
Simon Willison's Weblog
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
T
Tor Project blog
L
Lohrmann on Cybersecurity
G
GRAHAM CLULEY
B
Blog RSS Feed
Scott Helme
Scott Helme
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
NISL@THU
NISL@THU
P
Privacy International News Feed
Security Latest
Security Latest
Recorded Future
Recorded Future
L
LangChain Blog
Cyberwarzone
Cyberwarzone
C
Cyber Attacks, Cyber Crime and Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI
Apple Machine Learning Research
Apple Machine Learning Research
F
Fortinet All Blogs
O
OpenAI News
T
Threat Research - Cisco Blogs
Blog — PlanetScale
Blog — PlanetScale

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How We Migrated the Heart of Our Platform to Rust
Dwayne McDaniel · 2026-06-01 · via DEV Community

GitGuardian helps developers and security teams detect secrets (API keys, tokens, credentials) that have been accidentally committed to source code. At the core of our platform sits our secret detection engine: a component that takes raw bytes as input and outputs detected secrets, running against hundreds of gigabytes of code and data every day. Migrating this engine to Rust was driven by two goals: raw performance gains to reduce infrastructure costs, and improved portability, allowing us to eventually run the engine in environments where a Python runtime is not available.

Rewriting legacy software in Rust has been a trend in recent years. So much that it did not only spawn numerous rewrites but also its own meme. When we decided to migrate our secret detection engine to Rust, one of our main goals was performance: Our Python implementation was fast, but given that we scan hundreds of gigabytes on a daily basis, even small improvements can massively reduce our costs.

We set out on this journey with an audacious goal: Rewrite the engine from scratch and have nobody notice it. In retrospect, the decision to avoid breaking changes as much as possible ended up causing most of our headaches during the migration. The plan was to change the plane's engine, mid-flight, with all business class passengers on board.

A rewrite goes way beyond the code that needs to be rewritten

In order to limit in-flight turbulence, we decided to start our rewrite by migrating the public data types of our engine, so that issues in downstream usage would surface early on in the process, even though this required occasional acrobatics in our Python bindings.

We started by migrating our public API to identify potential blocking issues early on

We started by migrating our public API to identify potential blocking issues early on

Early awareness of issues also motivated our decision to use our new detection engine as soon as possible in production. Once we had migrated the first building blocks of our engine, we immediately started to scan with a subset of detectors running in Rust. In our engine, a detector is a self-contained unit responsible for identifying a specific type of secret (for example, an AWS access key or a GitHub token). Each detector encapsulates its own matching logic, making them natural units for an incremental migration: we could port them one by one and run Rust and Python detectors side by side. Incidentally, this progressive migration had the convenient side-effect that we reviewed and improved many of our detectors along the way.

We started scanning with Rust-based detectors as soon as possible

We started scanning with Rust-based detectors as soon as possible

The beauty of Python is that it's malleable. If Rust with its elaborate type system is Lego, Python is Play-Doh. If you need to access an internal property of a library's Python class, the language generously lets you poke a hole into it so that you can access the property value and leave the library maintainer to work on more important things than exposing an internal value via a public API.

import numpy as np
a = np.array([1.0, 2.0, 3.0])
print(a.dtype.type.mro()[2].__subclasses__())

Enter fullscreen mode Exit fullscreen mode

Want to dynamically learn about numpy's architecture? Go for it!

When migrating code with downstream users to Rust, this aspect of Python has an enormous impact. Throughout our migration, we invested a significant amount of time into reliable scaffolding for the actual rewrite. Fortunately, the pool of projects that depend on our detection engine was small and contained only internal codebases. Therefore we were able to immediately test every commit of Rust replacing Python against the test suites of our downstream consumers. It allowed us to survey the usage of every private property before we would enclose it in a private struct field in Rust.

A rewrite needs expertise in both the source and target language

Talking of bindings: We decided early on to use pyo3 for the Python bindings of our Rust rewrite. Initially, we had some concern that the binding layer might eat up our performance gains, but a first proof of concept quickly dispelled our concerns. pyo3 is a terrific project that does an excellent job of balancing performance and memory safety. Given that Rust and Python are built on fundamentally different core principles, it is remarkable how little pyo3 users are affected by the constant mediation between languages under the hood.

That said, our team's experience in both ecosystems proved invaluable: even with pyo3 smoothing out the boundary, the migration still surfaced a number of subtle, time-consuming bugs. About half-way through the rewrite, we noticed that our engine's performance was hitting an invisible ceiling. Despite notable improvements in local benchmarks, large-scale multiprocess scans with our detection engine ran at the same pace as before. At first, we were suspecting some sort of resource contention between processes related to Python's primary performance scapegoat, the GIL, but given that every process was running its own Python interpreter with its own lock, we quickly discarded this hypothesis.

Performance graph showing the GIL bottleneck

As it turned out, the issue was not in the GIL itself, but how our Rust engine was treating it. Scanning data for secrets is a computationally expensive operation. Our Python engine may have taken longer than our Rust rewrite to scan, but during the scanning process it would regularly release the GIL for the interpreter to run its routines, for example garbage collection.

Our Rust implementation on the other hand held the GIL during the entire scan process. As a result, no other Python thread was able to run, garbage piled up and chaos ensued. Once we identified the issue, the solution was as easy as a single pyo3 call that ensured that the GIL would be released during long-running operations in Rust. The next large-scale scan showed that without holding the GIL our new engine ran four times as fast.

The numbers

Relative increase of scanning speed over the course of our rewrite

Relative increase of scanning speed over the course of our rewrite

Once the GIL bottleneck was resolved, we finally saw the raw power of the Rust implementation, resulting in a 3x global speedup compared to the legacy Python engine. Throughout the rewrite, our performance increased steadily as more of our secret detectors were using the new components in Rust. There were few components of our engine that gained an extraordinary performance boost when we implemented them in Rust. Rather we saw consistent improvements across the entire engine as the abstraction costs of Python disappeared — a result that gave us confidence both in the quality of our existing codebase as well as our decision to rewrite it in Rust while retaining the general engine structure from Python.

A word about AI

When we began the migration project, coding was still down-to-earth manual labor. The full force of frontier models began to show when we were about half-way through the rewrite, and the agentic assistance significantly increased our ability to detect implementation disparities and to quickly prototype different feature representations in Rust. At the time of writing, the migration could have likely been completed in a fraction of the time we took, and in a largely automated fashion. However, besides the performance improvements, as a team we profited immensely from rewriting every feature of the engine. We reviewed every line of what most of us only knew as legacy code and every one of us now has an extensive, detailed understanding of the codebase, which is invaluable as we increasingly automate development.

There is a next step to this: we have achieved important performance goals with our Rust migration. However, we are scanning secrets in more sources than before, and with the advent of autonomous coding agents there's a need to catch secrets before they leave the user's machine. All of this requires even faster secret detection. We are already working on the next improvements.

Lessons Learned: Migrating to Rust

1. Start with the public API, not the implementation

Migrating public data types first forces downstream compatibility issues to surface early, before the bulk of the rewrite is done. It is much cheaper to fix interface problems at the start than mid-migration.

2. Ship to production incrementally

Don't wait until the rewrite is complete to deploy. Running Rust and Python side by side (via a dispatcher) allowed the team to catch real-world issues early and build confidence gradually, while keeping a safe fallback.

3. Build a kill switch

A runtime dispatcher that can route traffic between the old and new implementation is essential when rewriting a production system. It removes the risk of a hard cutover and makes rollbacks instant.

4. Understand the boundary between languages, not just each language

Even with a great bridging library like pyo3, subtle cross-language bugs will emerge. In this case, the Rust engine was holding the GIL throughout long scans, blocking Python's garbage collector and neutralising the performance gains entirely. You need expertise in both ecosystems to catch these issues.

5. Always release the GIL during long-running Rust operations

When calling Rust from Python, any long-running operation must explicitly release the GIL so the Python interpreter can continue its housekeeping. Failing to do so can make your rewrite significantly slower than the original.

6. Test against downstream consumers continuously

Running the full test suites of every downstream codebase on every commit keeps compatibility problems visible in real time and prevents surprises at the end of the migration.

7. Avoiding breaking changes costs more than you expect

The decision to make the migration invisible to users was the right call for business continuity, but it was also responsible for most of the headaches. Be prepared for significant scaffolding and binding work if you commit to backward compatibility.

8. The rewrite is also a code review

A full rewrite forces the team to read and understand every line of legacy code. The knowledge gained is a long-term asset, especially as more development gets automated.

GitGuardian Interactive Demo