Skip to content

Commit 3d83f2f

Browse files
committed
updating the code scanning workflow
1 parent 866ba68 commit 3d83f2f

1 file changed

Lines changed: 10 additions & 167 deletions

File tree

‎.github/workflows/code-scanning.yml‎

Lines changed: 10 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,11 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18-
analyze:
19-
name: Analyze Scala
18+
scala-scan:
19+
# User definable name of this GitHub Actions job.
20+
name: Scala Security Audit
21+
# If you are self-hosting, change the following `runs-on` value:
2022
runs-on: ubuntu-latest
21-
permissions:
22-
security-events: write
23-
packages: read
24-
actions: read
25-
contents: read
26-
id-token: write
27-
checks: read
28-
pull-requests: write
2923

3024
container:
3125
# A Docker image with Semgrep installed. Do not change this.
@@ -35,10 +29,7 @@ jobs:
3529
if: (github.actor != 'dependabot[bot]')
3630

3731
steps:
38-
- name: Checkout repo
39-
uses: actions/checkout@v4
40-
with:
41-
persist-credentials: 'false'
32+
- uses: actions/checkout@v6
4233

4334
- name: Fetch forked ruleset
4435
uses: actions/checkout@v4
@@ -48,160 +39,12 @@ jobs:
4839
sparse-checkout: 'scala'
4940
token: ${{ secrets.GITHUB_TOKEN }}
5041

51-
- name: Run Semgrep
52-
run: semgrep scan --config .scala-security/scala --sarif --output semgrep.sarif
42+
# Run the "semgrep scan" command on the command line of the docker image.
43+
- run: semgrep scan --config .scala-security/scala/ --sarif-output=semgrep.sarif
5344

5445
- name: Upload SARIF results to GitHub Code Scanning
55-
uses: actions/upload-artifact@v4
46+
uses: github/codeql-action/upload-sarif@v4
5647
if: always()
5748
with:
58-
name: semgrep-sarif
59-
path: semgrep.sarif
60-
61-
# triage_sarif_file:
62-
# name: Triage SARIF
63-
# runs-on: gha-runner-bedrock
64-
# permissions:
65-
# security-events: write
66-
# packages: read
67-
# actions: write
68-
# contents: write
69-
# id-token: write
70-
# checks: read
71-
# pull-requests: write
72-
# needs: analyze
73-
#
74-
# steps:
75-
# - name: Checkout repo
76-
# uses: actions/checkout@v4
77-
# with:
78-
# persist-credentials: 'false'
79-
# fetch-depth: '0'
80-
#
81-
# - name: Download SARIF artifact
82-
# uses: actions/download-artifact@v4
83-
# with:
84-
# name: semgrep-sarif
85-
#
86-
# - name: Setup Node.js
87-
# uses: actions/setup-node@v4
88-
# with:
89-
# node-version: '24'
90-
#
91-
# - name: Run ls command on downloaded artifact pre Claude #make sure we are getting the right file
92-
# run: ls -la
93-
#
94-
# - name: Extract Pod Identity Credentials
95-
# shell: bash
96-
# run: |
97-
# echo "Checking Pod Identity environment variables..."
98-
# if [ -n "$AWS_CONTAINER_CREDENTIALS_FULL_URI" ] && [ -n "$AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE" ]; then
99-
# echo "Pod Identity detected - fetching credentials..."
100-
#
101-
# # Read the authorization token
102-
# TOKEN=$(cat "$AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE")
103-
#
104-
# # Fetch credentials from the Pod Identity agent
105-
# CREDS=$(curl -s -f -H "Authorization: $TOKEN" "$AWS_CONTAINER_CREDENTIALS_FULL_URI" || exit 1)
106-
# echo "$CREDS" | jq -e '.AccessKeyId' > /dev/null || exit 1
107-
#
108-
# echo "Credentials response received"
109-
#
110-
# # Extract credentials using jq
111-
# ACCESS_KEY=$(echo "$CREDS" | jq -r '.AccessKeyId')
112-
# SECRET_KEY=$(echo "$CREDS" | jq -r '.SecretAccessKey')
113-
# SESSION_TOKEN=$(echo "$CREDS" | jq -r '.Token')
114-
# echo "::add-mask::$ACCESS_KEY"
115-
# echo "::add-mask::$SECRET_KEY"
116-
# echo "::add-mask::$SESSION_TOKEN"
117-
#
118-
# # Set as GitHub environment variables
119-
# {
120-
# echo "AWS_ACCESS_KEY_ID=$ACCESS_KEY"
121-
# echo "AWS_SECRET_ACCESS_KEY=$SECRET_KEY"
122-
# echo "AWS_SESSION_TOKEN=$SESSION_TOKEN"
123-
# echo "AWS_DEFAULT_REGION=us-west-2"
124-
# echo "AWS_REGION=us-west-2"
125-
# } >> "$GITHUB_ENV"
126-
#
127-
# echo "Pod Identity credentials extracted successfully"
128-
# else
129-
# echo "Pod Identity environment variables not found"
130-
# fi
131-
#
132-
# - name: Install Claude Code
133-
# env:
134-
# GITHUB_TOKEN: ""
135-
# GH_TOKEN: ""
136-
# CLAUDE_CODE_USE_NODE: "true" # Forces it to skip downloading/using Bun
137-
# run: |
138-
# npm install --no-ignore-scripts @anthropic-ai/claude-code@2.1.202
139-
#
140-
# - name: check files
141-
# run: ls -la
142-
#
143-
# - name: force install
144-
# run: node node_modules/@anthropic-ai/claude-code/install.cjs
145-
#
146-
# - name: Run Triage
147-
# uses: anthropics/claude-code-action@6867bb3ab0b2c0a10629b6823e457347e74ad6d2 # v1.0.43
148-
# with:
149-
# use_bedrock: "true"
150-
# use_sticky_comment: "true"
151-
# additional_permissions: "actions: read"
152-
# claude_args: |
153-
# --model us.anthropic.claude-opus-4-5-20251101-v1:0
154-
# --max-turns 45
155-
# --permission-mode acceptEdits
156-
# --allowedTools "Write(*),Read(*)"
157-
# settings: |
158-
# {
159-
# "CLAUDE_CODE_ENABLE_TELEMETRY": "0"
160-
# }
161-
# prompt: |
162-
# You are an expert AppSec Triage Agent. Your job is to analyze a Semgrep finding, review the surrounding source code, and calculate a strict "True Positive Confidence Score" (0.0 to 1.0). The file is semgrep.sarif. If there are any permission issues or other errors, fail the run.
163-
#
164-
# Analyze the input based on these strict evaluation buckets:
165-
# 1. Data Flow (0.0 - 0.35): Is untrusted input reachable?
166-
# 2. Mitigations (0.0 - 0.25): Deduct points if validation, escaping, or defensive frameworks are used.
167-
# 3. Reachability (0.0 - 0.20): Is this live production code, an active endpoint, or a mock/test file?
168-
# 4. Rule Fit (0.0 - 0.20): Is the finding a genuine logic flaw or a superficial/syntactic match?
169-
#
170-
# CRITICAL FILTERING RULE:
171-
# - If the calculated `total_confidence_score` is LESS THAN 0.80 (80%), you MUST set the `triage_decision` to "REMOVE".
172-
# - If the `total_confidence_score` is 0.80 or HIGHER, evaluate whether it is a "TRUE_POSITIVE".
173-
# - If the `triage_decision` is "REMOVE", exclude that finding from the output file.
174-
#
175-
# SARIF OUTPUT REQUIREMENTS (MANDATORY):
176-
# After triaging ALL findings, rewrite `semgrep.sarif` as a minimal file for GitHub Code Scanning upload.
177-
# Semgrep embeds thousands of rule definitions (~2 MB) that are NOT needed for upload — you MUST strip them.
178-
#
179-
# ALWAYS rewrite the file after processing all findings, even if every finding is removed (`results: []`).
180-
#
181-
# You MUST return your answer in the following JSON format:
182-
# {
183-
# "analysis": {
184-
# "data_flow_notes": "string",
185-
# "mitigation_notes": "string",
186-
# "reachability_notes": "string"
187-
# },
188-
# "scores": {
189-
# "data_flow": 0.00,
190-
# "mitigations": 0.00,
191-
# "reachability": 0.00,
192-
# "rule_fit": 0.00
193-
# },
194-
# "total_confidence_score": 0.00,
195-
# "triage_decision": "TRUE_POSITIVE" | "REMOVE"
196-
# }
197-
#
198-
# - name: Run ls command on downloaded artifact post Claude #make sure we are getting the right file
199-
# run: ls -la
200-
201-
# - name: Upload SARIF results to GitHub Code Scanning
202-
# uses: github/codeql-action/upload-sarif@v4
203-
# if: always()
204-
# with:
205-
# sarif_file: semgrep.sarif
206-
# category: semgrep
207-
49+
sarif_file: semgrep.sarif
50+
category: semgrep

0 commit comments

Comments
 (0)