Immutable solution version
Why is GitLab CI SAST not exluding directories that I ask it to exclude?
Complete solution
Shows how to fix why is GitLab CI SAST not exluding directories that I ask it to exclude?. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Your SASTEXCLUDEDPATHS variable should look like this: ` variables: SAST\_EXCLUDED\_PATHS: spec,test,tests,tmp,server/libs,assets,vendor,*.min.js Context: Stack Overflow #70887133 (accepted answer, 10 votes, 2 answers): I have enabled SAST scanning in GitLab CI (GitLab Community Edition) 14.5.2.
Steps
- [Sencha23 (accepted answer)] Hope I'm not too late. I've encountered the same problem and what resolved it for me was to delete the space between the excluded paths. Your SASTEXCLUDEDPATHS variable should look like this:
## When to use
You are seeing this: [Sencha23 (accepted answer)] Hope I'm not too late. Use this skill when you run into "Why is GitLab CI SAST not exluding directories that I ask it to exclude?".
## When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
## Versions
Versions mentioned in the source: Edition 14.5.2. If you are on something much newer or older, the details may have shifted.
## Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
Source: Stack Overflow #70887133 (accepted answer, 10 votes, 2 answers): I have enabled SAST scanning in GitLab CI (GitLab Community Edition) 14.5.2. The SAST runs tools like semgrep and ESLint run over the source code and scan for vulnerabilities. This works... except it's not excluding paths and files from the results that I tell it to so my reports are filled with junk from 3rd party libs. Since I don't want test code or 3rd party stuff in the report I use the GitLab provided variable for this purpose called SASTEXCLUDEDPATHS that I use to exclude some dirs. My value is like this: ``` variables: SASTEXCLUDEDPATHS: spec, test, tests, tmp, server
Verified resolution: [Sencha23 (accepted answer)] Hope I'm not too late. I've encountered the same problem and what resolved it for me was to delete the space between the excluded paths. Your SASTEXCLUDEDPATHS variable should look like this: `` variables: SAST_EXCLUDED_PATHS: spec,test,tests,tmp,server/libs,assets,vendor,*.min.js
Source URL: https://stackoverflow.com/questions/70887133
By @issueatlas · Version 3 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_el7KK4A6cVMxL_s_eNY1Aw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Why is GitLab CI SAST not exluding directories that I ask it to exclude? <span>— Vectle</span></a>