Skip to content

Commit aebc314

Browse files
Merge pull request #119 from skyflowapi/Revanthathreya-patch-1
SC-3121:Create Semgrep
2 parents 30d6acc + e32d3c2 commit aebc314

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.github/workflows/semgrep.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Semgrep
2+
3+
# Run workflow each time code is pushed to your repository.
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
- name: Install Semgrep
19+
run: pip install semgrep
20+
21+
- name: Run Semgrep
22+
run: |
23+
semgrep --config .semgreprules/customRule.yml --config auto --severity ERROR --sarif . > results.sarif
24+
25+
- name: Upload SARIF file
26+
uses: github/codeql-action/upload-sarif@v3
27+
with:
28+
# Path to SARIF file relative to the root of the repository
29+
sarif_file: results.sarif
30+
31+
- name: Upload results
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: semgrep-results
35+
path: results.sarif

.semgreprules/customRule.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
rules:
2+
- id: check-sensitive-info
3+
message: >-
4+
Potential sensitive information found: $1
5+
severity: ERROR
6+
languages:
7+
- yaml
8+
- go
9+
- javascript
10+
- java
11+
- python
12+
- golang
13+
- docker
14+
patterns:
15+
- pattern-regex: (?i)\b(api[_-]key|api[_-]token|api[_-]secret[_-]key|api[_-]password|token|secret[_-]key|password|auth[_-]key|auth[_-]token|AUTH_PASSWORD)\s*[:=]\s*(['"]?)((?!YOUR_EXCLUSION_PATTERN_HERE)[A-Z]+.*?)\2
16+
17+
- id: check-logger-appconfig
18+
message: >-
19+
Potential Logging configuration found: $1
20+
severity: ERROR
21+
languages:
22+
- yaml
23+
- go
24+
- javascript
25+
- java
26+
- python
27+
- golang
28+
- docker
29+
patterns:
30+
- pattern-regex: log\.Logger\(\).*(appConfig).*

0 commit comments

Comments
 (0)