Skip to content

Implementation of Semgrep#13

Merged
geekgonecrazy merged 2 commits intomainfrom
feat/implementation-semgrep
Sep 17, 2025
Merged

Implementation of Semgrep#13
geekgonecrazy merged 2 commits intomainfrom
feat/implementation-semgrep

Conversation

@jonasflorencio
Copy link
Copy Markdown
Member

What? ⛵

The security team is implementing in the private repositories according to this documentation, the semgrep, a SAST tool capable of identifying potential vulnerabilities in our repository.

Why? 🤔

The goal of this implementation is to reduce the likelihood of having vulnerabilities in our source-code

Links 🌎

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


jonasflorencio seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment on lines +8 to +34
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Semgrep and jq
run: |
pip install semgrep jq
- name: Run Semgrep Scan and Save JSON
run: |
semgrep --config p/go --json > semgrep-report.json
- name: Count Critical and Error findings
id: findings
run: |
count=$(jq '[.results[] | select(.extra.severity == "CRITICAL" or .extra.severity == "ERROR")] | length' semgrep-report.json)
echo "count=$count" >> $GITHUB_OUTPUT
- name: Send findings to webhook
env:
ROCKETCHAT_WEBHOOK_URL: ${{ secrets.ROCKETCHAT_WEBHOOK_URL }}
run: |
curl -X POST "$ROCKETCHAT_WEBHOOK_URL" \
-H "Content-Type: application/json" \
--data "{\"alias\":\"Security Notifications\",\"text\":\"**Semgrep Report - ($GITHUB_REPOSITORY)**\n\n**Finding count (Critical and Error):** ${{ steps.findings.outputs.count }}\"}"
- name: Print findings in logs
run: |
echo "=== ALL SEMGREP FINDINGS ==="
jq '.results[] | {rule: .check_id, file: .path, line: .start.line, severity: .extra.severity, message: .extra.message}' semgrep-report.json No newline at end of file

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 7 months ago

To resolve the flagged issue, add a permissions: block to restrict the GITHUB_TOKEN permissions for the workflow. This should be placed at the top level (applies to all jobs, unless overridden), above or directly below on: but before the jobs: block. Based on the actions performed in this workflow (checking out code, installing packages, reading JSON, sending webhook), the minimal necessary scope is likely contents: read. This change will ensure the workflow adheres to least privilege practices and future-proofs against broader permissions leaking in. No additional imports, methods, or definitions are required—just a YAML edit.


Suggested changeset 1
.github/workflows/semgrep.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml
--- a/.github/workflows/semgrep.yml
+++ b/.github/workflows/semgrep.yml
@@ -3,6 +3,8 @@
   schedule:
     - cron: '0 13 * * 1'
 
+permissions:
+  contents: read
 jobs:
   semgrep:
     runs-on: ubuntu-latest
EOF
@@ -3,6 +3,8 @@
schedule:
- cron: '0 13 * * 1'

permissions:
contents: read
jobs:
semgrep:
runs-on: ubuntu-latest
Copilot is powered by AI and may make mistakes. Always verify output.
@geekgonecrazy geekgonecrazy merged commit 3c90839 into main Sep 17, 2025
5 of 7 checks passed
@geekgonecrazy geekgonecrazy deleted the feat/implementation-semgrep branch September 17, 2025 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants