Integrating Snyk Security Analysis Tool into Github 2 #71
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.
In this Pull Request I integrated the Snyk security analysis tool into our CI pipeline to automate vulnerability detection on all pull requests on our branch ‘f24’. I also modified the GitHub Actions workflow to automate the Snyk test process on every pull request.
I installed snyk tool using the command 'npm install -g snyk' and then I made these following modifications to ensure its integration:
![Screenshot 2024-11-03 at 20 51 22](https://private-user-images.githubusercontent.com/87300208/382592985-2d4bb29b-07b0-4a1c-8696-25c790f90ce9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MzY0MDAsIm5iZiI6MTczODkzNjEwMCwicGF0aCI6Ii84NzMwMDIwOC8zODI1OTI5ODUtMmQ0YmIyOWItMDdiMC00YTFjLTg2OTYtMjVjNzkwZjkwY2U5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDEzNDgyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWExY2NiMzVhYTAzYWMwMzNmMThiM2FmYmE1MjhmMjU4MTA4MmZiMzk1ZTIyMzM1NTUwYWFiNTdjY2VhMDY5ZDMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.zsTuEUDfhpS1KfZFVB10GbC2Rb-69TABKDMR23t0uGo)
Authentication
Using the command 'snyk auth' I navigated to 'https://app.snyk.io/account' and created an account linked to my github account and connected our repository to the Snyk account for automated vulnerability scanning.
Went to setting and added a repository secret 'SNYK_KEY' to authenticate Snyk in our GitHub Actions workflow.
Files Added
./install/.snyk
I modified the ignore file to include entries for low-risk vulnerabilities that do not impact our current usage and each vulnerability entry includes a reason for ignoring and an expiration date to revisit the assessment as dependencies evolve.
.github/workflows/snyk.yaml
I configured Snyk to run security checks on each pull request targeting the f24 branch and set the checks to flag high and critical severity vulnerabilities, using the 'npx snyk test --severity-threshold=high command'.
Files modified
I added snyk version 1.1294.0 to the development dependencies and I updated body-parser from 1.20.2 to 1.20.3 to address an Asymmetric Resource Consumption (Amplification) vulnerability and upgraded express from 4.19.2 to 4.20.0 to fix a related vulnerability.
Workflow Execution and Testing
![Screenshot 2024-11-03 at 20 52 57](https://private-user-images.githubusercontent.com/87300208/382593093-f0950129-023c-4e10-9164-ea1603e0c0e2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MzY0MDAsIm5iZiI6MTczODkzNjEwMCwicGF0aCI6Ii84NzMwMDIwOC8zODI1OTMwOTMtZjA5NTAxMjktMDIzYy00ZTEwLTkxNjQtZWExNjAzZTBjMGUyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDEzNDgyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE1MTQ2ZmQ0OTExNTdkMjNmMDFjNmExOGIzOGIyZGI3ZGM5ZjdkMDUwYWE0MmViMDgyZGEzNDEzZjU5MWE2ODkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.wWcnJ_C2He9eUN-j4vmZ7Hz5Y_qxYDhLB8YdZRzCkEg)
I ran the Snyk Test GitHub Action workflow to validate the integration and ensure dependencies are scanned within the ./install directory and I manually tested the Snyk configuration locally to confirm that all vulnerability detections align with Snyk’s latest advisories.
This new attempt was made due to the last one (#69) messing with the deployment