Skip to content

Conversation

himanshusinghs
Copy link
Contributor

Description

Earlier snyk was never scanning the vscode project because of the combination of project auto-detection and the presence of .vscode-test folder which contains several directories with package.json files.

This commit disables the auto-detection so that snyk run tests on the current project.

Additionally the current project was having a problem with a package declaring optional dependencies. These optional dependencies were platform specific so for any platform, all the optional dependencies will never be installed, only the ones that are platform compatible. Snyk requires what is declared in package-lock.json to be also present in node_modules folder which is why it would've failed. In the same commit, we added a pre and post test hook to remove the identified problematic optional dependencies from package-lock file before running the test and then restore it when the test is finished.

Checklist

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

Earlier snyk was never scanning the vscode project because of the
combination of project auto-detection and the presence of .vscode-test
folder which contains several directories with package.json files.

This commit disables the auto-detection so that snyk run tests on the
current project.

Additionally the current project was having a problem
with a package declaring optional dependencies. These optional
dependencies were platform specific so for any platform, all the
optional dependencies will never be installed, only the ones that are
platform compatible. Snyk requires what is declared in package-lock.json
to be also present in node_modules folder which is why it would've
failed. In the same commit, we added a pre and post test hook to remove
the identified problematic optional dependencies from package-lock file
before running the test and then restore it when the test is finished.
@Copilot Copilot AI review requested due to automatic review settings September 25, 2025 14:22
@himanshusinghs himanshusinghs requested a review from a team as a code owner September 25, 2025 14:22
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes Snyk scanning for the VS Code project by addressing project auto-detection issues and handling problematic optional dependencies. The changes enable proper vulnerability scanning by disabling auto-detection and working around platform-specific optional dependencies that cause Snyk failures.

  • Removes --all-projects flag to disable auto-detection and scan only the current project
  • Adds functionality to temporarily remove problematic optional dependencies from package-lock.json during testing
  • Implements proper cleanup to restore the original package-lock.json after testing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@himanshusinghs himanshusinghs added the no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion) label Sep 25, 2025
@himanshusinghs
Copy link
Contributor Author

Will merge this after the release because merging this is going to block the release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants