Structure Mode: Never write an invalid Semgrep rule again
Blog post from Semgrep
Semgrep has established itself as a highly customizable code scanning tool, offering users the ability to write rules in YAML without needing to learn a vendor-specific DSL, though this can lead to common mistakes, particularly for new users unfamiliar with YAML formatting. To address this, Semgrep initially introduced "simple mode," which simplifies rule writing but is limited in functionality, excluding advanced features like metavariable-regex and nested patterns, which are essential for crafting high-quality rules. Recognizing these limitations, Semgrep introduced "structure mode," a new UI-based rule editing approach designed to make rule writing more accessible and less error-prone by offering features such as match badges, pattern extensibility, separate conditions, and advanced mode interoperability. Structure mode facilitates a seamless transition between simple and advanced rule writing, reducing errors and streamlining the process, ultimately making rule writing faster and more efficient for both newcomers and experienced users. This innovation aligns with Semgrep's goal of tailoring security tooling to the specific needs of various codebases while eliminating the frustrations associated with YAML errors and formatting issues.