Home / Companies / Semgrep / Blog / Post Details
Content Deep Dive

Keep your rules simple with symbolic propagation

Blog post from Semgrep

Post Details
Company
Date Published
Author
Iago Abal
Word Count
490
Language
English
Hacker News Points
-
Summary

Symbolic propagation is a new experimental feature in Semgrep that extends constant propagation by allowing pattern matching to consider variable assignments, thus enabling simple patterns to match equivalent code even with intermediate variables. Previously, writing Semgrep rules required enumerating all possible code structures when intermediate variables were used, making it cumbersome to create complex rules. With symbolic propagation, introduced in Semgrep version 0.78.0, users can simply set the option to true, allowing the matching engine to automatically recognize equivalent code structures, such as method call chains, without explicitly accounting for intermediate assignments. This feature enhances the simplicity and power of writing Semgrep rules, making it easier to handle complex cases and is expected to become a default feature due to its promising capabilities.