Skip to content

Commit

Permalink
semgrep
Browse files Browse the repository at this point in the history
  • Loading branch information
uranium committed Aug 24, 2024
1 parent 0574d81 commit 9762e51
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 44 deletions.
36 changes: 25 additions & 11 deletions .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
name: Semgrep Scan
name: Semgrep Analysis

on:
push:
branches: [master]
branches:
- main
pull_request:
branches: [master]

jobs:
semgrep:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install Semgrep
run: pip install semgrep
- name: Run Semgrep
run: semgrep --config .semgrep.yml .
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install Semgrep
run: |
python -m pip install semgrep
- name: Run Semgrep
run: |
semgrep --config=p/owasp-top-ten --output=semgrep-results.json
- name: Upload Semgrep results
uses: actions/upload-artifact@v3
with:
name: semgrep-results
path: semgrep-results.json
56 changes: 23 additions & 33 deletions .semgrep.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
name: Semgrep Analysis
rules:
- id: no-eval
patterns:
- pattern: eval($X)
message: Avoid using `eval` as it can lead to security vulnerabilities.
severity: ERROR
languages: [javascript, python]
metadata:
category: security
owasp: A1: Injection
paths:
include: ["src/**/*.js", "src/**/*.py"]
exclude: ["tests/"]

on:
push:
branches:
- main
pull_request:

jobs:
semgrep:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install Semgrep
run: |
python -m pip install semgrep
- name: Run Semgrep
run: |
semgrep --config=p/owasp-top-ten --output=semgrep-results.json
- name: Upload Semgrep results
uses: actions/upload-artifact@v3
with:
name: semgrep-results
path: semgrep-results.json
- id: no-console-log
patterns:
- pattern: console.log($X)
message: Remove `console.log` statements before committing code.
severity: WARNING
languages: [javascript]
paths:
include: ["src/**/*.js"]
exclude: ["src/vendor/"]
name: Semgrep Analysis on: push: branches: - main pull_request: jobs: semgrep: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install Semgrep run: | python -m pip install semgrep - name: Run Semgrep run: | semgrep --config=p/owasp-top-ten --output=semgrep-results.json - name: Upload Semgrep results uses: actions/upload-artifact@v3 with: name: semgrep-results path: semgrep-results.json

0 comments on commit 9762e51

Please sign in to comment.