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

and unknown to vuln types #427

Merged
merged 1 commit into from
Jan 14, 2025
Merged

and unknown to vuln types #427

merged 1 commit into from
Jan 14, 2025

Conversation

refaelm92
Copy link
Contributor

@refaelm92 refaelm92 commented Jan 14, 2025

PR Type

Enhancement


Description

  • Added UnknownCount field to multiple structs for better vulnerability categorization.

  • Updated ComponentSummary struct to include UnknownCount.

  • Updated ImageSummary struct to include UnknownCount.

  • Updated VulnerabilityUniqueDailyFindings struct to include UnknownCount.


Changes walkthrough 📝

Relevant files
Enhancement
vulnerabilitytypes.go
Add `UnknownCount` field to structs                                           

armotypes/vulnerabilitytypes.go

  • Added UnknownCount field to ComponentSummary struct.
  • Added UnknownCount field to ImageSummary struct.
  • Added UnknownCount field to VulnerabilityUniqueDailyFindings struct.
  • +3/-0     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ No major issues detected

    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    General
    Add omitempty tag to optional count fields to prevent zero values from being included in JSON output

    Initialize the UnknownCount field in all relevant constructors or initialization
    methods to ensure consistent zero values and prevent potential nil pointer
    dereferences when the field is accessed.

    armotypes/vulnerabilitytypes.go [62-77]

     type ComponentSummary struct {
         CustomerGUID    string              `json:"customerGUID"`
         Name            string              `json:"name"`
         Version         string              `json:"version"`
         PackageType     string              `json:"packageType"`
         Paths           []string            `json:"paths"`
         FixVersions     []string            `json:"fixVersions"`
         CriticalCount   int                 `json:"criticalCount"`
         HighCount       int                 `json:"highCount"`
         MediumCount     int                 `json:"mediumCount"`
         LowCount        int                 `json:"lowCount"`
    -    UnknownCount    int                 `json:"unknownCount"`
    +    UnknownCount    int                 `json:"unknownCount,omitempty"`
         ...
     }
    Suggestion importance[1-10]: 4

    Why: Adding omitempty tag is a reasonable suggestion for optional count fields to reduce JSON payload size, though the impact is minor since int fields with zero values don't take much space.

    4

    @refaelm92 refaelm92 merged commit 203c48e into main Jan 14, 2025
    3 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants