feat: set trusted folders scope to application #692
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When a user opens a code repository in an untrusted location in VS Code, the extension prompts for folder trust before running scans, providing an
additional trust layer on top of VS Code's built-in Workspace Trust feature. After the user trusts the project folder, the extension stores the folder path in the snyk.trustedFolders property in VS Code's global user settings. The Snyk Language Server then conducts a path prefix check of the project folder
against folders specified in the snyk.trustedFolders property.
Praetorian identified that the extension's default configuration scope allowed workspace-level settings to override global security settings. When a project folder contained a .vscode/settings.json file with a specially crafted snyk.trustedFolders property, the extension used the local workspace setting
instead of the global user setting, thereby overriding the trusted folders list on the machine.
Recommendation:
Configure the snyk.trustedFolders property to either the application or machine scope in the extension's package.json file. This change would prevent workspace-level settings from overriding the global trust configuration.
https://snyksec.atlassian.net/browse/PRODSEC-9471
Checklist
Screenshots / GIFs
Visuals that may help the reviewer. Please add screenshots for any UI change. GIFs are most welcome!