File tree Expand file tree Collapse file tree 2 files changed +32
-14
lines changed Expand file tree Collapse file tree 2 files changed +32
-14
lines changed Original file line number Diff line number Diff line change 1
- name : Semgrep
1
+ name : semgrep ci
2
2
3
3
on :
4
- workflow_run :
5
- workflows : ["trigger-semgrep"]
6
- types :
7
- - completed
8
-
4
+ workflow_run :
5
+ workflows : ["trigger-semgrep"]
6
+ types :
7
+ - completed
8
+
9
9
env :
10
10
CI : true
11
11
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD : " 1"
12
12
13
13
concurrency :
14
- group : " ${{ github.event.workflow_run.head_repository.full_name }}-${{ github.event.workflow_run.head_branch }}-${{ github.workflow_ref }}"
15
- cancel-in-progress : true
14
+ group : " ${{ github.event.workflow_run.head_repository.full_name }}-${{ github.event.workflow_run.head_branch }}-${{ github.workflow_ref }}"
15
+ cancel-in-progress : true
16
16
17
17
permissions : {}
18
18
19
19
jobs :
20
20
semgrep :
21
21
permissions :
22
- contents : read
22
+ contents : read
23
23
name : semgrep/ci
24
24
runs-on : ubuntu-latest
25
25
container :
26
26
image : semgrep/semgrep
27
27
outputs :
28
- pr_number : ${{ steps.json.outputs.pr_number }}
29
- sha : ${{ steps.json.outputs.sha }}
28
+ pr_number : ${{ steps.json.outputs.pr_number }}
29
+ sha : ${{ steps.json.outputs.sha }}
30
30
if : (github.actor != 'dependabot[bot]')
31
31
steps :
32
32
- name : Download artifact
@@ -38,12 +38,12 @@ jobs:
38
38
- uses : gradio-app/github/actions/json-to-output@main
39
39
id : json
40
40
with :
41
- path : output.json
41
+ path : output.json
42
42
- uses : actions/checkout@v4
43
43
with :
44
44
repository : ${{ steps.json.outputs.source_repo }}
45
45
ref : ${{ steps.json.outputs.sha }}
46
- - run : semgrep ci
46
+ - run : semgrep ci --config .github/workflows/semgrep_rules.yaml
47
47
env :
48
48
SEMGREP_APP_TOKEN : ${{ secrets.SEMGREP_APP_TOKEN2 }}
49
49
update-status :
61
61
name : " Semgrep Results"
62
62
pr : ${{ needs.semgrep.outputs.pr_number }}
63
63
result : ${{ needs.semgrep.result == 'success' && 'success' || 'failure' }}
64
- type : all
64
+ type : all
Original file line number Diff line number Diff line change
1
+ rules :
2
+ - id : detect-os-system-calls
3
+ pattern : os.system(...)
4
+ message : " Unsafe use of os.system(). Consider using subprocess.run() instead."
5
+ languages : [python]
6
+ severity : WARNING
7
+
8
+ - id : detect-sql-injection
9
+ pattern : ' execute("SELECT * FROM " + $TABLE)'
10
+ message : " Potential SQL injection detected. Use parameterized queries."
11
+ languages : [python]
12
+ severity : ERROR
13
+
14
+ - id : detect-eval-usage
15
+ pattern : eval(...)
16
+ message : " Use of eval() detected. This can be dangerous if used with untrusted input."
17
+ languages : [python]
18
+ severity : ERROR
You can’t perform that action at this time.
0 commit comments