A VS Code extension that scans changed files in a repository using GitHub Copilot knowledge, reports security findings, and helps create/update GitLab Merge Requests with the findings.
Features
- Automatic scan on commits (auto-scan can be enabled/disabled)
- Diff-aware scanning (only reports on changed lines; hallucination guard)
- Create or update GitLab MRs with scan results
- Fix vulnerabilities using GitHub Copilot chat integration
- Auto-publish branch and auto-push unpushed commits before MR creation
- CRLF line-ending detection and optional normalization before scanning
Quick Links
- Commands (Command Palette):
GitLab Security: Scan Changes and Create MRGitLab Security: Fix Issues using CopilotGitLab Security: Set Personal Access TokenGitLab Security: Enable Auto-Scan on All CommitsGitLab Security: Disable Auto-ScanGitLab Security: Change Copilot Scan Model
Requirements
- VS Code (see
engines.vscodein package.json) - Git installed and configured
- A GitLab instance reachable from your machine and a Personal Access Token with
apiscope - GitHub Copilot & Copilot Chat available for the fix workflow (optional for scanning)
Installation (developer / local)
- Clone the repository:
git clone <repo> - Install dev dependencies:
npm install
- Build and package (optional):
npm run lint
vsce package
Packaging Troubleshooting
- Error:
@types/vscode ^1.109.0 greater than engines.vscode >=1.90.0when runningvsce packagemeans the installed@types/vscoderequires a newer VS Code engine than declared.- Quick fixes:
- Downgrade
@types/vscodeto matchengines.vscode(example used in this repo): set@types/vscodeto^1.90.0inpackage.jsonand runnpm install. - OR bump
engines.vscodeto a newer minimal VS Code version (if you want to require newer hosts): updatepackage.jsonengines.vscodeaccordingly.
- Downgrade
- Quick fixes:
Configuration (settings)
- Open VS Code settings and search for
gitlabSecurityMrto configure:gitlabSecurityMr.baseUrl— GitLab base URL (default: https://gitlab.com)gitlabSecurityMr.defaultTargetBranch— Default MR target branch (default:main)gitlabSecurityMr.autoScanEnabled— Enable auto-scan on commitsgitlabSecurityMr.severityLevels— Which severities to include in MRgitlabSecurityMr.createMROnFindings— Create MR automatically when findings exist
Usage
- Set your GitLab Personal Access Token (Command:
GitLab Security: Set Personal Access Token). - Make some changes and commit.
- The extension will auto-scan (if enabled) or you can run
GitLab Security: Scan Changes and Create MR. - If the branch is not published, the extension will prompt to publish. If the branch is published but commits are unpushed, the extension will auto-sync unpushed commits before creating the MR.
- If vulnerabilities are found you can open the MR or use
Fix Issues using Copilotto open the Copilot Chat panel with a compact prompt for fixes.
CRLF Line Ending Handling
- Before scanning, the extension checks changed files for CRLF line endings (which can cause noisy diffs or CI issues).
- If CRLF is detected the extension offers:
- Normalize to LF (auto-convert uncommitted files and prompt you to stage/commit),
- Continue anyway, or
- Cancel the scan.
Security & Safety
- The extension will never modify committed files automatically; CRLF normalization applies only to uncommitted files. Publishing/pushing branches requires Git credentials to be valid.
Troubleshooting
- If MR creation fails, check the output channel
GitLab Security Scannerfor detailed logs and any GitLab API responses. - If
vsce packagefails with a@types/vscodevsengines.vscodemismatch, see Packaging Troubleshooting above.
Development Notes
- Scanning uses the Copilot Chat model selection logic; the extension tries to detect the model you use in Copilot Chat and will prompt you to choose if detection fails.
- To change which Copilot model is used for scan requests: run
GitLab Security: Change Copilot Scan Model.
Contributing
- Open issues or PRs for bugs, feature requests, or improvements.
License
- MIT — see the
LICENSEfile in this repository for the full text.
Contact
- Email: [email protected]