From 99af4167dc9879d83b8770b14284466461fc2a6b Mon Sep 17 00:00:00 2001 From: ayushmaheshwari Date: Wed, 18 Jan 2023 02:58:18 +0530 Subject: [PATCH 01/13] wip: semgrep sql script --- assets/semgrep.png | Bin 0 -> 8962 bytes scripts/sql/108_create_semgrep_plugin.up.sql | 39 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 assets/semgrep.png create mode 100644 scripts/sql/108_create_semgrep_plugin.up.sql diff --git a/assets/semgrep.png b/assets/semgrep.png new file mode 100644 index 0000000000000000000000000000000000000000..3fe706e630a44453ee4c7a2f2e0ffc3ad17af4d8 GIT binary patch literal 8962 zcmds-$g4#lmwyF+1dTVQc1?ku*r!{YAT z=l%z8a=*PNnM^Xt$;{XJ<%Fv!Nq@lng8Ayzs}Hg=5^Aqrp)~zhs2Feln_$cNHvZQf zRTMNNUtV6W9lZHXB=8`sOw+ zK7lL)jM9}7?0GCUZB`x}82@djcqJ<#s^PwPm=zUW(DX?vl+Y^itr>>yXFXlZ!Jr$z zzG0DhG!!Ly#GKRErBaM0B3pO6fFT7k)ZzR3zuW)6Q0F)$#zrBfwI5c%gil_z&OTt! zPRCU~o)4o3s(DYA(WyN8Pc|;4C=vXn=!06aM;tA-+`EnP0c4pcwgymtcYy`tSv;dt z9nOOSo{5u^53-z5+tKkBqc=VU&P18A5stSAH^iGKXfM(#FTTzGL?_8eq*1Vzdox5I zhluQ~QGFoxq_VzVc4Rf!R&CS8M7Xbmy>T>S)Dz!UcJ93^bu)n$4}dhqcGo4+tI2jc zTD0F5#joHku_U5a|G`POvSq0HFRMkVmKG+a$0?-M5+9~G7!t;17m=C00? zo6RQx+JYX}WIvWpXaC(?Y|=y7^0@<;tmEUdRVv_V(GzvVlc3)Q#l8ojL;X{^<>wXr z(Jqxe7)#eP?;YM0i(8efR%`9M)(`fPM_T8;5(~jtk-6sv-`S2ebeilEw7I2iNJ1Q6 zSeK98K{XXdX^MdDlf6dZajRO(#ch~uy`I!y(2qH<<(+++*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C{N@m%SiF=(|QIh3zC{E{B?{idqM)A1oPfCthWhmG5xaHnFF@&v2 zNdWMx2G2Ve@ZK_K%bADVk~y3eU;I-j>lFOW)@RGlT5=Y`8J~BhbooFxZikHuLVOx| zVvOV1*LVnTu@~w8PW|g_>bGFHt)!=AcA2azy|VX77=UUQ@;U`YOR3(&q|$)@ECi_g zr|C9Y!0PN+u+EK+Op)#w(`lt!3e>BEJ}NXfP|XUz zZBo&hKv+G&kKq}!;6eUop3S)!qU?!T>2LN=o*c>cUVCh1AR1~&-^vcy4$hgl-N-UM!usC_0KzuZ5;Wv0Wk(5W5P@ww~q|4K6cFBIhe d+4}-`dELp<{qvO>&8Po0$x13oREik|{11^ENZbGb literal 0 HcmV?d00001 diff --git a/scripts/sql/108_create_semgrep_plugin.up.sql b/scripts/sql/108_create_semgrep_plugin.up.sql new file mode 100644 index 0000000000..bb6c4ac257 --- /dev/null +++ b/scripts/sql/108_create_semgrep_plugin.up.sql @@ -0,0 +1,39 @@ +INSERT INTO "plugin_metadata" ("id", "name", "description","type","icon","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_metadata'), 'Semgrep','Semgrep is a fast, open source, static analysis engine for finding bugs, detecting dependency vulnerabilities, and enforcing code standards.','SHARED','link_to_icon','f', 'now()', 1, 'now()', 1); + +INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_tag_relation'), 2, 7,'now()', 1, 'now()', 1); +INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_tag_relation'), 3, 7,'now()', 1, 'now()', 1); + + + +INSERT INTO "plugin_pipeline_script" ("id", "script","type","deleted","created_on", "created_by", "updated_on", "updated_by") +VALUES ( + nextval('id_seq_plugin_pipeline_script'), + '#!/bin/sh +set -eo pipefail +PathToCodeDir=/devtroncd$CheckoutPath +chmod 741 $PathToCodeDir +apk add py3-pip +pip install pip==21.3.1 +pip install semgrep +cp $PathToCodeDir $SemgrepProjectName -r +cd $SemgrepProjectName +export SEMGREP_APP_TOKEN=$SemgrepAppToken +semgrep ci +cd $PathToCodeDir +', + 'SHELL', + 'f', + 'now()', + 1, + 'now()', + 1 +); + +INSERT INTO "plugin_step" ("id", "plugin_id","name","description","index","step_type","script_id","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_step'), 7,'Step 1','Step 1 - Dependency Track for Semgrep','1','INLINE','14','f','now()', 1, 'now()', 1); + +INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value", "variable_type", "value_type", "variable_step_index", "deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES +(nextval('id_seq_plugin_step_variable'), 7, 'SemgrepAppToken','STRING','App token for Semgrep account',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), 7, 'CheckoutPath','STRING','git repo checkout path',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), 7, 'SemgrepProjectName','STRING','Semgrep dashboard project name',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1); + + From 8b929e70851eff1c916a67348bf6f28a72ef0ee5 Mon Sep 17 00:00:00 2001 From: ayushmaheshwari Date: Fri, 20 Jan 2023 12:40:03 +0530 Subject: [PATCH 02/13] semgrep sql scrit --- scripts/sql/108_create_semgrep_plugin.up.sql | 68 ++++++++++++++++---- 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/scripts/sql/108_create_semgrep_plugin.up.sql b/scripts/sql/108_create_semgrep_plugin.up.sql index bb6c4ac257..8f4e205390 100644 --- a/scripts/sql/108_create_semgrep_plugin.up.sql +++ b/scripts/sql/108_create_semgrep_plugin.up.sql @@ -3,24 +3,64 @@ INSERT INTO "plugin_metadata" ("id", "name", "description","type","icon","delete INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_tag_relation'), 2, 7,'now()', 1, 'now()', 1); INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_tag_relation'), 3, 7,'now()', 1, 'now()', 1); - - INSERT INTO "plugin_pipeline_script" ("id", "script","type","deleted","created_on", "created_by", "updated_on", "updated_by") VALUES ( nextval('id_seq_plugin_pipeline_script'), '#!/bin/sh set -eo pipefail -PathToCodeDir=/devtroncd$CheckoutPath -chmod 741 $PathToCodeDir +chmod 741 /devtroncd +chmod 741 /devtroncd/* apk add py3-pip pip install pip==21.3.1 pip install semgrep -cp $PathToCodeDir $SemgrepProjectName -r -cd $SemgrepProjectName export SEMGREP_APP_TOKEN=$SemgrepAppToken -semgrep ci -cd $PathToCodeDir -', + +CiMaterialsEnv=$GIT_MATERIAL_REQUEST +repoName="" +checkoutPath="" +branchName="" +gitHash="" +materials=$(echo $CiMaterialsEnv | tr "|" "\n") +for material in $materials +do + data=$(echo $material | tr "," "\n") + i=0 + for d in $data + do + if [ $((i)) == 0 ] + then + repoName=$d + elif [ $((i)) == 1 ] + then + checkoutPath=$d + elif [ $((i)) == 2 ] + then + branchName=$d + elif [ $((i)) == 3 ] + then + gitHash=$d + fi + i=$((i+1)) + done + #docker run --rm --env SEMGREP_APP_TOKEN=$SemgrepAppToken --env SEMGREP_REPO_NAME=$repoName --env SEMGREP_BRANCH=$branchName -v "${PWD}/:/src/" returntocorp/semgrep semgrep ci + cd /devtroncd + cd $checkoutPath + export SEMGREP_REPO_NAME=$repoName + if [ $UseCommitAsSemgrepBranchName == true -a $PrefixAppNameInSemgrepBranchName == true ] + then + export SEMGREP_BRANCH="$SemgrepAppName - $gitHash" + elif [ $PrefixAppNameInSemgrepBranchName == true ] + then + export SEMGREP_BRANCH="$SemgrepAppName - $branchName" + elif [ $UseCommitAsSemgrepBranchName == true ] + then + export SEMGREP_BRANCH=$gitHash + else + export SEMGREP_BRANCH=$branchName + fi + semgrep ci $ExtraCommandArguments +done' + , 'SHELL', 'f', 'now()', @@ -32,8 +72,12 @@ cd $PathToCodeDir INSERT INTO "plugin_step" ("id", "plugin_id","name","description","index","step_type","script_id","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_step'), 7,'Step 1','Step 1 - Dependency Track for Semgrep','1','INLINE','14','f','now()', 1, 'now()', 1); INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value", "variable_type", "value_type", "variable_step_index", "deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES -(nextval('id_seq_plugin_step_variable'), 7, 'SemgrepAppToken','STRING','App token for Semgrep account',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), -(nextval('id_seq_plugin_step_variable'), 7, 'CheckoutPath','STRING','git repo checkout path',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), -(nextval('id_seq_plugin_step_variable'), 7, 'SemgrepProjectName','STRING','Semgrep dashboard project name',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1); +(nextval('id_seq_plugin_step_variable'), 7, 'SemgrepAppToken','STRING','App token of Semgrep account',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), 7, 'PrefixAppNameInSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{branchName}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), 7, 'UseCommitAsSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{CommitHash}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), 7, 'SemgrepAppName','STRING','App Name will be used as an extra metadata for publishing results',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), 7, 'ExtraCommandArguments','STRING','Extra Command arguments for semgrep CI command. eg input - --json --sem',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1); +INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value","value","variable_type", "value_type", "variable_step_index",reference_variable_name, "deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES +(nextval('id_seq_plugin_step_variable'), 7, 'GIT_MATERIAL_REQUEST','STRING','git material data',false,true,3,'INPUT','GLOBAL',1 ,'GIT_MATERIAL_REQUEST','f','now()', 1, 'now()', 1); From 522f11dc3a0876d33ed696685f27ca28b1c9056a Mon Sep 17 00:00:00 2001 From: ayushmaheshwari Date: Fri, 20 Jan 2023 12:44:21 +0530 Subject: [PATCH 03/13] wip: adding down script --- scripts/sql/108_create_semgrep_plugin.down.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 scripts/sql/108_create_semgrep_plugin.down.sql diff --git a/scripts/sql/108_create_semgrep_plugin.down.sql b/scripts/sql/108_create_semgrep_plugin.down.sql new file mode 100644 index 0000000000..1f4130591d --- /dev/null +++ b/scripts/sql/108_create_semgrep_plugin.down.sql @@ -0,0 +1,6 @@ +DELETE FROM plugin_step_variable WHERE name = 'SemgrepAppToken'; +DELETE FROM plugin_step_variable WHERE name = 'PrefixAppNameInSemgrepBranchName'; +DELETE FROM plugin_step_variable WHERE name = 'UseCommitAsSemgrepBranchName'; +DELETE FROM plugin_step_variable WHERE name = 'SemgrepAppName'; +DELETE FROM plugin_step_variable WHERE name = 'ExtraCommandArguments'; +DELETE FROM plugin_step_variable WHERE name = 'GIT_MATERIAL_REQUEST'; From d8eb81b1b7439e14c45f4373e3a654f776708cab Mon Sep 17 00:00:00 2001 From: ayushmaheshwari Date: Fri, 20 Jan 2023 19:26:42 +0530 Subject: [PATCH 04/13] correcting sql script id --- scripts/sql/108_create_semgrep_plugin.up.sql | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/sql/108_create_semgrep_plugin.up.sql b/scripts/sql/108_create_semgrep_plugin.up.sql index 8f4e205390..2d5f92f676 100644 --- a/scripts/sql/108_create_semgrep_plugin.up.sql +++ b/scripts/sql/108_create_semgrep_plugin.up.sql @@ -1,7 +1,7 @@ -INSERT INTO "plugin_metadata" ("id", "name", "description","type","icon","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_metadata'), 'Semgrep','Semgrep is a fast, open source, static analysis engine for finding bugs, detecting dependency vulnerabilities, and enforcing code standards.','SHARED','link_to_icon','f', 'now()', 1, 'now()', 1); +INSERT INTO "plugin_metadata" ("id", "name", "description","type","icon","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_metadata'), 'Semgrep','Semgrep is a fast, open source, static analysis engine for finding bugs, detecting dependency vulnerabilities, and enforcing code standards.','PRESET','link_to_icon','f', 'now()', 1, 'now()', 1); -INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_tag_relation'), 2, 7,'now()', 1, 'now()', 1); -INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_tag_relation'), 3, 7,'now()', 1, 'now()', 1); +INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_tag_relation'), 2, 6,'now()', 1, 'now()', 1); +INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_tag_relation'), 3, 6,'now()', 1, 'now()', 1); INSERT INTO "plugin_pipeline_script" ("id", "script","type","deleted","created_on", "created_by", "updated_on", "updated_by") VALUES ( @@ -69,15 +69,15 @@ done' 1 ); -INSERT INTO "plugin_step" ("id", "plugin_id","name","description","index","step_type","script_id","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_step'), 7,'Step 1','Step 1 - Dependency Track for Semgrep','1','INLINE','14','f','now()', 1, 'now()', 1); +INSERT INTO "plugin_step" ("id", "plugin_id","name","description","index","step_type","script_id","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_step'), 6,'Step 1','Step 1 - Dependency Track for Semgrep','1','INLINE',6,'f','now()', 1, 'now()', 1); INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value", "variable_type", "value_type", "variable_step_index", "deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES -(nextval('id_seq_plugin_step_variable'), 7, 'SemgrepAppToken','STRING','App token of Semgrep account',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), -(nextval('id_seq_plugin_step_variable'), 7, 'PrefixAppNameInSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{branchName}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), -(nextval('id_seq_plugin_step_variable'), 7, 'UseCommitAsSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{CommitHash}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), -(nextval('id_seq_plugin_step_variable'), 7, 'SemgrepAppName','STRING','App Name will be used as an extra metadata for publishing results',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), -(nextval('id_seq_plugin_step_variable'), 7, 'ExtraCommandArguments','STRING','Extra Command arguments for semgrep CI command. eg input - --json --sem',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1); +(nextval('id_seq_plugin_step_variable'), 6, 'SemgrepAppToken','STRING','App token of Semgrep account',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), 6, 'PrefixAppNameInSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{branchName}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), 6, 'UseCommitAsSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{CommitHash}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), 6, 'SemgrepAppName','STRING','App Name will be used as an extra metadata for publishing results',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), 6, 'ExtraCommandArguments','STRING','Extra Command arguments for semgrep CI command. eg input - --json --sem',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1); INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value","value","variable_type", "value_type", "variable_step_index",reference_variable_name, "deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES -(nextval('id_seq_plugin_step_variable'), 7, 'GIT_MATERIAL_REQUEST','STRING','git material data',false,true,3,'INPUT','GLOBAL',1 ,'GIT_MATERIAL_REQUEST','f','now()', 1, 'now()', 1); +(nextval('id_seq_plugin_step_variable'), 6, 'GIT_MATERIAL_REQUEST','STRING','git material data',false,true,3,'INPUT','GLOBAL',1 ,'GIT_MATERIAL_REQUEST','f','now()', 1, 'now()', 1); From 9d530439da6823e270386579991b86bdbee6d189 Mon Sep 17 00:00:00 2001 From: vikramdevtron Date: Mon, 23 Jan 2023 14:54:52 +0530 Subject: [PATCH 05/13] fix sql script for semgrep plugin integration --- scripts/sql/108_create_semgrep_plugin.up.sql | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/sql/108_create_semgrep_plugin.up.sql b/scripts/sql/108_create_semgrep_plugin.up.sql index 2d5f92f676..baa37d1c60 100644 --- a/scripts/sql/108_create_semgrep_plugin.up.sql +++ b/scripts/sql/108_create_semgrep_plugin.up.sql @@ -1,7 +1,7 @@ INSERT INTO "plugin_metadata" ("id", "name", "description","type","icon","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_metadata'), 'Semgrep','Semgrep is a fast, open source, static analysis engine for finding bugs, detecting dependency vulnerabilities, and enforcing code standards.','PRESET','link_to_icon','f', 'now()', 1, 'now()', 1); -INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_tag_relation'), 2, 6,'now()', 1, 'now()', 1); -INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_tag_relation'), 3, 6,'now()', 1, 'now()', 1); +INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_tag_relation'), 2, (SELECT id FROM plugin_metadata WHERE name='Semgrep'),'now()', 1, 'now()', 1); +INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_tag_relation'), 3, (SELECT id FROM plugin_metadata WHERE name='Semgrep'),'now()', 1, 'now()', 1); INSERT INTO "plugin_pipeline_script" ("id", "script","type","deleted","created_on", "created_by", "updated_on", "updated_by") VALUES ( @@ -69,15 +69,15 @@ done' 1 ); -INSERT INTO "plugin_step" ("id", "plugin_id","name","description","index","step_type","script_id","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_step'), 6,'Step 1','Step 1 - Dependency Track for Semgrep','1','INLINE',6,'f','now()', 1, 'now()', 1); +INSERT INTO "plugin_step" ("id", "plugin_id","name","description","index","step_type","script_id","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_step'), (SELECT id FROM plugin_metadata WHERE name='Semgrep'),'Step 1','Step 1 - Dependency Track for Semgrep','1','INLINE',(SELECT ps.script_id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false),'f','now()', 1, 'now()', 1); INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value", "variable_type", "value_type", "variable_step_index", "deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES -(nextval('id_seq_plugin_step_variable'), 6, 'SemgrepAppToken','STRING','App token of Semgrep account',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), -(nextval('id_seq_plugin_step_variable'), 6, 'PrefixAppNameInSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{branchName}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), -(nextval('id_seq_plugin_step_variable'), 6, 'UseCommitAsSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{CommitHash}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), -(nextval('id_seq_plugin_step_variable'), 6, 'SemgrepAppName','STRING','App Name will be used as an extra metadata for publishing results',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), -(nextval('id_seq_plugin_step_variable'), 6, 'ExtraCommandArguments','STRING','Extra Command arguments for semgrep CI command. eg input - --json --sem',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1); +(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppToken','STRING','App token of Semgrep account',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'PrefixAppNameInSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{branchName}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'UseCommitAsSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{CommitHash}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppName','STRING','App Name will be used as an extra metadata for publishing results',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'ExtraCommandArguments','STRING','Extra Command arguments for semgrep CI command. eg input - --json --sem',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1); INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value","value","variable_type", "value_type", "variable_step_index",reference_variable_name, "deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES -(nextval('id_seq_plugin_step_variable'), 6, 'GIT_MATERIAL_REQUEST','STRING','git material data',false,true,3,'INPUT','GLOBAL',1 ,'GIT_MATERIAL_REQUEST','f','now()', 1, 'now()', 1); +(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'GIT_MATERIAL_REQUEST','STRING','git material data',false,true,3,'INPUT','GLOBAL',1 ,'GIT_MATERIAL_REQUEST','f','now()', 1, 'now()', 1); From f6cab3b6759b6760e6c1f5318a4944e304a1abe2 Mon Sep 17 00:00:00 2001 From: vikramdevtron Date: Mon, 23 Jan 2023 18:23:42 +0530 Subject: [PATCH 06/13] fix semgrep sql insert --- scripts/sql/108_create_semgrep_plugin.up.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sql/108_create_semgrep_plugin.up.sql b/scripts/sql/108_create_semgrep_plugin.up.sql index baa37d1c60..a90a9958ca 100644 --- a/scripts/sql/108_create_semgrep_plugin.up.sql +++ b/scripts/sql/108_create_semgrep_plugin.up.sql @@ -69,7 +69,7 @@ done' 1 ); -INSERT INTO "plugin_step" ("id", "plugin_id","name","description","index","step_type","script_id","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_step'), (SELECT id FROM plugin_metadata WHERE name='Semgrep'),'Step 1','Step 1 - Dependency Track for Semgrep','1','INLINE',(SELECT ps.script_id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false),'f','now()', 1, 'now()', 1); +INSERT INTO "plugin_step" ("id", "plugin_id","name","description","index","step_type","script_id","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_step'), (SELECT id FROM plugin_metadata WHERE name='Semgrep'),'Step 1','Step 1 - Dependency Track for Semgrep','1','INLINE',(SELECT last_value FROM id_seq_plugin_pipeline_script),'f','now()', 1, 'now()', 1); INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value", "variable_type", "value_type", "variable_step_index", "deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppToken','STRING','App token of Semgrep account',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), From 26e901b478e04b9574f2f10e32a084a027e45c7a Mon Sep 17 00:00:00 2001 From: ayushmaheshwari Date: Mon, 23 Jan 2023 19:14:28 +0530 Subject: [PATCH 07/13] adding semgrep icon link --- cmd/external-app/wire_gen.go | 2 +- scripts/sql/108_create_semgrep_plugin.up.sql | 4 ++-- wire_gen.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/external-app/wire_gen.go b/cmd/external-app/wire_gen.go index edcaa70e70..8846cb4410 100644 --- a/cmd/external-app/wire_gen.go +++ b/cmd/external-app/wire_gen.go @@ -194,7 +194,7 @@ func InitializeApp() (*App, error) { serverDataStoreServerDataStore := serverDataStore.InitServerDataStore() appStoreApplicationVersionRepositoryImpl := appStoreDiscoverRepository.NewAppStoreApplicationVersionRepositoryImpl(sugaredLogger, db) pipelineRepositoryImpl := pipelineConfig.NewPipelineRepositoryImpl(db, sugaredLogger) - helmAppServiceImpl := client2.NewHelmAppServiceImpl(sugaredLogger, clusterServiceImpl, helmAppClientImpl, pumpImpl, enforcerUtilHelmImpl, serverDataStoreServerDataStore, serverEnvConfigServerEnvConfig, appStoreApplicationVersionRepositoryImpl, environmentServiceImpl, pipelineRepositoryImpl, installedAppRepositoryImpl, appRepositoryImpl) + helmAppServiceImpl := client2.NewHelmAppServiceImpl(sugaredLogger, clusterServiceImpl, helmAppClientImpl, pumpImpl, enforcerUtilHelmImpl, serverDataStoreServerDataStore, serverEnvConfigServerEnvConfig, appStoreApplicationVersionRepositoryImpl, environmentServiceImpl, pipelineRepositoryImpl, installedAppRepositoryImpl, appRepositoryImpl, clusterRepositoryImpl) appStoreDeploymentCommonServiceImpl := appStoreDeploymentCommon.NewAppStoreDeploymentCommonServiceImpl(sugaredLogger, installedAppRepositoryImpl) attributesRepositoryImpl := repository4.NewAttributesRepositoryImpl(db) attributesServiceImpl := attributes.NewAttributesServiceImpl(sugaredLogger, attributesRepositoryImpl) diff --git a/scripts/sql/108_create_semgrep_plugin.up.sql b/scripts/sql/108_create_semgrep_plugin.up.sql index a90a9958ca..909d46f954 100644 --- a/scripts/sql/108_create_semgrep_plugin.up.sql +++ b/scripts/sql/108_create_semgrep_plugin.up.sql @@ -1,4 +1,4 @@ -INSERT INTO "plugin_metadata" ("id", "name", "description","type","icon","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_metadata'), 'Semgrep','Semgrep is a fast, open source, static analysis engine for finding bugs, detecting dependency vulnerabilities, and enforcing code standards.','PRESET','link_to_icon','f', 'now()', 1, 'now()', 1); +INSERT INTO "plugin_metadata" ("id", "name", "description","type","icon","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_metadata'), 'Semgrep','Semgrep is a fast, open source, static analysis engine for finding bugs, detecting dependency vulnerabilities, and enforcing code standards.','PRESET','https://raw.githubusercontent.com/devtron-labs/devtron/main/assets/semgrep.png','f', 'now()', 1, 'now()', 1); INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_tag_relation'), 2, (SELECT id FROM plugin_metadata WHERE name='Semgrep'),'now()', 1, 'now()', 1); INSERT INTO "plugin_tag_relation" ("id", "tag_id", "plugin_id", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_tag_relation'), 3, (SELECT id FROM plugin_metadata WHERE name='Semgrep'),'now()', 1, 'now()', 1); @@ -58,7 +58,7 @@ do else export SEMGREP_BRANCH=$branchName fi - semgrep ci $ExtraCommandArguments + semgrep ci --json $ExtraCommandArguments done' , 'SHELL', diff --git a/wire_gen.go b/wire_gen.go index dedc2998e8..75702da33a 100644 --- a/wire_gen.go +++ b/wire_gen.go @@ -239,7 +239,7 @@ func InitializeApp() (*App, error) { userServiceImpl := user.NewUserServiceImpl(userAuthRepositoryImpl, sugaredLogger, userRepositoryImpl, roleGroupRepositoryImpl, sessionManager, userCommonServiceImpl, userAuditServiceImpl) userAuthServiceImpl := user.NewUserAuthServiceImpl(userAuthRepositoryImpl, sessionManager, loginService, sugaredLogger, userRepositoryImpl, roleGroupRepositoryImpl, userServiceImpl) environmentServiceImpl := cluster2.NewEnvironmentServiceImpl(environmentRepositoryImpl, clusterServiceImplExtended, sugaredLogger, k8sUtil, k8sInformerFactoryImpl, userAuthServiceImpl) - helmAppServiceImpl := client3.NewHelmAppServiceImpl(sugaredLogger, clusterServiceImplExtended, helmAppClientImpl, pumpImpl, enforcerUtilHelmImpl, serverDataStoreServerDataStore, serverEnvConfigServerEnvConfig, appStoreApplicationVersionRepositoryImpl, environmentServiceImpl, pipelineRepositoryImpl, installedAppRepositoryImpl, appRepositoryImpl) + helmAppServiceImpl := client3.NewHelmAppServiceImpl(sugaredLogger, clusterServiceImplExtended, helmAppClientImpl, pumpImpl, enforcerUtilHelmImpl, serverDataStoreServerDataStore, serverEnvConfigServerEnvConfig, appStoreApplicationVersionRepositoryImpl, environmentServiceImpl, pipelineRepositoryImpl, installedAppRepositoryImpl, appRepositoryImpl, clusterRepositoryImpl) serverCacheServiceImpl := server.NewServerCacheServiceImpl(sugaredLogger, serverEnvConfigServerEnvConfig, serverDataStoreServerDataStore, helmAppServiceImpl) moduleEnvConfig, err := module.ParseModuleEnvConfig() if err != nil { @@ -442,7 +442,7 @@ func InitializeApp() (*App, error) { appStoreDeploymentHelmServiceImpl := appStoreDeploymentTool.NewAppStoreDeploymentHelmServiceImpl(sugaredLogger, helmAppServiceImpl, appStoreApplicationVersionRepositoryImpl, environmentRepositoryImpl, helmAppClientImpl, installedAppRepositoryImpl) installedAppVersionHistoryRepositoryImpl := repository3.NewInstalledAppVersionHistoryRepositoryImpl(sugaredLogger, db) appStoreDeploymentCommonServiceImpl := appStoreDeploymentCommon.NewAppStoreDeploymentCommonServiceImpl(sugaredLogger, installedAppRepositoryImpl) - appStoreDeploymentArgoCdServiceImpl := appStoreDeploymentGitopsTool.NewAppStoreDeploymentArgoCdServiceImpl(sugaredLogger, appStoreDeploymentFullModeServiceImpl, applicationServiceClientImpl, chartGroupDeploymentRepositoryImpl, installedAppRepositoryImpl, installedAppVersionHistoryRepositoryImpl, chartTemplateServiceImpl, gitFactory, argoUserServiceImpl, appStoreDeploymentCommonServiceImpl, gitOpsConfigRepositoryImpl) + appStoreDeploymentArgoCdServiceImpl := appStoreDeploymentGitopsTool.NewAppStoreDeploymentArgoCdServiceImpl(sugaredLogger, appStoreDeploymentFullModeServiceImpl, applicationServiceClientImpl, chartGroupDeploymentRepositoryImpl, installedAppRepositoryImpl, installedAppVersionHistoryRepositoryImpl, chartTemplateServiceImpl, gitFactory, argoUserServiceImpl, appStoreDeploymentCommonServiceImpl, helmAppServiceImpl, gitOpsConfigRepositoryImpl) serviceDeploymentServiceTypeConfig, err := service2.GetDeploymentServiceTypeConfig() if err != nil { return nil, err From e3692d66943878f90283735212b5e3f682bacffc Mon Sep 17 00:00:00 2001 From: ayushmaheshwari Date: Mon, 23 Jan 2023 19:26:19 +0530 Subject: [PATCH 08/13] modifying variable description --- scripts/sql/108_create_semgrep_plugin.up.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sql/108_create_semgrep_plugin.up.sql b/scripts/sql/108_create_semgrep_plugin.up.sql index 909d46f954..90afffc1c7 100644 --- a/scripts/sql/108_create_semgrep_plugin.up.sql +++ b/scripts/sql/108_create_semgrep_plugin.up.sql @@ -76,7 +76,7 @@ INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "d (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'PrefixAppNameInSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{branchName}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'UseCommitAsSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{CommitHash}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppName','STRING','App Name will be used as an extra metadata for publishing results',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), -(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'ExtraCommandArguments','STRING','Extra Command arguments for semgrep CI command. eg input - --json --sem',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1); +(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'ExtraCommandArguments','STRING','Extra Command arguments for semgrep CI command. eg input: --json --dry-run.',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1); INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value","value","variable_type", "value_type", "variable_step_index",reference_variable_name, "deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'GIT_MATERIAL_REQUEST','STRING','git material data',false,true,3,'INPUT','GLOBAL',1 ,'GIT_MATERIAL_REQUEST','f','now()', 1, 'now()', 1); From 3ddd4bf11c66daedd89f2850917f70bf0c43d8ff Mon Sep 17 00:00:00 2001 From: ayushmaheshwari Date: Tue, 24 Jan 2023 00:52:07 +0530 Subject: [PATCH 09/13] adding option to pass semgrep api token from secret --- scripts/sql/108_create_semgrep_plugin.up.sql | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/sql/108_create_semgrep_plugin.up.sql b/scripts/sql/108_create_semgrep_plugin.up.sql index 90afffc1c7..cdebc7133c 100644 --- a/scripts/sql/108_create_semgrep_plugin.up.sql +++ b/scripts/sql/108_create_semgrep_plugin.up.sql @@ -14,7 +14,11 @@ apk add py3-pip pip install pip==21.3.1 pip install semgrep export SEMGREP_APP_TOKEN=$SemgrepAppToken - +SemgrepTokenLen=$(echo -n $SEMGREP_APP_TOKEN | wc -m) +if [ $((SemgrepTokenLen)) == 0 ] +then + SEMGREP_APP_TOKEN=$SEMGREP_API_TOKEN +fi CiMaterialsEnv=$GIT_MATERIAL_REQUEST repoName="" checkoutPath="" @@ -72,7 +76,7 @@ done' INSERT INTO "plugin_step" ("id", "plugin_id","name","description","index","step_type","script_id","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_step'), (SELECT id FROM plugin_metadata WHERE name='Semgrep'),'Step 1','Step 1 - Dependency Track for Semgrep','1','INLINE',(SELECT last_value FROM id_seq_plugin_pipeline_script),'f','now()', 1, 'now()', 1); INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value", "variable_type", "value_type", "variable_step_index", "deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES -(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppToken','STRING','App token of Semgrep account',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppToken','STRING','Input App token of Semgrep account',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'PrefixAppNameInSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{branchName}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'UseCommitAsSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{CommitHash}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppName','STRING','App Name will be used as an extra metadata for publishing results',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), From e52a5e9a3e3b4d12e3821c8d385687649f72cbb5 Mon Sep 17 00:00:00 2001 From: ayushmaheshwari Date: Tue, 24 Jan 2023 00:58:47 +0530 Subject: [PATCH 10/13] adding description for semgrep app token --- scripts/sql/108_create_semgrep_plugin.up.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sql/108_create_semgrep_plugin.up.sql b/scripts/sql/108_create_semgrep_plugin.up.sql index cdebc7133c..ffb22e7e3f 100644 --- a/scripts/sql/108_create_semgrep_plugin.up.sql +++ b/scripts/sql/108_create_semgrep_plugin.up.sql @@ -76,7 +76,7 @@ done' INSERT INTO "plugin_step" ("id", "plugin_id","name","description","index","step_type","script_id","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_step'), (SELECT id FROM plugin_metadata WHERE name='Semgrep'),'Step 1','Step 1 - Dependency Track for Semgrep','1','INLINE',(SELECT last_value FROM id_seq_plugin_pipeline_script),'f','now()', 1, 'now()', 1); INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value", "variable_type", "value_type", "variable_step_index", "deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES -(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppToken','STRING','Input App token of Semgrep account',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppToken','STRING','Input App token of Semgrep account if not already set in secret',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'PrefixAppNameInSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{branchName}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'UseCommitAsSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{CommitHash}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppName','STRING','App Name will be used as an extra metadata for publishing results',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), From 16176e67ea1a176bdc31df91ddee157c32469dcc Mon Sep 17 00:00:00 2001 From: ayushmaheshwari Date: Tue, 24 Jan 2023 11:19:09 +0530 Subject: [PATCH 11/13] changing semgrep logo --- assets/semgrep.png | Bin 8962 -> 2072 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/assets/semgrep.png b/assets/semgrep.png index 3fe706e630a44453ee4c7a2f2e0ffc3ad17af4d8..0848fe5a8ed088021f006927ecad30d6bd75a97f 100644 GIT binary patch literal 2072 zcmai#i#rnv1I9Nr%QE*P_q#-*iOr=kwv0pA5Nf5|!pLRJZ87TP(%f?mxu0s-nkM(~ ziItEc>`R{x!m`Ni98Sllzu>&j^S;0LA9$ZP!}XHAxR|0C000noz@l+S#QroGbd(TmAT~yIf%$Y0D8zu>*Uq9@++OFa=X`!k^P?iCwQ-nrtMj_F zp)9$?2{m8TKkth#h&>;Dluup)&unF z%6634@lN+Llo`(BIjzcUMx2rM&?@LMr!fOM6GXeU-9Bn!LzFrjdWBJbFB@Zd#oMxv zvz6zWcBv=YmNL7ukHiEqk@pgqdVca}|Jv?QALExvEcqQOJ+n4?iQ9Wb*w&{YcB$j9 z+@lQqtvC_?xEAGo6cU41>uHk1)2ijV^fevbE6|W z@-u<(Rk-SEK@8N~#R*YQO^>2{uW*tmWz>LuRgfi9c=y3;0TO{RcfO>ZEft^1rp(k( zdpJAeJZ8$u-YO4$T-e335WLcfeE_4!yCz8ndgB%Z6&)|4)TRtr#q zmY{E*VaYDThA#@Kc+R96d4rh@HcOygYA2g_91p_wFmz8#SH7(QJC&SVE+e8Nh?3i+ z$*+4AEtqaf@w)FvYD^BPE?wqz+qlLW;jORj1z57%sX0Uk=?1T;n`AH@INFx|OlNG? za4jZ?Q>9`cjm*VZvPmdO0 zvMq=g40WxXI)-1yZ{CS=8JZ1}HKHl`uxn^r|E_mpqaH9dPCV;3Kc@xkw~>%=vB)oj z{{y&sH6u(Hqw+$(>W(&&1EBvAsWr+s*w349F|HX|tu+spZC53LTTuC?OKv#xG!E9*Qk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BkLvxV zj7k-XFAqn7@dw@ZR%UN(H^?UsmaGmYeJ5oF@1n|=kM^xaG@Z)&v~hxtV*2egHK)JI zAP3hxgq2+Q@k`EDX5f!u%Z(;lNs8{glHW{gpuD8D%u{WgKBf!Q_tIvDb1n%ROuC)z+aTdV7< z;UB0qf42C{N@m%SiF=(|QIh3zC{E{B?{idqM)A1oPfCthWhmG5xaHnFF@&v2 zNdWMx2G2Ve@ZK_K%bADVk~y3eU;I-j>lFOW)@RGlT5=Y`8J~BhbooFxZikHuLVOx| zVvOV1*LVnTu@~w8PW|g_>bGFHt)!=AcA2azy|VX77=UUQ@;U`YOR3(&q|$)@ECi_g zr|C9Y!0PN+u+EK+Op)#w(`lt!3e>BEJ}NXfP|XUz zZBo&hKv+G&kKq}!;6eUop3S)!qU?!T>2LN=o*c>cUVCh1AR1~&-^vcy4$hgl-N-UM!usC_0KzuZ5;Wv0Wk(5W5P@ww~q|4K6cFBIhe d+4}-`dELp<{qvO>&8Po0$x13oREik|{11^ENZbGb From 14767cdf54b46c4efeabe3501f6a24ef57997406 Mon Sep 17 00:00:00 2001 From: ayushmaheshwari Date: Tue, 24 Jan 2023 11:23:57 +0530 Subject: [PATCH 12/13] changing variable description --- scripts/sql/108_create_semgrep_plugin.up.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/sql/108_create_semgrep_plugin.up.sql b/scripts/sql/108_create_semgrep_plugin.up.sql index ffb22e7e3f..71a6e0b9fa 100644 --- a/scripts/sql/108_create_semgrep_plugin.up.sql +++ b/scripts/sql/108_create_semgrep_plugin.up.sql @@ -77,8 +77,8 @@ INSERT INTO "plugin_step" ("id", "plugin_id","name","description","index","step_ INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value", "variable_type", "value_type", "variable_step_index", "deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppToken','STRING','Input App token of Semgrep account if not already set in secret',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), -(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'PrefixAppNameInSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{branchName}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), -(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'UseCommitAsSemgrepBranchName','BOOL','if true, this will publish scan results by name {SemgrepAppName}-{CommitHash}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'PrefixAppNameInSemgrepBranchName','BOOL','if true, this will add app name with branch name: {SemgrepAppName}-{branchName}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'UseCommitAsSemgrepBranchName','BOOL','if true, this will add app name with commit hash: {SemgrepAppName}-{CommitHash}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppName','STRING','App Name will be used as an extra metadata for publishing results',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'ExtraCommandArguments','STRING','Extra Command arguments for semgrep CI command. eg input: --json --dry-run.',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1); From dc81b030922cbcf24d62d1f3e9c52d7dee40940d Mon Sep 17 00:00:00 2001 From: ayushmaheshwari Date: Tue, 24 Jan 2023 11:33:16 +0530 Subject: [PATCH 13/13] modifying description --- scripts/sql/108_create_semgrep_plugin.up.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/sql/108_create_semgrep_plugin.up.sql b/scripts/sql/108_create_semgrep_plugin.up.sql index 71a6e0b9fa..d6cae26feb 100644 --- a/scripts/sql/108_create_semgrep_plugin.up.sql +++ b/scripts/sql/108_create_semgrep_plugin.up.sql @@ -76,10 +76,10 @@ done' INSERT INTO "plugin_step" ("id", "plugin_id","name","description","index","step_type","script_id","deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES (nextval('id_seq_plugin_step'), (SELECT id FROM plugin_metadata WHERE name='Semgrep'),'Step 1','Step 1 - Dependency Track for Semgrep','1','INLINE',(SELECT last_value FROM id_seq_plugin_pipeline_script),'f','now()', 1, 'now()', 1); INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value", "variable_type", "value_type", "variable_step_index", "deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES -(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppToken','STRING','Input App token of Semgrep account if not already set in secret',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), -(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'PrefixAppNameInSemgrepBranchName','BOOL','if true, this will add app name with branch name: {SemgrepAppName}-{branchName}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppToken','STRING','If provided, this token will be used. If not provided it will be picked from secret.',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'PrefixAppNameInSemgrepBranchName','BOOL','if true, this will add app name with branch name: {SemgrepAppName}-{branchName}.',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'UseCommitAsSemgrepBranchName','BOOL','if true, this will add app name with commit hash: {SemgrepAppName}-{CommitHash}',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), -(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppName','STRING','App Name will be used as an extra metadata for publishing results',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), +(nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'SemgrepAppName','STRING','if provided and PrefixAppNameInSemgrepBranchName is true, then this will be prefixed with branch name/ commit hash',true,false,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1), (nextval('id_seq_plugin_step_variable'), (SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Semgrep' and ps."index"=1 and ps.deleted=false), 'ExtraCommandArguments','STRING','Extra Command arguments for semgrep CI command. eg input: --json --dry-run.',true,true,'INPUT','NEW',1 ,'f','now()', 1, 'now()', 1); INSERT INTO "plugin_step_variable" ("id", "plugin_step_id", "name", "format", "description", "is_exposed", "allow_empty_value","value","variable_type", "value_type", "variable_step_index",reference_variable_name, "deleted", "created_on", "created_by", "updated_on", "updated_by") VALUES