Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update and Split Trivy #80

Merged
merged 37 commits into from
Jan 25, 2024
Merged

Update and Split Trivy #80

merged 37 commits into from
Jan 25, 2024

Conversation

faizan12123
Copy link
Contributor

@faizan12123 faizan12123 commented Dec 13, 2023

Description

Updating Trivy from version 0.16.0 to version 0.48.0 to get all the new features Trivy has to offer. This will yield more results for SCA and container scanning from the trivy tool as well as expand the language support Trivy has for lock file scanning.

This PR will also split trivy SCA and Trivy container image scanning into 2 separate plugins for improved user experience. This will change the plugin list on the UI from Trivy (Container Images) to instead have one plugin called Trivy Container Image and another called Trivy SCA. Although the UI will be displaying the plugins as such, the API will still expect "trivy" as an argument to trigger the container image scanning and "trivy_sca" as an argument to trigger the SCA scanning.

This PR also updates the trivy SCA plugin to generate package-lock.json files and NPMRCs in directories where the package.json exists but there is no package-lock.json file for Trivy's SCA capability.

Cryptography dependency was updated as well

Motivation and Context

Trivy was outdated and we were missing out on some language support and more accurate scan results. We also wanted to improve the usability of Trivy by allowing more focused results from SCA and Container image scanning.

How Has This Been Tested?

  • Ran on local system as well as dev environment. Scans were yielding more results.
  • Unit tests were ran as well and all passed
  • Ran CI script to make sure both Trivy plugins were being called

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows conforms to the coding standards.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Pic

Embed something funny here

…r not as an argument and then altering the trivy scan command according to if that is true or not
…ing errors, but did not create migration for it yet due to some errors I am getting when trying to create the migration due to my environment. Updated the Trivy plugin to fix parsing issues with the changes in the JSON due to a newer version of Trivy being used. Currently finishing the feature for parsing through directories of a project and generating package-lock files for directories that do not have one. Updated the UI for Trivy to say that it is an SCA scanner as well instead of just a container scanner.
…package.json exists. Code still needs to be refactored/cleaned/split
…y. Also migrated the artemisdb model to reflect database changes.
Updating working branch with changes in main branch.
…en node dependencies and trivy as they both rely on the same code. Ensures better code re-usability
…orm Users that we detected a missing lock file when we detect their package.json by itself
…the parent param can supply the logging method as it is a shared function
backend/lambdas/api/repo/repo/util/const.py Outdated Show resolved Hide resolved
backend/lambdas/api/repo/repo/util/const.py Outdated Show resolved Hide resolved
ui/src/app/scanPlugins.ts Outdated Show resolved Hide resolved
@faizan12123 faizan12123 changed the title Updating trivy Update and Split Trivy Jan 24, 2024
Syncing main with feature branch
@faizan12123 faizan12123 marked this pull request as ready for review January 24, 2024 22:38
@faizan12123 faizan12123 requested a review from a team as a code owner January 24, 2024 22:38
backend/engine/plugins/trivy/main.py Outdated Show resolved Hide resolved
backend/engine/plugins/trivy/main.py Show resolved Hide resolved
backend/engine/plugins/trivy_sca/main.py Outdated Show resolved Hide resolved
backend/engine/plugins/trivy_sca/main.py Outdated Show resolved Hide resolved
backend/engine/plugins/trivy_sca/settings.json Outdated Show resolved Hide resolved
…ned up code for including/discluding dev dependency flag for trivy_sca
backend/Dockerfiles/Dockerfile.dind Show resolved Hide resolved
backend/engine/plugins/lib/write_npmrc.py Show resolved Hide resolved
backend/engine/plugins/trivy_sca/main.py Outdated Show resolved Hide resolved
backend/engine/plugins/trivy_sca/main.py Outdated Show resolved Hide resolved
backend/engine/tests/test_trivy.py Show resolved Hide resolved
@faizan12123 faizan12123 merged commit dbb9389 into main Jan 25, 2024
3 checks passed
@davakos davakos deleted the Updating-Trivy branch February 1, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants