[VS Code] Security Scanning (SAST) Sidebar
User problem to solve
When working on a project in VS Code, I want to see a detailed view of security scan results for my files, so I can quickly identify and prioritize security vulnerabilities that need attention.
Proposal
In the GitLab sidebar, users can view and interact with security scan results in an organized manner.
- Scan status indicator: display a loading indicator while a file is being actively scanned
-
Scan history organization
- List scans in reverse chronological order (newest files scanned first)
- Display file name and relative timestamp for each scan (e.g.
3 minutes ago)
-
Vulnerability display
- Present vulnerabilities in a collapsible tree structure under file
- Sort vulnerabilities by severity level (Critical -> Low)
- Allow users to expand/collapse the vulnerability tree for better workspace management
-
Visual hierarchy
- Each file entry should show:
- File name of the file scanned
- Relative scan timestamp
- Relative file path
- Expandable/collapsible vulnerability tree
- Label should indicate the severity level.
- Colored label by severity level would be a nice-to-have
- Each file entry should show:
Technical Proposal
- Sidebar TreeView UI
- Create new tree view under existing workflow extension following contributes.view
-
ScanResultItem[]will be responsible rendering the view - Create
RemoteSecurityScansDataProviderwhich implementsvscode.TreeDataProviderto populate the data.- In gitlab-lsp/-/security_diagnostics_publisher.ts, update to send new response notification with results. Let
RemoteSecurityScansDataProviderlisten to the new response notification and update theScanResultItem[].
- In gitlab-lsp/-/security_diagnostics_publisher.ts, update to send new response notification with results. Let
-
type RemoteSecurityScanResponse = {
documentUri: string;
status: number;
timestamp: string;
results?: Diagnostic[];
error?: string;
};
type ScanResultItem = {
fileName: string;
status: 'inProgress' | 'completed' | 'error'
results?: Diagnostic[];
error?: string;
lastCompleted: string;
}
-
Scan Status Indicator
- Upon initiating a scan, create a
ScanResultItemwith default status set toinProgress - When response notification is received, update the status accordingly.
- if there's no vulnerabilities, we can either remove the item from the list or filter it out.
- Upon initiating a scan, create a
MVC Considerations
- When a file is scanned and vulnerabilities are not found, they are not shown in the sidebar.
- A file is listed only once in the sidebar view
- If a file is being scanned again, the previous entry is removed and we only show the new scan results.
- Multiple files can be scanned in parallel, the user has to either save the file or trigger the command for security scanning.
- We are not storing state. When user restarts VS Code, they will not see results from their previous session.
Edited by Juhee Lee