How @snyk/protect works
mainWhen a patch is available for a vulnerability, Snyk modifies your project to apply the patch automatically during installation. The process involves:
- Adding a
patchentry to your.snykfile. - Adding
@snyk/protectto yourpackage.jsondependencies. - Adding
@snyk/protectto yourpackage.jsonpreparescript.
Once configured, running npm install will trigger @snyk/protect to download and apply the patches defined in your .snyk file to your installed dependencies.
{
"name": "my-project",
"scripts": {
+ "prepare": "npm run snyk-protect",
+ "snyk-protect": "snyk-protect"
},
"dependencies": {
+ "@snyk/protect": "^1.657.0"
}
}