'How do I download a rule yaml file directly?

Is there a way to download a Semgrep rule's yaml file from providing the rule name id? I know that you can bring them manually from the registry (via copy/paste).. but I am looking for a faster way so I can test rules locally.



Solution 1:[1]

The best way to find all rule yaml files from Semgrep is through the Semgrep Rules Github Repository. You can use the rule-id to search for it using the "Go to file" button within the repo:

"Go to file button within repo"

"Searching for rules via rule-id".

Once you have located the rule you wish to download, right-click on the "Raw" button and then click "Save link as..." to download the yaml file directly.

"Rule yaml file within repo"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jason