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

Disable vulnerability and relevancy scans in Helm configurations acro… #569

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

kooomix
Copy link
Contributor

@kooomix kooomix commented Jan 7, 2025

User description

…ss multiple test scripts


PR Type

Enhancement


Description

  • Disabled vulnerabilityScan and relevancy capabilities in Helm configurations.

  • Updated test scripts to include helm_kwargs for disabling specific capabilities.

  • Modified Helm chart installation methods to accept and apply helm_kwargs.

  • Ensured consistent handling of helm_kwargs across multiple test scripts.


Changes walkthrough 📝

Relevant files
Enhancement
base_network_policy.py
Added `helm_kwargs` for disabling specific capabilities   

tests_scripts/helm/base_network_policy.py

  • Added helm_kwargs to disable vulnerabilityScan and relevancy.
  • Introduced a dictionary for Helm configuration overrides.
  • +5/-0     
    ks_microservice.py
    Updated Helm chart installation with `helm_kwargs`             

    tests_scripts/helm/ks_microservice.py

  • Added helm_kwargs to disable vulnerabilityScan and relevancy.
  • Updated Helm chart installation to use helm_kwargs.
  • +6/-1     
    network_policy.py
    Integrated `helm_kwargs` into Helm installation                   

    tests_scripts/helm/network_policy.py

  • Integrated helm_kwargs into the Helm chart installation process.
  • Ensured helm_kwargs updates are applied if provided.
  • +3/-0     
    smart_remediation.py
    Adjusted `helm_kwargs` for capability configurations         

    tests_scripts/helm/smart_remediation.py

  • Updated helm_kwargs to disable vulnerabilityScan and relevancy.
  • Adjusted other capability configurations for consistency.
  • +2/-1     
    vuln_scan.py
    Enhanced Helm chart setup with `helm_kwargs`                         

    tests_scripts/helm/vuln_scan.py

  • Added helm_kwargs to disable vulnerabilityScan and relevancy.
  • Updated Helm chart setup to use helm_kwargs.
  • +7/-1     

    💡 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: 2 🔵🔵⚪⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Duplicate Config

    The vulnerabilityScan capability is defined twice in the helm_kwargs dictionary, once as "disable" at the top and again at the bottom of the dictionary. Remove the duplicate entry.

    self.helm_kwargs = {
        "capabilities.vulnerabilityScan": "disable",
        "capabilities.relevancy": "disable",
        "capabilities.configurationScan": "enable",
        "capabilities.continuousScan": "disable",
        "capabilities.nodeScan": "disable",
        "capabilities.vulnerabilityScan": "disable",
    Null Check

    The condition if self.helm_kwargs is not None should check if helm_kwargs is not None first, since we're trying to update it. Current order could cause NullPointerException.

    if self.helm_kwargs is not None:
        helm_kwargs.update(self.helm_kwargs)

    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    General
    Remove duplicate configuration entries to prevent potential inconsistencies

    Remove the duplicate capabilities.vulnerabilityScan entry in the helm_kwargs
    dictionary to avoid potential conflicts or confusion.

    tests_scripts/helm/smart_remediation.py [141-147]

     self.helm_kwargs = {
         "capabilities.vulnerabilityScan": "disable",
         "capabilities.relevancy": "disable",
         "capabilities.configurationScan": "enable",
         "capabilities.continuousScan": "disable",
         "capabilities.nodeScan": "disable",
    -    "capabilities.vulnerabilityScan": "disable",
    +}
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: The suggestion correctly identifies a duplicate entry for 'capabilities.vulnerabilityScan' in the helm_kwargs dictionary, which could lead to confusion and maintenance issues. Removing the duplicate is important for code clarity and preventing potential bugs.

    8
    Possible issue
    Add proper null checks before dictionary operations to prevent runtime errors

    Add null check for helm_kwargs before attempting to update it to prevent potential
    AttributeError.

    tests_scripts/helm/network_policy.py [117-118]

    -if self.helm_kwargs is not None:
    +if self.helm_kwargs is not None and helm_kwargs is not None:
         helm_kwargs.update(self.helm_kwargs)
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: The suggestion correctly identifies a potential NullPointerException risk when updating helm_kwargs. Adding a null check for both dictionaries would prevent runtime errors and improve code robustness.

    7

    Copy link

    github-actions bot commented Jan 7, 2025

    Failed to generate code suggestions for PR

    @kooomix kooomix merged commit e42ee52 into master Jan 8, 2025
    2 checks passed
    @kooomix kooomix deleted the removevulnscans branch February 3, 2025 12:26
    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.

    1 participant