simon-willison
TRE Python 绑定 — ReDoS 鲁棒性演示
TRE Python binding — ReDoS robustness demo
摘要
作者基于 Ville Laurikari 的 TRE regular expression engine,用 Claude Code 构建了一个实验性 Python binding,采用 ctypes 调用 C 库,并测试恶意 regular expression 攻击。结果显示,TRE 因不支持 backtracking,在 ReDoS 稳健性上优于 Python 标准库实现。
研究:TRE Python binding — ReDoS 稳健性演示 如果它足够好到让 antirez 将其加入 Redis,我想 Ville Laurikari 的 TRE regular expression engine 值得更深入地探索一下。我让 Claude Code 构建了一个实验性的 Python binding(它使用了 ctypes),并尝试对该库进行一些恶意 regular expression 攻击。TRE 对这些攻击的处理比 Python 标准库实现好得多,这主要归功于它不支持 backtracking。标签:security、python、regular-expressions、c、ctypes
译自 simon-willison · 录于 二〇二六年五月四日