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 summary #199

Merged
merged 18 commits into from
Jan 18, 2024
Merged

Update summary #199

merged 18 commits into from
Jan 18, 2024

Conversation

dwertent
Copy link
Contributor

@dwertent dwertent commented Jan 4, 2024

Type

enhancement, bug_fix


Description

This PR primarily focuses on enhancing the reporting and handling of CVEs:

  • Added AttributeApiVersion handling in the SubmitCVE function in adapters/v1/backend.go.
  • Included ApiVersion in the summary report in adapters/v1/backend_utils.go.
  • Added PackageType and Coordinates to the vulnerability result in adapters/v1/domain_to_armo.go.
  • Introduced a new function GetCVESummary to the CVERepository interface in core/ports/repositories.go.
  • Updated ScanCVE function in core/services/scan.go to store summary CVE if it does not exist.
  • Implemented GetCVESummary function in repositories/apiserver.go, repositories/broken.go, and repositories/memory.go.
  • Updated the version of github.com/armosec/armoapi-go from v0.0.254 to v0.0.294 in go.mod.

PR changes walkthrough

Relevant files                                                                                                                                 
Error handling
1 files
mockplatform.go                                                                                         
    adapters/mockplatform.go

    Removed unused import and error handling related to empty
    reports in the SubmitCVE function.

+0/-5
Enhancement
8 files
backend.go                                                                                                   
    adapters/v1/backend.go

    Added handling for AttributeApiVersion in the SubmitCVE
    function.

+5/-1
backend_utils.go                                                                                       
    adapters/v1/backend_utils.go

    Added ApiVersion to the summary report in the summarize
    function.

+1/-0
domain_to_armo.go                                                                                     
    adapters/v1/domain_to_armo.go

    Added PackageType and Coordinates to the vulnerability
    result. Also added a function to convert syft coordinates to
    coordinates.

+14/-0
repositories.go                                                                                         
    core/ports/repositories.go

    Added GetCVESummary function to the CVERepository
    interface.

+2/-0
scan.go                                                                                                         
    core/services/scan.go

    Added handling for storing summary CVE if it does not exist
    in the ScanCVE function. Also added instanceID to the
    logging information.

+12/-0
apiserver.go                                                                                               
    repositories/apiserver.go

    Added GetCVESummary function to retrieve summary CVE
    manifest. Also updated the StoreCVESummary function to
    handle update conflicts.

+32/-2
broken.go                                                                                                     
    repositories/broken.go

    Added GetCVESummary function that returns a new
    VulnerabilityManifestSummary.

+6/-0
memory.go                                                                                                     
    repositories/memory.go

    Added GetCVESummary function that returns nil.

+8/-0
Dependencies
1 files
go.mod                                                                                                           
    go.mod

    Updated the version of github.com/armosec/armoapi-go from
    v0.0.254 to v0.0.294.

+1/-1

User description

Overview

  1. Enrich report
  • Locations
  • Package type
  • ApiVersion (summary)
  1. Fixed storing summary CVEs issue

Signed-off-by: David Wertenteil <dwertent@armosec.io>
@codiumai-pr-agent codiumai-pr-agent bot added enhancement New feature or request bug_fix labels Jan 4, 2024
Copy link

PR Description updated to latest commit (f2eabc2)

Copy link

PR Analysis

  • 🎯 Main theme: Enhancing the reporting and handling of CVEs
  • 📝 PR summary: This PR introduces several enhancements to the reporting and handling of CVEs. It adds AttributeApiVersion handling in the SubmitCVE function, includes ApiVersion in the summary report, adds PackageType and Coordinates to the vulnerability result, introduces a new function GetCVESummary to the CVERepository interface, updates ScanCVE function to store summary CVE if it does not exist, and implements GetCVESummary function in various files. It also updates the version of github.com/armosec/armoapi-go from v0.0.254 to v0.0.294 in go.mod.
  • 📌 Type of PR: Enhancement
  • 🧪 Relevant tests added: No
  • ⏱️ Estimated effort to review [1-5]: 4, because the PR involves changes in multiple files and introduces new functions which increases the complexity of the review.
  • 🔒 Security concerns: No security concerns found

PR Feedback

💡 General suggestions: The PR seems to be well-structured and follows good coding practices. However, it would be beneficial to include tests for the new functions introduced in this PR. This would help ensure the correctness of the code and prevent potential bugs in the future. Also, it would be helpful to add comments explaining the purpose and functionality of the new functions and changes for better maintainability.

🤖 Code feedback:
relevant fileadapters/v1/backend.go
suggestion      

Consider handling the error when converting the Resource to AttributeApiVersion. If the conversion fails, it could lead to unexpected behavior. [important]

relevant linefinalReport.Designators.Attributes[identifiers.AttributeApiVersion] = k8sinterface.GroupVersionResourceToString(&schema.GroupVersionResource{Resource: val})

relevant filecore/services/scan.go
suggestion      

The error returned by s.cveRepository.GetCVESummary(ctx) is not handled. It would be better to handle this error to prevent potential issues. [important]

relevant lineif cveSumm, err := s.cveRepository.GetCVESummary(ctx); err != nil || cveSumm == nil {

relevant filerepositories/apiserver.go
suggestion      

The error returned by GetCVESummaryK8sResourceName(ctx) is not handled. It would be better to handle this error to prevent potential issues. [important]

relevant linename, err := GetCVESummaryK8sResourceName(ctx)

relevant filego.mod
suggestion      

Ensure that the updated version of github.com/armosec/armoapi-go is compatible with the rest of the codebase and does not introduce any breaking changes. [medium]

relevant linegithub.com/armosec/armoapi-go v0.0.294

✨ Usage tips:

To invoke the PR-Agent, add a comment using one of the following commands:

  • /review: Request a review of your Pull Request.
  • /describe: Update the PR title and description based on the contents of the PR.
  • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
  • /ask <QUESTION>: Ask a question about the PR.
  • /update_changelog: Update the changelog based on the PR's contents.
  • /add_docs 💎: Generate docstring for new components introduced in the PR.
  • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
  • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To edit any configuration parameter from the configuration.toml, add --config_path=new_value.
For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."
To list the possible configuration parameters, add a /config comment.

amirmalka and others added 15 commits January 14, 2024 14:07
Signed-off-by: Amir Malka <amirm@armosec.io>
Signed-off-by: Amir Malka <amirm@armosec.io>
…age-multiple-creds

Signed-off-by: Amir Malka <amirm@armosec.io>
Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.3 to 1.3.7.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](cloudflare/circl@v1.3.3...v1.3.7)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
…om/cloudflare/circl-1.3.7

Bump github.com/cloudflare/circl from 1.3.3 to 1.3.7
Signed-off-by: Amir Malka <amirm@armosec.io>
Signed-off-by: Amir Malka <amirm@armosec.io>
Fix serveraddress parsing, log appropriate message in case of rate limiting by the configured backend
Signed-off-by: David Wertenteil <dwertent@armosec.io>
Signed-off-by: David Wertenteil <dwertent@armosec.io>
Signed-off-by: David Wertenteil <dwertent@armosec.io>
Signed-off-by: David Wertenteil <dwertent@armosec.io>
…into enrich-report

Signed-off-by: David Wertenteil <dwertent@armosec.io>
Signed-off-by: David Wertenteil <dwertent@armosec.io>
Copy link

gitguardian bot commented Jan 17, 2024

⚠️ GitGuardian has uncovered 6 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id Secret Commit Filename
9273905 Generic High Entropy Secret 5ef2b88 core/services/scan_test.go View secret
9273905 Generic High Entropy Secret f14d7b5 core/services/scan_test.go View secret
9273906 Generic High Entropy Secret 5ef2b88 core/services/scan_test.go View secret
9273906 Generic High Entropy Secret f14d7b5 core/services/scan_test.go View secret
9273907 Generic High Entropy Secret f14d7b5 core/services/scan_test.go View secret
9273907 Generic High Entropy Secret 5ef2b88 core/services/scan_test.go View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

Signed-off-by: David Wertenteil <dwertent@armosec.io>
Signed-off-by: David Wertenteil <dwertent@armosec.io>
@dwertent dwertent added the release Create release label Jan 17, 2024
@dwertent dwertent merged commit 31aaeb4 into main Jan 18, 2024
3 of 6 checks passed
@dwertent dwertent deleted the enrich-report branch January 18, 2024 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug_fix enhancement New feature or request release Create release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants