From 613179548b483dd5db961dab6975d7502ed59b9b Mon Sep 17 00:00:00 2001 From: AkikoOrenji <30274508+AkikoOrenji@users.noreply.github.com> Date: Tue, 25 Jul 2023 09:15:01 +1000 Subject: [PATCH] Update README.md Include instructions for tuning analysis via severities for semgrep by modification of semgrep controller. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index a856068..23a4d35 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,13 @@ I owe Marco Ivaldi [@0xdea](https://github.com/0xdea) a huge thanks for his publ **Program Output Example:**\ ![](callisto.png) +**Tuning** + +When using OpenAI analysis you may wish to tune Semgrep to focus on higher priority issues on the initial run. By default semgrep will flag low severity issues which can result in heavy usage of your OpenAI key for similar issues and lead to rate limiting (depending on free vs paid accounts etc). You can tune semgrep behaviour by modifying sgrep/controller.py to implement severity flags which set a floor level on the analysis. For example, the below will only include High and Medium confidence level rules excluding Low (INFO). + +`sGrepResults = subprocess.run(["semgrep", "--config=sgrep/semgrep-rules-c/c","--severity","ERROR","--severity","WARNING", "--json", "sgrep/semgrep.c"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)` + +You can confirm the severity to confidence level rule mappings using the following command: + +`grep -R severity sgrep/semgrep-rules-c` +