TRE Python binding, ReDoS robustness demo
AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.
Why it matters
An experimental Python binding to the TRE regex engine shows developers a practical way to avoid catastrophic ReDoS vulnerabilities that the built-in re module cannot prevent.
Simon Willison had Claude Code build a small Python connection to TRE, a regular expression engine originally used in Redis. Regular expressions are pattern-matching rules, and some malicious ones can freeze programs, an attack called ReDoS. TRE avoids this because it does not use backtracking, so it handled attacks on 10-million-character inputs quickly while Python's built-in re module choked on much smaller ones.
ReDoS attacks can hang servers using Python's standard re module, which scales exponentially on crafted inputs. Willison's experimental ctypes binding to TRE, built via Claude Code, demonstrates linear-time matching even on 10-million-character inputs. No production-ready library or pricing is offered, it is a proof of concept, but engineering teams running user-supplied regexes should evaluate TRE-based alternatives.
Willison used Claude Code to generate a minimal ctypes Python binding to Ville Laurikari's TRE regex engine, the one antirez adopted for Redis. TRE lacks backtracking, giving linear-time worst-case matching: it processed 'evil' regex patterns against 10-million-character inputs quickly, while Python's re module scaled exponentially. The binding is experimental, and no benchmark table, package release or performance figures beyond that input size are given.
Read the original
This summary exists to save you time, not to replace the source.
Key terms
Was this summary useful?
One click, anonymous. It tells us which summaries to re-run.
Related reading
Code-driven AI illustrations are more useful than images from dedicated image models
Code-driven AI illustrations let designers edit assets directly in code, saving time on iteration and ensuring consistency, which is a game-changer for teams that need rapid, reusable visual content.
A hierarchical note-taking app for building large personal knowledge bases
Trilium lets users build and navigate massive personal knowledge bases without duplicating content, saving time on organization and retrieval.
Desktop apps in Go with native UI or web frontend
Go developers can now ship cross-platform desktop and mobile apps in a single small binary without cgo or heavy runtimes, cutting build complexity and deployment size.
OpenBitFun: an agent workspace with four harness modes and phone remote control
OpenBitFun lets agents run on any machine and be controlled from a phone, eliminating the need to choose between local power and remote access, saving developers time switching contexts.
Intel One Mono: a monospaced font designed with low-vision developers
Developers with low vision or eye fatigue can read code more clearly, reducing errors and improving productivity.